On Mon, Jul 16, 2007 at 05:07:33PM +0800, ro wrote: > On 7/16/07, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > If you run a query with ORDER BY manually (without SQLObject at all) > > - does the backend return the rows in a proper order? > > Yes, I have tried to run the SQL manually in server(MySQL), the result > set is right -- "f" in front of "G" > > The SQL is "select * from page where space_id = 3 order by name asc"
sqlite> CREATE TABLE test (name VARCHAR); sqlite> INSERT INTO test ('function'); SQL error: near ";": syntax error sqlite> INSERT INTO test VALUES ('function'); sqlite> INSERT INTO test VALUES ('GetThis'); sqlite> SELECT * FROM test ORDER BY name ASC; GetThis function Uppercase before lowercase. PostgreSQL: test=# CREATE TABLE test (name VARCHAR); CREATE TABLE test=# INSERT INTO test VALUES ('function'); INSERT 0 1 test=# INSERT INTO test VALUES ('GetThis'); INSERT 0 1 test=# SELECT * FROM test ORDER BY name ASC; name ---------- function GetThis (2 rows) Lowercase before uppercase. So it seems different backends sort in different order. About MultipleJoin: it doesn't use backend's ORDER BY, it sorts itself in Python, hence the order "uppercase before lowercase". To use backend's ORDER BY switch to SQLMultipleJoin. The difference is MultipleJoin draws the rows as a list and sorts them, SQLMultipleJoin column constructs a SelectResult instance that you can iterate over, and it runs the corresponding SQL query. Oleg. -- Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss