← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11399: Fixed bug related to the _dataelementcategoryoptioncombo resource table on mysql

 

------------------------------------------------------------
revno: 11399
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-07-15 22:16:24 +0200
message:
  Fixed bug related to the _dataelementcategoryoptioncombo resource table on mysql
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.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	2013-06-27 19:38:25 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java	2013-07-15 20:16:24 +0000
@@ -290,21 +290,28 @@
             // Do nothing, table does not exist
         }
         
+        final String create = "CREATE TABLE " + TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO + 
+            " (dataelementuid VARCHAR(11) NOT NULL, categoryoptioncombouid VARCHAR(11) NOT NULL)";
+        
+        jdbcTemplate.execute( create );
+        
+        log.info( "Create data element category option combo SQL: " + create );
+        
         final String sql = 
+            "insert into " + TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO + " (dataelementuid, categoryoptioncombouid) " +
             "select de.uid as dataelementuid, coc.uid as categoryoptioncombouid " +
-            "into " + TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO + " " +
             "from dataelement de " +
             "join categorycombos_optioncombos cc on de.categorycomboid = cc.categorycomboid " +
             "join categoryoptioncombo coc on cc.categoryoptioncomboid = coc.categoryoptioncomboid";
         
-        log.info( "Create data element category option combo SQL: " + sql );
+        log.info( "Insert data element category option combo SQL: " + sql );
         
         jdbcTemplate.execute( sql );
         
         final String index = "CREATE INDEX dataelement_categoryoptioncombo ON " + 
             TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO + " (dataelementuid, categoryoptioncombouid)";
         
-        log.info( "Create data element category option combo index: " + index );
+        log.info( "Create data element category option combo index SQL: " + index );
 
         jdbcTemplate.execute( index );        
     }