Exemple #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))
Exemple #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)
Exemple #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))
Exemple #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.")
Exemple #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.")