[Twisted-Python] enterprise.row

David Phillips david at acz.org
Mon Apr 7 12:28:35 EDT 2003


Justin Ryan writes:
> I think that if you insert a row and allow the database to assign the
> pkey, you can select out the pkey.  I'm not sure this is more
> efficient than selecting nextval() before insert, but it would be more
> database-independent..

Some databases have an efficient way to get the key for the last row that
was inserted.  MySQL, for example, has mysql_insert_id() and
LAST_INSERT_ID():

http://www.mysql.com/doc/en/mysql_insert_id.html
http://www.mysql.com/doc/en/Miscellaneous_functions.html#IDX1347

--
David Phillips <david at acz.org>
http://david.acz.org/





More information about the Twisted-Python mailing list