Re: [Sqlrelay-discussion] mysql_insertid
Brought to you by:
mused
|
From: Gaucho <ga...@gm...> - 2006-03-29 21:41:44
|
Thanks for the tip but would this be the last_insert_id for the database
handler I'm connected to (which is what I'd want) or would this be the
last_insert_id of the entire database (which would cause problems if other
inserts were going on at the same time)?
thanks very much,
//Gaucho
On 3/23/06, Ady Wicaksono <ady...@re...> wrote:
>
> Hi Gaucho
>
> Maybe you should run this query : "select last_insert_id()"
>
> Good luck
>
> Gaucho wrote:
>
> > 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
> >
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=
=3D121642
> _______________________________________________
> Sqlrelay-discussion mailing list
> Sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion
>
|