← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13887: SQL view, fixed bug, the db sql view was not dropped when the dhis sql view was deleted

 

------------------------------------------------------------
revno: 13887
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-28 16:18:54 +0200
message:
  SQL view, fixed bug, the db sql view was not dropped when the dhis sql view was deleted
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewExpandStore.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/sqlview/DefaultSqlViewService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java	2013-10-02 13:49:44 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/DefaultSqlViewService.java	2014-01-28 14:18:54 +0000
@@ -73,6 +73,8 @@
     @Override
     public void deleteSqlView( SqlView sqlViewObject )
     {
+        dropViewTable( sqlViewObject.getViewName() );
+        
         sqlViewStore.delete( sqlViewObject );
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewExpandStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewExpandStore.java	2013-10-08 17:16:47 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/sqlview/jdbc/JdbcSqlViewExpandStore.java	2014-01-28 14:18:54 +0000
@@ -164,11 +164,15 @@
     {
         try
         {
-            jdbcTemplate.update( "DROP VIEW IF EXISTS " + statementBuilder.columnQuote( viewName ) );
+            final String sql = "DROP VIEW IF EXISTS " + statementBuilder.columnQuote( viewName );
+            
+            log.info( "Drop view SQL: " + sql );
+            
+            jdbcTemplate.update( sql );
         }
         catch ( BadSqlGrammarException ex )
         {
-            throw new RuntimeException( "Failed to drop view: " + viewName, ex );
+            log.warn( "Could not drop view: " + viewName, ex );
         }
     }
 }
\ No newline at end of file