Changeset 47 for trunk/npemap.org.uk
- Timestamp:
- Oct 15, 2006, 5:25:05 PM (14 years ago)
- Location:
- trunk/npemap.org.uk/cgi
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/npemap.org.uk/cgi/get-postcodes.fcgi
r45 r47 8 8 use JSON; 9 9 10 use vars qw($dbname $dbhost $dbuser $dbpass); 11 10 12 sub print_err; 11 13 sub setup_dbh; 14 15 # Read in database config 16 my $config = 'npemap.conf'; 17 do $config or die "Can't read $config!\n"; 18 12 19 13 20 # Set up database handler to try and make sure it's ready for the first … … 92 99 sub setup_dbh { 93 100 # $dbh is global 94 return $dbh = DBI->connect_cached("dbi:Pg:dbname=npemaps;host=127.0.0.1","npemaps","npemaps"); 101 my $data_source = "dbi:Pg:dbname=$dbname"; 102 $data_source .= ";host=$dbhost" if $dbhost; 103 return $dbh = DBI->connect_cached($data_source, $dbuser, $dbpass); 95 104 } -
trunk/npemap.org.uk/cgi/submit.fcgi
r44 r47 9 9 use Date::Format; 10 10 11 use vars qw($dbname $dbhost $dbuser $dbpass); 12 11 13 sub print_err; 12 14 sub setup_dbh; 15 16 # Read in database config 17 my $config = 'npemap.conf'; 18 do $config or die "Can't read $config!\n"; 13 19 14 20 # Set up database handler to try and make sure it's ready for the first … … 152 158 sub setup_dbh { 153 159 # $dbh is global 154 return $dbh = DBI->connect_cached("dbi:Pg:dbname=npemaps;host=127.0.0.1","npemaps","npemaps"); 160 my $data_source = "dbi:Pg:dbname=$dbname"; 161 $data_source .= ";host=$dbhost" if $dbhost; 162 return $dbh = DBI->connect_cached($data_source, $dbuser, $dbpass); 155 163 } 164
Note: See TracChangeset
for help on using the changeset viewer.