net.sf.farrago.session
Interface FarragoSessionParser

All Known Implementing Classes:
FarragoAbstractParser, FarragoParser, FarragoRngParser

public interface FarragoSessionParser

FarragoSessionParser represents an object capable of parsing Farrago SQL statements.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/session/FarragoSessionParser.java#22 $
Author:
John V. Sichi

Method Summary
 SqlParserPos getCurrentPosition()
           
 FarragoSessionDdlValidator getDdlValidator()
           
 String getJdbcKeywords()
           
 String getSourceString()
           
 FarragoSessionStmtValidator getStmtValidator()
           
 String getSubstring(SqlParserPos start, SqlParserPos end)
          Gets a substring from the text currently being parsed.
 EigenbaseException newPositionalError(SqlValidatorException ex)
          Wraps a validation error with the current position information of the parser.
 Object parseSqlText(FarragoSessionStmtValidator stmtValidator, FarragoSessionDdlValidator ddlValidator, String sql, boolean expectStatement)
          Parses an SQL expression.
 

Method Detail

parseSqlText

Object parseSqlText(FarragoSessionStmtValidator stmtValidator,
                    FarragoSessionDdlValidator ddlValidator,
                    String sql,
                    boolean expectStatement)
Parses an SQL expression. If a DDL statement, implicitly performs uncommitted catalog updates.

Parameters:
stmtValidator - the statement validator to use
ddlValidator - the validator to use for lookup during parsing if this turns out to be a DDL statement; may be null if DDL is not allowed
sql - the SQL text to be parsed
expectStatement - if true, expect a statement; if false, expect a row-expression
Returns:
for DDL, a FarragoSessionDdlStmt; for DML or query, top-level SqlNode

getCurrentPosition

SqlParserPos getCurrentPosition()
Returns:
the current position, or null if done parsing

getJdbcKeywords

String getJdbcKeywords()
Returns:
a comma-separated list of all a database's SQL keywords that are NOT also SQL92 keywords (as defined by JDBC getSQLKeywords)

getDdlValidator

FarragoSessionDdlValidator getDdlValidator()
Returns:
validator to use for validating DDL statements as they are parsed

getStmtValidator

FarragoSessionStmtValidator getStmtValidator()
Returns:
validator to use for validating statements as they are parsed

getSourceString

String getSourceString()
Returns:
Last string processed by the parser.

newPositionalError

EigenbaseException newPositionalError(SqlValidatorException ex)
Wraps a validation error with the current position information of the parser.

Parameters:
ex - exception to be wrapped
Returns:
wrapping exception

getSubstring

String getSubstring(SqlParserPos start,
                    SqlParserPos end)
Gets a substring from the text currently being parsed.

Parameters:
start - start position (inclusive) of substring
end - end position (exclusive) of substring
Returns:
substring