← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16572: Delete zero values, SQL fix for HSQL and H2

 

------------------------------------------------------------
revno: 16572
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-08-29 14:49:10 +0200
message:
  Delete zero values, SQL fix for HSQL and H2
modified:
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java	2014-08-29 08:45:54 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java	2014-08-29 12:49:10 +0000
@@ -83,10 +83,10 @@
     {
         return
             "DELETE FROM datavalue " +
-            "USING datavalue, dataelement " +
-            "WHERE datavalue.dataelementid = dataelement.dataelementid " +
-            "AND dataelement.aggregationtype = 'sum' " +
-            "AND dataelement.zeroissignificant = false " +
+            "WHERE datavalue.dataelementid IN (" +
+                "SELECT dataelementid from dataelement " +
+                "WHERE dataelement.aggregationtype = 'sum' " +
+                "AND dataelement.zeroissignificant = false) " +
             "AND datavalue.value = '0'";
     }
 

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java	2014-08-29 08:45:54 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java	2014-08-29 12:49:10 +0000
@@ -83,10 +83,10 @@
     {
         return
             "DELETE FROM datavalue " +
-            "USING datavalue, dataelement " +
-            "WHERE datavalue.dataelementid = dataelement.dataelementid " +
-            "AND dataelement.aggregationtype = 'sum' " +
-            "AND dataelement.zeroissignificant = false " +
+            "WHERE datavalue.dataelementid IN (" +
+                "SELECT dataelementid from dataelement " +
+                "WHERE dataelement.aggregationtype = 'sum' " +
+                "AND dataelement.zeroissignificant = false) " +
             "AND datavalue.value = '0'";
     }