diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-11-18 10:54:10 -0700 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2010-11-18 11:02:25 -0700 |
commit | b3d5432cff0ff28f4c8a5bcf10efa3e383b4fd4d (patch) | |
tree | e7e4a3fa25adf152e8a6940317943b2a651b4607 /lib/bb/persist_data.py | |
parent | 5b85de2c71973ba490b95a5d9ab634635f395142 (diff) | |
download | bitbake-b3d5432cff0ff28f4c8a5bcf10efa3e383b4fd4d.tar.gz |
persist_data: handle locked db for SELECT
Parallel processes interacting with the persist_data db can quite easily
explode without this.
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/persist_data.py')
-rw-r--r-- | lib/bb/persist_data.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/bb/persist_data.py b/lib/bb/persist_data.py index 91c089bdf..3c61d9573 100644 --- a/lib/bb/persist_data.py +++ b/lib/bb/persist_data.py @@ -94,7 +94,7 @@ class PersistData: """ Return the value of a key for a domain """ - data = self.cursor.execute("SELECT * from %s where key=?;" % domain, [key]) + data = self._execute("SELECT * from %s where key=?;" % domain, [key]) for row in data: return row[1] @@ -102,7 +102,7 @@ class PersistData: """ Sets the value of a key for a domain """ - data = self.cursor.execute("SELECT * from %s where key=?;" % domain, [key]) + data = self._execute("SELECT * from %s where key=?;" % domain, [key]) rows = 0 for row in data: rows = rows + 1 @@ -120,8 +120,7 @@ class PersistData: def _execute(self, *query): while True: try: - self.cursor.execute(*query) - return + return self.cursor.execute(*query) except sqlite3.OperationalError as e: if 'database is locked' in str(e): continue |