use of com.alibaba.cobar.parser.ast.stmt.mts.MTSSavepointStatement in project cobar by alibaba.
the class MySQLMTSParser method savepoint.
/**
* first token <code>SAVEPOINT</code> is scanned but not yet consumed
*/
public MTSSavepointStatement savepoint() throws SQLSyntaxErrorException {
// matchIdentifier("SAVEPOINT"); // for performance issue, change to
// follow:
lexer.nextToken();
Identifier id = identifier();
match(EOF);
return new MTSSavepointStatement(id);
}
use of com.alibaba.cobar.parser.ast.stmt.mts.MTSSavepointStatement in project cobar by alibaba.
the class MySQLMTSParserTest method testSavepint.
public void testSavepint() throws SQLSyntaxErrorException {
String sql = " savepoint 123e123e";
MySQLMTSParser parser = new MySQLMTSParser(new MySQLLexer(sql));
MTSSavepointStatement savepoint = parser.savepoint();
String output = output2MySQL(savepoint, sql);
Assert.assertEquals("SAVEPOINT 123e123e", output);
Assert.assertEquals("123e123e", savepoint.getSavepoint().getIdText());
sql = " savepoint SAVEPOINT";
parser = new MySQLMTSParser(new MySQLLexer(sql));
savepoint = parser.savepoint();
output = output2MySQL(savepoint, sql);
Assert.assertEquals("SAVEPOINT SAVEPOINT", output);
Assert.assertEquals("SAVEPOINT", savepoint.getSavepoint().getIdText());
sql = " savepoInt `select`";
parser = new MySQLMTSParser(new MySQLLexer(sql));
savepoint = parser.savepoint();
output = output2MySQL(savepoint, sql);
Assert.assertEquals("SAVEPOINT `select`", output);
Assert.assertEquals("`select`", savepoint.getSavepoint().getIdText());
}
Aggregations