[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[6475] branches/1.3



Revision: 6475
          http://sourceforge.net/p/ledger-smb/code/6475
Author:   einhverfr
Date:     2014-01-16 08:12:24 +0000 (Thu, 16 Jan 2014)
Log Message:
-----------
Fixing bug 946, db names with spaces not supported, merged from trunk, with additional modifications to scripts/setup.pl

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/DBObject/User.pm
    branches/1.3/LedgerSMB/Database.pm
    branches/1.3/LedgerSMB/Form.pm
    branches/1.3/LedgerSMB.pm
    branches/1.3/scripts/setup.pl

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2014-01-16 08:07:10 UTC (rev 6474)
+++ branches/1.3/Changelog	2014-01-16 08:12:24 UTC (rev 6475)
@@ -3,7 +3,8 @@
 Supported Presently
 
 Changelog for 1.3.37
-* 1.3-1.2 downgrade now drops extensions (Chris T, 946)
+* 1.3-1.2 downgrade now drops extensions (Chris T, 943)
+* Fixed db names with spaces not supported (Chris T, 946)
 
 Changelog for 1.3.36
 * Set default date for AP invoice creation to current date (Chris T)

Modified: branches/1.3/LedgerSMB/DBObject/User.pm
===================================================================
--- branches/1.3/LedgerSMB/DBObject/User.pm	2014-01-16 08:07:10 UTC (rev 6474)
+++ branches/1.3/LedgerSMB/DBObject/User.pm	2014-01-16 08:12:24 UTC (rev 6475)
@@ -68,7 +68,7 @@
     # Just in case, however, I think it is a good idea to include the DBI
     # error string.  CT
     $self->{dbh} = DBI->connect(
-        "dbi:Pg:dbname=$dbname", "$self->{login}", "$self->{old_password}", { AutoCommit => 0 }
+        qq|dbi:Pg:dbname="$dbname"|, "$self->{login}", "$self->{old_password}", { AutoCommit => 0 }
     ); 
     if (!$self->{dbh}){
         $self->error($self->{_locale}->text('Incorrect Password'));

Modified: branches/1.3/LedgerSMB/Database.pm
===================================================================
--- branches/1.3/LedgerSMB/Database.pm	2014-01-16 08:07:10 UTC (rev 6474)
+++ branches/1.3/LedgerSMB/Database.pm	2014-01-16 08:12:24 UTC (rev 6475)
@@ -646,7 +646,7 @@
     my $retval = {};
     my $qtemp = 'SELECT count(*) FROM TABLE';
     my $dbh = DBI->connect(
-        "dbi:Pg:dbname=$self->{company_name}",  
+        qq|dbi:Pg:dbname="$self->{company_name}"|,  
          $self->{username}, $self->{password},
          { AutoCommit => 0, PrintError => $logger->is_warn(), }
     );

Modified: branches/1.3/LedgerSMB/Form.pm
===================================================================
--- branches/1.3/LedgerSMB/Form.pm	2014-01-16 08:07:10 UTC (rev 6474)
+++ branches/1.3/LedgerSMB/Form.pm	2014-01-16 08:12:24 UTC (rev 6475)
@@ -1375,12 +1375,9 @@
         $self->{company} = $LedgerSMB::Sysconfig::default_db;
     }
     my $dbname = $self->{company};
-    my $dbconfig = { dbconnect => "dbi:Pg:dbname=$dbname",
-                  dbuser    => $login,
-                  dbpasswd  => $password
-    };
+    $self->{dbh} = DBI->connect(qq|dbi:Pg:dbname="$dbname"|, $login, $password,
+           { AutoCommit => 0 }) || $self->dberror();
 
-    $self->{dbh} = $self->dbconnect_noauto($dbconfig) || $self->dberror();
     $logger->debug("acquired dbh \$self->{dbh}=$self->{dbh}");
     $self->{dbh}->{pg_server_prepare} = 0;
     my $dbh = $self->{dbh};

Modified: branches/1.3/LedgerSMB.pm
===================================================================
--- branches/1.3/LedgerSMB.pm	2014-01-16 08:07:10 UTC (rev 6474)
+++ branches/1.3/LedgerSMB.pm	2014-01-16 08:12:24 UTC (rev 6475)
@@ -986,7 +986,7 @@
     # Just in case, however, I think it is a good idea to include the DBI
     # error string.  CT
     $self->{dbh} = DBI->connect(
-        "dbi:Pg:dbname=$dbname", "$creds->{login}", "$creds->{password}", { AutoCommit => 0 }
+        qq|dbi:Pg:dbname="$dbname"|, "$creds->{login}", "$creds->{password}", { AutoCommit => 0 }
     ); 
     $logger->debug("DBI->connect dbh=$self->{dbh}");
     my $dbi_trace=$LedgerSMB::Sysconfig::DBI_TRACE;

Modified: branches/1.3/scripts/setup.pl
===================================================================
--- branches/1.3/scripts/setup.pl	2014-01-16 08:07:10 UTC (rev 6474)
+++ branches/1.3/scripts/setup.pl	2014-01-16 08:12:24 UTC (rev 6475)
@@ -344,7 +344,7 @@
     $ENV{PGDATABASE} = $request->{database};
 
     # Credentials set above via environment variables --CT
-    $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}");
+    $request->{dbh} = DBI->connect(qq|dbi:Pg:dbname="$request->{database}"|);
     my $dbh = $request->{dbh};
     $dbh->do('ALTER SCHEMA public RENAME TO sl28');
     $dbh->do('CREATE SCHEMA PUBLIC');
@@ -376,7 +376,7 @@
     $rc2 = system("psql -f $temp/sl2.8-1.3-upgrade.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
     $rc ||= $rc2;
 
-    $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}");
+    $request->{dbh} = DBI->connect(qq|dbi:Pg:dbname="$request->{database}"|);
 
    @{$request->{salutations}} 
     = $request->call_procedure(procname => 'person__list_salutations' ); 
@@ -448,7 +448,7 @@
     $ENV{PGDATABASE} = $request->{database};
 
     # Credentials set above via environment variables --CT
-    $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}");
+    $request->{dbh} = DBI->connect(qq|dbi:Pg:dbname="$request->{database}"|);
     my $locale = $request->{_locale};
 
     my @pre_upgrade_checks = (
@@ -601,7 +601,7 @@
     $ENV{PGDATABASE} = $request->{database};
 
     # Credentials set above via environment variables --CT
-    $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}");
+    $request->{dbh} = DBI->connect(qq|dbi:Pg:dbname="$request->{database}"|);
     my $locale = $request->{_locale};
 
     my $table = $request->{dbh}->quote_identifier($request->{table});
@@ -791,7 +791,7 @@
 
 
 
-    $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}");
+    $request->{dbh} = DBI->connect(qq|dbi:Pg:dbname="$request->{database}"|);
     $request->{dbh}->{AutoCommit} = 0;
 
     @{$request->{salutations}} 
@@ -833,7 +833,7 @@
     use LedgerSMB::DBObject::Admin;
     my ($request) = @_;
     my $creds = LedgerSMB::Auth::get_credentials();
-    $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}",
+    $request->{dbh} = DBI->connect(qq|dbi:Pg:dbname="$request->{database}"|,
                                    $creds->{login},
                                    $creds->{password});
     $LedgerSMB::App_State::DBH = $request->{dbh};
@@ -910,7 +910,7 @@
     $ENV{PGDATABASE} = $request->{database};
 
     # Credentials set above via environment variables --CT
-    $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}");
+    $request->{dbh} = DBI->connect(qq|dbi:Pg:dbname="$request->{database}"|);
     my $dbh = $request->{dbh};
     $dbh->do('ALTER SCHEMA public RENAME TO lsmb12');
     $dbh->do('CREATE SCHEMA PUBLIC');
@@ -942,7 +942,7 @@
     $rc2 = system("psql -f $temp/1.2-1.3-upgrade.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
     $rc ||= $rc2;
 
-    $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}");
+    $request->{dbh} = DBI->connect(qq|dbi:Pg:dbname="$request->{database}"|);
 
    @{$request->{salutations}} 
     = $request->call_procedure(procname => 'person__list_salutations' ); 
@@ -1000,7 +1000,7 @@
     $request->{lsmb_info} = $database->lsmb_info();
     # Credentials set above via environment variables --CT
     #avoid msg commit ineffective with AutoCommit enabled
-    $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}",$creds->{login},$creds->{password},{AutoCommit=>0});
+    $request->{dbh} = DBI->connect(qq|dbi:Pg:dbname="$request->{database}"|,$creds->{login},$creds->{password},{AutoCommit=>0});
     my $dbh = $request->{dbh};
     my $sth = $dbh->prepare(
           'UPDATE defaults SET value = ? WHERE setting_key = ?'

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits