From 39f2cd0a0f39a090f7f49b1a3ef71dd8625a438a Mon Sep 17 00:00:00 2001 From: lxnay Date: Thu, 9 Oct 2008 18:06:22 +0000 Subject: [PATCH] Entropy/EntropyDatabaseInterface: - retrieveContent(): add order_by parameter git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@2508 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- libraries/entropy.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/entropy.py b/libraries/entropy.py index c00214f15..52e5e32d6 100644 --- a/libraries/entropy.py +++ b/libraries/entropy.py @@ -30719,7 +30719,7 @@ class EntropyDatabaseInterface: self.cursor.execute('SELECT sourcesreference.source FROM sources,sourcesreference WHERE idpackage = (?) and sources.idsource = sourcesreference.idsource', (idpackage,)) return self.fetchall2set(self.cursor.fetchall()) - def retrieveContent(self, idpackage, extended = False, contentType = None, formatted = False, insert_formatted = False): + def retrieveContent(self, idpackage, extended = False, contentType = None, formatted = False, insert_formatted = False, order_by = ''): # like portage does self.connection.text_factory = lambda x: unicode(x, "raw_unicode_escape") @@ -30737,7 +30737,11 @@ class EntropyDatabaseInterface: searchkeywords.append(contentType) contentstring = ' and type = (?)' - self.cursor.execute('SELECT '+extstring_idpackage+'file'+extstring+' FROM content WHERE idpackage = (?) '+contentstring, searchkeywords) + order_by_string = '' + if order_by: + order_by_string = ' order by %s' % (order_by,) + + self.cursor.execute('SELECT '+extstring_idpackage+'file'+extstring+' FROM content WHERE idpackage = (?) '+contentstring+order_by_string, searchkeywords) if extended and insert_formatted: fl = self.cursor.fetchall()