Do you have the latest version of DBI and DBD::mysql installed?

First try:

$ cpan
cpan> install DBI
cpan> install DBD::mysql

You can also do:

my $sth = $dbh->prepare("select last_insert_id()");
$sth->execute();
my ($last_insert_id) = $sth->fetchrow_array();

Octavian

----- Original Message ----- From: "Dean Karres" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Monday, January 28, 2008 10:29 PM
Subject: MySQL, perl, last_insert_id() question


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?

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



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

Reply via email to