← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2698: Fixed bug in Sql View

 

------------------------------------------------------------
revno: 2698
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-01-21 17:26:33 +0700
message:
  Fixed bug in Sql View
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/ValidateAddUpdateSqlViewAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module_vi_VN.properties


--
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-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/ValidateAddUpdateSqlViewAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/ValidateAddUpdateSqlViewAction.java	2010-11-18 06:46:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/ValidateAddUpdateSqlViewAction.java	2011-01-21 10:26:33 +0000
@@ -48,11 +48,13 @@
     private static final String SEMICOLON = ";";
     
     private static final String SEPERATE = "|";
+    
+    private static final String SPACE = " ";
 
+    private static final String INTO = " into ";
+    
     private static final String REGEX_SELECT_QUERY = "^(?i)\\s*select\\s{1,}.+$";
 
-    private static final String REGEX_SELECT_INTO_QUERY = " into ";
-
     private static final String PREFIX_REGEX_IGNORE_TABLES_QUERY = "^(?i).+((?<=[^\\d\\w])(";
 
     private static final String SUFFIX_REGEX_IGNORE_TABLES_QUERY = ")(?=[^\\d\\w])).*$";
@@ -152,14 +154,14 @@
         {
             String tmp = new String( s.toLowerCase() );
 
-            if ( !s.matches( REGEX_SELECT_QUERY ) || tmp.contains( REGEX_SELECT_INTO_QUERY ) )
+            if ( !s.matches( REGEX_SELECT_QUERY ) || tmp.contains( INTO ) )
             {
                 message = i18n.getString( "sqlquery_is_invalid" ) + "<br/>" + i18n.getString( "sqlquery_is_welformed" );
 
                 return INPUT;
             }
 
-            if ( tmp.matches( ignoredRegex ) )
+            if ( tmp.concat( SPACE ).matches( ignoredRegex ) )
             {
                 message = i18n.getString( "sqlquery_is_not_allowed" );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2010-12-09 06:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2011-01-21 10:26:33 +0000
@@ -312,3 +312,4 @@
 sqlquery_is_not_allowed                                             = Not allowance to query in the special tables !
 drill_down_real_values                                              = Data entered
 sections_with_invalid_category_combinations                         = Sections with invalid category combinations
+confirm_delete_sqlview                                              = Do you want to delete this sql view object ?
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module_vi_VN.properties	2010-12-09 06:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module_vi_VN.properties	2011-01-21 10:26:33 +0000
@@ -288,4 +288,5 @@
 data_browser                                                        = Tr\u00ecnh duy\u1ec7t d\u1eef li\u1ec7u
 organisation_unit_pruning                                           = T\u1ec9a x\u00e9n C\u00e2y \u0111\u01a1n v\u1ecb
 pruning_interrupted                                                 = B\u1ea1n ph\u1ea3i ch\u1ecdn \u0111\u01a1n v\u1ecb c\u00f3 cha \u0111\u1ec3 ti\u1ebfn h\u00e0nh c\u1eaft x\u00e9n. H\u00e3y th\u1eed l\u1ea1i!
-drill_down_real_values                                              = D\u1eef li\u1ec7u \u0111\u01b0\u1ee3c nh\u1eadp
\ No newline at end of file
+drill_down_real_values                                              = D\u1eef li\u1ec7u \u0111\u01b0\u1ee3c nh\u1eadp
+confirm_delete_sqlview                                              = B\u1ea1n c\u00f3 mu\u1ed1n x\u00f3a \u0111\u1ed1i t\u01b0\u1ee3ng n\u00e0y?
\ No newline at end of file