[Zope] Convert Help

Keith J. Farmer kfarmer@thuban.org
Wed, 27 Feb 2002 13:30:20 -0800


Let's avoid the confusion, since they look similar but are in fact
different enough to cause errors:

 It's a TUPLE of LISTS.

Also note that extra comma: (['1','2','3'],)

Required, as I recall, for single-element tuples.  I'm not sure *WHY*,
but it is.

Idle question -- do you know if executemany is supported for
MSDE/SQL-Server?  I don't have any need for it at the moment, but it may
come in handy for a particular project I'm working on.

----------
Keith J. Farmer
kfarmer@thuban.org
http://www.thuban.org


-----Original Message-----
From: Matthew T. Kromer [mailto:matt@zope.com]
Sent: Tuesday, February 26, 2002 11:42

    cursor.executemany('INSERT INTO TABLE VALUES (:1)',
(['1','2','3'],))
[...]

API says that this SINGLE argument is the LIST of ALL argument LISTS --=20
ie, if I wanted to insert two values, I would:

    cursor.executemany('INSERT INTO TABLE VALUES(:1, :2)', (['1','a'],=20
['2','b'], ['3','c']))