On Mon, 17 Apr 2006 15:29:03 +0200, Dr.Ruud wrote:

Hi

>> sub last_insert_id [...]
>> if ($self -> db_vendor() =~ /(?:mysql|Pg)/)
>>
> That regex can be written as /mysql|Pg/.

Correct.

> Notice that 'CertainlyNotPgAtAll' matches, so maybe you were
> looking for /\A(?:mysql|pg)\z/i

Nope. Method db_vendor() extracts the vendor's name from the connect string
passed to DBI, so I don't see how it could return that :-))).

> MySQL's native LAST_INSERT_ID() will return the *first* id from a
> multi row insert. I don't now what DBI does with that.

Good point. But then my code doesn't come with a written guarantee to work with
multi-row inserts...

> DBI doc last_insert_id() "For some drivers the $catalog, $schema,
> $table, and $field parameters are required (e.g., Pg), for others
> they are ignored (e.g., mysql)."

Right. That's why they are undef for MySQL, and it seems the last time I tested
it under Pg, undef worked there too, but that was months ago. Proof to the
contrary should be published here.

--
Cheers
Ron Savage, [EMAIL PROTECTED] on 18/04/2006
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company


Reply via email to