summaryrefslogtreecommitdiff
path: root/patchtracker/DB.py
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2008-06-28 13:15:16 +0200
committerSean Finney <seanius@debian.org>2008-06-28 13:15:16 +0200
commit2f65fe4774881edbac29200a2a464f668c56b6d4 (patch)
treeb7ba5faa5592a2b5e09e6668941581271e252c7f /patchtracker/DB.py
parentd31d22dcca484a6fd51a7d4857426038063e00c7 (diff)
downloadpatch-tracker-2f65fe4774881edbac29200a2a464f668c56b6d4.tar.gz
remove need for initial empty rows, fix syntax err
Diffstat (limited to 'patchtracker/DB.py')
-rw-r--r--patchtracker/DB.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/patchtracker/DB.py b/patchtracker/DB.py
index 9324e97..443c40f 100644
--- a/patchtracker/DB.py
+++ b/patchtracker/DB.py
@@ -71,20 +71,20 @@ class PatchTrackerDB:
#print "creating new record for",srcpkg
q = "INSERT OR REPLACE INTO packages (id,name,format,loc,version,\
diffgz_name,diffgz_size,diffgz_md5sum)\
- VALUES ((SELECT MAX(id)+1 FROM packages),?,?,?,?,?,?,?)"
+ VALUES ((SELECT IFNULL(MAX(id)+1,0) FROM packages),?,?,?,?,?,?,?)"
cursor.execute(q, (srcpkg.name,srcpkg.format,srcpkg.loc,
srcpkg.version,srcpkg.diffgz_name,srcpkg.diffgz_size,
srcpkg.diffgz_md5sum))
def saveSuite(self, suite):
q = "INSERT OR REPLACE INTO suites (id,name) \
- VALUES ((SELECT MAX(id)+1 FROM suites),?)"
+ VALUES ((SELECT IFNULL(MAX(id)+1,0) FROM suites),?)"
cursor = self.db.cursor()
cursor.execute(q, (suite,))
def saveComponent(self, component):
q = "INSERT OR REPLACE INTO components (id,name) \
- VALUES ((SELECT MAX(id)+1 FROM components),?)"
+ VALUES ((SELECT IFNULL(MAX(id)+1,0) FROM components),?)"
cursor = self.db.cursor()
cursor.execute(q, (component,))
@@ -116,7 +116,7 @@ class PatchTrackerDB:
def relateSourcePackage(self, name, version, suite, component):
q = "INSERT OR REPLACE INTO package_rel_map \
(package_id,suite_id,component_id) \
- VALUES (SELECT id FROM packages WHERE name=? AND version=?), \
+ VALUES ((SELECT id FROM packages WHERE name=? AND version=?), \
(SELECT id FROM suites WHERE name=?), \
(SELECT id FROM components WHERE name=?))"
cursor = self.db.cursor()