I'd appreciate a summary of which drivers support some form of ``last insert id'' and details of the interface they provide.
Specifically... via an attribute or method? at the sth or dbh level, or both? any other details that might be relevant... Also, for databases that do _not_ support a ``last insert id'' concept in the client API, are there any SQL mechanisms for finding the last insert id? I'm currently (very vagely) thinking that it'll be a dbh level method something like this: $id = $dbh->last_insert_id(); $id = $dbh->last_insert_id($table_name, $column_name); where many drivers will ignore the parameters, but some might need them, for example to do: select $column_name from $table_name where $column_name IS NULL which is, I believe, the 'standard' ODBC way to get the last insert id. But I'm working from memory so could easily be wrong or confused here. (And, of course, the select would only reliably return the right value if AutoCommit is off so the table would still be locked after the insert.) Speak up! Thanks. Tim. p.s. I'm hoping DBI 1.35, which I've just released, will be fairly stable and I can aim to put new things like this, and 'take_imp_data' for Stas, into development releases leading up to a DBI 1.36.