Author: gilbert-guest Date: 2010-01-03 08:25:45 +0000 (Sun, 03 Jan 2010) New Revision: 13700 Modified: lib/python/security_db.py Log: refactor logic due to a bug in lenny''s apsw Modified: lib/python/security_db.py ==================================================================--- lib/python/security_db.py 2010-01-02 20:40:53 UTC (rev 13699) +++ lib/python/security_db.py 2010-01-03 08:25:45 UTC (rev 13700) @@ -1038,10 +1038,10 @@ cursor.execute( """INSERT INTO source_package_status SELECT n.bug_name, p.rowid, - ( ( n.fixed_version IS NULL - OR p.version_id < n.fixed_version_id ) - AND NOT ( n.fixed_version IS ''undetermined'' ) ) - + 2*( n.fixed_version IS ''undetermined'' ), + CASE WHEN n.fixed_version == ''undetermined'' THEN 2 + ELSE CASE WHEN n.fixed_version IS NULL THEN 1 + ELSE CASE WHEN p.version_id < n.fixed_version_id THEN 1 + ELSE 0 END END END, n.urgency FROM package_notes AS n, source_packages AS p WHERE n.release = '''' AND p.name = n.package""") @@ -1054,10 +1054,10 @@ cursor.execute( """INSERT OR REPLACE INTO source_package_status SELECT n.bug_name, p.rowid, - ( ( n.fixed_version IS NULL - OR p.version_id < n.fixed_version_id ) - AND NOT ( n.fixed_version IS ''undetermined'' ) ) - + 2*( n.fixed_version IS ''undetermined'' ), + CASE WHEN n.fixed_version == ''undetermined'' THEN 2 + ELSE CASE WHEN n.fixed_version IS NULL THEN 1 + ELSE CASE WHEN p.version_id < n.fixed_version_id THEN 1 + ELSE 0 END END END, n.urgency FROM package_notes AS n, source_packages AS p WHERE p.name = n.package @@ -1068,10 +1068,10 @@ cursor.execute( """INSERT INTO binary_package_status SELECT n.bug_name, p.rowid, - ( ( n.fixed_version IS NULL - OR p.source_version_id < n.fixed_version_id ) - AND NOT ( n.fixed_version IS ''undetermined'' ) ) - + 2*( n.fixed_version IS ''undetermined'' ), + CASE WHEN n.fixed_version == ''undetermined'' THEN 2 + ELSE CASE WHEN n.fixed_version IS NULL THEN 1 + ELSE CASE WHEN p.version_id < n.fixed_version_id THEN 1 + ELSE 0 END END END, n.urgency FROM package_notes AS n, binary_packages AS p WHERE n.release = '''' AND p.source = n.package""") @@ -1079,10 +1079,10 @@ cursor.execute( """INSERT OR REPLACE INTO binary_package_status SELECT n.bug_name, p.rowid, - ( ( n.fixed_version IS NULL - OR p.source_version_id < n.fixed_version_id ) - AND NOT ( n.fixed_version IS ''undetermined'' ) ) - + 2*( n.fixed_version IS ''undetermined'' ), + CASE WHEN n.fixed_version == ''undetermined'' THEN 2 + ELSE CASE WHEN n.fixed_version IS NULL THEN 1 + ELSE CASE WHEN p.version_id < n.fixed_version_id THEN 1 + ELSE 0 END END END, n.urgency FROM package_notes AS n, binary_packages AS p WHERE p.source = n.package AND p.release = n.release""") @@ -1098,10 +1098,10 @@ cursor.execute( """INSERT INTO binary_package_status SELECT n.bug_name, p.rowid, - ( ( n.fixed_version IS NULL - OR p.version_id < n.fixed_version_id ) - AND NOT ( n.fixed_version IS ''undetermined'' ) ) - + 2*( n.fixed_version IS ''undetermined'' ), + CASE WHEN n.fixed_version == ''undetermined'' THEN 2 + ELSE CASE WHEN n.fixed_version IS NULL THEN 1 + ELSE CASE WHEN p.version_id < n.fixed_version_id THEN 1 + ELSE 0 END END END, n.urgency FROM package_notes AS n, binary_packages AS p WHERE n.release = '''' AND p.name = n.package @@ -1112,10 +1112,10 @@ cursor.execute( """INSERT OR REPLACE INTO binary_package_status SELECT n.bug_name, p.rowid, - ( ( n.fixed_version IS NULL - OR p.version_id < n.fixed_version_id ) - AND NOT ( n.fixed_version IS ''undetermined'' ) ) - + 2*( n.fixed_version IS ''undetermined'' ), + CASE WHEN n.fixed_version == ''undetermined'' THEN 2 + ELSE CASE WHEN n.fixed_version IS NULL THEN 1 + ELSE CASE WHEN p.version_id < n.fixed_version_id THEN 1 + ELSE 0 END END END, n.urgency FROM package_notes AS n, binary_packages AS p WHERE p.name = n.package AND p.release = n.release @@ -1126,10 +1126,10 @@ cursor.execute( """INSERT INTO source_package_status SELECT n.bug_name, s.rowid, - MAX( ( ( n.fixed_version IS NULL - OR b.version_id < n.fixed_version_id ) - AND NOT ( n.fixed_version IS ''undetermined'' ) ) - + 2*( n.fixed_version IS ''undetermined'' ) ), + MAX( CASE WHEN n.fixed_version == ''undetermined'' THEN 2 + ELSE CASE WHEN n.fixed_version IS NULL THEN 1 + ELSE CASE WHEN b.version_id < n.fixed_version_id THEN 1 + ELSE 0 END END END ), MAX(n.urgency) FROM package_notes AS n, binary_packages AS b, source_packages AS s