diff options
Diffstat (limited to 'bitbake/lib/prserv/db.py')
| -rw-r--r-- | bitbake/lib/prserv/db.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/bitbake/lib/prserv/db.py b/bitbake/lib/prserv/db.py index f267daed13..9d8e9db9f2 100644 --- a/bitbake/lib/prserv/db.py +++ b/bitbake/lib/prserv/db.py | |||
| @@ -8,6 +8,8 @@ try: | |||
| 8 | except ImportError: | 8 | except ImportError: |
| 9 | from pysqlite2 import dbapi2 as sqlite3 | 9 | from pysqlite2 import dbapi2 as sqlite3 |
| 10 | 10 | ||
| 11 | logger = logging.getLogger("BitBake.PRserv") | ||
| 12 | |||
| 11 | sqlversion = sqlite3.sqlite_version_info | 13 | sqlversion = sqlite3.sqlite_version_info |
| 12 | if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3): | 14 | if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3): |
| 13 | raise Exception("sqlite3 version 3.3.0 or later is required.") | 15 | raise Exception("sqlite3 version 3.3.0 or later is required.") |
| @@ -55,7 +57,7 @@ class PRTable(): | |||
| 55 | (version,pkgarch, checksum,version, pkgarch)) | 57 | (version,pkgarch, checksum,version, pkgarch)) |
| 56 | self.conn.commit() | 58 | self.conn.commit() |
| 57 | except sqlite3.IntegrityError as exc: | 59 | except sqlite3.IntegrityError as exc: |
| 58 | logging.error(str(exc)) | 60 | logger.error(str(exc)) |
| 59 | 61 | ||
| 60 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, | 62 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, |
| 61 | (version, pkgarch, checksum)) | 63 | (version, pkgarch, checksum)) |
| @@ -83,7 +85,7 @@ class PRTable(): | |||
| 83 | (version, pkgarch, checksum, version, pkgarch)) | 85 | (version, pkgarch, checksum, version, pkgarch)) |
| 84 | self.conn.commit() | 86 | self.conn.commit() |
| 85 | except sqlite3.IntegrityError as exc: | 87 | except sqlite3.IntegrityError as exc: |
| 86 | logging.error(str(exc)) | 88 | logger.error(str(exc)) |
| 87 | self.conn.rollback() | 89 | self.conn.rollback() |
| 88 | 90 | ||
| 89 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, | 91 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, |
| @@ -115,7 +117,7 @@ class PRTable(): | |||
| 115 | (version, pkgarch, checksum, value)) | 117 | (version, pkgarch, checksum, value)) |
| 116 | self.conn.commit() | 118 | self.conn.commit() |
| 117 | except sqlite3.IntegrityError as exc: | 119 | except sqlite3.IntegrityError as exc: |
| 118 | logging.error(str(exc)) | 120 | logger.error(str(exc)) |
| 119 | 121 | ||
| 120 | data = self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, | 122 | data = self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, |
| 121 | (version, pkgarch, checksum)) | 123 | (version, pkgarch, checksum)) |
| @@ -140,7 +142,7 @@ class PRTable(): | |||
| 140 | (value,version,pkgarch,checksum,value)) | 142 | (value,version,pkgarch,checksum,value)) |
| 141 | self.conn.commit() | 143 | self.conn.commit() |
| 142 | except sqlite3.IntegrityError as exc: | 144 | except sqlite3.IntegrityError as exc: |
| 143 | logging.error(str(exc)) | 145 | logger.error(str(exc)) |
| 144 | 146 | ||
| 145 | data = self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=? AND value>=?;" % self.table, | 147 | data = self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=? AND value>=?;" % self.table, |
| 146 | (version,pkgarch,checksum,value)) | 148 | (version,pkgarch,checksum,value)) |
| @@ -241,5 +243,5 @@ class PRData(object): | |||
| 241 | def __delitem__(self, tblname): | 243 | def __delitem__(self, tblname): |
| 242 | if tblname in self._tables: | 244 | if tblname in self._tables: |
| 243 | del self._tables[tblname] | 245 | del self._tables[tblname] |
| 244 | logging.info("drop table %s" % (tblname)) | 246 | logger.info("drop table %s" % (tblname)) |
| 245 | self.connection.execute("DROP TABLE IF EXISTS %s;" % tblname) | 247 | self.connection.execute("DROP TABLE IF EXISTS %s;" % tblname) |
