Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: last_insert_id issue

by ikegami (Patriarch)
on Aug 27, 2014 at 21:35 UTC ( [id://1098814]=note: print w/replies, xml ) Need Help??


in reply to Re^2: last_insert_id issue
in thread last_insert_id issue

Can you elaborate on what you mean by 'meaningfully'?

In a way that has meaning, makes sense, conveys information, is useful.

I understand $! is basic

Actually, in this situation, it's value is meaningless, makes no sense, conveys no information, useless.

if you can give an example of how the error handling code could be written more meaningfully

Sorry, I thought the linked document had this.

I prefer to pass RaiseError => 1 to connect. Otherwise, if you establish there has been a DBI error, you can get it using DBI->errstr. You can also call errstr on database and statement handles if you want to make sure to get the right error when dealing with multiple handles.

my $id = $dbh->last_insert_id(); die "Foo: " . $dbh->errstr() if !defined($id);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1098814]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-16 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found