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

SF.net SVN: ledger-smb:[2665] trunk/sql



Revision: 2665
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2665&view=rev
Author:   einhverfr
Date:     2009-06-12 19:32:22 +0000 (Fri, 12 Jun 2009)

Log Message:
-----------
Correcting db load issue with rule depending on functions

Modified Paths:
--------------
    trunk/sql/Pg-database.sql
    trunk/sql/modules/Account.sql

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2009-06-12 19:01:20 UTC (rev 2664)
+++ trunk/sql/Pg-database.sql	2009-06-12 19:32:22 UTC (rev 2665)
@@ -40,12 +40,6 @@
 SELECT id, accno, description, 'H' as charttype, NULL as category, NULL as link, NULL as account_heading, null as gifi_accno, false as contra from account_heading UNION
 select c.id, c.accno, c.description, 'A' as charttype, c.category, concat_colon(l.description) as link, heading, gifi_accno, contra from account c left join account_link l ON (c.id = l.account_id) group by c.id, c.accno, c.description, c.category, c.heading, c.gifi_accno, c.contra;
 
-CREATE RULE chart_i AS ON INSERT TO chart
-DO INSTEAD
-SELECT CASE WHEN new.charttype='H' THEN account_heading_save(new.id, new.accno, new.description, NULL)
-ELSE account_save(new.id, new.accno, new.description, new.category, new.gifi_accno, NULL, CASE WHEN new.contra IS NULL THEN FALSE ELSE new.contra END, string_to_array(new.link, ':'))
-END;
---
 -- pricegroup added here due to references
 CREATE TABLE pricegroup (
   id serial PRIMARY KEY,

Modified: trunk/sql/modules/Account.sql
===================================================================
--- trunk/sql/modules/Account.sql	2009-06-12 19:01:20 UTC (rev 2664)
+++ trunk/sql/modules/Account.sql	2009-06-12 19:32:22 UTC (rev 2665)
@@ -105,3 +105,10 @@
 	RETURN currval('account_heading_id_seq');
 END;
 $$ LANGUAGE PLPGSQL;
+
+CREATE RULE chart_i AS ON INSERT TO chart
+DO INSTEAD
+SELECT CASE WHEN new.charttype='H' THEN account_heading_save(new.id, new.accno, new.description, NULL)
+ELSE account_save(new.id, new.accno, new.description, new.category, new.gifi_accno, NULL, CASE WHEN new.contra IS NULL THEN FALSE ELSE new.contra END, string_to_array(new.link, ':'))
+END;
+--


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