[SQL-CVS] r503 - in trunk/SQLObject: docs examples
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2004-12-29 16:51:59
|
Author: ianb Date: 2004-12-29 16:51:52 +0000 (Wed, 29 Dec 2004) New Revision: 503 Modified: trunk/SQLObject/docs/SQLObject.txt trunk/SQLObject/examples/personaddress.py Log: Added a note about .selectBy Modified: trunk/SQLObject/docs/SQLObject.txt =================================================================== --- trunk/SQLObject/docs/SQLObject.txt 2004-12-28 12:12:57 UTC (rev 502) +++ trunk/SQLObject/docs/SQLObject.txt 2004-12-29 16:51:52 UTC (rev 503) @@ -455,6 +455,18 @@ .. _`SQLBuilder documentation`: SQLBuilder.html +Select-By Method +~~~~~~~~~~~~~~~~ + +An alternative to ``.select`` is ``.selectBy``. It works like: + +.. raw:: html + :file: ../examples/snippets/select-by.html + +Each keyword argument is a column, and all the keyword arguments +are ANDed together. The return value is a `SelectResult`, so you +can slice it, count it, order it, etc. + Customizing the Objects ----------------------- Modified: trunk/SQLObject/examples/personaddress.py =================================================================== --- trunk/SQLObject/examples/personaddress.py 2004-12-28 12:12:57 UTC (rev 502) +++ trunk/SQLObject/examples/personaddress.py 2004-12-29 16:51:52 UTC (rev 503) @@ -56,6 +56,11 @@ # SELECT person.id FROM person WHERE person.first_name = 'John'; ## end snippet +## Snippet "person-select-by" +peeps = Person.selectBy(firstName="John", lastName="Doe") +## end snippet +list(peeps) + ## Snippet "person-select2" peeps = Person.select( AND(Address.q.personID == Person.q.id, |