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

SF.net SVN: ledger-smb:[6340] trunk/sql/modules/Templates.sql



Revision: 6340
          http://sourceforge.net/p/ledger-smb/code/6340
Author:   einhverfr
Date:     2014-01-02 05:46:09 +0000 (Thu, 02 Jan 2014)
Log Message:
-----------
More fixes for template.sql (adding format field

Modified Paths:
--------------
    trunk/sql/modules/Templates.sql

Modified: trunk/sql/modules/Templates.sql
===================================================================
--- trunk/sql/modules/Templates.sql	2014-01-02 05:42:57 UTC (rev 6339)
+++ trunk/sql/modules/Templates.sql	2014-01-02 05:46:09 UTC (rev 6340)
@@ -1,11 +1,12 @@
 BEGIN;
 
 CREATE OR REPLACE FUNCTION template__get(
-in_template_name text, in_language_code varchar(6)
+in_template_name text, in_language_code varchar(6), in_format text
 ) RETURNS template language sql as
 $$
 SELECT * FROM template 
- WHERE template_name = $1 AND language_code IS NOT DISTINCT FROM $2;
+ WHERE template_name = $1 AND format = $3 AND
+       language_code IS NOT DISTINCT FROM $2;
 $$;
 
 CREATE OR REPLACE FUNCTION template__get_by_id(in_id int)
@@ -16,21 +17,22 @@
 
 CREATE OR REPLACE FUNCTION template__save(
 in_template_name text, in_language_code varchar(6), in_template text
+in_format text
 ) 
 RETURNS template LANGUAGE PLPGSQL AS
 $$
 BEGIN
    UPDATE template SET template = in_template
-    WHERE template_name = in_template_name AND
+    WHERE template_name = in_template_name AND format = in_format AND
           language_code IS NOT DISTINCT FROM in_language_code;
           
    IF FOUND THEN
-      RETURN template_get(in_template_name, in_language_code);
+      RETURN template_get(in_template_name, in_language_code, in_format);
    END;
-   INSERT INTO template (template_name, language_code, template)
-   VALUES (in_template_name, language_code, template);
+   INSERT INTO template (template_name, language_code, template, format)
+   VALUES (in_template_name, language_code, template, in_format);
 
-   RETURN template_get(in_template_name, in_language_code);
+   RETURN template_get(in_template_name, in_language_code, in_format);
 END;
 $$;
 

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


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits