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

Dittmar, Daniel daniel.dittmar at sap.com
Wed Apr 19 16:02:15 CEST 2006


>On Wed, 2006-04-19 at 08:24, M.-A. Lemburg wrote:
>> I've found the qmark style to be sufficient for everything

This is more about convenience (same as Python positional arguments vs.
keyword arguments). Celko's book on SQL tree structures is full of
examples using :names, with the same name appearing sevveral times in
the same query.

But I guess it's not that difficult to write an SQL tokenizer that can
translate named to qmark and build a map from name to indices.

>
>I agree. Considering that many modules already support qmark, and those
>that currently use 'format'/'pyformat' would have to move to something
>else if these are dropped, I'd like to suggest that supporting 'qmark'
>style should become a required feature. Modules would be free to also
>implement 'named' and/or 'numeric', but supporting 'qmark' should be
>mandatory.

But how should a module support multiple notations?
- by tokenizing any SQL statement to check which paramstyle was used
- by having an option on the connection or the cursor
- by having an additional method which requires qmark placeholders (this
one would be backwards compatible)

And while we're discussing annoying differences between drivers: aren't
there some drivers that define 
def execute (stmt, *args)
instead of 
def execute (stmt, args = [])

Daniel

-- 
Daniel Dittmar
SAP Labs Berlin
daniel.dittmar at sap.com  


More information about the DB-SIG mailing list