| 356 | pass |
| 357 | |
| 358 | class StatsDBManager(object): |
| 359 | def __init__(self, dbpath): |
| 360 | self._dbPath = dbpath |
| 361 | self._connection = None |
| 362 | |
| 363 | def __del__(self): |
| 364 | if self._connection is not None: |
| 365 | self._connection.close() |
| 366 | |
| 367 | def connect(self): |
| 368 | self._connection = adbapi.ConnectionPool("sqlite3", self._dbPath, check_same_thread=False) |
| 369 | self._createSchema() |
| 370 | |
| 371 | def _createSchema(self): |
| 372 | initQuery = 'create table if not exists clients_snapshots (snapshot_time INTEGER, version STRING)' |
| 373 | return self._connection.runQuery(initQuery) |
| 374 | |
| 375 | def addVersionLog(self, timestamp, version): |
| 376 | content = (timestamp, version, ) |
| 377 | self._connection.runQuery("INSERT INTO clients_snapshots VALUES (?, ?)", content) |
| 378 | |
| 379 | class RoomDBManager(object): |
| 380 | def __init__(self, dbpath, loadroomscallback): |