summaryrefslogtreecommitdiff
path: root/patchtracker
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2008-06-24 23:38:28 +0200
committerSean Finney <seanius@debian.org>2008-06-24 23:38:28 +0200
commit92da2bbd8993b32a57e439582c8c91a7155d16b4 (patch)
tree24c22de3032316f5c2fc146c8372b9e75bb768be /patchtracker
parentf14596034d1838cddd1950e7d2983b850efbd9c0 (diff)
downloadpatch-tracker-92da2bbd8993b32a57e439582c8c91a7155d16b4.tar.gz
modify relateSourcePackage to take package/version
...instead of a source package, which should remove an extra query and also allow changing the behaviour for findSourcePackage later on as well
Diffstat (limited to 'patchtracker')
-rw-r--r--patchtracker/DB.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/patchtracker/DB.py b/patchtracker/DB.py
index b72b11e..e706d97 100644
--- a/patchtracker/DB.py
+++ b/patchtracker/DB.py
@@ -129,15 +129,14 @@ class PatchTrackerDB:
cursor.execute(q, (srcpkg.name, suite))
return cursor.fetchone()
- def relateSourcePackage(self, srcpkg, suite, component):
- s = self.findSourcePackage(srcpkg)
+ def relateSourcePackage(self, name, version, suite, component):
q = "INSERT OR REPLACE INTO package_rel_map \
(package_id,suite_id,component_id) \
- VALUES (?, \
+ 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()
- cursor.execute(q, (s[0], suite, component))
+ cursor.execute(q, (name, version, suite, component))
def finalize(self):
self.db.commit()