Skip to content
Snippets Groups Projects
Commit 28649d1f authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

more detailed handling of error modes

parent ca4c7b48
No related branches found
No related tags found
No related merge requests found
...@@ -86,7 +86,14 @@ sub get_all_x ...@@ -86,7 +86,14 @@ sub get_all_x
my $sth= $dbh->prepare($ss) or print $dbh->errstr; my $sth= $dbh->prepare($ss) or print $dbh->errstr;
# print "sth=[$sth]\n"; # print "sth=[$sth]\n";
$sth->execute(@v); my $rc= $sth->execute(@v);
# print __LINE__, "rc=[$rc]\n";
unless (defined ($rc))
{
print __LINE__, " rc=[$rc] ", $dbh->errstr(), "\n";
print __LINE__, " caller: ", join (' ', caller()), "\n";
return undef;
}
my $t= $self->table($table); my $t= $self->table($table);
my $tt= {}; my $tt= {};
...@@ -240,7 +247,14 @@ sub insert ...@@ -240,7 +247,14 @@ sub insert
print "ssi=[$ssi]\n"; print "ssi=[$ssi]\n";
print "vals: ", join (',', @vals), "\n"; print "vals: ", join (',', @vals), "\n";
my $sth= $dbh->prepare($ssi); my $sth= $dbh->prepare($ssi);
$sth->execute(@vals); my $rc= $sth->execute(@vals);
unless (defined ($rc))
{
print __LINE__, " rc=[$rc] ", $dbh->errstr(), "\n";
print __LINE__, " caller: ", join (' ', caller()), "\n";
return undef;
}
print "ERROR: ", $dbh->errstr() if ($dbh->err); print "ERROR: ", $dbh->errstr() if ($dbh->err);
$sth->finish(); $sth->finish();
...@@ -288,8 +302,15 @@ sub update ...@@ -288,8 +302,15 @@ sub update
} }
my $sth= $dbh->prepare($ssu); my $sth= $dbh->prepare($ssu);
$sth->execute(@vals); my $rc= $sth->execute(@vals);
print "ERROR: ", $dbh->errstr() if ($dbh->err);
unless (defined ($rc))
{
print __LINE__, " rc=[$rc] ", $dbh->errstr(), "\n";
print __LINE__, " caller: ", join (' ', caller()), "\n";
return undef;
}
$sth->finish(); $sth->finish();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment