[DB-SIG] Remaining issues with DB API 2.0
Andy Dustman
adustman@comstar.net
Sun, 28 Mar 1999 18:36:17 -0500 (EST)
On Sun, 28 Mar 1999, M.-A. Lemburg wrote:
> Note: The URL for the API spec has changed:
>
> http://starship.skyport.net/~lemburg/DatabaseAPI-2.0.html
>
> Greg Stein wrote:
>
> > > · Naming of some of the values for the .paramstyle attribute:
> > > Andy Dustman proposed to change "percent" and "xpercent"
> > > to "format" and "dictformat". I prefer "pyformat" instead of
> > > "dictformat"...
> >
> > format and pyformat seem fine.
> > [ and it is in the spec like this ]
> >
> > The part about multiple paramstyles should not be included. A database
> > should take just one style and be done with it. Higher levels can
> > perform the appropriate mappings.
>
> Andy ?
Yeah, sure. There's no database that supports multiple styles at this
time, though the new MySQLdb could, since it is using the % string
operator anyway. Maybe I'll slip that in as a separate method or
something.
> Hmm, I guess you've got a point there. I'll make the parameter
> list a guideline then (this part of the spec isn't going to be
> portable anyway...). Still, I'll leave the keyword stuff in --
> people should start using keyword based functions in C more
> often...
I make pretty good use of keyword parameters in the underlying _mysql
module, i.e.
c=_mysql.connect(host, user, passwd, db, port, unix_socket, client_flag)
where all those are keyword parameters which mostly default to NULL.
Usually I can get away with:
c=_mysql.connect(passwd='pwd')
The current positional parameters really sorta cramp my style a bit,
though I have worked around it. If it were legal for me to define my
connect() to only take keyword parameters, I'd be happy, though I need to
renamed the password parameter somehow; my design for the C module has
been to keep it very close to the C MySQL API. Well, I'll work it out.
--
Andy Dustman (ICQ#32922760) You should always say "spam" and "eggs"
ComStar Communications Corp. instead of "foo" and "bar"
(706) 549-7689 | PGP KeyID=0xC72F3F1D in Python examples. (Mark Lutz)