[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [615] trunk/LedgerSMB/User.pm
- Subject: SF.net SVN: ledger-smb: [615] trunk/LedgerSMB/User.pm
- From: ..hidden..
- Date: Tue, 14 Nov 2006 21:06:11 -0800
Revision: 615
http://svn.sourceforge.net/ledger-smb/?rev=615&view=rev
Author: einhverfr
Date: 2006-11-14 21:06:11 -0800 (Tue, 14 Nov 2006)
Log Message:
-----------
Added psql error detection
Modified Paths:
--------------
trunk/LedgerSMB/User.pm
Modified: trunk/LedgerSMB/User.pm
===================================================================
--- trunk/LedgerSMB/User.pm 2006-11-15 04:56:55 UTC (rev 614)
+++ trunk/LedgerSMB/User.pm 2006-11-15 05:06:11 UTC (rev 615)
@@ -453,20 +453,14 @@
return unless (-f $filename);
- open(FH, "$filename") or $form->error(__FILE__.':'.__LINE__.": $filename : $!\n");
$ENV{PGPASSWORD} = $form->{dbpasswd};
$ENV{PGUSER} = $form->{dbuser};
$ENV{PGDATABASE} = $form->{db};
- open(PSQL, "| psql") or $form->error(__FILE__.':'.__LINE__.": psql : $! \n");
- print PSQL "\\o spool/log \n";
- print PSQL "BEGIN;\n";
- while (<FH>){
- print PSQL $_;
+ $results = `psql -f $filename 2>&1`;
+ if ($? or ($results =~ /error/i)){
+ $form->error($results);
}
- print PSQL "COMMIT;\n";
- close FH;
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.