← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13745: Column quoting remaining period resource tables. Fixes problem on h2.

 

------------------------------------------------------------
revno: 13745
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-01-15 17:16:23 +0100
message:
  Column quoting remaining period resource tables. Fixes problem on h2.
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-09-24 07:05:03 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java	2014-01-15 16:16:23 +0000
@@ -110,6 +110,8 @@
         {
             // Do nothing, table does not exist
         }
+
+        String quote = statementBuilder.getColumnQuote();
         
         StringBuilder sql = new StringBuilder();
         
@@ -118,8 +120,8 @@
         
         for ( int k = 1 ; k <= maxLevel; k++ )
         {
-            sql.append( ", " ).append( "idlevel" + k ).append (" INTEGER, " ).
-                append( "uidlevel" + k ).append( " CHARACTER(11)" );
+            sql.append( ", " ).append( quote ).append( "idlevel" + k ).append( quote ).append (" INTEGER, " ).
+                append( quote ).append( "uidlevel" + k ).append( quote ).append( " CHARACTER(11)" );
         }
         
         sql.append( ");" );
@@ -270,11 +272,13 @@
             // Do nothing, table does not exist
         }
         
+        String quote = statementBuilder.getColumnQuote();
+        
         String sql = "CREATE TABLE " + TABLE_NAME_DATE_PERIOD_STRUCTURE + " (dateperiod DATE NOT NULL PRIMARY KEY";
         
         for ( PeriodType periodType : PeriodType.PERIOD_TYPES )
         {
-            sql += ", " + periodType.getName().toLowerCase() + " VARCHAR(10)";
+            sql += ", " + quote + periodType.getName().toLowerCase() + quote + " VARCHAR(10)";
         }
         
         sql += ")";
@@ -294,12 +298,14 @@
         {
             // Do nothing, table does not exist
         }
+
+        String quote = statementBuilder.getColumnQuote();
         
         String sql = "CREATE TABLE " + TABLE_NAME_PERIOD_STRUCTURE + " (periodid INTEGER NOT NULL PRIMARY KEY, iso VARCHAR(10) NOT NULL, daysno INTEGER NOT NULL";
         
         for ( PeriodType periodType : PeriodType.PERIOD_TYPES )
         {
-            sql += ", " + periodType.getName().toLowerCase() + " VARCHAR(10)";
+            sql += ", " + quote + periodType.getName().toLowerCase() + quote + " VARCHAR(10)";
         }
         
         sql += ")";