[Koha-bugs] [Bug 3315] Aggregate SQL clauses break pagination in guided reports

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Mar 28 12:22:47 CEST 2011


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3315

--- Comment #2 from Katrin Fischer <katrin.fischer at bsz-bw.de> 2011-03-28 10:22:47 UTC ---
I think I found the place in the code, but I get lost trying to understand it:

guided_reports.pl
 487         my $total = select_2_select_count_value($sql) || 0;

Guided.pm
 402 sub select_2_select_count_value ($) {
 403     my $sql = shift or return;
 404     my $countsql = select_2_select_count($sql);
 405     $debug and warn "original query: $sql\ncount query: $countsql\n";
 406     my $sth1 = C4::Context->dbh->prepare($countsql);
 407     $sth1->execute();
 408     my $total = $sth1->fetchrow();
 409     $debug and warn "total records for this query: $total\n";
 410     return $total;
 411 }
 412 sub select_2_select_count ($) {
 413     # Modify the query passed in to create a count query... (I think this
covers all cases -crn)
 414     my ($sql) = strip_limit(shift) or return;
 415     $sql =~ s/\bSELECT\W+(?:\w+\W+){1,}?FROM\b|\bSELECT\W\*\WFROM\b/SELECT
count(*) FROM /ig;
 416     return $sql;
 417 }

Is there perhaps a better way to find out the number of results of a sql query?

-- 
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.


More information about the Koha-bugs mailing list