Bug 35907: Tidy execute_query

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Kyle Hall 2024-01-25 10:27:11 -05:00 committed by Katrin Fischer
parent 26014e62da
commit 2f702d2387
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -556,7 +556,6 @@ and that the number placeholders matches the number of parameters.
=cut =cut
sub execute_query { sub execute_query {
my $params = shift; my $params = shift;
my $sql = $params->{sql}; my $sql = $params->{sql};
my $offset = $params->{offset} || 0; my $offset = $params->{offset} || 0;
@ -594,7 +593,8 @@ sub execute_query {
Koha::Logger->get->debug( Koha::Logger->get->debug(
sprintf "User has supplied (OFFSET,) LIMIT = %s, %s", sprintf "User has supplied (OFFSET,) LIMIT = %s, %s",
$useroffset, ( defined($userlimit) ? $userlimit : 'UNDEF' ) ); $useroffset, ( defined($userlimit) ? $userlimit : 'UNDEF' )
);
$offset += $useroffset; $offset += $useroffset;
if ( defined($userlimit) ) { if ( defined($userlimit) ) {
@ -616,9 +616,7 @@ sub execute_query {
->info("Report starting: $report_id") if $report_id; ->info("Report starting: $report_id") if $report_id;
my $sth = $dbh->prepare($sql); my $sth = $dbh->prepare($sql);
eval { eval { $sth->execute( @$sql_params, $offset, $limit ); };
$sth->execute(@$sql_params, $offset, $limit);
};
warn $@ if $@; warn $@ if $@;
Koha::Logger->get( { prefix => 0, interface => 'reports', category => 'execute.time.end' } ) Koha::Logger->get( { prefix => 0, interface => 'reports', category => 'execute.time.end' } )