diff --git a/sql/engines/mssql.py b/sql/engines/mssql.py index c670a01cc9..63125ddbaf 100644 --- a/sql/engines/mssql.py +++ b/sql/engines/mssql.py @@ -99,9 +99,6 @@ def query_check(self, db_name=None, sql=''): if re.search(star_patter, sql_lower) is not None: keyword_warning += '禁止使用 * 关键词\n' result['has_star'] = True - if '+' in sql_lower: - keyword_warning += '禁止使用 + 关键词\n' - result['bad_query'] = True for keyword in banned_keywords: pattern = r"(^|,| |=){}( |\(|$)".format(keyword) if re.search(pattern, sql_lower) is not None: diff --git a/sql/engines/oracle.py b/sql/engines/oracle.py index d324833578..8b1913a25f 100644 --- a/sql/engines/oracle.py +++ b/sql/engines/oracle.py @@ -314,9 +314,6 @@ def query_check(self, db_name=None, sql=''): if re.search(star_patter, sql_lower) is not None: keyword_warning += '禁止使用 * 关键词\n' result['has_star'] = True - if '+' in sql_lower: - keyword_warning += '禁止使用 + 关键词\n' - result['bad_query'] = True if result.get('bad_query') or result.get('has_star'): result['msg'] = keyword_warning return result diff --git a/sql/engines/tests.py b/sql/engines/tests.py index 5d380866d8..6124c856a7 100644 --- a/sql/engines/tests.py +++ b/sql/engines/tests.py @@ -1384,15 +1384,6 @@ def test_query_check_IndexError(self): self.assertDictEqual(check_result, {'msg': '没有有效的SQL语句', 'bad_query': True, 'filtered_sql': sql.strip(), 'has_star': False}) - @patch('sql.engines.oracle.OracleEngine.explain_check', return_value={'msg': '', 'rows': 0}) - def test_query_check_plus(self, _explain_check): - sql = "select 100+1 from tb;" - new_engine = OracleEngine(instance=self.ins) - check_result = new_engine.query_check(db_name='archery', sql=sql) - self.assertDictEqual(check_result, - {'msg': '禁止使用 + 关键词\n', 'bad_query': True, 'filtered_sql': sql.strip(';'), - 'has_star': False}) - def test_filter_sql_with_delimiter(self): sql = "select * from xx;" new_engine = OracleEngine(instance=self.ins)