[DB-SIG] paramstyles, again
mike_mp at zzzcomputing.com
Thu May 31 17:04:44 CEST 2007
On May 31, 2007, at 9:13 AM, Carsten Haese wrote:
> That makes +3 votes for making qmark mandatory (you, Marc-Andre, and
> myself). I'm not sure what your stance is on format, pyformat, and
> numeric. Are you allowing them optionally or are you proposing that
> be deprecated/removed? I would vote -1 on completely removing numeric
> because I don't think it's redundant.
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 ?
> 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
> 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.
More information about the DB-SIG