Updated SQL_Parser_Parameterize (markdown)

高铁
2017-10-08 10:18:57 -05:00
parent 89618a218e
commit 269cb0cd71
+13
@@ -8,3 +8,16 @@ select * from t where id = 2
// 参数化SQL
select * from t where id = ?
```
# 2. 参数化
```java
import com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils;
final String dbType = JdbcConstants.MYSQL;
String sql = "select * from t where id = 1 or id = 2 or id = 3";
String psql = ParameterizedOutputVisitorUtils.parameterize(sql, dbType);
assertEquals("SELECT *\n" +
"FROM t\n" +
"WHERE id = ?", psql);
```