Пример #1
0
    def db(self):
        if self._db is None:
            self._db = sqlite.connect(self.database_file, check_same_thread=False)

            # Check schema version, upgrade if necessary
            schema.upgrade(self._db, self.database_file)

            logger.debug('Database opened.')
        return self._db
Пример #2
0
    def db(self):
        if self._db is None:
            self._db = sqlite.connect(self.database_file,
                                      check_same_thread=False)

            # Check schema version, upgrade if necessary
            schema.upgrade(self._db, self.database_file)

            logger.debug('Database opened.')
        return self._db
Пример #3
0
    def db(self):
        if self._db is None:
            self._db = sqlite.connect(self.database_file, check_same_thread=False)

            # Check schema version, upgrade if necessary
            schema.upgrade(self._db, self.database_file)

            # Sanity checks for the data in the database
            schema.check_data(self)

            logger.debug("Database opened.")
        return self._db