← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2691: Fix bug: Startup error with empty mysql db.

 

------------------------------------------------------------
revno: 2691
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-01-21 11:33:28 +0700
message:
  Fix bug: Startup error with empty mysql db.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/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-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2011-01-18 09:41:25 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2011-01-21 04:33:28 +0000
@@ -90,19 +90,17 @@
 
     private void updatePatientOrgunitAssociation()
     {
-
-        StatementHolder holder = statementManager.getHolder();
+    	StatementHolder holder = statementManager.getHolder();
 
         try
         {
             Statement statement = holder.getStatement();
 
             ResultSet isUpdated = statement
-                .executeQuery( "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'patientidentifier' AND COLUMN_NAME = 'organisationunitid'" );
+                .executeQuery( "SELECT organisationunitid FROM patient where organisationunitid is null " );
 
             if ( isUpdated.next() )
             {
-
                 ResultSet resultSet = statement
                     .executeQuery( "SELECT patientid, organisationunitid FROM patientidentifier" );
                 while ( resultSet.next() )
@@ -116,6 +114,7 @@
         }
         catch ( Exception ex )
         {
+        	ex.printStackTrace();
             log.error( ex );
         }
         finally