← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4802: Replaced postgres proprietary sql with standard sql in JdbcDataSetCompletenessStore.

 

------------------------------------------------------------
revno: 4802
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-10-03 11:51:44 +0200
message:
  Replaced postgres proprietary sql with standard sql in JdbcDataSetCompletenessStore.
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.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-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java	2011-04-10 10:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java	2011-10-03 09:51:44 +0000
@@ -146,9 +146,11 @@
         final String sql = 
             "SELECT COUNT(completed) FROM ( " +
                 "SELECT sourceid, COUNT(sourceid) AS sources " +
-                "FROM datavalue " +
-                "JOIN dataelementoperand USING (dataelementid, categoryoptioncomboid) " +
-                "JOIN datasetoperands USING (dataelementoperandid) " +
+                "FROM datavalue dv " +
+                "JOIN dataelementoperand deo " +
+                "ON dv.dataelementid=deo.dataelementid AND dv.categoryoptioncomboid=deo.categoryoptioncomboid " +
+                "JOIN datasetoperands dso " +
+                "ON deo.dataelementoperandid=dso.dataelementoperandid " +
                 "WHERE periodid = " + period.getId() + " " + deadlineCriteria +
                 "AND sourceid IN (" + childrenIds + ") " +
                 "AND datasetid = " + dataSet.getId() + " GROUP BY sourceid) AS completed " +
@@ -163,10 +165,10 @@
         final String deadlineCriteria = deadline != null ? "AND lastupdated < '" + DateUtils.getMediumDateString( deadline ) + "' " : "";
         
         final String sql =
-            "SELECT count(*) FROM datavalue " +
-            "JOIN datasetmembers USING (dataelementid) " +
-            "JOIN dataset USING (datasetid) " +
-            "WHERE datasetid = " + dataSet.getId() + " " + deadlineCriteria +
+            "SELECT count(*) FROM datavalue dv " +
+            "JOIN datasetmembers dsm ON dv.dataelementid=dsm.dataelementid " +
+            "JOIN dataset ds ON dsm.datasetid=ds.datasetid " +
+            "WHERE ds.datasetid = " + dataSet.getId() + " " + deadlineCriteria +
             "AND periodid = " + period.getId() + " " +
             "AND sourceid IN (" + childrenIds + ")";