Fixes Issue 0023140 : DB specific ant task for update audit trail process
authorShankar Balachandran <shankar.balachandran@openbravo.com>
Tue, 26 Mar 2013 15:10:46 +0530
changeset 20002 affe31812cc0
parent 20001 3c9887b82ed4
child 20003 b22612f93099
Fixes Issue 0023140 : DB specific ant task for update audit trail process

Create seperate sub targets for oracle and postgres method call of ad_create_audit_triggers procedure.
Also create condition targets to check whether the instance is an oracle instance or postgres instance.
build.xml
--- a/build.xml	Fri Mar 15 12:45:46 2013 +0100
+++ b/build.xml	Tue Mar 26 15:10:46 2013 +0530
@@ -206,6 +206,18 @@
     </and>
   </condition>
 
+  <condition property="instance.oracle" value="true">
+    <and>
+      <equals arg1="${bbdd.rdbms}" arg2="ORACLE" />
+    </and>
+  </condition>
+
+  <condition property="instance.postgres" value="true" >
+    <and>
+      <equals arg1="${bbdd.rdbms}" arg2="POSTGRE" />
+    </and>
+  </condition>
+
   <condition property="root.user">
     <and>
       <equals arg1="${user.name}" arg2="root" />
@@ -347,15 +359,24 @@
      </sequential>
   </macrodef>
 
-  <macrodef name="createAuditTriggers">
+  <macrodef name="createAuditTriggersOracle">
      <sequential>
        <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="abort" autocommit="true" print="yes">
          <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
-         <transaction> SELECT ad_create_audit_triggers(null);
+         <transaction> CALL ad_create_audit_triggers(null)
          </transaction>
        </sql>
      </sequential>
   </macrodef>
+
+  <macrodef name="createAuditTriggersPostgres">
+     <sequential>
+       <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="abort" autocommit="true" print="yes">
+         <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
+         <transaction> SELECT ad_create_audit_triggers(null) FROM DUAL; </transaction>
+       </sql>
+     </sequential>
+  </macrodef>
   
   <taskdef resource="axis-tasks.properties" classpathref="project.class.path" />
   
@@ -1203,8 +1224,17 @@
                     propertiesFile="${base.config}/Openbravo.properties"/>
   </target>
 
+  <target name="update.audit.trail.infrastructure.oracle" if="instance.oracle">
+    <createAuditTriggersOracle/>
+  </target>
+
+  <target name="update.audit.trail.infrastructure.postgres" if="instance.postgres">
+    <createAuditTriggersPostgres/>
+  </target>
+
   <target name="update.audit.trail.infrastructure">
-    <createAuditTriggers/>
+    <antcall target="update.audit.trail.infrastructure.postgres"/>
+    <antcall target="update.audit.trail.infrastructure.oracle"/>
   </target>
   
 </project>