def get_setting_info(self) -> SettingInfo: # need to improve this function cmd = u"SELECT * FROM Settings WHERE Company=\'{0:s}\';".format(self.company,) cur = self.cur.execute(cmd) data = cur.fetchone() self.db.commit() if data is not None and len(data) > 0: settings = SettingInfo(data[0]) try: if data[1] is not None: settings.db_filter = Serializable.get_deserialized_json(data[1]) except: pass return settings else: return None
def get_setting_info(self) -> SettingInfo: # need to improve this function cmd = u"SELECT * FROM Settings WHERE Company=\'{0:s}\';".format( self.company, ) cur = self.cur.execute(cmd) data = cur.fetchone() self.db.commit() if data is not None and len(data) > 0: settings = SettingInfo(data[0]) try: if data[1] is not None: settings.db_filter = Serializable.get_deserialized_json( data[1]) except: pass return settings else: return None
def _read_from_power_save_db(self): if os.path.exists(self._recovery_file_path): data_converted = None try: db = sqlite3.connect(self._recovery_file_path) cur = db.cursor() cur_ex = cur.execute( "SELECT STATE_V FROM STATE_TAB WHERE STATE={0:s};".format( "state", )) data = cur_ex.fetchone()[0] db.close() data_converted = Serializable.get_deserialized_json(data) except Exception as ex: ErrorLogger.log_error( "FileBuffInterface", ex, "_read_from_power_save_db() " + self._recovery_file_path) self.recovery_from_power_cut(data_converted)