def __init__(self, file_dir: str = "", file_name="UserAccounts.db"): if len(file_dir) == 0: file_dir = get_temp_db_dir() FileHandler.create_file_if_not_exist(file_dir) self._file_name = file_name file_path = file_dir + self._file_name self.db = sqlite3.connect(file_path) self.cur = self.db.cursor() self.cur.execute( "CREATE TABLE IF NOT EXISTS ACCOUNTS(TYPE INTEGER, USER_ID TEXT, PSD TEXT," " LINK TEXT,ACCESS_ID TEXT, API_KEY TEXT, PROXY TEXT);") self.db.commit()
def __init__(self, company: str): DB_prefix = get_temp_db_dir() DB_name = "UserSettings" #AccountTabName = "Account" #SettingTabName = "Settings" self.company = company self.db = sqlite3.connect(DB_prefix+DB_name) self.cur = self.db.cursor() self.cur.execute("CREATE TABLE IF NOT EXISTS Account(Email TEXT, Company TEXT, Password TEXT, PRIMARY KEY(Email));") self.cur.execute("CREATE TABLE IF NOT EXISTS Settings(Company TEXT, DB_FILTER TEXT, SCHEDULE TEXT, OPERATION_DATA TEXT," "AccountTpye TEXT, CompanyKey TEXT, SubAccounts TEXT, PRIMARY KEY(Company));") self.db.commit()
def __init__(self, file_name, worker: ExternalTempInterface, stop_event: Event, buf_size=200, output_f=1000, dir_path="", table_name="temp", convert_input=True, convert_output=True, terminate_callback=None): """ :param file_name: :param worker: :param stop_event: :param buf_size: :param dir_path: :param table_name: :param convert_input: :param convert_output: convert output to OnSiteLink by default, else return raw tuple data. :return: """ self._file_name = file_name if len(dir_path) > 0: self._file_dir = dir_path else: self._file_dir = get_temp_db_dir() self._file_path = self._file_dir + self._file_name PrintLogger.print("ExternalTempDataDiskBuffer create path in init: " + self._file_path) FileHandler.create_file_if_not_exist(self._file_path) self.stop_event = stop_event self._tab = table_name self._worker = worker self._get_lock = threading.RLock() self._put_lock = threading.RLock() self._convert_input = convert_input self._convert_output = convert_output FileBuffInterface.__init__(self, self._file_name, buf_size, output_f=output_f, power_save_mode=True, terminate_callback=terminate_callback) self.set_db_update_interval(10) self._is_reading = Event() self._need_to_vaccum = Event() self._total_record = self.count_all()
def __init__(self, company: str): DB_prefix = get_temp_db_dir() DB_name = "UserSettings" #AccountTabName = "Account" #SettingTabName = "Settings" self.company = company self.db = sqlite3.connect(DB_prefix + DB_name) self.cur = self.db.cursor() self.cur.execute( "CREATE TABLE IF NOT EXISTS Account(Email TEXT, Company TEXT, Password TEXT, PRIMARY KEY(Email));" ) self.cur.execute( "CREATE TABLE IF NOT EXISTS Settings(Company TEXT, DB_FILTER TEXT, SCHEDULE TEXT, OPERATION_DATA TEXT," "AccountTpye TEXT, CompanyKey TEXT, SubAccounts TEXT, PRIMARY KEY(Company));" ) self.db.commit()
def __init__(self, file_name, worker: ExternalTempInterface, stop_event: Event, buf_size=200, output_f=1000, dir_path="", table_name="temp", convert_input=True, convert_output=True, terminate_callback=None): """ :param file_name: :param worker: :param stop_event: :param buf_size: :param dir_path: :param table_name: :param convert_input: :param convert_output: convert output to OnSiteLink by default, else return raw tuple data. :return: """ self._file_name = file_name if len(dir_path) > 0: self._file_dir = dir_path else: self._file_dir = get_temp_db_dir() self._file_path = self._file_dir + self._file_name PrintLogger.print("ExternalTempDataDiskBuffer create path in init: " + self._file_path) FileHandler.create_file_if_not_exist(self._file_path) self.stop_event = stop_event self._tab = table_name self._worker = worker self._get_lock = threading.RLock() self._put_lock = threading.RLock() self._convert_input = convert_input self._convert_output = convert_output FileBuffInterface.__init__(self, self._file_name, buf_size, output_f=output_f, power_save_mode=True, terminate_callback=terminate_callback) self.set_db_update_interval(10) self._is_reading = Event() self._need_to_vaccum = Event() self._total_record = self.count_all()