Bugzilla – Attachment 92841 Details for
Bug 23624
Count rows in report without (potentially) consuming all memory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Count total number of rows 1,000 at a time
koha-nb_rows.diff (text/plain), 557 bytes, created by
Paul Hoffman
on 2019-09-16 18:58:58 UTC
(
hide
)
Description:
Count total number of rows 1,000 at a time
Filename:
MIME Type:
Creator:
Paul Hoffman
Created:
2019-09-16 18:58:58 UTC
Size:
557 bytes
patch
obsolete
>--- a/C4/Reports/Guided.pm >+++ b/C4/Reports/Guided.pm >@@ -420,8 +420,13 @@ sub nb_rows { > my $sql = shift or return; > my $sth = C4::Context->dbh->prepare($sql); > $sth->execute(); >- my $rows = $sth->fetchall_arrayref(); >- return scalar (@$rows); >+ my $n = 0; >+ # Loop through the complete results, fetching 1,000 rows at a time. This >+ # lowers memory requirements but increases execution time. >+ while (my $rows = $sth->fetchall_arrayref(undef, 1000)) { >+ $n += @$rows; >+ } >+ return $n; > } > > =head2 execute_query
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23624
:
92841
|
92903
|
92968
|
92969
|
92970
|
92974
|
92975
|
92976
|
92995
|
93037
|
93153
|
93154
|
93155
|
93156
|
93157