As far as I can tell it is possible to pass a list to the orderBy
keyword in a select to produce results that are ordered with respect
to several columns. However when I try to do the same on inherited
classes it fails (ordering by a single column works):

---------------------------------------------------------------
class parent( InheritableSQLObject ):
    pass

class t( parent ):
    c = IntCol( )
    d = IntCol( )
---------------------------------------------------------------

Having a single orderBy column works, for example:

---------------------------------------------------------------
for i in t.select( orderBy=t.q.d ):
    print i

SELECT parent.id, parent.child_name
              FROM t, parent WHERE
              (((parent.child_name) = ('t'))
              AND ((t.id) = (parent.id)))
              ORDER BY t.d
SELECT t.id, t.c, t.d, t.child_name
              FROM t WHERE ((t.id) = (1))
----------------------------------------------------------------

but multiple orderBy columns throw an exception in the first query:

----------------------------------------------------------------
for i in t.select( orderBy=( t.q.c, t.q.d ) ):
    print i

SELECT parent.id, parent.child_name
              FROM parent WHERE
              ((parent.child_name) = ('t'))
              ORDER BY t.c, t.d

sqlobject.dberrors.OperationalError: no such column: t.c
-----------------------------------------------------------------

And it seems that the problem is that the query doesn't have "FROM t,
parent" only "FROM parent" (among other things) while in the first
case (only one orderBy column) the query was generated correctly.

Any ideas?

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to