Bugzilla – Attachment 171383 Details for
Bug 37895
Update skeleton.pl to show an example use of coding guideline SQL14
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37895: Update skelton.pl to show an example use of coding guideline SQL14
Bug-37895-Update-skeltonpl-to-show-an-example-use-.patch (text/plain), 1.57 KB, created by
Owen Leonard
on 2024-09-12 11:42:27 UTC
(
hide
)
Description:
Bug 37895: Update skelton.pl to show an example use of coding guideline SQL14
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2024-09-12 11:42:27 UTC
Size:
1.57 KB
patch
obsolete
>From 0722eb086498b7e63e4ae431ce40cee3db49fbd7 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 11 Sep 2024 10:50:42 -0400 >Subject: [PATCH] Bug 37895: Update skelton.pl to show an example use of coding > guideline SQL14 > >Guideline SQL14 recommends using try/finally blocks to report database >modification errors. It would be helpful to update skeleton.pl to use >this methodology. > >Test Plan: >1) Apply this patch >2) Copy skeleton.pl to test.pl >3) Add a bad query to the the $dbh->do({}) line >4) Run updatedatabase.pl >5) Note the error message is displayed >6) Change the bad query to a good query >7) Run updatedatabase.pl >8) Note the success message is displayed! > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > installer/data/mysql/atomicupdate/skeleton.pl | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > >diff --git a/installer/data/mysql/atomicupdate/skeleton.pl b/installer/data/mysql/atomicupdate/skeleton.pl >index 9e5738136b8..62870ef5ecb 100755 >--- a/installer/data/mysql/atomicupdate/skeleton.pl >+++ b/installer/data/mysql/atomicupdate/skeleton.pl >@@ -9,7 +9,15 @@ return { > my ( $dbh, $out ) = @$args{qw(dbh out)}; > > # Do you stuffs here >- $dbh->do(q{}); >+ try { >+ $dbh->do(q{}); >+ } finally { >+ if (@_) { >+ say_failure( $out, "Database modification failed with errors: @_" ); >+ } else { >+ say_success( $out, "Database modification was successful!" ); >+ } >+ }; > > # Print useful stuff here > # tables >-- >2.39.2
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 37895
:
171338
| 171383 |
171629
|
171660