mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor
This commit is contained in:
@@ -17,6 +17,15 @@ public class HintsTest extends TestCase {
|
||||
SQLStatement stmt = parser.parseStatementList().get(0);
|
||||
parser.match(Token.EOF);
|
||||
String output = SQLUtils.toMySqlString(stmt);
|
||||
Assert.assertEquals("CREATE /*!32302 TEMPORARY*/ TABLE t (\n\ta INT\n)", output);
|
||||
Assert.assertEquals("CREATE /*!32302 TEMPORARY */ TABLE t (\n\ta INT\n)", output);
|
||||
}
|
||||
|
||||
public void test_hints_1() throws Exception {
|
||||
String sql = "SELECT /*! STRAIGHT_JOIN */ col1 FROM table1,table2";
|
||||
MySqlStatementParser parser = new MySqlStatementParser(sql);
|
||||
SQLStatement stmt = parser.parseStatementList().get(0);
|
||||
parser.match(Token.EOF);
|
||||
String output = SQLUtils.toMySqlString(stmt);
|
||||
Assert.assertEquals("SELECT /*! STRAIGHT_JOIN */ col1\nFROM table1, table2", output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.alibaba.druid.bvt.sql.mysql;
|
||||
|
||||
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 HelpTest extends TestCase {
|
||||
|
||||
public void test_help_0() throws Exception {
|
||||
String sql = "HELP 'contents'";
|
||||
MySqlStatementParser parser = new MySqlStatementParser(sql);
|
||||
SQLStatement stmt = parser.parseStatementList().get(0);
|
||||
parser.match(Token.EOF);
|
||||
String output = SQLUtils.toMySqlString(stmt);
|
||||
Assert.assertEquals("HELP 'contents'", output);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user