mirror of
https://git.yoctoproject.org/poky
synced 2026-04-21 21:32:12 +02:00
bitbake: Add renameDomain and getKeyValues functions to the persistent data code
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
@@ -69,6 +69,26 @@ class PersistData:
|
||||
"""
|
||||
self.connection.execute("DROP TABLE IF EXISTS %s;" % domain)
|
||||
|
||||
|
||||
def renameDomain(self, domain, newdomain):
|
||||
"""
|
||||
Renames a domain, removing the target if it already exists
|
||||
"""
|
||||
|
||||
self.connection.execute("DROP TABLE IF EXISTS %s;" % newdomain)
|
||||
self.connection.execute("ALTER TABLE %s RENAME TO %s;" % (domain, newdomain))
|
||||
|
||||
def getKeyValues(self, domain):
|
||||
"""
|
||||
Return a list of key + value pairs for a domain
|
||||
"""
|
||||
ret = {}
|
||||
data = self.connection.execute("SELECT key, value from %s;" % domain)
|
||||
for row in data:
|
||||
ret[str(row[0])] = str(row[1])
|
||||
|
||||
return ret
|
||||
|
||||
def getValue(self, domain, key):
|
||||
"""
|
||||
Return the value of a key for a domain
|
||||
|
||||
@@ -69,6 +69,26 @@ class PersistData:
|
||||
"""
|
||||
self.connection.execute("DROP TABLE IF EXISTS %s;" % domain)
|
||||
|
||||
|
||||
def renameDomain(self, domain, newdomain):
|
||||
"""
|
||||
Renames a domain, removing the target if it already exists
|
||||
"""
|
||||
|
||||
self.connection.execute("DROP TABLE IF EXISTS %s;" % newdomain)
|
||||
self.connection.execute("ALTER TABLE %s RENAME TO %s;" % (domain, newdomain))
|
||||
|
||||
def getKeyValues(self, domain):
|
||||
"""
|
||||
Return a list of key + value pairs for a domain
|
||||
"""
|
||||
ret = {}
|
||||
data = self.connection.execute("SELECT key, value from %s;" % domain)
|
||||
for row in data:
|
||||
ret[str(row[0])] = str(row[1])
|
||||
|
||||
return ret
|
||||
|
||||
def getValue(self, domain, key):
|
||||
"""
|
||||
Return the value of a key for a domain
|
||||
|
||||
Reference in New Issue
Block a user