From 5b6a67f5b131b22e8507b2f69af06bf5a586d021 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Mon, 1 Feb 2010 17:23:04 +0100 Subject: [PATCH] [entropy.db] remove EntropyRepository.searchSlottedPackages(), uniform search methods, add searchSlotted() --- client/text_query.py | 6 +++--- libraries/entropy/db/__init__.py | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/client/text_query.py b/client/text_query.py index 18867c52c..7c098698e 100644 --- a/client/text_query.py +++ b/client/text_query.py @@ -1260,10 +1260,10 @@ def search_slotted_packages(slots, Equo = None): dbconn = Equo.open_repository(repo) for slot in slots: - results = dbconn.searchSlottedPackages(slot, atoms = True) - for result in results: + results = dbconn.searchSlotted(slot, just_id = True) + for idpackage in results: found = True - print_package_info(result[1], dbconn, Equo = Equo, + print_package_info(idpackage, dbconn, Equo = Equo, extended = etpUi['verbose'], strictOutput = etpUi['quiet']) if not etpUi['quiet']: diff --git a/libraries/entropy/db/__init__.py b/libraries/entropy/db/__init__.py index b3dc998ce..3242ab2a6 100644 --- a/libraries/entropy/db/__init__.py +++ b/libraries/entropy/db/__init__.py @@ -5406,27 +5406,27 @@ class EntropyRepository(EntropyRepositoryPluginStore, TextInterface): """, ("%"+keyword+"%".lower(),)) return cur.fetchall() - def searchSlottedPackages(self, slot, atoms = False): + def searchSlotted(self, keyword, just_id = False): """ Search packages with given slot string. - @param slot: slot to search - @type slot: string - @keyword atoms: return list of atoms instead of package identifiers - @type atoms: bool + @param keyword: slot to search + @type keyword: string + @keyword just_id: just return package identifiers (returning set()) + @type just_id: bool @return: list of packages using given slot @rtype: set or list """ - if atoms: + if just_id: + cur = self._cursor().execute(""" + SELECT idpackage FROM baseinfo WHERE slot = (?)""", (keyword,)) + return self._cur2set(cur) + else: cur = self._cursor().execute(""" SELECT atom,idpackage FROM baseinfo WHERE slot = (?) - """, (slot,)) + """, (keyword,)) return cur.fetchall() - cur = self._cursor().execute(""" - SELECT idpackage FROM baseinfo WHERE slot = (?)""", (slot,)) - return self._cur2set(cur) - def searchKeySlot(self, key, slot): """ Search package with given key and slot