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

SF.net SVN: ledger-smb: [110] trunk



Revision: 110
          http://svn.sourceforge.net/ledger-smb/?rev=110&view=rev
Author:   einhverfr
Date:     2006-09-17 22:40:51 -0700 (Sun, 17 Sep 2006)

Log Message:
-----------
fixed broken db version.  Also fixed bug of trying to add all relations to
template1.

Modified Paths:
--------------
    trunk/LedgerSMB/User.pm
    trunk/sql/Pg-tables.sql

Modified: trunk/LedgerSMB/User.pm
===================================================================
--- trunk/LedgerSMB/User.pm	2006-09-18 04:44:02 UTC (rev 109)
+++ trunk/LedgerSMB/User.pm	2006-09-18 05:40:51 UTC (rev 110)
@@ -306,10 +306,18 @@
   
   $form->{sid} = $form->{dbdefault};
   &dbconnect_vars($form, $form->{dbdefault});
+  # The below line connects to Template1 or another template file in order
+  # to create the db.  One must disconnect and reconnect later.
   my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror;
   my $query = qq|$dbcreate{$form->{dbdriver}}|;
   $dbh->do($query) || $form->dberror($query);
     
+  $dbh->disconnect;  
+  #Reassign for the work below
+
+  &dbconnect_vars($form, $form->{db});
+  
+  my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror;
   # JD: We need to check for plpgsql, if it isn't there create it, if we can't error
   # Good chance I will have to do this twice as I get used to the way the code is
   # structured
@@ -318,11 +326,6 @@
   my $query = qq|$langcreate{$form->{dbdriver}}|;
   $dbh->do($query) || $form->dberror($query);
   
-  #Reassign for the work below
-
-  &dbconnect_vars($form, $form->{db});
-  
-  
   # create the tables
   my $dbdriver = ($form->{dbdriver} =~ /Pg/) ? 'Pg' : $form->{dbdriver};
   

Modified: trunk/sql/Pg-tables.sql
===================================================================
--- trunk/sql/Pg-tables.sql	2006-09-18 04:44:02 UTC (rev 109)
+++ trunk/sql/Pg-tables.sql	2006-09-18 05:40:51 UTC (rev 110)
@@ -71,7 +71,7 @@
   glnumber text,
   projectnumber text
 );
-INSERT INTO defaults (version) VALUES ('2.6.17');
+INSERT INTO defaults (version) VALUES ('2.6.18');
 --
 CREATE TABLE acc_trans (
   trans_id int,


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