Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sync

  • Loading branch information...
commit d63fec7fe3b6e4dabb3b98fd176740fa07623782 1 parent a199931
Dag Wieers authored
Showing with 17 additions and 9 deletions.
  1. +4 −0 consistency.sh
  2. +13 −9 sarahlib.py
4 consistency.sh
View
@@ -21,6 +21,10 @@ echo
#./sarahsql.py 'select a.advid, synopsis from adv a where ( select count(*) from adv a, ref r where r.advid = a.advid ) = NULL'
#echo
+#echo "Show non-unique filenames"
+#echo "Show non-unique md5s"
+#echo "Show non-unique refids"
+
echo -n "Number of advisories in adv: "
./sarahsql.py 'select distinct advid from adv' | wc -l
echo -n "Number of advisories in rpm: "
22 sarahlib.py
View
@@ -12,10 +12,11 @@
}
dataopts = {
- 'adv': { 'advid': 'unique primary key', },
-# 'ref': { 'reftype': 'unique primary key', },
-# 'rpm': { 'filename': 'unique primary key', },
- 'pro': { 'prodshort': 'unique primary key', },
+ 'adv': { 'advid': 'unique primary key', 'pushcount': 'integer'},
+# 'ref': { 'refid': 'unique primary key', },
+# 'rpm': { 'filename': 'unique primary key', 'md5': 'unique'},
+# 'rpm': { 'filename': 'unique primary key',},
+ 'pro': { 'prodshort': 'unique primary key', 'product': 'unique'},
}
@@ -31,10 +32,10 @@ def sqlcreate(name):
'Return a database create SQL statement'
str = 'create table %s ( ' % name
for key in headers[name]:
- ds = ''
if dataopts.has_key(name) and dataopts[name].has_key(key):
- ds = dataopts[name][key]
- str += '%s varchar(10) %s,' % (key, ds)
+ str += '%s %s,' % (key, dataopts[name][key])
+ else:
+ str += '%s varchar(10),' % key
return str.rstrip(', ') + ' )'
#def sqlinsert(name):
@@ -52,8 +53,11 @@ def opendb():
return con, cur
def createtb(cur, name, create=False):
- try: cur.execute('drop table "%s"' % name)
- except: pass
+ try:
+ cur.execute('drop table "%s"' % name)
+ except Exception, e:
+# print e
+ pass
cur.execute(sqlcreate(name))
def insertrec(cur, name, rec):
Please sign in to comment.
Something went wrong with that request. Please try again.