[orm-devel] Re: Postgres & Views
Sat, 23 Nov 2002 12:32:13 +0100
>p=ds.select(person, name=like("john"), birth=between(d1,d2))
ah! Excellent idea!
I won't get arround to implement it myself this week or so, because
of my commissioned and academic work. But you can give it a try. Check
out the datasource.select() method in line 398. There's a for loop
that iterates over the method's keyword parameters. Here you'd have
if isinstance(value, selector):
As you see I suggest an sql_code() method for your selector class
that assembles correct sql with the information supplied in its
constructor and the columnName supplied in the keyword arguments dict.
We might want to introduce a selectors module and adapter.*.selectors
in case different backends introduce different syntax (like for regex
etc). You might have to figure that one out...
If you feel like giving it a try I'd create an account for you on
c200.tux4web.de and give you CVS write permession.
If not you'll have to wait until I've the time and energy to look
into it myself. Until then you might want to take a look at the
datasource.rselect() method, which lets you do a query as
SELECT <all the cols we need> FROM <dbclass' table> <rest>
for any dbclass and will assemble the usual queryResult. Also you can
use selectByClauses() method which lets you supply only a specific
_..._ Diedrich Vorberg
/ _ _ \ http://www.tux4web.de
| (o)_(o) | firstname.lastname@example.org
\( ) / .---.
//'._.'\ \ / \ Internet Dienstleistungen
// . \ \ \.@-@./ und 'Consulting'.
|| . \ \ /`\_/`\
|\ : / | // _ \\ Linux Rules!
\ `) ' (` /_ | \ )|_
_)``".____,.'"` (_ /`\_`> <_/ \
) )'--'( ( \__/'---'\__/