|
Lines 43-49
BEGIN {
Link Here
|
| 43 |
save_report get_saved_reports execute_query get_saved_report create_compound run_compound |
43 |
save_report get_saved_reports execute_query get_saved_report create_compound run_compound |
| 44 |
get_column_type get_distinct_values save_dictionary get_from_dictionary |
44 |
get_column_type get_distinct_values save_dictionary get_from_dictionary |
| 45 |
delete_definition delete_report format_results get_sql |
45 |
delete_definition delete_report format_results get_sql |
| 46 |
select_2_select_count_value update_sql |
46 |
nb_rows update_sql |
| 47 |
); |
47 |
); |
| 48 |
} |
48 |
} |
| 49 |
|
49 |
|
|
Lines 373-378
sub get_criteria {
Link Here
|
| 373 |
return ( \@criteria_array ); |
373 |
return ( \@criteria_array ); |
| 374 |
} |
374 |
} |
| 375 |
|
375 |
|
|
|
376 |
sub nb_rows($) { |
| 377 |
my $sql = shift or return; |
| 378 |
my $sth = C4::Context->dbh->prepare($sql); |
| 379 |
$sth->execute(); |
| 380 |
my $rows = $sth->fetchall_arrayref(); |
| 381 |
return scalar (@$rows); |
| 382 |
} |
| 383 |
|
| 376 |
=item execute_query |
384 |
=item execute_query |
| 377 |
|
385 |
|
| 378 |
($results, $total, $error) = execute_query($sql, $offset, $limit) |
386 |
($results, $total, $error) = execute_query($sql, $offset, $limit) |
|
Lines 399-414
the user in a user-supplied SQL query WILL apply in any case.
Link Here
|
| 399 |
# ~ remove any LIMIT clause |
407 |
# ~ remove any LIMIT clause |
| 400 |
# ~ repace SELECT clause w/ SELECT count(*) |
408 |
# ~ repace SELECT clause w/ SELECT count(*) |
| 401 |
|
409 |
|
| 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 ($) { |
410 |
sub select_2_select_count ($) { |
| 413 |
# Modify the query passed in to create a count query... (I think this covers all cases -crn) |
411 |
# 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; |
412 |
my ($sql) = strip_limit(shift) or return; |