mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser.
This commit is contained in:
@@ -34,10 +34,24 @@ public class ParameterizedOutputVisitorUtils {
|
||||
};
|
||||
|
||||
public static String parameterize(String sql, String dbType) {
|
||||
return parameterize(sql, dbType, null);
|
||||
return parameterize(sql, dbType, null, null);
|
||||
}
|
||||
|
||||
public static String parameterize(String sql, String dbType, SQLSelectListCache selectListCache) {
|
||||
public static String parameterize(String sql
|
||||
, String dbType
|
||||
, SQLSelectListCache selectListCache) {
|
||||
return parameterize(sql, dbType, selectListCache, null);
|
||||
}
|
||||
|
||||
public static String parameterize(String sql
|
||||
, String dbType
|
||||
, List<Object> outParameters) {
|
||||
return parameterize(sql, dbType, null, outParameters);
|
||||
}
|
||||
|
||||
public static String parameterize(String sql
|
||||
, String dbType
|
||||
, SQLSelectListCache selectListCache, List<Object> outParameters) {
|
||||
SQLStatementParser parser = SQLParserUtils.createSQLStatementParser(sql, dbType, features);
|
||||
|
||||
if (selectListCache != null) {
|
||||
@@ -51,6 +65,9 @@ public class ParameterizedOutputVisitorUtils {
|
||||
|
||||
StringBuilder out = new StringBuilder(sql.length());
|
||||
ParameterizedVisitor visitor = createParameterizedOutputVisitor(out, dbType);
|
||||
if (outParameters != null) {
|
||||
visitor.setOutputParameters(outParameters);
|
||||
}
|
||||
|
||||
for (int i = 0; i < statementList.size(); i++) {
|
||||
if (i > 0) {
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.alibaba.druid.sql.visitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ParameterizedVisitor extends PrintableVisitor {
|
||||
|
||||
int getReplaceCount();
|
||||
@@ -23,4 +25,5 @@ public interface ParameterizedVisitor extends PrintableVisitor {
|
||||
|
||||
String getDbType();
|
||||
|
||||
void setOutputParameters(List<Object> parameters);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user