mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for sql parser. for issue #2105
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
package com.alibaba.druid.bvt.sql.mysql.param;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wenshao on 16/8/23.
|
||||
*/
|
||||
public class MySqlParameterizedOutputVisitorTest_59_multiupdate extends TestCase {
|
||||
final String dbType = JdbcConstants.MYSQL;
|
||||
public void test_for_parameterize() throws Exception {
|
||||
|
||||
String sql = "update t_order set salary = 101 where id = 101;update t_order set salary = 102 where id = 102";
|
||||
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
String psql = ParameterizedOutputVisitorUtils.parameterize(sql, dbType, params);
|
||||
assertEquals("UPDATE t_order\n" +
|
||||
"SET salary = ?\n" +
|
||||
"WHERE id = ?;", psql);
|
||||
assertEquals(2, params.size());
|
||||
assertEquals(101, params.get(0));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user