YongGoose commented on code in PR #7456:
URL: https://github.com/apache/incubator-seata/pull/7456#discussion_r2158716559


##########
sqlparser/seata-sqlparser-druid/src/main/java/org/apache/seata/sqlparser/druid/DruidSQLRecognizerFactoryImpl.java:
##########
@@ -38,43 +38,65 @@
 class DruidSQLRecognizerFactoryImpl implements SQLRecognizerFactory {
     @Override
     public List<SQLRecognizer> create(String sql, String dbType) {
-        List<SQLStatement> asts = SQLUtils.parseStatements(sql, 
DruidDbTypeAdapter.getAdaptiveDbType(dbType));
-        if (CollectionUtils.isEmpty(asts)) {
-            throw new UnsupportedOperationException("Unsupported SQL: " + sql);
-        }
-        if (asts.size() > 1 && !(asts.stream().allMatch(statement -> statement 
instanceof SQLUpdateStatement)
-                || asts.stream().allMatch(statement -> statement instanceof 
SQLDeleteStatement))) {
-            throw new UnsupportedOperationException("ONLY SUPPORT SAME TYPE 
(UPDATE OR DELETE) MULTI SQL -" + sql);
-        }
         List<SQLRecognizer> recognizers = null;
         SQLRecognizer recognizer = null;
-        for (SQLStatement ast : asts) {
-            SQLOperateRecognizerHolder recognizerHolder =
-                    
SQLOperateRecognizerHolderFactory.getSQLRecognizerHolder(dbType.toLowerCase());
-            if (ast instanceof SQLInsertStatement) {
-                recognizer = recognizerHolder.getInsertRecognizer(sql, ast);
-            } else if (ast instanceof SQLUpdateStatement) {
-                recognizer = recognizerHolder.getUpdateRecognizer(sql, ast);
-            } else if (ast instanceof SQLDeleteStatement) {
-                recognizer = recognizerHolder.getDeleteRecognizer(sql, ast);
-            } else if (ast instanceof SQLSelectStatement) {
-                recognizer = 
recognizerHolder.getSelectForUpdateRecognizer(sql, ast);
+        try {

Review Comment:
   Was there a specific reason you added the try block?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to