mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-01-27 00:33:34 +00:00
Output the database error when a query fails.
Signed-off-by: Andrew McMillan <andrew@morphoss.com>
This commit is contained in:
parent
34a27d126d
commit
1e4c7e7a26
@ -229,6 +229,10 @@ if ( defined(@{$queries}) && @{$queries} ) {
|
||||
foreach $sql_statement ( @$queries ) {
|
||||
# run SQL statement and dump results, into array of hashes
|
||||
my $results = $dbh->selectall_arrayref($sql_statement, { Slice => {} } );
|
||||
if ( $dbh->err ) {
|
||||
print $dbh->errstr, "\n";
|
||||
next;
|
||||
}
|
||||
foreach my $row ( @$results ) {
|
||||
print "Query result ================================================\n" if ( $debug );
|
||||
my $sep = "";
|
||||
@ -258,6 +262,10 @@ sub get_sql_value {
|
||||
|
||||
opendb() unless defined($dbh);
|
||||
my $results = $dbh->selectall_arrayref($sql);
|
||||
if ( $dbh->err ) {
|
||||
print $dbh->errstr, "\n";
|
||||
return;
|
||||
}
|
||||
print STDERR "RESULT for $varname is ", $results->[0][0], "\n" if ( $debug );
|
||||
$values->{$varname} = (defined($results->[0][0]) ? $results->[0][0] : "");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user