[DB-SIG] Experiences with DB-API2.0

Andy Dustman andy@dustman.net
20 Jun 2002 20:35:26 -0400

On Thu, 2002-06-20 at 18:39, Tom Jenkins wrote:

> paramstyle (forgot about this one) - this was another one that got us. 
> letting driver developers pick from a set of paramstyles means a
> hodge-podge of implemented paramstyles.  we generate alot of our sql, so
> this becomes another extra step to make sure our generated paramstyle
> matches the style for the adapter we're using.  is there a reason there
> are 5 different styles?  can we narrow this down to maybe one? <wink>

Sure, as long as it's %s, and then the driver can map in the correct
placeholder with the % string formatting operator, since the placeholder
determined by the database vendor and not by the module author unless
the database doesn't support placeholders and parameter binding to begin
with; most do, though MySQL and PostgreSQL don't.

Example: If the implementation uses qmark (?), substitute them in with
query % ['?']*len(params)

Andy Dustman         PGP: 0x930B8AB6
    @       .net     http://dustman.net/andy
"Cogito, ergo sum." -- Rene Descartes
"I yam what I yam and that's all what I yam." -- Popeye