[#8290] Add Parser.parseStatement() to parse procedural code
This commit is contained in:
parent
2ecd7600b0
commit
498c2a4b11
@ -91,6 +91,27 @@ public interface Parser {
|
||||
@PlainSQL
|
||||
Query parseQuery(String sql, Object... bindings) throws ParserException;
|
||||
|
||||
/**
|
||||
* Parse a SQL string to a procedural statement.
|
||||
*
|
||||
* @param sql The SQL string
|
||||
* @throws ParserException If the SQL string could not be parsed.
|
||||
*/
|
||||
@Support
|
||||
@PlainSQL
|
||||
Statement parseStatement(String sql) throws ParserException;
|
||||
|
||||
/**
|
||||
* Parse a SQL string with bind variables to a procedural statement.
|
||||
*
|
||||
* @param sql The SQL string
|
||||
* @param bindings The bind variables
|
||||
* @throws ParserException If the SQL string could not be parsed.
|
||||
*/
|
||||
@Support
|
||||
@PlainSQL
|
||||
Statement parseStatement(String sql, Object... bindings) throws ParserException;
|
||||
|
||||
/**
|
||||
* Parse a SQL string to a result query.
|
||||
*
|
||||
|
||||
@ -532,6 +532,20 @@ final class ParserImpl implements Parser {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Statement parseStatement(String sql) {
|
||||
return parseStatement(sql, new Object[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Statement parseStatement(String sql, Object... bindings) {
|
||||
ParserContext ctx = ctx(sql, bindings);
|
||||
Statement result = parseStatement(ctx);
|
||||
parseSemicolonAfterNonBlocks(ctx, result);
|
||||
ctx.done("Unexpected content");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ResultQuery<?> parseResultQuery(String sql) {
|
||||
return parseResultQuery(sql, new Object[0]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user