X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDBUtils.pm;h=4a4ac25c19283c91c2765ed5d9c6c9cafdb15027;hb=e81efe40ef7fa9dbf4f5785f8d775b8398385aee;hp=e041e10014160119a421b1b20c2871b960e4a248;hpb=9bd3030a376850c427c102c6e0c54f19bd19332e;p=kivitendo-erp.git diff --git a/SL/DBUtils.pm b/SL/DBUtils.pm index e041e1001..4a4ac25c1 100644 --- a/SL/DBUtils.pm +++ b/SL/DBUtils.pm @@ -84,7 +84,7 @@ sub dump_query { } while ($query =~ /\?/) { - my $value = shift(@_); + my $value = shift || ''; $value =~ s/\'/\\\'/g; $value = "'${value}'"; $query =~ s/\?/$value/; @@ -147,12 +147,11 @@ sub selectall_hashref_query { my ($form, $dbh, $query) = splice(@_, 0, 3); - my $sth = prepare_execute_query($form, $dbh, $query, @_); - my $result = []; - while (my $ref = $sth->fetchrow_hashref()) { - push(@{ $result }, $ref); - } - $sth->finish(); + dump_query(LXDebug->QUERY(), '', $query, @_); + + # this works back 'til at least DBI 1.46 on perl 5.8.4 on Debian Sarge (2004) + my $result = $dbh->selectall_arrayref($query, { Slice => {} }, @_) + or $form->dberror($query . (@_ ? " (" . join(", ", @_) . ")" : '')); $main::lxdebug->leave_sub(2);