Using the SQLObject included in TurboGears 0.9a4 (presently against the
SQLite backend), I'm trying to do the following query:
model.LessonPage.select(model.LessonPage.q.pageNumber ==
Select(func.MIN(model.LessonPage.q.pageNumber),
where=model.LessonPage.q.pageNumber > page.pageNumber))
...for which the following SQL is generated:
SELECT lesson_page.id, lesson_page.child_name, lesson_page.title,
lesson_page.page_number, lesson_page.lesson_id FROM lesson_page WHERE
(lesson_page.page_number = SELECT MIN(lesson_page.page_number) FROM
lesson_page WHERE (lesson_page.page_number > 1))
This is invalid, however, and leads to a syntax error on account of the
subselect not having parenthesis around it. If I paste the query into
SQLite and add an extra set of parenthesis (from just before the nested
SELECT to the end of the statement), all is well.
Is there a mechanism by which I can ask SQLObject to add these parens?
Alternately, is the SQLite binding for SQLObject broken? If the latter
is the case, is there a way to fix it?
Also, is there a better way to write this query? (I'm trying to find the
next page number, but there's no guarantee that pages are contiguous).
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss