[DB-SIG] Optional DB API Extensions
M.-A. Lemburg
mal@lemburg.com
Fri, 26 Oct 2001 14:49:40 +0200
brian zimmer wrote:
>
> What happens in the case of:
>
> cur.execute("insert into x values (?, ?)", [(a, b), (c, d)])
>
> I presume the .lastrowid is the value of the insert with (c, d)?
You get a TypeError ;-) .execute() only supports sequence arguments,
not sequences of sequences. .executemany() is meant for the latter.
Now back to your question:
> What happens in the case of:
>
> cur.executemany("insert into x values (?, ?)", [(a, b), (c, d)])
>
> I presume the .lastrowid is the value of the insert with (c, d)?
Good Point !
I would presume that too -- except: how do you know that the database
maintains the order of the arguments that you presented ? Some
optimizer might feel like adding (a,b) last...
--
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company: http://www.egenix.com/
Python Software: http://www.lemburg.com/python/