chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.web-live.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
abolish $dbh global in Mason code to shorten db connection lifetime
[ypp-sc-tools.web-live.git]
/
yarrg
/
web
/
route
diff --git
a/yarrg/web/route
b/yarrg/web/route
index 74a5086f1428b64f37e269dd66f3eff07ed999d7..9c7200c39480df0343ab70b7615e4e994316b3d2 100644
(file)
--- a/
yarrg/web/route
+++ b/
yarrg/web/route
@@
-87,11
+87,7
@@
foreach my $var (@vars) {
#---------- initial checks, startup, main entry form ----------
#---------- initial checks, startup, main entry form ----------
-die "unknown ocean $a{Ocean} ?"
- unless grep { $_ eq $a{Ocean} } ocean_list();
-
-db_setocean($a{Ocean});
-db_connect();
+dbw_connect($a{Ocean});
</%perl>
<%args>
</%perl>
<%args>
@@
-176,6
+172,8
@@
my $optionlistmap= sub {
return $out;
};
return $out;
};
+my $dbh= dbw_connect($a{Ocean});
+
$sth= $dbh->prepare("SELECT DISTINCT archipelago FROM islands
ORDER BY archipelago;");
$sth->execute();
$sth= $dbh->prepare("SELECT DISTINCT archipelago FROM islands
ORDER BY archipelago;");
$sth->execute();
@@
-342,5
+340,6
@@
function debug (m) {
use CommodsWeb;
use HTML::Entities;
use URI::Escape;
use CommodsWeb;
use HTML::Entities;
use URI::Escape;
+use JSON;
</%init>
</%init>