From 5fc3fc343e5794764c4345f73b25b3f671a80a69 Mon Sep 17 00:00:00 2001 From: Constantin Musca Date: Tue, 22 Jan 2013 11:37:57 +0200 Subject: 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 Signed-off-by: Richard Purdie --- bitbake/lib/bb/persist_data.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bitbake/lib/bb/persist_data.py b/bitbake/lib/bb/persist_data.py index c69758dd5b..994e61b0a6 100644 --- a/bitbake/lib/bb/persist_data.py +++ b/bitbake/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()) -- cgit v1.2.3-54-g00ecf