← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11274: Using jdbctemplate execute instead of update for creating resource tables, more correct use of th...

 

------------------------------------------------------------
revno: 11274
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-06-27 21:38:25 +0200
message:
  Using jdbctemplate execute instead of update for creating resource tables, more correct use of the api
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-05-27 11:07:26 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java	2013-06-27 19:38:25 +0000
@@ -95,7 +95,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE IF EXISTS " + TABLE_NAME_ORGANISATION_UNIT_STRUCTURE );            
+            jdbcTemplate.execute( "DROP TABLE IF EXISTS " + TABLE_NAME_ORGANISATION_UNIT_STRUCTURE );            
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -117,7 +117,7 @@
         
         log.info( "Create organisation unit structure table SQL: " + sql );
         
-        jdbcTemplate.update( sql.toString() );
+        jdbcTemplate.execute( sql.toString() );
     }
     
     // -------------------------------------------------------------------------
@@ -128,7 +128,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE IF EXISTS " + TABLE_NAME_CATEGORY_OPTION_COMBO_NAME );            
+            jdbcTemplate.execute( "DROP TABLE IF EXISTS " + TABLE_NAME_CATEGORY_OPTION_COMBO_NAME );            
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -140,7 +140,7 @@
         
         log.info( "Create category option combo name table SQL: " + sql );
         
-        jdbcTemplate.update( sql );
+        jdbcTemplate.execute( sql );
     }
     
     // -------------------------------------------------------------------------
@@ -151,7 +151,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE IF EXISTS " + CreateDataElementGroupSetTableStatement.TABLE_NAME );
+            jdbcTemplate.execute( "DROP TABLE IF EXISTS " + CreateDataElementGroupSetTableStatement.TABLE_NAME );
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -160,7 +160,7 @@
         
         Statement statement = new CreateDataElementGroupSetTableStatement( groupSets );
         
-        jdbcTemplate.update( statement.getStatement() );
+        jdbcTemplate.execute( statement.getStatement() );
     }
 
     // -------------------------------------------------------------------------
@@ -171,7 +171,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE IF EXISTS " + CreateIndicatorGroupSetTableStatement.TABLE_NAME );
+            jdbcTemplate.execute( "DROP TABLE IF EXISTS " + CreateIndicatorGroupSetTableStatement.TABLE_NAME );
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -180,7 +180,7 @@
         
         Statement statement = new CreateIndicatorGroupSetTableStatement( groupSets );
         
-        jdbcTemplate.update( statement.getStatement() );
+        jdbcTemplate.execute( statement.getStatement() );
     }
     
     // -------------------------------------------------------------------------
@@ -191,7 +191,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE IF EXISTS " + CreateOrganisationUnitGroupSetTableStatement.TABLE_NAME );
+            jdbcTemplate.execute( "DROP TABLE IF EXISTS " + CreateOrganisationUnitGroupSetTableStatement.TABLE_NAME );
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -200,7 +200,7 @@
         
         Statement statement = new CreateOrganisationUnitGroupSetTableStatement( groupSets );
         
-        jdbcTemplate.update( statement.getStatement() );
+        jdbcTemplate.execute( statement.getStatement() );
     }
     
     // -------------------------------------------------------------------------
@@ -211,7 +211,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE IF EXISTS " + CreateCategoryTableStatement.TABLE_NAME );
+            jdbcTemplate.execute( "DROP TABLE IF EXISTS " + CreateCategoryTableStatement.TABLE_NAME );
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -220,7 +220,7 @@
         
         Statement statement = new CreateCategoryTableStatement( categories );
         
-        jdbcTemplate.update( statement.getStatement() );
+        jdbcTemplate.execute( statement.getStatement() );
     }
 
     // -------------------------------------------------------------------------
@@ -231,7 +231,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE IF EXISTS " + TABLE_NAME_DATA_ELEMENT_STRUCTURE );            
+            jdbcTemplate.execute( "DROP TABLE IF EXISTS " + TABLE_NAME_DATA_ELEMENT_STRUCTURE );            
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -243,7 +243,7 @@
         
         log.info( "Create data element structure SQL: " + sql );
         
-        jdbcTemplate.update( sql );        
+        jdbcTemplate.execute( sql );        
     }
     
     // -------------------------------------------------------------------------
@@ -254,7 +254,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE IF EXISTS " + TABLE_NAME_PERIOD_STRUCTURE );            
+            jdbcTemplate.execute( "DROP TABLE IF EXISTS " + TABLE_NAME_PERIOD_STRUCTURE );            
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -272,7 +272,7 @@
         
         log.info( "Create period structure SQL: " + sql );
         
-        jdbcTemplate.update( sql );
+        jdbcTemplate.execute( sql );
     }
 
     // -------------------------------------------------------------------------
@@ -283,7 +283,7 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP TABLE IF EXISTS " + TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO );            
+            jdbcTemplate.execute( "DROP TABLE IF EXISTS " + TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO );            
         }
         catch ( BadSqlGrammarException ex )
         {
@@ -299,13 +299,13 @@
         
         log.info( "Create data element category option combo SQL: " + sql );
         
-        jdbcTemplate.update( 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 );
 
-        jdbcTemplate.update( index );        
+        jdbcTemplate.execute( index );        
     }
 }