|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.datatools.sqltools.parsers.sql.SQLParserManager
org.eclipse.datatools.sqltools.parsers.sql.query.SQLQueryParserManager
public class SQLQueryParserManager
String
representations of SQL statements into a structured
SQLQueryObject
model representations.
Options regarding the SQL source code can be provided with a
SQLQuerySourceFormat
, otherwise the default settings in
SQLQuerySourceFormat.SQL_SOURCE_FORMAT_DEFAULT
will be used.
The whole parsing process can be seen as a two phase process with first the
syntactical phase, the actual parse, and second the optional semantical phase,
for further, higher level validation and resolving of the parse result.
The result of the syntactical phase is an instance of the
SQLQueryObject
model, if parsing was successful, or a
SQLParserException
, if the given SQL statement
String
did not conform to the parser's syntax definition.
If the first syntactical phase succeeded into an instance of the
SQLQueryObject
model, the second semantical phase is started, if
the parser is provided a list of PostParseProcessor
s. The result
of the semantical post parse processing is a List of
SQLParseErrorInfo
objects, in case of less severe semantical
errors, or can be a SQLParserException
, if a semantical error
encountered justifies to discard the SQLQueryObject
model as
invalid.SQLQuerySourceFormat
,
PostParseProcessor
Field Summary | |
---|---|
static java.util.List |
DEFAULT_POST_PARSE_PROCESSOR_LIST
Default list of s that can be
copied and extended for use with
#parse(String, SQLQuerySourceFormat, List) or
#parseScript(String, SQLQuerySourceFormat, List) ,
DEFAULT_POST_PARSE_PROCESSOR_LIST consists of:
TableReferenceResolver
DataTypeResolver
RoutineReferenceResolver
|
Fields inherited from class org.eclipse.datatools.sqltools.parsers.sql.SQLParserManager |
---|
astElementCount, byteCount, debugPerformance, ERROR_DIAGNOSING_NONE, ERROR_DIAGNOSING_NUMBER_MAX_DEFAULT, ERROR_DIAGNOSING_TIME_MAX_DEFAULT, ERROR_DIAGNOSING_UNLIMITED, PRINTER, statementCount, timeCount |
Constructor Summary | |
---|---|
SQLQueryParserManager()
|
|
SQLQueryParserManager(SQLQuerySourceFormat sourceFormat,
java.util.List postParseProcessors)
|
Method Summary | |
---|---|
QueryStatement |
checkSyntaxQuery(java.lang.String stmt)
Convenience proxy method for SQLParserManager.checkSyntax(String)
casting the returned SQLStatement to
QueryStatement . |
java.util.List |
checkSyntaxQueryScript(java.lang.String script)
Convenience proxy method for SQLParserManager.checkSyntaxScript(String)
casting the returned SQLStatement s to
QueryStatement s. |
java.util.List |
copyDefaultPostParseProcessorList()
Returns a value-copy of the static list of default s returned by
. |
java.util.List |
getDefaultPostParseProcessorList()
Returns the static list of default s that can be used
with or
. |
static SQLQueryParserManager |
getInstance()
|
SQLParserFactory |
getParserFactory()
Returns this SQLQueryParserManager 's
SQLQueryParserFactory . |
SQLControlParseResult |
parseControlStatement(java.lang.String stmt)
Parses the given control statement string and returns the result of the parse. |
SQLQueryParseResult |
parseQuery(java.lang.String stmt)
Convenience proxy method for SQLParserManager.parse(String)
casting the returned SQLParseResult to
SQLQueryParseResult . |
java.util.List |
parseQueryScript(java.lang.String script)
Convenience proxy method for SQLParserManager.parseScript(String)
casting the returned SQLParseResult s to
SQLQueryParseResult s. |
void |
setParserFactory(SQLQueryParserFactory parserFactory)
Sets this SQLQueryParserManager 's
parserFactory . |
void |
setSourceFormat(SQLQuerySourceFormat sourceFormat)
Sets the SQL source format options for the following parses. |
Methods inherited from class org.eclipse.datatools.sqltools.parsers.sql.SQLParserManager |
---|
checkSyntax, checkSyntaxScript, configParser, configPostParseProcessors, getErrorDiagnosingNumberMax, getErrorDiagnosingTimeMax, getPostParseProcessors, getSourceFormat, parse, parseScript, printAST, printAST, printErrorList, printParseRuntimeException, printSQL, setErrorDiagnosingNumberMax, setErrorDiagnosingTimeMax, setPostParseProcessors |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.List DEFAULT_POST_PARSE_PROCESSOR_LIST
PostParseProcessor
s that can be
copied and extended for use with
#parse(String, SQLQuerySourceFormat, List)
or
#parseScript(String, SQLQuerySourceFormat, List)
,
DEFAULT_POST_PARSE_PROCESSOR_LIST
consists of:
Constructor Detail |
---|
public SQLQueryParserManager()
public SQLQueryParserManager(SQLQuerySourceFormat sourceFormat, java.util.List postParseProcessors)
sourceFormat
- postParseProcessors
- Method Detail |
---|
public static SQLQueryParserManager getInstance()
public SQLParserFactory getParserFactory()
SQLQueryParserManager
's
SQLQueryParserFactory
. If this
SQLQueryParserManager
's parserFactory
is
null
, a new SQLQueryParserFactory
will be
created for this SQLQueryParserManager
and returned.
That is, this method never returns null
!
SQLQueryParserFactory
public void setParserFactory(SQLQueryParserFactory parserFactory)
SQLQueryParserManager
's
parserFactory
.
Note: the given parserFactory
must be an
appropriate instance of SQLQueryParserFactory
for the
runtime-type of this SQLQueryParserManager
.
IllegalArgumentException,
- if given parserFactory
is null
or not of the appropriate runtime-type
SQLQueryParserFactory
public java.util.List getDefaultPostParseProcessorList()
SQLParserManager
PostParseProcessor
s that can be used
with SQLParserManager.parse(String)
or
SQLParserManager.parseScript(String)
. Returned List at least consists of:
TableReferenceResolver
DataTypeResolver
Note:
Modifications to the properties of the PostParseProcessor
s contained in the returned list, will affect post-parse-process behaviour of
or
SQLParserManager.parse(String)
on a different instance of
SQLParserManager.parseScript(String)
SQLParserManager
using the List of
PostParseProcessor
s returned by invoking this method on
that instance, as the List of default PostParseProcessor
s
is hold by a static reference in the specific SQLParserManager
.
getDefaultPostParseProcessorList
in class SQLParserManager
PostParseProcessor
sSQLParserManager.copyDefaultPostParseProcessorList()
public java.util.List copyDefaultPostParseProcessorList()
SQLParserManager
PostParseProcessor
s returned by
SQLParserManager.getDefaultPostParseProcessorList()
. That list
can be used or be extended for use with
SQLParserManager.parse(String)
or
SQLParserManager.parseScript(String)
. Returned List consists at
least of:
TableReferenceResolver
DataTypeResolver
Modifications to the properties of the PostParseProcessor
s contained in this list, will not affect post-parse-process behaviour of
or
SQLParserManager.parse(String)
on a different instance of
SQLParserManager.parseScript(String)
SQLParserManager
using the List of
PostParseProcessor
s returned by invoking this method on
that instance.
copyDefaultPostParseProcessorList
in class SQLParserManager
PostParseProcessor
spublic void setSourceFormat(SQLQuerySourceFormat sourceFormat)
SQLParserManager
Note: referential modifications on the given
sourceFormat
will not be reflected in the parse results,
unless this method is called after modifying the
SQLQuerySourceFormat
and before the parse.
setSourceFormat
in class SQLParserManager
public QueryStatement checkSyntaxQuery(java.lang.String stmt) throws SQLParserException, SQLParserInternalException
SQLParserManager.checkSyntax(String)
casting the returned SQLStatement
to
QueryStatement
.
stmt
- the SQL DML statement
(QueryStatement) super.checkSyntax(stmt);
SQLParserException
SQLParserInternalException
SQLParserManager.checkSyntax(String)
public java.util.List checkSyntaxQueryScript(java.lang.String script) throws SQLParserException, SQLParserInternalException
SQLParserManager.checkSyntaxScript(String)
casting the returned SQLStatement
s to
QueryStatement
s.
script
- the SQL DML statements
QueryStatement
s
SQLParserException
SQLParserInternalException
SQLParserManager.checkSyntaxScript(String)
public SQLQueryParseResult parseQuery(java.lang.String stmt) throws SQLParserException, SQLParserInternalException
SQLParserManager.parse(String)
casting the returned SQLParseResult
to
SQLQueryParseResult
.
stmt
- the SQL DML statement
(SQLQueryParseResult) super.parse(stmt);
SQLParserException
SQLParserInternalException
SQLParserManager.parse(String)
public SQLControlParseResult parseControlStatement(java.lang.String stmt) throws SQLParserException, SQLParserInternalException
stmt
- the statement string to parse
SQLParserException
- when the statement can't be parsed
SQLParserInternalException
- when a parser internal error occurspublic java.util.List parseQueryScript(java.lang.String script) throws SQLParserException, SQLParserInternalException
SQLParserManager.parseScript(String)
casting the returned SQLParseResult
s to
SQLQueryParseResult
s.
script
- the SQL DML statements
SQLQueryParseResult
s
SQLParserException
SQLParserInternalException
SQLParserManager.parseScript(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |