def set_database(self, database_name): if not database_name.endswith(".db"): database_name += ".db" if database_name != self.database_name: # "str" is used to convert type from unicode to str. self.database_name = str(database_name) self.reader = EbeDBReader( path.join(DATABASE_RELATIVE_PATH, self.database_name))
def use(database): """ Create a EbeDBReader object and link the factory functions for evaluateExpression and evaluateExpressionOnly as uhg_check and uhg. """ global _storedEbeDBReader _storedEbeDBReader = EbeDBReader(database)
def set_database(self, database_name): if not database_name.endswith(".db"): database_name += ".db" if database_name != self.database_name: # "str" is used to convert type from unicode to str. self.database_name = str(database_name) self.reader = EbeDBReader(path.join(DATABASE_RELATIVE_PATH, self.database_name))
class QueryBridge(object): def __init__(self): self.database_name = "" self.reader = None def set_database(self, database_name): if not database_name.endswith(".db"): database_name += ".db" if database_name != self.database_name: # "str" is used to convert type from unicode to str. self.database_name = str(database_name) self.reader = EbeDBReader(path.join(DATABASE_RELATIVE_PATH, self.database_name)) def evaluate_expression(self, expr): if self.reader: return self.reader.evaluateExpressionOnly(expr) else: raise Exception("Invalid database.")
class QueryBridge(object): def __init__(self): self.database_name = "" self.reader = None def set_database(self, database_name): if not database_name.endswith(".db"): database_name += ".db" if database_name != self.database_name: # "str" is used to convert type from unicode to str. self.database_name = str(database_name) self.reader = EbeDBReader( path.join(DATABASE_RELATIVE_PATH, self.database_name)) def evaluate_expression(self, expr): if self.reader: return self.reader.evaluateExpressionOnly(expr) else: raise Exception("Invalid database.")