List:General Discussion« Previous MessageNext Message »
From:Dean Karres Date:January 28 2008 8:29pm
Subject:MySQL, perl, last_insert_id() question
View as plain text  
Hi,

I know that someone is going to say, "go ask the perl module guys" and
I will but they are likely to say, "go ask the MySQL guys".  I'll be
asking in both groups.

I am installing a script on a brand new RedHat, Fedora Core 7 (x86_64)
box that is running MySQL 5.0.45 (rpm install).  I also have a mix
of other rpm MySQL installs on older Redhat boxes that are also a
mix of 32 and 64 bit machines.

The script works fine on the older installs.  For example another 64
bit machine has a MySQL rpm rev of 5.0.27

I have a valid DB handle and after an insert I try to get the ID of
that inserted row, a la:

     my $id = $DBH->last_insert_id();


This has been working everywhere until I tried installing the exact
same script on this newest machine.  When the script runs now I get:

    DBI last_insert_id: invalid number of arguments: got handle + 0, expected handle +
between 4 and 5
    Usage: $h->last_insert_id($catalog, $schema, $table_name,
    $field_name [, \%attr ]) at /usr/local/bin/myScript line 454.

Ok, I know the DBI Docs say that some versions of the drivers may
demand an argument list for last_insert_id() but since I have not seen
this behavior in the earlier versions is this new or is there a
problem?
Thread
MySQL, perl, last_insert_id() questionDean Karres28 Jan
  • Re: MySQL, perl, last_insert_id() questionOctavian Rasnita28 Jan
  • Re: MySQL, perl, last_insert_id() questionBaron Schwartz29 Jan