diff options
| -rw-r--r-- | bitbake-dev/lib/bb/persist_data.py | 20 | ||||
| -rw-r--r-- | bitbake/lib/bb/persist_data.py | 20 |
2 files changed, 40 insertions, 0 deletions
diff --git a/bitbake-dev/lib/bb/persist_data.py b/bitbake-dev/lib/bb/persist_data.py index 79e7448bee..ea921072cd 100644 --- a/bitbake-dev/lib/bb/persist_data.py +++ b/bitbake-dev/lib/bb/persist_data.py | |||
| @@ -69,6 +69,26 @@ class PersistData: | |||
| 69 | """ | 69 | """ |
| 70 | self.connection.execute("DROP TABLE IF EXISTS %s;" % domain) | 70 | self.connection.execute("DROP TABLE IF EXISTS %s;" % domain) |
| 71 | 71 | ||
| 72 | |||
| 73 | def renameDomain(self, domain, newdomain): | ||
| 74 | """ | ||
| 75 | Renames a domain, removing the target if it already exists | ||
| 76 | """ | ||
| 77 | |||
| 78 | self.connection.execute("DROP TABLE IF EXISTS %s;" % newdomain) | ||
| 79 | self.connection.execute("ALTER TABLE %s RENAME TO %s;" % (domain, newdomain)) | ||
| 80 | |||
| 81 | def getKeyValues(self, domain): | ||
| 82 | """ | ||
| 83 | Return a list of key + value pairs for a domain | ||
| 84 | """ | ||
| 85 | ret = {} | ||
| 86 | data = self.connection.execute("SELECT key, value from %s;" % domain) | ||
| 87 | for row in data: | ||
| 88 | ret[str(row[0])] = str(row[1]) | ||
| 89 | |||
| 90 | return ret | ||
| 91 | |||
| 72 | def getValue(self, domain, key): | 92 | def getValue(self, domain, key): |
| 73 | """ | 93 | """ |
| 74 | Return the value of a key for a domain | 94 | Return the value of a key for a domain |
diff --git a/bitbake/lib/bb/persist_data.py b/bitbake/lib/bb/persist_data.py index 79e7448bee..ea921072cd 100644 --- a/bitbake/lib/bb/persist_data.py +++ b/bitbake/lib/bb/persist_data.py | |||
| @@ -69,6 +69,26 @@ class PersistData: | |||
| 69 | """ | 69 | """ |
| 70 | self.connection.execute("DROP TABLE IF EXISTS %s;" % domain) | 70 | self.connection.execute("DROP TABLE IF EXISTS %s;" % domain) |
| 71 | 71 | ||
| 72 | |||
| 73 | def renameDomain(self, domain, newdomain): | ||
| 74 | """ | ||
| 75 | Renames a domain, removing the target if it already exists | ||
| 76 | """ | ||
| 77 | |||
| 78 | self.connection.execute("DROP TABLE IF EXISTS %s;" % newdomain) | ||
| 79 | self.connection.execute("ALTER TABLE %s RENAME TO %s;" % (domain, newdomain)) | ||
| 80 | |||
| 81 | def getKeyValues(self, domain): | ||
| 82 | """ | ||
| 83 | Return a list of key + value pairs for a domain | ||
| 84 | """ | ||
| 85 | ret = {} | ||
| 86 | data = self.connection.execute("SELECT key, value from %s;" % domain) | ||
| 87 | for row in data: | ||
| 88 | ret[str(row[0])] = str(row[1]) | ||
| 89 | |||
| 90 | return ret | ||
| 91 | |||
| 72 | def getValue(self, domain, key): | 92 | def getValue(self, domain, key): |
| 73 | """ | 93 | """ |
| 74 | Return the value of a key for a domain | 94 | Return the value of a key for a domain |
