For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > April 2007 > DBI Last Inserted ID









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author DBI Last Inserted ID
movingsnail@gmail.com

2007-04-07, 6:57 pm

Hi pros:
i have been search around for the way to access the recent inserted
row to get the id from auto incremented col.
there are a lot of ways to access that col. such as $dbh-
>{'mysql_insertid'} etc.


what i am wondering is this will the statement $dbh-
>{'mysql_insertid'} give the id that i want.

what if there are many other connections to the database and
constantly inserting other rows.
will that mess up the whole purpose of get back the id;

thanks in advance for anyone tries to answer my question

Thanks a lot

Jonathan Leffler

2007-04-07, 9:58 pm

movingsnail@gmail.com wrote:
> i have been search around for the way to access the recent inserted
> row to get the id from auto incremented col.
> there are a lot of ways to access that col. such as $dbh-
>
> what i am wondering is this will the statement
> $dbh-> {'mysql_insertid'} give the id that i want.
> what if there are many other connections to the database and
> constantly inserting other rows.
> will that mess up the whole purpose of get back the id;


You'd do better, probably, on the dbi-users@perl.org mailing list.

If the driver is implemented properly, activity on a separate database
handle ($dbh2, say) definitely won't (shouldn't) affect the insert ID on
the current one ($dbh1). If I was asked, I'd the say the same of
statement handles on the same $dbh; $st1 and $st2 should be able to have
separate 'last inserted ID' values (and DBD::Informix implements that),
but I'm not sure what the DBI spec (perldoc DBI) has to say about it.

--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2007.0226 -- http://dbi.perl.org/
Sorry

2007-04-18, 12:07 pm

http://Mel-Gibson-spanking.info/Win...hp?movie=148803
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com