mysql parser

This commit is contained in:
温少
2012-05-18 10:35:42 +08:00
parent b53407c5e9
commit 74a27a4b7f
5 changed files with 133 additions and 8 deletions
@@ -0,0 +1,22 @@
package com.alibaba.druid.bvt.sql.cobar;
import org.junit.Assert;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.parser.Token;
import junit.framework.TestCase;
public class HintsTest extends TestCase {
public void test_hints_0() throws Exception {
String sql = "CREATE /*!32302 TEMPORARY */ TABLE t (a INT);";
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLStatement stmt = parser.parseStatementList().get(0);
parser.match(Token.EOF);
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t (\n\ta INT\n)", output);
}
}