[entropy.db] add order_by="date" support to listAllPackageIds

This commit is contained in:
Fabio Erculiani
2011-02-20 19:33:32 +01:00
parent 2e3398f928
commit 4e0d24d11c
2 changed files with 10 additions and 4 deletions

View File

@@ -4484,15 +4484,21 @@ class EntropyRepository(EntropyRepositoryBase):
order_by_string = ''
if order_by is not None:
valid_order_by = ("atom", "idpackage", "package_id", "branch",
"name", "version", "versiontag", "revision", "slot")
"name", "version", "versiontag", "revision", "slot", "date")
if order_by not in valid_order_by:
raise AttributeError("invalid order_by argument")
if order_by == "package_id":
order_by = "idpackage"
order_by_string = ' order by %s' % (order_by,)
cur = self._cursor().execute("""
SELECT idpackage FROM baseinfo""" + order_by_string)
if order_by == "date":
cur = self._cursor().execute("""
SELECT baseinfo.idpackage FROM baseinfo, extrainfo
WHERE baseinfo.idpackage = extrainfo.idpackage
ORDER BY extrainfo.datecreation DESC""")
else:
cur = self._cursor().execute("""
SELECT idpackage FROM baseinfo""" + order_by_string)
try:
if order_by:

View File

@@ -3272,7 +3272,7 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore):
List all package identifiers available in repository.
@keyword order_by: order by "atom", "idpackage", "package_id", "branch",
"name", "version", "versiontag", "revision", "slot"
"name", "version", "versiontag", "revision", "slot", "date"
@type order_by: string
@return: tuple (if order_by) or frozenset of package identifiers
@rtype: tuple or frozenset