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

SF.net SVN: ledger-smb:[6877] trunk/sql/possible_views/ap_paid_nok.sql



Revision: 6877
          http://sourceforge.net/p/ledger-smb/code/6877
Author:   tshvr
Date:     2014-02-19 17:06:35 +0000 (Wed, 19 Feb 2014)
Log Message:
-----------
example of instead trigger on view working under openjpa

Modified Paths:
--------------
    trunk/sql/possible_views/ap_paid_nok.sql

Modified: trunk/sql/possible_views/ap_paid_nok.sql
===================================================================
--- trunk/sql/possible_views/ap_paid_nok.sql	2014-02-19 09:05:58 UTC (rev 6876)
+++ trunk/sql/possible_views/ap_paid_nok.sql	2014-02-19 17:06:35 UTC (rev 6877)
@@ -32,3 +32,20 @@
    JOIN account_link al ON al.description = 'AP'::text AND al.account_id = ac.chart_id
   GROUP BY e.name, ap.id, ap.invnumber, ap.transdate, ap.taxincluded, ap.amount, ap.netamount, ap.duedate, ap.invoice, ap.ordnumber, ap.curr, ap.notes, ap.person_id, ap.till, ap.quonumber, ap.intnotes, ap.shipvia, ap.language_code, ap.ponumber, ap.shippingpoint, ap.on_hold, ap.approved, ap.reverse, ap.terms, ap.description, ap.force_closed, ap.crdate
  HAVING sum(ac.amount) <> 0::numeric;
+
+--example of instead trigger on view working under openjpa
+CREATE OR REPLACE FUNCTION ap_paid_nok1_delete()
+RETURNS TRIGGER AS
+$$
+BEGIN
+ IF TG_OP <> 'DELETE' then
+  RAISE EXCEPTION 'TG_OP should be DELETE';
+ END IF;
+ delete from acc_trans where trans_id=OLD.id;
+ DELETE FROM ap WHERE id=OLD.id;
+return OLD; 
+END;
+$$ language plpgsql;
+
+CREATE TRIGGER ap_paid_nok1_delete INSTEAD OF DELETE ON ap_paid_nok1 FOR EACH ROW EXECUTE PROCEDURE ap_paid_nok1_delete();
+

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


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits