[DB-SIG] cx_Oracle 2.5
Kevin Jacobs
jacobs@penguin.theopalgroup.com
Wed, 17 Jul 2002 13:17:57 -0400 (EDT)
On Wed, 17 Jul 2002, M.-A. Lemburg wrote:
> Interesting. Porting such an application to a sequence based
> DB API module must be a nightmare though...
>
> I think we really need some sort of standard support for this:
> a function which takes an SQL string, a parameter object (or
> sequence of such object) and a paramstyle
> and converts it to whichever other paramstyle format
> is needed.
>
> Any volunteers ?
Got one -- except that it is really slow, and needs to be taught all the
details of the various SQL dialects. (i.e., it is a full SQL parser)
A much simpler verion could easily be written that only knows how to
tokenize SQL and about a few syntactic landmarks.
Before I start, can people tell me all the wacky things that one can do with
parameters in SQL statements? I have a sneaky feeling that I don't know the
whole story.
i.e., I'm sure some users attempt the following abuse of bound parameters:
paramstyle = 'format'
sql = '''SELECT foo_%s from bar;'''
Where binding for, e.g. dbcon.execute(sql, 'a'), is implemented as
sql % 'a'.
-Kevin
--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19 E-mail: jacobs@theopalgroup.com
Fax: (216) 986-0714 WWW: http://www.theopalgroup.com