[Sqlrelay-discussion] mysql_insertid
Brought to you by:
mused
|
From: Gaucho <ga...@gm...> - 2006-03-23 18:20:38
|
Hi there,
I've searched all around and found hints from different posts but still
can't find the answer to this problem....
I just implemented sqlrelay with my mysql server (4.0.22) and I had some
code that used to work that got the insertid from an autoincrement field
when I inserted it as such:
--------------------------------------
$sql_query =3D " INSERT INTO mytable (autoinc_field,y,z) VALUES
('','foo','bar')";
$db_ptr =3D &run_sqlquery($sql_query);
my $insert_id =3D $db->{'mysql_insertid'};
print STDERR "I GOT THIS: $insert_id\n";
--------------------------------------
When I run that code directly to the database, it prints out the value
assigned to the autoincrement field in that table when I inserted... when I
run it through sqlrelay it returns blank.
Does this functionality not work in sqlrelay? Is there a workaround?
Some supplimental info:
I'm using the DBI::SQLRelay dropin functionality to replace the current way
I'm doing it with DBI / DBD::mysql.
The relevant part of the runsqlquery function is as follows:
--------------------
sub run_sqlquery{
my ($sql_query) =3D @_;
my $prepared =3D $db->prepare($sql_query);
my $dbquery =3D $prepared->execute();
return $prepared;
}
---------------------------
Any help would be greatly appreciated.
//Gaucho
|