[DB-SIG] paramstyles (mysql string length?)

M.-A. Lemburg mal at egenix.com
Wed Apr 19 20:36:21 CEST 2006

Ian Bicking wrote:
> Carsten Haese wrote:
>> I agree that if we decide to abolish (py)format, we should help out
>> module authors for databases that don't natively support '?' by
>> providing example code for performing the necessary parsing.
> When using a higher-level SQL generator the parsing overhead would be 
> unnecessary, as such a library can produce proper pyformat queries 
> itself.  Using a parser and whatnot might be more reasonable if the user 
> could select the format in some manner; then libraries that didn't care 
> could stick with the most efficient one for the driver.

Actually, I don't think that parsing SQL is really necessary
at all: in all the years I've used qmark style, I've never come
across a situation where a SQL literal would include a question

In reality, it all boils down to doing a simple search for
'?' in the string - after all, you usually pass strings in via
bound parameters.

> OK, crazy idea: use \x00 as a marker, which requires no quoting or 
> parsing (as it can't be included in any SQL literal anyway).

Not sure about that one: some systems such as e.g. Zope use
\x00 to delimit multi-line SQL statements.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Apr 19 2006)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

More information about the DB-SIG mailing list