summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2019-12-08 20:35:53 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-16 22:38:52 +0000
commitee2c8e04b8e59c1caabdb01c7637b35b475103d3 (patch)
treea57ccd2b041f02db5ca31cc871c946c6ef00ccad
parent55bec749c027050328a050c6a2688179ce973a9e (diff)
downloadpoky-ee2c8e04b8e59c1caabdb01c7637b35b475103d3.tar.gz
cve-update-db-native: add an index on the CVE ID column
Create an index on the PRODUCTS table which contains a row for each CPE, drastically increasing the performance of lookups for a specific CVE. (From OE-Core rev: b4048b05b3a00d85c40d09961f846eadcebd812e) (From OE-Core rev: 9abd2b5c4ddfb98f3b8574954e1fd0e95a47ebcc) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/meta/cve-update-db-native.bb3
1 files changed, 3 insertions, 0 deletions
diff --git a/meta/recipes-core/meta/cve-update-db-native.bb b/meta/recipes-core/meta/cve-update-db-native.bb
index c15534de08..08b18f064f 100644
--- a/meta/recipes-core/meta/cve-update-db-native.bb
+++ b/meta/recipes-core/meta/cve-update-db-native.bb
@@ -120,11 +120,14 @@ python do_populate_cve_db() {
120 120
121def initialize_db(c): 121def initialize_db(c):
122 c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)") 122 c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)")
123
123 c.execute("CREATE TABLE IF NOT EXISTS NVD (ID TEXT UNIQUE, SUMMARY TEXT, \ 124 c.execute("CREATE TABLE IF NOT EXISTS NVD (ID TEXT UNIQUE, SUMMARY TEXT, \
124 SCOREV2 TEXT, SCOREV3 TEXT, MODIFIED INTEGER, VECTOR TEXT)") 125 SCOREV2 TEXT, SCOREV3 TEXT, MODIFIED INTEGER, VECTOR TEXT)")
126
125 c.execute("CREATE TABLE IF NOT EXISTS PRODUCTS (ID TEXT, \ 127 c.execute("CREATE TABLE IF NOT EXISTS PRODUCTS (ID TEXT, \
126 VENDOR TEXT, PRODUCT TEXT, VERSION_START TEXT, OPERATOR_START TEXT, \ 128 VENDOR TEXT, PRODUCT TEXT, VERSION_START TEXT, OPERATOR_START TEXT, \
127 VERSION_END TEXT, OPERATOR_END TEXT)") 129 VERSION_END TEXT, OPERATOR_END TEXT)")
130 c.execute("CREATE INDEX IF NOT EXISTS PRODUCT_ID_IDX on PRODUCTS(ID);")
128 131
129def parse_node_and_insert(c, node, cveId): 132def parse_node_and_insert(c, node, cveId):
130 # Parse children node if needed 133 # Parse children node if needed