This commit is contained in:
温少
2012-05-17 21:50:01 +08:00
parent a6ab1d846f
commit f31f52f390
9 changed files with 216 additions and 16 deletions
@@ -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);
}
}