[yum-cvs] yum/yum sqlitesack.py,1.61,1.62

Seth Vidal skvidal at linux.duke.edu
Fri Feb 23 16:10:43 UTC 2007


Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv9032/yum

Modified Files:
	sqlitesack.py 
Log Message:

collapse the searchPrco select into a single select combining packages and
the prco table. Speeds up returns of big items.


Index: sqlitesack.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/sqlitesack.py,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- sqlitesack.py	23 Feb 2007 07:26:46 -0000	1.61
+++ sqlitesack.py	23 Feb 2007 16:10:41 -0000	1.62
@@ -323,20 +323,17 @@
 
     def searchPrco(self, name, prcotype):
         """return list of packages having prcotype name (any evr and flag)"""
+        
         results = []
         for (rep,cache) in self.primarydb.items():
             cur = cache.cursor()
-            executeSQL(cur, "select * from %s where name=?" %(prcotype,), (name,))
-            prcos = cur.fetchall()
-            for res in prcos:
-                executeSQL(cur, "select * from packages where pkgKey = ?" , (res['pkgKey'],))
-                for x in cur.fetchall():
-                    pkg = self.db2class(x)
-                    if (self.excludes[rep].has_key(pkg.pkgId)):
-                        continue
-                    results.append(self.pc(rep,pkg))
-
-
+            executeSQL(cur, "select packages.* from packages,%s where %s.name =? and %s.pkgKey=packages.pkgKey" % (prcotype,prcotype,prcotype), (name,))
+            for x in cur.fetchall():
+                pkg = self.db2class(x)
+                if (self.excludes[rep].has_key(pkg.pkgId)):
+                    continue
+                results.append(self.pc(rep,pkg))
+        
         # If it's not a provides or a filename, we are done
         if prcotype != "provides" or name[0] != '/':
             return results




More information about the Yum-cvs-commits mailing list