[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [302] trunk
- Subject: SF.net SVN: ledger-smb: [302] trunk
- From: ..hidden..
- Date: Tue, 24 Oct 2006 22:54:00 -0700
Revision: 302
http://svn.sourceforge.net/ledger-smb/?rev=302&view=rev
Author: einhverfr
Date: 2006-10-24 22:53:58 -0700 (Tue, 24 Oct 2006)
Log Message:
-----------
Database upgrades now use psql
Modified Paths:
--------------
trunk/Changelog
trunk/LedgerSMB/User.pm
Modified: trunk/Changelog
===================================================================
--- trunk/Changelog 2006-10-25 05:18:43 UTC (rev 301)
+++ trunk/Changelog 2006-10-25 05:53:58 UTC (rev 302)
@@ -3,6 +3,7 @@
Database:
* Added script to configure Slony replication (Chris Browne)
* Added defined primary keys to all tables (Chris T)
+* Database upgrades now use psql (Chris T)
Security:
* Added whitelist of allowed directories to file editor (Seneca)
Modified: trunk/LedgerSMB/User.pm
===================================================================
--- trunk/LedgerSMB/User.pm 2006-10-25 05:18:43 UTC (rev 301)
+++ trunk/LedgerSMB/User.pm 2006-10-25 05:53:58 UTC (rev 302)
@@ -388,50 +388,9 @@
return unless (-f $filename);
open(FH, "$filename") or $form->error("$filename : $!\n");
- my $query = "";
- my $loop = 0;
- my $sth;
-
-
- while (<FH>) {
-
- if ($loop && /^--\s*end\s*(procedure|function|trigger)/i) {
- $loop = 0;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- $sth->finish;
-
- $query = "";
- next;
- }
-
- if ($loop || /^create *(or replace)? *(procedure|function|trigger)/i) {
- $loop = 1;
- next if /^(--.*|\s+)$/;
-
- $query .= $_;
- next;
- }
-
- # don't add comments or empty lines
- next if /^(--.*|\s+)$/;
-
- # anything else, add to query
- $query .= $_;
-
- if (/;\s*$/) {
- # strip ;... Oracle doesn't like it
- $query =~ s/;\s*$//;
- $query =~ s/\\'/''/g;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- $sth->finish;
-
- $query = "";
- }
-
+ open(PSQL, "| psql") or $form->error("psql : $! \n");
+ while (<FH>){
+ print PSQL $_;
}
close FH;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.