[SQLObject] Bug with SQLBuilder's .orderBy() routine
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Kevin J. R. <kr...@te...> - 2007-07-13 20:06:39
|
Hello: I found two problems with SQLBuilder's .orderBy() routine: 1. Multiple values are sorted incorrectly one is negative and the other positive. 2. Multiple negatives make a positive, yielding incorrect results. Consider: Res1 = TableNameHere.select(TableNameHere.q.fieldNameHere == False).orderBy("field1, field2") # correct results Res2 = TableNameHere.select(TableNameHere.q.fieldNameHere == False).orderBy("-field1, field2") # same as 3 Res3 = TableNameHere.select(TableNameHere.q.fieldNameHere == False).orderBy("field1, -field2") # same as 2 Res4 = TableNameHere.select(TableNameHere.q.fieldNameHere == False).orderBy("-field1, -field2") # same as 1 Res5 = TableNameHere.select(TableNameHere.q.fieldNameHere == False, orderBy=[TableNameHere.q.field1, -TableNameHere.q.field2])) #OK If this is hard to parse / fix, fine. I thought at least someone should know about it. -- Kevin Rice ___________________________________ Kevin J. Rice Senior Software Engineer, Textura LLC 51-K Sherwood Terrace, Lake Bluff IL (847) 235-8437 (spells VISAFLUIDS) (847) 845-7423 (845-RICE, cellphone) ___________________________________ |