[Moin-user] Re: SQL Queries in Moin

Paul Moore pf_moore at yahoo.co.uk
Fri Oct 31 13:57:07 EST 2003


"Juergen Hermann" <jh at web.de> writes:

> On Sun, 26 Oct 2003 18:53:15 +0000, Paul Moore wrote:
>
>>[[SQL("select * from emp")]]
>
> 2 hours work at max.

Coo. You were right! Thanks for the pointer to ShowSmileys.py, that
really helped.

Attached is the result (under 1 hour, in fact :-)) I've tested it
against Oracle, using cx_Oracle, as that's the only database I have
available at the moment. I hope it's general enough - it requires a
DB-API 2.0 compliant module, and I use 2 config variables, the module
name, and the arguments needed for the connect() call.

My error handling is a bit ad-hoc, I just return some canned HTML
showing the SQL and the error (cx_Oracle allows str(errorvalue) to get
a message - I'm not sure how standard this is). I'm not sure whether
there's a better way of doing this (or even if I should just let the
exception fall through and have the core MoinMoin code catch it).

If you want to use this, feel free - I cloned the copyright message
from the ShowSmileys module, but I'm happy to donate the code to the
MoinMoin project if you'd like.

Paul.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SQL.py
URL: <http://mail.python.org/pipermail/moin-user/attachments/20031031/e772d1c8/attachment.ksh>
-------------- next part --------------
-- 
This signature intentionally left blank


More information about the Moin-user mailing list