Lines 445-452
sub nb_rows {
Link Here
|
445 |
$dbh->{RaiseError} = $RaiseError; |
445 |
$dbh->{RaiseError} = $RaiseError; |
446 |
$dbh->{PrintError} = $PrintError; |
446 |
$dbh->{PrintError} = $PrintError; |
447 |
if ($@) { # To catch "Duplicate column name" caused by the derived table, or any other syntax error |
447 |
if ($@) { # To catch "Duplicate column name" caused by the derived table, or any other syntax error |
448 |
$sth = $dbh->prepare($sql); |
448 |
eval { |
449 |
$sth->execute; |
449 |
$sth = $dbh->prepare($sql); |
|
|
450 |
$sth->execute; |
451 |
}; |
452 |
warn $@ if $@; |
450 |
# Loop through the complete results, fetching 1,000 rows at a time. This |
453 |
# Loop through the complete results, fetching 1,000 rows at a time. This |
451 |
# lowers memory requirements but increases execution time. |
454 |
# lowers memory requirements but increases execution time. |
452 |
while (my $rows = $sth->fetchall_arrayref(undef, 1000)) { |
455 |
while (my $rows = $sth->fetchall_arrayref(undef, 1000)) { |
Lines 576-582
sub execute_query {
Link Here
|
576 |
$dbh->do( 'UPDATE saved_sql SET last_run = NOW() WHERE id = ?', undef, $report_id ) if $report_id; |
579 |
$dbh->do( 'UPDATE saved_sql SET last_run = NOW() WHERE id = ?', undef, $report_id ) if $report_id; |
577 |
|
580 |
|
578 |
my $sth = $dbh->prepare($sql); |
581 |
my $sth = $dbh->prepare($sql); |
579 |
$sth->execute(@$sql_params, $offset, $limit); |
582 |
eval { |
|
|
583 |
$sth->execute(@$sql_params, $offset, $limit); |
584 |
}; |
585 |
warn $@ if $@; |
580 |
|
586 |
|
581 |
return ( $sth, { queryerr => $sth->errstr } ) if ($sth->err); |
587 |
return ( $sth, { queryerr => $sth->errstr } ) if ($sth->err); |
582 |
return ( $sth ); |
588 |
return ( $sth ); |
583 |
- |
|
|