[Zope-DB] Re: How to call a zsql method with NOT a parameter
Axel Straschil
axel at straschil.com
Fri Jan 28 03:09:17 EST 2005
Hello!
>> Think for the geek's, it's an easy to subclass zsql for that ;-)
>> Could someone give an example?
> ZSQL methods are some of the oldest code in Zope, good luck ;-)
That's too bad ;-(
For me, zsql is some of the strongest features zope give's to me!
But there are some things which makes a subclass worth:
- Can't stop acquisition (as we discussed in this thread)
- No support for boolean (as python now has a bool type)
- No support for binary, I have a workaround for PostgreSQL, but
converting a binary to an escaped string and passing that over
zsql to the backend is fu**ing slow and a memory pig ;-)
- You can pass wrong variables to zsql without an exception (if you
define a zsql with the parameter x and call it as mistake with
my_zsql(y=1) instead of x=1, noting happens but get more results as
you expect, this bugs are hard to find
There is also another thing I'm umhappy with, and didn't found a quick
resolution:
Sometimes, in want to get the connection of a database connection and
want to work with it directly in an external python product or method.
A example: I have a Zope Database Connection to a postgresql server via
ZPsycoPG called mypgcon. I want to pass the connection to an external
method and let the external method work directly on it.
Maybe, something like mypgcon.getCursor() would be something I want.
The rest of the (great) Zope behavior that it commits when no exception
is thrown, otherwise rollback should be the same.
In other words: How to mix zsql-calls and direct database calls on the
same connection for one request.
Thanks,
AXEL.
More information about the Zope-DB
mailing list