← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21261: Don't compress whitespace before saving SQL Views

 

------------------------------------------------------------
revno: 21261
committer: jimgrace@xxxxxxxxx
branch nick: dhis2
timestamp: Tue 2015-12-01 20:50:20 -0500
message:
  Don't compress whitespace before saving SQL Views
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java
  dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/sqlview/SqlViewServiceTest.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/AddSqlViewAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/UpdateSqlViewAction.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-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java	2015-09-15 09:43:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java	2015-12-02 01:50:20 +0000
@@ -218,16 +218,6 @@
         return regex.append( ")(\\s|$).*$" ).toString();
     }
     
-    public SqlView cleanSqlQuery()
-    {
-        sqlQuery = sqlQuery.
-            replaceAll( "\\s*;\\s+", ";" ).
-            replaceAll( ";+", ";" ).
-            replaceAll( "\\s+", " " ).trim();
-        
-        return this;
-    }
-
     /**
      * Indicates whether this SQL view is a query.
      */

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/sqlview/SqlViewServiceTest.java'
--- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/sqlview/SqlViewServiceTest.java	2015-09-23 17:15:50 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/sqlview/SqlViewServiceTest.java	2015-12-02 01:50:20 +0000
@@ -153,22 +153,6 @@
     }
 
     @Test
-    public void testCleanSqlQuery()
-    {
-        SqlView sqlViewA = createSqlView( 'A', sqlA );
-
-        sqlViewA.cleanSqlQuery();
-        
-        int idA = sqlViewService.saveSqlView( sqlViewA );
-
-        assertEquals( sqlViewService.getSqlView( "SqlViewA" ).getId(), idA );
-
-        SqlView sqlViewB = sqlViewService.getSqlView( idA );
-
-        assertEq( 'A', sqlViewB, "SELECT * FROM _categorystructure;" );
-    }
-
-    @Test
     public void testSetUpViewTableName()
     {
         SqlView sqlViewC = createSqlView( 'C', sqlC );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/AddSqlViewAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/AddSqlViewAction.java	2015-10-20 15:38:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/AddSqlViewAction.java	2015-12-02 01:50:20 +0000
@@ -114,7 +114,7 @@
             sqlView.setCacheStrategy( SqlView.DEFAULT_CACHE_STRATEGY );
         }
 
-        sqlViewService.saveSqlView( sqlView.cleanSqlQuery() );
+        sqlViewService.saveSqlView( sqlView );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/UpdateSqlViewAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/UpdateSqlViewAction.java	2015-10-20 15:38:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/UpdateSqlViewAction.java	2015-12-02 01:50:20 +0000
@@ -101,7 +101,7 @@
             sqlView.setCacheStrategy( cacheStrategy != null ? cacheStrategy : SqlView.DEFAULT_CACHE_STRATEGY );
         }
 
-        sqlViewService.updateSqlView( sqlView.cleanSqlQuery() );
+        sqlViewService.updateSqlView( sqlView );
 
         return SUCCESS;
     }