die if $styles{Query} =~ m/[^a-z]/;
-dbw_connect($styles{Ocean});
+my $mydbh;
+my $dbh= ($mydbh= dbw_connect($styles{Ocean}));
my $results_head_done=0;
my $someresults= sub {
<hr>
-<& "query_$styles{Query}", %baseqf, %queryqf, %styles, quri => $quri,
+<& "query_$styles{Query}", %baseqf, %queryqf, %styles,
+ quri => $quri, dbh => $dbh,
someresults => $someresults,
emsgokorprint => sub {
my ($emsg) = @_;
use URI::Escape;
</%init>
+<%cleanup>
+
+$mydbh->rollback() if $mydbh;
+
+</%cleanup>
</%doc>
<%args>
+$qa => $m->caller_args(1)->{'qa'}
+$dbh
$thingstring
$emsgstore
$perresult
-$qa => $m->caller_args(1)->{'qa'}
</%args>
<%perl>
my $stringval= $qa->{$thingstring};
$ctype => undef
$string
$what
+$dbh => undef
</%args>
<%flags>
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);
print Dumper($emsg, $canontext, \@results);
}
-$dbh->rollback();
+$mydbh->rollback() if $mydbh;
return $emsg,
$canontext,
</%doc>
+
+<%args>
+$quri
+$dbh
+</%args>
+
<%once>
my $meta_prettyprint_age= sub {
my ($age,$floor,$plus) = @_;
</%once>
<%perl>
-
my $now= time;
my $row;
<span id="daid_loaded">(not known; times above not updating)</span>
<form action="lookup" method="get">
-% foreach my $a (keys %ARGS) {
-<input type="hidden" name="<% $a |h %>" value="<% $ARGS{$a} |h %>">
-% }
<input type=submit name=submit value="Reload">
+<& "lookup:formhidden", ours => sub { 0; } &>
</form>
<&| script &>
<%init>
use POSIX;
use CommodsWeb;
-my $dbh= dbw_connect('Midnight');
</%init>
-<%cleanup>
-$dbh->rollback();
-</%cleanup>
</%doc>
<%args>
$quri
+$dbh
$commodstring => '';
$someresults
$emsgokorprint
<form action="<% $quri->() |h %>" method="get">
-<&| qtextstring, qa => $qa, thingstring => 'commodstring', emsgstore => \$emsg,
+<&| qtextstring, qa => $qa, dbh => $dbh,
+ thingstring => 'commodstring', emsgstore => \$emsg,
perresult => sub { ($commodname,$commodid)= @_; }
&>
size=80
</%doc>
<%args>
$quri
+$dbh
$routestring => '';
$someresults
$emsgokorprint
<form action="<% $quri->() |h %>" method="get">
-<&| qtextstring, qa => $qa, thingstring => 'routestring', emsgstore => \$emsg,
+<&| qtextstring, qa => $qa, dbh => $dbh,
+ thingstring => 'routestring', emsgstore => \$emsg,
perresult => sub {
my ($canonname, $island, $arch) = @_;
push @islandids, $island;
return $out;
};
-my $dbh= dbw_connect($qa->{Ocean});
-
$sth= $dbh->prepare("SELECT DISTINCT archipelago FROM islands
ORDER BY archipelago;");
$sth->execute();
$optionlistmap->($islandlistdata{$arch}, '');
}
-$dbh->rollback();
-
</%perl>
<&| script &>
% if (@islandids) {
% $someresults->();
-<& routetrade, islandids => \@islandids, archipelagoes => \@archipelagoes &>
+<& routetrade,
+ dbh => $dbh,
+ islandids => \@islandids,
+ archipelagoes => \@archipelagoes &>
% }
<%args>
+$dbh
@islandids
@archipelagoes
</%args>
<%init>
use CommodsWeb;
-my $dbh= dbw_connect('Midnight');
</%init>