← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16176: Fixed bug with resource tables which failed on mysql

 

------------------------------------------------------------
revno: 16176
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-07-18 14:52:24 +0200
message:
  Fixed bug with resource tables which failed on mysql
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPeriodAggregator.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-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java	2014-05-04 09:55:24 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java	2014-07-18 12:52:24 +0000
@@ -211,14 +211,16 @@
         {
             sql += "(" +
                 "select deg.name from dataelementgroup deg " +
-                "inner join dataelementgroupmembers degm on degm.dataelementgroupid = deg.dataelementgroupid and degm.dataelementid = d.dataelementid " +
+                "inner join dataelementgroupmembers degm on degm.dataelementgroupid = deg.dataelementgroupid " +
                 "inner join dataelementgroupsetmembers degsm on degsm.dataelementgroupid = degm.dataelementgroupid and degsm.dataelementgroupsetid = " + groupSet.getId() + " " +
+                "where degm.dataelementid = d.dataelementid " +
                 "limit 1) as " + statementBuilder.columnQuote( groupSet.getName() ) + ", ";
             
             sql += "(" +
                 "select deg.uid from dataelementgroup deg " +
-                "inner join dataelementgroupmembers degm on degm.dataelementgroupid = deg.dataelementgroupid and degm.dataelementid = d.dataelementid " +
+                "inner join dataelementgroupmembers degm on degm.dataelementgroupid = deg.dataelementgroupid " +
                 "inner join dataelementgroupsetmembers degsm on degsm.dataelementgroupid = degm.dataelementgroupid and degsm.dataelementgroupsetid = " + groupSet.getId() + " " +
+                "where degm.dataelementid = d.dataelementid " +
                 "limit 1) as " + statementBuilder.columnQuote( groupSet.getUid() ) + ", ";            
         }
 
@@ -260,14 +262,16 @@
         {
             sql += "(" +
                 "select ig.name from indicatorgroup ig " +
-                "inner join indicatorgroupmembers igm on igm.indicatorgroupid = ig.indicatorgroupid and igm.indicatorid = i.indicatorid " +
+                "inner join indicatorgroupmembers igm on igm.indicatorgroupid = ig.indicatorgroupid " +
                 "inner join indicatorgroupsetmembers igsm on igsm.indicatorgroupid = igm.indicatorgroupid and igsm.indicatorgroupsetid = " + groupSet.getId() + " " +
+                "where igm.indicatorid = i.indicatorid " +
                 "limit 1) as " + statementBuilder.columnQuote( groupSet.getName() ) + ", ";
 
             sql += "(" +
                 "select ig.uid from indicatorgroup ig " +
-                "inner join indicatorgroupmembers igm on igm.indicatorgroupid = ig.indicatorgroupid and igm.indicatorid = i.indicatorid " +
+                "inner join indicatorgroupmembers igm on igm.indicatorgroupid = ig.indicatorgroupid " +
                 "inner join indicatorgroupsetmembers igsm on igsm.indicatorgroupid = igm.indicatorgroupid and igsm.indicatorgroupsetid = " + groupSet.getId() + " " +
+                "where igm.indicatorid = i.indicatorid " +
                 "limit 1) as " + statementBuilder.columnQuote( groupSet.getUid() ) + ", ";            
         }
 
@@ -309,14 +313,16 @@
         {
             sql += "(" + 
                 "select oug.name from orgunitgroup oug " +
-                "inner join orgunitgroupmembers ougm on ougm.orgunitgroupid = oug.orgunitgroupid and ougm.organisationunitid = ou.organisationunitid " +
+                "inner join orgunitgroupmembers ougm on ougm.orgunitgroupid = oug.orgunitgroupid " +
                 "inner join orgunitgroupsetmembers ougsm on ougsm.orgunitgroupid = ougm.orgunitgroupid and ougsm.orgunitgroupsetid = " + groupSet.getId() + " " +
+                "where ougm.organisationunitid = ou.organisationunitid " +
                 "limit 1) as " + statementBuilder.columnQuote( groupSet.getName() ) + ", ";
             
             sql += "(" +
                 "select oug.uid from orgunitgroup oug " +
-                "inner join orgunitgroupmembers ougm on ougm.orgunitgroupid = oug.orgunitgroupid and ougm.organisationunitid = ou.organisationunitid " +
+                "inner join orgunitgroupmembers ougm on ougm.orgunitgroupid = oug.orgunitgroupid " +
                 "inner join orgunitgroupsetmembers ougsm on ougsm.orgunitgroupid = ougm.orgunitgroupid and ougsm.orgunitgroupsetid = " + groupSet.getId() + " " +
+                "where ougm.organisationunitid = ou.organisationunitid " +
                 "limit 1) as " + statementBuilder.columnQuote( groupSet.getUid() ) + ", ";
         }
         

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPeriodAggregator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPeriodAggregator.java	2014-07-18 11:51:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPeriodAggregator.java	2014-07-18 12:52:24 +0000
@@ -209,7 +209,7 @@
      * @param <T> type of items
      * @return the first non-null item
      */
-    private static <T> T firstNonNull( T ...values) 
+    private static <T> T firstNonNull( T ...values ) 
     {
         for ( T value : values )
         {