[DB-SIG] paramstyles, again
Carsten Haese
carsten at uniqsys.com
Thu May 31 17:33:56 CEST 2007
On Thu, 2007-05-31 at 11:04 -0400, Michael Bayer wrote:
> numeric is redunant if you have named. just name your params :1, :
> 2, :3, etc. OK, possibly you'd say then you have to send a dict
> instead of a list, id just use a dict/enumerate combination on my
> list for that. whats the use case for numeric exactly ?
Backwards compatibility and performance. InformixDB has had numeric
style for much longer than it had named style, and it's cheaper to build
a parameter tuple than to build a parameter dict.
> >
> > I personally like named style, but I'm +0 on making it required. If it
> > were required, you'd have to specify how the API is expected to
> > differentiate between qmark and named. Do you expect the API to
> > auto-detect the parameter style from the query string, or do you
> > expect
> > some kind of switching mechanism?
>
> psycopg2, mysqldb, and pysqlite all support positional and non-
> positional paramstyles right now (mysql/postgres do format and
> pyformat, pysqlite does qmark and named), and they all know how to
> automatically "switch" between the two categories. im not sure if
> they look at the string itself or the given args (my guess is they
> look at the args being sent) but its totally doable.
I know auto-detect is doable, that's what InformixDB does. My point was
simply that you didn't specify your preference.
--
Carsten Haese
http://informixdb.sourceforge.net
More information about the DB-SIG
mailing list