[oe-commits] [bitbake] 03/10: persist_data: Add key constraints

git at git.openembedded.org git at git.openembedded.org
Tue Aug 14 09:49:19 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 61d51e578b3ec18940de39e47179bde02078a571
Author: Joshua Watt <jpewhacker at gmail.com>
AuthorDate: Thu Aug 9 17:08:27 2018 -0500

    persist_data: Add key constraints
    
    Constructs the "key" column in the persistent database as a non-NULL
    primary key. This significantly speeds up lookup operations in large
    databases.
    
    Signed-off-by: Joshua Watt <JPEWhacker at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/persist_data.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/persist_data.py b/lib/bb/persist_data.py
index 1a6319f..2bc3e76 100644
--- a/lib/bb/persist_data.py
+++ b/lib/bb/persist_data.py
@@ -94,7 +94,7 @@ class SQLTable(collections.MutableMapping):
         self.table = table
         self.connection = connect(self.cachefile)
 
-        self._execute_single("CREATE TABLE IF NOT EXISTS %s(key TEXT, value TEXT);" % table)
+        self._execute_single("CREATE TABLE IF NOT EXISTS %s(key TEXT PRIMARY KEY NOT NULL, value TEXT);" % table)
 
     @_Decorators.retry
     @_Decorators.transaction

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list