mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor
This commit is contained in:
@@ -72,4 +72,31 @@ public class MTSParserTest extends TestCase {
|
||||
String output = SQLUtils.toMySqlString(stmt);
|
||||
Assert.assertEquals("ROLLBACK TO x1", output);
|
||||
}
|
||||
|
||||
public void test_lockTable() throws Exception {
|
||||
String sql = "LOCK TABLES t1 READ;";
|
||||
MySqlStatementParser parser = new MySqlStatementParser(sql);
|
||||
SQLStatement stmt = parser.parseStatementList().get(0);
|
||||
parser.match(Token.EOF);
|
||||
String output = SQLUtils.toMySqlString(stmt);
|
||||
Assert.assertEquals("LOCK TABLES t1 READ", output);
|
||||
}
|
||||
|
||||
public void test_lockTable_1() throws Exception {
|
||||
String sql = "LOCK TABLES t2 READ LOCAL;";
|
||||
MySqlStatementParser parser = new MySqlStatementParser(sql);
|
||||
SQLStatement stmt = parser.parseStatementList().get(0);
|
||||
parser.match(Token.EOF);
|
||||
String output = SQLUtils.toMySqlString(stmt);
|
||||
Assert.assertEquals("LOCK TABLES t2 READ LOCAL", output);
|
||||
}
|
||||
|
||||
public void test_unlockTable() throws Exception {
|
||||
String sql = "UNLOCK TABLES";
|
||||
MySqlStatementParser parser = new MySqlStatementParser(sql);
|
||||
SQLStatement stmt = parser.parseStatementList().get(0);
|
||||
parser.match(Token.EOF);
|
||||
String output = SQLUtils.toMySqlString(stmt);
|
||||
Assert.assertEquals("UNLOCK TABLES", output);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user