Esempio n. 1
0
    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))
Esempio n. 2
0
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)
Esempio n. 3
0
    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))
Esempio n. 4
0
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.")
Esempio n. 5
0
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.")