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

SF.net SVN: ledger-smb:[2884] trunk/LedgerSMB/Initiate.pm



Revision: 2884
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2884&view=rev
Author:   einhverfr
Date:     2010-02-10 05:26:39 +0000 (Wed, 10 Feb 2010)

Log Message:
-----------
More fixes from Ian Goodacre

Modified Paths:
--------------
    trunk/LedgerSMB/Initiate.pm

Modified: trunk/LedgerSMB/Initiate.pm
===================================================================
--- trunk/LedgerSMB/Initiate.pm	2010-02-10 05:07:58 UTC (rev 2883)
+++ trunk/LedgerSMB/Initiate.pm	2010-02-10 05:26:39 UTC (rev 2884)
@@ -360,55 +360,22 @@
 
 	my($self,$form)..hidden..;
 
-	$form->{initiateon}=0;
-		
-	my $newdbh=LedgerSMB::Initiate->getdbh($form);	
-		
-	$form->{initiateon}=1;
-		
-
-	if(lc($newdbh) eq 'no999')
-	{
-		
- 		$form->{dbh}->do("drop database $form->{database}");
-
-		$form->error( __FILE__ . ':' . __LINE__ . ': '
-		        . $locale->text( 'connection failed to database [_1] might be port/localhost problem!', $form->{database} )
-		            );		
-
-	}
-
-	
-
-	if(!LedgerSMB::Initiate->create_language($newdbh))
-	{
-		$form->{dbh}->do("drop database $form->{database}");
-
-		$form->error( __FILE__ . ':' . __LINE__ . ': '
-	        . $locale->text( 'connection failed to database [_1] might be port/localhost problem!', $form->{database} )
-		            );		
-
-	}
-
-
-	return($newdbh);
-	
+    eval {
+        local $form->{dbh}->{RaiseError} = 1;
+        $form->{dbh}->do("create language plpgsql");
+    };
+    if($@) {
+        $form->error( __FILE__ . ':' . __LINE__ . ': '
+            . $locale->text( 'create language plpgsql failed on database [_1]!', $form->{database} )
+        );
+    }
 }
 
 
-sub create_language
-{
 
-	my ($self,$newdbh)..hidden..;
-	$newdbh->do("create language plpgsql") || return 0;
-	return 1;
 
-}
 
 
-
-
-
 sub check_contrib_valid_exist
 {
 


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