summaryrefslogtreecommitdiffstats
path: root/lib/bb/persist_data.py
diff options
context:
space:
mode:
authorConstantin Musca <constantinx.musca@intel.com>2013-01-22 11:37:57 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-22 15:33:26 +0000
commit6ee1f58698e2d782c54ce5aec271bcec26107eac (patch)
tree30648f06dcd3a94cbc80036be3599b3990386ba5 /lib/bb/persist_data.py
parent7c15ff1d50d7b601414f1d55c90e3c59981a0876 (diff)
downloadbitbake-contrib-6ee1f58698e2d782c54ce5aec271bcec26107eac.tar.gz
persist_data: add get_by_pattern method to API
- one can use get_by_pattern to get a list of values associated with keys that match the specified pattern Signed-off-by: Constantin Musca <constantinx.musca@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/persist_data.py')
-rw-r--r--lib/bb/persist_data.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/bb/persist_data.py b/lib/bb/persist_data.py
index c69758dd5..994e61b0a 100644
--- a/lib/bb/persist_data.py
+++ b/lib/bb/persist_data.py
@@ -125,6 +125,11 @@ class SQLTable(collections.MutableMapping):
return len(self) < len(other)
+ def get_by_pattern(self, pattern):
+ data = self._execute("SELECT * FROM %s WHERE key LIKE ?;" %
+ self.table, [pattern])
+ return [row[1] for row in data]
+
def values(self):
return list(self.itervalues())