Search in sources :

Example 1 with MTSReleaseStatement

use of com.alibaba.cobar.parser.ast.stmt.mts.MTSReleaseStatement in project cobar by alibaba.

the class MySQLMTSParserTest method testRelease.

public void testRelease() throws SQLSyntaxErrorException {
    String sql = "Release sAVEPOINT 1234e   ";
    MySQLMTSParser parser = new MySQLMTSParser(new MySQLLexer(sql));
    MTSReleaseStatement savepoint = parser.release();
    String output = output2MySQL(savepoint, sql);
    Assert.assertEquals("RELEASE SAVEPOINT 1234e", output);
    Assert.assertEquals("1234e", savepoint.getSavepoint().getIdText());
    sql = "Release SAVEPOINT sAVEPOINT";
    parser = new MySQLMTSParser(new MySQLLexer(sql));
    savepoint = parser.release();
    output = output2MySQL(savepoint, sql);
    Assert.assertEquals("RELEASE SAVEPOINT sAVEPOINT", output);
    Assert.assertEquals("sAVEPOINT", savepoint.getSavepoint().getIdText());
}
Also used : MySQLLexer(com.alibaba.cobar.parser.recognizer.mysql.lexer.MySQLLexer) MTSReleaseStatement(com.alibaba.cobar.parser.ast.stmt.mts.MTSReleaseStatement)

Example 2 with MTSReleaseStatement

use of com.alibaba.cobar.parser.ast.stmt.mts.MTSReleaseStatement in project cobar by alibaba.

the class MySQLMTSParser method release.

/**
     * first token <code>RELEASE</code> is scanned but not yet consumed
     */
public MTSReleaseStatement release() throws SQLSyntaxErrorException {
    match(KW_RELEASE);
    matchIdentifier("SAVEPOINT");
    Identifier id = identifier();
    match(EOF);
    return new MTSReleaseStatement(id);
}
Also used : Identifier(com.alibaba.cobar.parser.ast.expression.primary.Identifier) MTSReleaseStatement(com.alibaba.cobar.parser.ast.stmt.mts.MTSReleaseStatement)

Aggregations

MTSReleaseStatement (com.alibaba.cobar.parser.ast.stmt.mts.MTSReleaseStatement)2 Identifier (com.alibaba.cobar.parser.ast.expression.primary.Identifier)1 MySQLLexer (com.alibaba.cobar.parser.recognizer.mysql.lexer.MySQLLexer)1