You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class TestCondition {
public static void main(String[] args) {
String sql = "SELECT * FROM (SELECT id, org_id, NAME, age, phone, email, ( SELECT dep_name FROM dept WHERE dep_id = @depid ) FROM USER t \n" +
"WHERE t.is_delete = 0 AND t.id IN ( SELECT id FROM USER WHERE org_id = @orgid ) AND create_time>= @CreateTime AND age = @Age AND type IN @type AND state <> @State \n" +
"AND ( name = @name OR user_name = @name ) ) AS a \n" +
"WHERE a.org_id = @orgid AND id IN @id AND email LIKE '%@163.com' AND phone = @phone";
System.out.println(sql);
DbType dbType = JdbcConstants.MYSQL;
List stmtList = SQLUtils.parseStatements(sql, dbType);
SQLStatement stmt = stmtList.get(0);
SchemaStatVisitor statVisitor = SQLUtils.createSchemaStatVisitor(dbType);
stmt.accept(statVisitor);
System.out.println(statVisitor.getConditions());
}
}
问题:getConditions不包含sql结尾的email 、phone 等condition
The text was updated successfully, but these errors were encountered:
duird version: 1.2.22
1、复现代码:
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.visitor.SchemaStatVisitor;
import com.alibaba.druid.util.JdbcConstants;
import java.util.List;
public class TestCondition {
public static void main(String[] args) {
String sql = "SELECT * FROM (SELECT id, org_id, NAME, age, phone, email, ( SELECT dep_name FROM dept WHERE dep_id = @depid ) FROM USER t \n" +
"WHERE t.is_delete = 0 AND t.id IN ( SELECT id FROM USER WHERE org_id = @orgid ) AND create_time>= @CreateTime AND age = @Age AND type IN @type AND state <> @State \n" +
"AND ( name = @name OR user_name = @name ) ) AS a \n" +
"WHERE a.org_id = @orgid AND id IN @id AND email LIKE '%@163.com' AND phone = @phone";
System.out.println(sql);
DbType dbType = JdbcConstants.MYSQL;
List stmtList = SQLUtils.parseStatements(sql, dbType);
SQLStatement stmt = stmtList.get(0);
SchemaStatVisitor statVisitor = SQLUtils.createSchemaStatVisitor(dbType);
stmt.accept(statVisitor);
System.out.println(statVisitor.getConditions());
}
}
问题:getConditions不包含sql结尾的email 、phone 等condition
The text was updated successfully, but these errors were encountered: