summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2019-12-08 18:35:53 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-16 23:11:10 (GMT)
commit7da85f3a884758fedfb31b2bc277c5e892833400 (patch)
treef767cfea1c04ea1c9d85870e54c78c6c9334b71a
parentbc70e97a888430e5ef07926c11ff6c09905446a4 (diff)
downloadpoky-7da85f3a884758fedfb31b2bc277c5e892833400.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: 27ee95bd1ec2076509cfc2230eadb876fb35d6c2) 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 c15534d..08b18f0 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