chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.db-live.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pass $dbh down through the stack, for better lifetime
[ypp-sc-tools.db-live.git]
/
yarrg
/
web
/
qtextstringcheck
diff --git
a/yarrg/web/qtextstringcheck
b/yarrg/web/qtextstringcheck
index 5ef8971f644b63991af5d6eb5379be7fec1da596..b2c101390589b01daf00d858c60f9d205d05ce83 100755
(executable)
--- a/
yarrg/web/qtextstringcheck
+++ b/
yarrg/web/qtextstringcheck
@@
-43,6
+43,7
@@
$format
$ctype => undef
$string
$what
$ctype => undef
$string
$what
+$dbh => undef
</%args>
<%flags>
</%args>
<%flags>
@@
-58,7
+59,8
@@
use CommodsWeb;
die if $what =~ m/[^a-z]/;
my $chk= $m->fetch_comp("check_${what}");
die if $what =~ m/[^a-z]/;
my $chk= $m->fetch_comp("check_${what}");
-my $dbh= dbw_connect($ocean);
+my $mydbh;
+$dbh ||= ($mydbh= dbw_connect($ocean));
my $sqlstmt= $chk->scall_method("sqlstmt");
my $sth= $dbh->prepare($sqlstmt);
my $sqlstmt= $chk->scall_method("sqlstmt");
my $sth= $dbh->prepare($sqlstmt);
@@
-119,7
+121,7
@@
if ($format =~ /dump/) {
print Dumper($emsg, $canontext, \@results);
}
print Dumper($emsg, $canontext, \@results);
}
-$
dbh->rollback()
;
+$
mydbh->rollback() if $mydbh
;
return $emsg,
$canontext,
return $emsg,
$canontext,