bitbake: 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

(Bitbake rev: 6ee1f58698e2d782c54ce5aec271bcec26107eac)

Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Constantin Musca 2013-01-22 11:37:57 +02:00 committed by Richard Purdie
parent 1e50274f55
commit 5fc3fc343e
1 changed files with 5 additions and 0 deletions

View File

@ -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())