← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2042: Minor changed

 

------------------------------------------------------------
revno: 2042
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-09-03 00:08:37 +0700
message:
  Minor changed
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.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-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2010-09-01 18:39:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2010-09-02 17:08:37 +0000
@@ -28,8 +28,6 @@
  */
 
 import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -179,20 +177,11 @@
         }
 
         // Working on Section table
-        if ( isColumnExist( "section", "title" ) )
-        {
-            executeSql( "ALTER TABLE section DROP COLUMN title;" );
-
-            log.info( "Successfully, removed column 'title' from table 'section'" );
-        }
+        executeSql( "ALTER TABLE section DROP COLUMN title;" );
 
         // Working on ConceptName
-        /*if ( isColumnExist( "dataelementcategory", "conceptname" ) )
-        {
-            executeSql( "ALTER TABLE dataelementcategory DROP COLUMN conceptname;" );
-
-            log.info( "Successfully, removed column 'conceptname' from table 'dataelementcategory'" );
-        }*/
+        // executeSql( "ALTER TABLE dataelementcategory DROP COLUMN
+        // conceptname;" );
 
         log.info( "Tables updated" );
     }
@@ -369,35 +358,4 @@
         }
 
     }
-
-    /*
-     * Ex: table "dataelementcategory", columnName is "conceptname"
-     */
-    private boolean isColumnExist( String table, String columnName )
-    {
-        final StatementHolder holder = statementManager.getHolder();
-
-        try
-        {
-            ResultSet rs = holder.getStatement().executeQuery( "SELECT * FROM " + table + " LIMIT 1;" );
-            ResultSetMetaData rsmd = rs.getMetaData();
-
-            int columnNo = rsmd.getColumnCount();
-
-            if ( columnNo > 0 )
-            {
-                return rsmd.getColumnName( columnNo - 1 ).equalsIgnoreCase( columnName );
-            }
-        }
-        catch ( SQLException e )
-        {
-            log.debug( e );
-        }
-        finally
-        {
-            holder.close();
-        }
-
-        return false;
-    }
 }