|
Lines 420-427
sub nb_rows {
Link Here
|
| 420 |
my $sql = shift or return; |
420 |
my $sql = shift or return; |
| 421 |
my $sth = C4::Context->dbh->prepare($sql); |
421 |
my $sth = C4::Context->dbh->prepare($sql); |
| 422 |
$sth->execute(); |
422 |
$sth->execute(); |
| 423 |
my $rows = $sth->fetchall_arrayref(); |
423 |
my $n = 0; |
| 424 |
return scalar (@$rows); |
424 |
# Loop through the complete results, fetching 1,000 rows at a time. This |
|
|
425 |
# lowers memory requirements but increases execution time. |
| 426 |
while (my $rows = $sth->fetchall_arrayref(undef, 1000)) { |
| 427 |
$n += @$rows; |
| 428 |
} |
| 429 |
return $n; |
| 425 |
} |
430 |
} |
| 426 |
|
431 |
|
| 427 |
=head2 execute_query |
432 |
=head2 execute_query |
| 428 |
- |
|
|