[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4173] branches/1.3/scripts/setup.pl
- Subject: SF.net SVN: ledger-smb:[4173] branches/1.3/scripts/setup.pl
- From: ..hidden..
- Date: Thu, 08 Dec 2011 22:04:12 +0000
Revision: 4173
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4173&view=rev
Author: tshvr
Date: 2011-12-08 22:04:12 +0000 (Thu, 08 Dec 2011)
Log Message:
-----------
use locale from request,put dbh in request,avoid msg,leave disconnect to upper stack
Modified Paths:
--------------
branches/1.3/scripts/setup.pl
Modified: branches/1.3/scripts/setup.pl
===================================================================
--- branches/1.3/scripts/setup.pl 2011-12-08 22:01:26 UTC (rev 4172)
+++ branches/1.3/scripts/setup.pl 2011-12-08 22:04:12 UTC (rev 4173)
@@ -46,7 +46,8 @@
sub login {
use LedgerSMB::Locale;
my ($request) = @_;
- $request->{_locale}->new('en');
+ $logger->trace("\$request=$request \$request->{dbh}=$request->{dbh} request=".Data::Dumper::Dumper(\$request));
+ #$request->{_locale}->new('en'); why not continue to use already set $request->{_locale}
my $creds = LedgerSMB::Auth::get_credentials();
if (!$request->{database}){
$request->error($request->{_locale}->text('No database specified'));
@@ -57,6 +58,7 @@
password => $creds->{password}}
);
my $version_info = $database->get_info();
+ if(!$request->{dbh}){$request->{dbh}=$database->{dbh};}#allow upper stack to disconnect dbh when leaving
$request->{login_name} = $version_info->{username};
if ($version_info->{appname} eq 'sql-ledger'){
$request->{message} =
@@ -762,7 +764,8 @@
$database->load_modules('LOADORDER');
$database->process_roles('Roles.sql');
# Credentials set above via environment variables --CT
- $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}");
+ #avoid msg commit ineffective with AutoCommit enabled
+ $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}",{AutoCommit=>0});
my $dbh = $request->{dbh};
my $sth = $dbh->prepare(
'UPDATE defaults SET value = ? WHERE setting_key = ?'
@@ -770,7 +773,7 @@
$sth->execute($request->{dbversion}, 'version');
$sth->finish;
$dbh->commit;
- $dbh->disconnect;
+ #$dbh->disconnect;#upper stack will disconnect
my $template = LedgerSMB::Template->new(
path => 'UI/setup',
template => 'complete',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.