Esempio n. 1
0
 def __init__(self, host=_default_host, username=_default_user,
              passwd=_default_pass, port=_default_port,
              dbname=_default_db,
              *args, **kwargs):
     self.__host = host
     self.__port = port
     self.__username = username
     self.__passwd = passwd
     self.__dbname = dbname
     DBStorage.__init__(self, *args, **kwargs)
        def _FetchOne(self, instruction, *args, **kwargs):
            """
            Executes the given SQL query and returns a unique
            tuple of result

            Threadsafe
            """
            instruction = instruction.replace('?', '%s')
            return DBStorage._FetchOne(self, instruction, *args, **kwargs)
        def _FetchAll(self, instruction, *args, **kwargs):
            """
            Executes the given SQL query and returns a list
            of tuples of the results

            Threadsafe
            """
            instruction = instruction.replace('?', '%s')
            return DBStorage._FetchAll(self, instruction, *args, **kwargs)
        def _ExecuteCommit(self, instruction, *args, **kwargs):
            """
            Calls .execute(instruction, *args, **kwargs) and .commit()

            Returns the last row id

            Threadsafe
            """
            instruction = instruction.replace('?', '%s')
            return DBStorage._ExecuteCommit(self, instruction, *args, **kwargs)
 def __init__(self, path, *args, **kwargs):
     self.path = path
     DBStorage.__init__(self, *args, **kwargs)
 def _ExecuteMany(self, instruction, *args, **kwargs):
     instruction = instruction.replace('?', '%s')
     return DBStorage._ExecuteMany(self, instruction, *args, **kwargs)