bug fixed for issue #2015

This commit is contained in:
wenshao
2017-09-28 21:28:53 +08:00
parent bdb79ec48e
commit 80d3e98241
2 changed files with 25 additions and 16 deletions
@@ -0,0 +1,21 @@
package com.alibaba.druid.bvt.bug;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.util.JdbcConstants;
import junit.framework.TestCase;
import java.util.List;
public class Issue2015 extends TestCase {
public void test_for_issue() throws Exception {
String sql = "update t set a=1,b=2 where a > 1";
List<SQLStatement> stmtList = SQLUtils.parseStatements(sql, JdbcConstants.MYSQL);
StringBuffer buf = new StringBuffer();
stmtList.get(0).output(buf);
assertEquals("UPDATE t\n" +
"SET a = 1, b = 2\n" +
"WHERE a > 1", buf.toString());
}
}