← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1943: SQL fix for mysql in databrowser

 

------------------------------------------------------------
revno: 1943
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-08-19 22:13:13 +0200
message:
  SQL fix for mysql in databrowser
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/jdbc/StatementManagerDataBrowserStore.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm


--
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/databrowser/jdbc/StatementManagerDataBrowserStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/jdbc/StatementManagerDataBrowserStore.java	2010-07-19 05:49:33 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/jdbc/StatementManagerDataBrowserStore.java	2010-08-19 20:13:13 +0000
@@ -675,22 +675,22 @@
              * The current organization unit
              */
             sb.append( "SELECT DISTINCT o.organisationunitid AS parentid, o.name AS OrganisationUnit, COUNT(value) as countdv_descendants, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
-            sb.append( "FROM OrganisationUnit o " );
-            sb.append( "JOIN DataValue dv ON ( dv.sourceid = o.organisationunitid ) " );
-            sb.append( "JOIN Period p ON ( p.periodid = dv.periodid ) " );
+            sb.append( "FROM organisationunit o " );
+            sb.append( "JOIN datavalue dv ON ( dv.sourceid = o.organisationunitid ) " );
+            sb.append( "JOIN period p ON ( p.periodid = dv.periodid ) " );
             sb.append( "WHERE o.parentid = '" + orgUnitSelected + "' " );
             sb.append( "AND dv.periodid = '" + periodid + "' " );
-            sb.append( "GROUP BY o.organisationunitid, OrganisationUnit, p.periodid, p.startDate " );
+            sb.append( "GROUP BY o.organisationunitid, OrganisationUnit, p.periodid, p.startdate " );
             sb.append( "UNION " );
 
             /**
              * All descendant levels of selected organization unit
              */
             sb.append( "SELECT DISTINCT ou" + orgIndex + ".organisationunitid AS parentid, ou" + orgIndex + ".name AS OrganisationUnit, COUNT(value) as countdv_descendants, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
-            sb.append( "FROM DataValue dv " );
-            sb.append( "JOIN OrganisationUnit ou ON ( ou.organisationunitid = dv.sourceid ) " );
+            sb.append( "FROM datavalue dv " );
+            sb.append( "JOIN organisationunit ou ON ( ou.organisationunitid = dv.sourceid ) " );
             this.setUpQueryForJOINTable( sb, diffLevel );
-            sb.append( "JOIN Period p ON ( p.periodid = dv.periodid ) " );
+            sb.append( "JOIN period p ON ( p.periodid = dv.periodid ) " );
             sb.append( "WHERE dv.periodid = '" + periodid + "' " );
             sb.append( "AND dv.sourceid IN " );
             sb.append( "( " );
@@ -707,12 +707,12 @@
     {
         int j = curLevel;
 
-        String oldSQL = "SELECT DISTINCT idlevel" + (j + 1) + " FROM OrgunitStructure os WHERE os.idlevel" + (j)
+        String oldSQL = "SELECT DISTINCT idlevel" + (j + 1) + " FROM _orgunitstructure os WHERE os.idlevel" + (j)
             + " = '" + orgUnitSelected + "'";
 
         for ( j++; j < (maxLevel); j++ )
         {
-            oldSQL = "SELECT DISTINCT idlevel" + (j + 1) + " as descendant FROM OrgunitStructure os WHERE idlevel"
+            oldSQL = "SELECT DISTINCT idlevel" + (j + 1) + " as descendant FROM _orgunitstructure os WHERE idlevel"
                 + (j) + " IN ( " + oldSQL + " ) ";
         }
 
@@ -723,8 +723,7 @@
     {
         sb.delete( 0, sb.capacity() );
 
-        sb
-            .append( "SELECT parentid, organisationunit, sum(countdv_descendants) AS counts_of_aggregated_values, periodid, columnheader " );
+        sb.append( "SELECT parentid, organisationunit, sum(countdv_descendants) AS counts_of_aggregated_values, periodid, columnheader " );
         sb.append( "FROM view_count_descentdants " );
         sb.append( "GROUP BY parentid, organisationunit, periodid, columnheader " );
         sb.append( "ORDER BY periodid; " );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm	2010-08-09 03:57:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm	2010-08-19 20:13:13 +0000
@@ -3,12 +3,12 @@
 
 <p>
     <input type="checkbox" name="resourceTableCheckBox" id="organisationUnit">
-    <label for="organisationUnit">$i18n.getString( "organisation_unit_structure" ) <span style="color:#606060">(orgunitstructure)</span></label>
+    <label for="organisationUnit">$i18n.getString( "organisation_unit_structure" ) <span style="color:#606060">(_orgunitstructure)</span></label>
 </p>
 
 <p>
     <input type="checkbox" name="resourceTableCheckBox" id="groupSet">
-    <label for="groupSet">$i18n.getString( "group_set_structure" ) <span style="color:#606060">(orgunitgroupsetstructure)</span></label>
+    <label for="groupSet">$i18n.getString( "group_set_structure" ) <span style="color:#606060">(_orgunitgroupsetstructure)</span></label>
 </p>
 
 <p>
@@ -33,15 +33,15 @@
 
 <p>
     <input type="checkbox" name="resourceTableCheckBox" id="categoryOptionComboName">
-    <label for="categoryOptionComboName">$i18n.getString( "data_element_category_option_combo_name" ) <span style="color:#606060">(categoryoptioncomboname)</span></label>
+    <label for="categoryOptionComboName">$i18n.getString( "data_element_category_option_combo_name" ) <span style="color:#606060">(_categoryoptioncomboname)</span></label>
 </p>
 
 
 <table>
 	<tr>
 		<td>
-			<input type="button" value='$i18n.getString( "select_all" )' id="selectAllButton" onclick="selectOrUnselectALL()"/>
-		    <input type="button" value='$i18n.getString( "generate_resource_tables" )' onclick="regenerateResourceTableAndViewTables()" style="width:175px"/> 
+			<input type="button" value='$i18n.getString( "select_all" )' id="selectAllButton" onclick="selectOrUnselectALL()" style="width:100px">
+		    <input type="button" value='$i18n.getString( "generate_resource_tables" )' onclick="regenerateResourceTableAndViewTables()" style="width:150px"> 
 		</td>
 	</tr>