12 messages in com.mysql.lists.perlRE: $dbh->{'mysql_insertid'} returning 0| From | Sent On | Attachments |
|---|---|---|
| Nick Tonkin | 04 Dec 2001 14:40 | |
| Vaughan, Penny | 04 Dec 2001 14:43 | |
| Ruben Safir | 04 Dec 2001 15:05 | |
| Vaughan, Penny | 04 Dec 2001 15:08 | |
| sherzodR | 04 Dec 2001 15:38 | |
| Nick Tonkin | 04 Dec 2001 16:24 | |
| Vaughan, Penny | 05 Dec 2001 08:03 | |
| Chuck O'Donnell | 05 Dec 2001 08:41 | |
| Vaughan, Penny | 05 Dec 2001 08:52 | |
| Jochen Wiedmann | 05 Dec 2001 09:56 | |
| Bernd Prager | 10 Dec 2001 00:45 | |
| Jochen Wiedmann | 10 Dec 2001 09:16 |
| Subject: | RE: $dbh->{'mysql_insertid'} returning 0![]() |
|---|---|
| From: | Vaughan, Penny (Penn...@turner.com) |
| Date: | 12/05/2001 08:03:37 AM |
| List: | com.mysql.lists.perl |
Nothing like a good night's sleep...
The crux: using the database handle to get with mysql_insertid just doesn't seem
to work anymore, however using the statement handle ($sth->{mysql_insertid'}) is
working.
I was getting zeros because I didn't realize that "The last ID that was
generated is maintained in the server on a per-connection basis."
(http://www.mysql.com/doc/M/i/Miscellaneous_functions.html) and I had isolated
the code to return the id without bringing an insert statement along that would
generate an id for that connection. I'm still getting 0 if I use the database
handle despite the note in the Perl DBI section of the manual that still says
you can use that as an alternative.
Thanks for your comments, Penny
-----Original Message----- From: sherzodR [mailto:sher...@cgi101.com] Sent: Tuesday, December 04, 2001 6:39 PM To: Ruben Safir Cc: Nick Tonkin; msql...@lists.mysql.com Subject: Re: $dbh->{'mysql_insertid'} returning 0
well, I am using $dbh->{mysql_insertid} a lot (MySQL 3.23.*), and haven't had any problems. Hmmm, try to upgrade to 3.23, since I have no clue what might be wrong.
Ruben Safir wrote:
RS: That's bad. RS: RS: That breaks a lot of legacy code without reason RS: RS: RS: Ruben RS: RS: On 2001.12.04 17:40:38 -0500 Nick Tonkin wrote: RS: >> RS: >> IIRC it's $sth->{insertid} these days .... check the docs for your new RS: >> version. RS: >> RS: >> RS: >> ~~~~~~~~~~~ RS: >> Nick Tonkin RS: >> RS: >> On Tue, 4 Dec 2001, Vaughan, Penny wrote: RS: >> RS: >>> Hello all, RS: >>> RS: >>> I was using $dbh->{'mysql_insertid'} to return the auto_increment RS: >> number with no problem until a recent server upgrade. We moved RS: >> everything to a new box, but had to re-install the mysql perl modules. RS: >> We're running mysql 3.22.25. Now, I'm just getting 0 whether I use the RS: >> database handle or the statement handle in my cgi. No error messages RS: >> are RS: >> showing up so it thinks it's working. RS: >>> RS: >>> Clues or red herrings: RS: >>> When I ran select last_insert_id() at the mysql command line I was also RS: >> was getting zero until I added a record and then I got a correct number, RS: >> but still zeros through the DBI. RS: >>> RS: >>> When I was trying anything, I used the old $sth->{insert_id} and got a RS: >> message telling me that this has been deprecated so I'm guessing that RS: >> means the modules are working? RS: >>> RS: >>> I ran the auto_increment.tst; it looked good. We restarted the mysql RS: >> server and last_insert_id() gave zero again at the mysql prompt. RS: >>> RS: >>> Any suggestions? RS: >>> RS: >>> Thanks, RS: >>> Penny RS: >>> RS: >>> RS: >>> RS: >>> RS: >> RS: >> RS: >>
--------------------------------------------------------------------- RS: >> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" RS: >> before RS: >> posting. To request this thread, e-mail RS: >> msql...@lists.mysql.com RS: >> RS: >> To unsubscribe, send a message to the address shown in the RS: >> List-Unsubscribe header of this message. If you cannot see it, RS: >> e-mail msql...@lists.mysql.com instead. RS: >> RS: -- RS: __________________________ RS: RS: Brooklyn Linux Solutions RS: __________________________ RS: http://www.mrbrklyn.com - Consulting RS: http://www.brooklynonline.com - For the love of Brooklyn RS: http://www.nylxs.com - Leadership Development in Free Software RS: http://www.nyfairuse.org - The foundation of Democracy RS: http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and RS: articles from around the net RS: http://www2.mrbrklyn.com/mp3/annie.mp3 - Armed and Dangerous.... RS: http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn.... RS: RS: 1-718-382-5752 RS: RS: RS: RS: RS: RS:
--------------------------------------------------------------------- RS: Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before RS: posting. To request this thread, e-mail msql...@lists.mysql.com RS: RS: To unsubscribe, send a message to the address shown in the RS: List-Unsubscribe header of this message. If you cannot see it, RS: e-mail msql...@lists.mysql.com instead. RS:
-- sherzodR <sher...@cgi101.com> use CGI::Session;
--------------------------------------------------------------------- Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail msql...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail msql...@lists.mysql.com instead.




