Questions to DB-API 2

Steven Taschuk staschuk at telusplanet.net
Fri Feb 21 08:30:06 EST 2003


Quoth Jakob Simon-Gaarde:
  [...]
> cur.execute("insert into table (text,number,date) values (?,?,?)",
> (strvar,numvar,datevar))
> 
> Unfortunately this doesen't seem to work in DB-API 2 but since I don't
> expect that it is a degrade compared to DB-API 1 I guess there must be
> some other way.

As the PEP explains, drivers can provide parameters in SQL
statements with a variety of syntaxes: there's ? and %s and
%(foo)s and :1 and... :foo, I think.  See what the PEP has to say
about 'paramstyle'.

-- 
Steven Taschuk                                     staschuk at telusplanet.net
Receive them ignorant; dispatch them confused.  (Weschler's Teaching Motto)





More information about the Python-list mailing list