Hi,

On Jan 28, 2008 3:29 PM, Dean Karres <[EMAIL PROTECTED]> wrote:
> 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?

If you don't need your script to work on other databases, you should
use $dbh->{mysql_insert_id} instead.  This accesses the API function
of the same name, instead of going through DBD's wrapper.  It doesn't
have to send another query to the server.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to