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

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



Revision: 136
          http://svn.sourceforge.net/ledger-smb/?rev=136&view=rev
Author:   einhverfr
Date:     2006-09-22 23:03:43 -0700 (Fri, 22 Sep 2006)

Log Message:
-----------
Fixed issues with the creation of function in the upgrade scripts and function
files

Modified Paths:
--------------
    trunk/LedgerSMB/Form.pm
    trunk/sql/Pg-functions.sql
    trunk/sql/Pg-upgrade-2.6.17-2.6.18.sql

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2006-09-23 04:15:46 UTC (rev 135)
+++ trunk/LedgerSMB/Form.pm	2006-09-23 06:03:43 UTC (rev 136)
@@ -1280,6 +1280,32 @@
 	}
 }
 
+sub get_custom_queries {
+	my ($self, $tablename) = @_;
+	my @rc;
+	my %temphash;
+	my @elements;
+	my $query;
+	for (@{$self->{custom_db_fields}{$tablename}}){
+		@elements = split (/:/, $_);
+		push @{$temphash{$elements[0]}}, $elements[1];
+	}
+	for (keys %temphash){
+		$query = "SELECT ";
+		my $first = 1;
+		for (@{$temphash{$_}}){
+			$query .= "$_";
+			if ($first == 0){
+				$query .= ", "
+			}
+			$first = 0;
+		}
+		$query .= " FROM $_ WHERE field_id = ?";
+		push @rc, $query;
+	}
+	@rc;
+}
+
 sub dbconnect {
 
 	my ($self, $myconfig) = @_;

Modified: trunk/sql/Pg-functions.sql
===================================================================
--- trunk/sql/Pg-functions.sql	2006-09-23 04:15:46 UTC (rev 135)
+++ trunk/sql/Pg-functions.sql	2006-09-23 06:03:43 UTC (rev 136)
@@ -263,9 +263,11 @@
   RETURN NEW;
 END;
 ' LANGUAGE PLPGSQL;
+-- end function
 
 CREATE TRIGGER parts_short AFTER UPDATE ON parts 
 FOR EACH ROW EXECUTE PROCEDURE trigger_parts_short();
+-- end function
 
 CREATE OR REPLACE FUNCTION add_custom_field (VARCHAR, VARCHAR, VARCHAR) 
 RETURNS BOOL AS
@@ -296,6 +298,7 @@
 	RETURN TRUE;
 END;
 ' LANGUAGE PLPGSQL;
+-- end function
 
 CREATE OR REPLACE FUNCTION drop_custom_field (VARCHAR, VARCHAR) 
 RETURNS BOOL AS
@@ -313,3 +316,4 @@
 	RETURN TRUE;	
 END;
 ' LANGUAGE PLPGSQL;
+-- end function

Modified: trunk/sql/Pg-upgrade-2.6.17-2.6.18.sql
===================================================================
--- trunk/sql/Pg-upgrade-2.6.17-2.6.18.sql	2006-09-23 04:15:46 UTC (rev 135)
+++ trunk/sql/Pg-upgrade-2.6.17-2.6.18.sql	2006-09-23 06:03:43 UTC (rev 136)
@@ -94,6 +94,7 @@
   RETURN NEW;
 END;
 ' LANGUAGE PLPGSQL;
+-- end function
 
 CREATE TRIGGER parts_short AFTER UPDATE ON parts 
 FOR EACH ROW EXECUTE PROCEDURE trigger_parts_short();
@@ -263,6 +264,7 @@
 	RETURN TRUE;
 END;
 ' LANGUAGE PLPGSQL;
+-- end function
 
 CREATE OR REPLACE FUNCTION drop_custom_field (VARCHAR, VARCHAR) 
 RETURNS BOOL AS
@@ -280,5 +282,6 @@
 	RETURN TRUE;	
 END;
 ' LANGUAGE PLPGSQL;
+-- end function
 
 UPDATE defaults SET version = '2.6.18';


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