Bugzilla – Attachment 93157 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]
Bug 23624: (QA follow-up) Test error cases
Bug-23624-QA-follow-up-Test-error-cases.patch (text/plain), 1.65 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-09-25 13:45:18 UTC
(
hide
)
Description:
Bug 23624: (QA follow-up) Test error cases
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-09-25 13:45:18 UTC
Size:
1.65 KB
patch
obsolete
>From 8772b76a0af16866011e27073c21d92e2493bacc Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 25 Sep 2019 10:44:03 -0300 >Subject: [PATCH] Bug 23624: (QA follow-up) Test error cases > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Reports/Guided.pm | 9 ++++++--- > t/db_dependent/Reports/Guided.t | 13 ++++++++++++- > 2 files changed, 18 insertions(+), 4 deletions(-) > >diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm >index 4ff311edb8..6f77f5dfe9 100644 >--- a/C4/Reports/Guided.pm >+++ b/C4/Reports/Guided.pm >@@ -431,10 +431,13 @@ sub nb_rows { > }); > > $sth->execute(); >- my $results = $sth->fetch; >- my $n = $results ? $results->[0] : 0; > >- return $n; >+ if ( $sth->errstr ) { >+ return 0; >+ } >+ else { >+ return $sth->fetch->[0]; >+ } > } > > =head2 execute_query >diff --git a/t/db_dependent/Reports/Guided.t b/t/db_dependent/Reports/Guided.t >index a2c90eee2f..e0aacfd29e 100644 >--- a/t/db_dependent/Reports/Guided.t >+++ b/t/db_dependent/Reports/Guided.t >@@ -413,7 +413,7 @@ $schema->storage->txn_rollback; > > subtest 'nb_rows() tests' => sub { > >- plan tests => 1; >+ plan tests => 3; > > $schema->storage->txn_begin; > >@@ -430,6 +430,17 @@ subtest 'nb_rows() tests' => sub { > > is( $nb_rows, $items_count, 'nb_rows returns the right value' ); > >+ my $bad_query = q{ >+ SELECT * items xxx >+ }; >+ >+ warning_like >+ { $nb_rows = nb_rows( $bad_query ) } >+ qr/^DBD::mysql::st execute failed:/, >+ 'Bad queries raise a warning'; >+ >+ is( $nb_rows, 0, 'nb_rows returns 0 on bad queries' ); >+ > $schema->storage->txn_rollback; > }; > >-- >2.23.0
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