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);
|
---|