Exemple #1
0
 def containsPackage(self, po):
     result = executeSQL(self.pri_cx, "SELECT count(*) FROM packages WHERE name = ? AND arch = ? AND version = ? AND epoch = ? AND release = ?;", (po.name, po.arch, po.version, po.epoch, po.release)).fetchall()
     count = result[0][0]
     if count > 0:
         return True
     
     return False
Exemple #2
0
 def check_or_create(self, cursor, expected_count, create_method):
     result = executeSQL(cursor, 'select count(*) from sqlite_master where type="table";').fetchall()
     object_count = result[0][0]
     if object_count == 0:
         print 'Create db ...'
         create_method(self)
     elif object_count != expected_count:
         raise MDError('DB exists, but has wrong table count. Was ' + object_count.__str__() + ', expected: ' + expected_count.__str__())
Exemple #3
0
 def generateNewPackageNumber(self):
     result = executeSQL(self.pri_cx, 'SELECT MAX(pkgKey) FROM packages;').fetchall()
     maxPkgKey = result[0][0]
     
     if maxPkgKey is not None:
         return maxPkgKey + 1
     else:
         return 1
Exemple #4
0
 def removePkgKey(self, pkgKey):
     executeSQL(self.pri_cx, "delete from packages where pkgKey = ?;", (pkgKey, ))
Exemple #5
0
 def getPackageIndex(self):
     index = {}
     result = executeSQL(self.pri_cx, "SELECT pkgKey, location_href FROM packages;").fetchall()
     for row in result:
         index[row[1]] = row[0]
     return index