|
||||||||||
| 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
public abstract class SQLParserManager
| Field Summary | |
|---|---|
int |
astElementCount
|
int |
byteCount
|
boolean |
debugPerformance
|
static int |
ERROR_DIAGNOSING_NONE
Constant to supress error diagnosing. |
static int |
ERROR_DIAGNOSING_NUMBER_MAX_DEFAULT
Default limit for number of errors diagnosed, value: 5 |
static int |
ERROR_DIAGNOSING_TIME_MAX_DEFAULT
Default time limit for error diagnosing in ms, value: 1500 |
static int |
ERROR_DIAGNOSING_UNLIMITED
Constant for unlimited error diagnosing. |
EObjectPrinter |
PRINTER
|
int |
statementCount
|
int |
timeCount
|
| Constructor Summary | |
|---|---|
SQLParserManager()
|
|
SQLParserManager(SQLQuerySourceFormat sourceFormat,
java.util.List postParseProcessors)
|
|
| Method Summary | |
|---|---|
QueryStatement |
checkSyntax(java.lang.String stmt)
Parses the given String representation of a SQL statement and returns an instance of the @link SQLQueryObject model
(QueryStatement) which will have no references and contain no
structural information about the given SQL statement. |
java.util.List |
checkSyntaxScript(java.lang.String script)
Parses the given SQL script and returns a List of QueryStatements, which will have no references and contain no
structural information about the given SQL statement. |
void |
configParser(SQLQuerySourceFormat sourceFormat,
java.util.List postParseProcessors)
Configures this SQLParserManager for the following parses. |
void |
configPostParseProcessors(PostParseProcessorConfiguration config)
Configures this SQLParserManager's
PostParseProcessors with the arguments given in the
PostParseProcessorConfiguration config. |
abstract java.util.List |
copyDefaultPostParseProcessorList()
Returns a value-copy of the static list of default s returned by
. |
abstract java.util.List |
getDefaultPostParseProcessorList()
Returns the static list of default s that can be used
with or
. |
int |
getErrorDiagnosingNumberMax()
|
int |
getErrorDiagnosingTimeMax()
|
java.util.List |
getPostParseProcessors()
|
SQLQuerySourceFormat |
getSourceFormat()
|
SQLParseResult |
parse(java.lang.String stmt)
Parses the given String representation of a SQL statement into an instance of the SQLQueryObject model. |
java.util.List |
parseScript(java.lang.String script)
Parses the given String representation of a SQL statement or a list of SQL statements separated by the statement terminator provided by the given format
(SQLQuerySourceFormat.getStatementTerminator()). |
void |
printAST(java.util.List sqlStmts)
Prints the SQL source and the abstract syntax tree elements (SQLObject) in the given List of SQLStatements. |
void |
printAST(SQLStatement p_Stmt)
Prints the SQL source and the abstract syntax tree elements (SQLQueryObject) in the given List of SQLQueryStatements. |
void |
printErrorList(SQLParseResult parseResult)
|
void |
printParseRuntimeException(SQLParserException e1)
|
void |
printSQL(java.util.List sqlQueryStmts)
Prints the SQL source of the SQLQueryStatements in the given List by calling SQLQueryObject.getSQL(). |
void |
setErrorDiagnosingNumberMax(int errorDiagnosingNumberMax)
|
void |
setErrorDiagnosingTimeMax(int errorDiagnosingTimeMax)
|
void |
setPostParseProcessors(java.util.List postParseProcessors)
Sets the post parse processors used for semantical checks and resolvings after successful syntactical parsing. |
void |
setSourceFormat(SQLQuerySourceFormat sourceFormat)
Sets the SQL source format options for the following parses. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public int statementCount
public int astElementCount
public int byteCount
public int timeCount
public boolean debugPerformance
public static final int ERROR_DIAGNOSING_NONE
public static final int ERROR_DIAGNOSING_UNLIMITED
public static final int ERROR_DIAGNOSING_TIME_MAX_DEFAULT
public static final int ERROR_DIAGNOSING_NUMBER_MAX_DEFAULT
public EObjectPrinter PRINTER
| Constructor Detail |
|---|
public SQLParserManager()
public SQLParserManager(SQLQuerySourceFormat sourceFormat,
java.util.List postParseProcessors)
| Method Detail |
|---|
public abstract java.util.List getDefaultPostParseProcessorList()
PostParseProcessors that can be used
with parse(String) or
parseScript(String). Returned List at least consists of:
TableReferenceResolverDataTypeResolver
Note:
Modifications to the properties of the PostParseProcessor
s contained in the returned list, will affect post-parse-process behaviour of
or
parse(String) on a different instance of
parseScript(String)SQLParserManager using the List of
PostParseProcessors returned by invoking this method on
that instance, as the List of default PostParseProcessors
is hold by a static reference in the specific SQLParserManager.
PostParseProcessor scopyDefaultPostParseProcessorList()public abstract java.util.List copyDefaultPostParseProcessorList()
PostParseProcessor s returned by
getDefaultPostParseProcessorList(). That list
can be used or be extended for use with
parse(String) or
parseScript(String). Returned List consists at
least of:
TableReferenceResolverDataTypeResolver
Modifications to the properties of the PostParseProcessor
s contained in this list, will not affect post-parse-process behaviour of
or
parse(String) on a different instance of
parseScript(String)SQLParserManager using the List of
PostParseProcessors returned by invoking this method on
that instance.
PostParseProcessorspublic final java.util.List getPostParseProcessors()
public final void setPostParseProcessors(java.util.List postParseProcessors)
postParseProcessors - public SQLQuerySourceFormat getSourceFormat()
public void setSourceFormat(SQLQuerySourceFormat sourceFormat)
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.
sourceFormat -
public void configParser(SQLQuerySourceFormat sourceFormat,
java.util.List postParseProcessors)
SQLParserManager for the following parses.
The result of a call to this method is equal to the result of calls to
the methods
setSourceFormat(SQLQuerySourceFormat) and
setPostParseProcessors(List).
sourceFormat - postParseProcessors - public void configPostParseProcessors(PostParseProcessorConfiguration config)
SQLParserManager's
PostParseProcessors with the arguments given in the
PostParseProcessorConfiguration config. If
this SQLParserManager was not yet setup for
post-parse-processing, it herewith will be setup with the list of default
PostParseProcessor s returned by
copyDefaultPostParseProcessorList() and
configured according to the given
PostParseProcessorConfiguration config.
That method is especially useful when the runtime type of
PostParseProcessors is unknown and specific setter methods
therefore can not be invoked.
config - the PostParseProcessorConfiguration
providing the configuration arguments for this
SQLParserManager's PostParseProcessors
public SQLParseResult parse(java.lang.String stmt)
throws SQLParserException,
SQLParserInternalException
SQLQueryObject model. Returns the
instance of the SQLQueryObject model and a List of
SQLParseErrorInfo objects wraped in a SQLQueryParseResult.
For the parameter format you can use a copy of
the default SQLQuerySourceFormat returned by
SQLQuerySourceFormat.copyDefaultFormat().
For the parameter postParseProcessors you can use the
default List of PostParseProcessors of the
SQLParserManager
getDefaultPostParseProcessorList().
Note: During the post parse processing, no
Exceptions other than SQLParserException will
be thrown, as post parse processing is not considered to be crucial for
the success of a parse. Any other type of Exception that
shall be trown during post parse processing has to be wrapped within a
SQLParserException. For that purpose you might subclass an
existing PostParseProcessor and overwrite its
process(SQLQueryObject) method, catching the desired
Exception and throwing it wrapped into a new
SQLParserException.
SQLParserManager
a very basic standard post parse processing will be done, using the
getDefaultPostParseProcessorList() .
Note: SQLParserException will be thrown,
if the given stmt contains more than one SQL
statement.
stmt - the SQL text input to parseformat - optional the source format options, you can explicitly use
the default SQLQuerySourceFormat.copyDefaultFormat(), that
will be used if format is not specifiedpostParseProcessors - list of PostParseProcessors to be
invoked in the post parse phase, ordering is important as the first
PostParseProcessor in the list will get invoked first,
you can use getDefaultPostParseProcessorList()
SQLQueryParseResults containing the
parsed input as QueryStatement and a List of
SQLParseErrorInfo objects containing sementical errors
found during the post parse process
SQLParserException - if the input is not accepted by the parser
SQLParserException - if the given stmt contains more than one SQL
statement
SQLParserInternalException - if an internal error occurs
public java.util.List parseScript(java.lang.String script)
throws SQLParserException,
SQLParserInternalException
format
(SQLQuerySourceFormat.getStatementTerminator()). Returns an
instance of the SQLQueryObject model and a List of
SQLParseErrorInfo objects wraped in a SQLQueryParseResult for
each SQL statement contained in the given SQL script.
For the parameter format you can use a copy of
the default SQLQuerySourceFormat returned by
SQLQuerySourceFormat.copyDefaultFormat().
For the parameter postParseProcessors you can use the
default List of PostParseProcessors of the
SQLParserManager
getDefaultPostParseProcessorList().
Note: During the post parse processing, no
Exceptions other than SQLParserException will
be thrown, as post parse processing is not considered to be crucial for
the success of a parse. Any other type of Exception that
shall be trown during post parse processing has to be wrapped within a
SQLParserException. For that purpose you might subclass an
existing PostParseProcessor and overwrite its
process(SQLQueryObject) method, catching the desired
Exception and throwing it wrapped into a new
SQLParserException.
script - the SQL script (separated list of statements) to be parsedformat - optional the source format options, you can explicitly use
the default SQLQuerySourceFormat.copyDefaultFormat(), that
will be used if format is not specifiedpostParseProcessors - List of
org.eclipse.datatools.sqltools.parsers.sql.query.postparse.PostParseProcessors
to be invoked in the post parse phase,
ordering is important as the first
PostParseProcessor in the list will get invoked first,
you can use getDefaultPostParseProcessorList()
SQLQueryParseResults for each
parsed SQL statement, containing the parsed input as
QueryStatement and a List of
SQLParseErrorInfo objects containing sementical errors
found during the post parse process
SQLParserException - if an SQL syntactical (or semantical) error occurs in the
given stmt
SQLParserInternalException - if an internal error occursSQLQuerySourceFormat,
PostParseProcessor
public QueryStatement checkSyntax(java.lang.String stmt)
throws SQLParserException,
SQLParserInternalException
@link SQLQueryObject model
(QueryStatement) which will have no references and contain no
structural information about the given SQL statement.
Note: SQLParserException will be thrown,
if the given stmt contains more than one SQL
statement.
stmt - the SQL statement to be parsedformat - optional the source format options, you can explicitly use
the default SQLQuerySourceFormat.copyDefaultFormat(), that
will be used if format is not specified
QueryStatement object only to indicate the
type of SQL statement given
SQLParserException - if an SQL syntactical error occurs in the
given stmt
SQLParserException - if the given stmt contains more than one SQL
statement
SQLParserInternalException - if an internal error occurs
public java.util.List checkSyntaxScript(java.lang.String script)
throws SQLParserException,
SQLParserInternalException
QueryStatements, which will have no references and contain no
structural information about the given SQL statement.
Only syntax checking is performed.
script - the SQL script (separated list of statements) to be parsedformat - optional the source format options, you can explicitly use
the default SQLQuerySourceFormat.copyDefaultFormat(), that
will be used if format is not specified
QueryStatements only to indicate the
types of SQL statements given
SQLParserException - if an SQL syntactical error occurs in the
given stmt
SQLParserInternalException - if an internal error occurspublic int getErrorDiagnosingNumberMax()
public void setErrorDiagnosingNumberMax(int errorDiagnosingNumberMax)
errorDiagnosingNumberMax - The errorDiagnosingNumberMax to set.public int getErrorDiagnosingTimeMax()
public void setErrorDiagnosingTimeMax(int errorDiagnosingTimeMax)
errorDiagnosingTimeMax - The errorDiagnosingTimeMax to set.public void printParseRuntimeException(SQLParserException e1)
public void printErrorList(SQLParseResult parseResult)
errorList - queryStmt - TODOpublic void printAST(java.util.List sqlStmts)
public void printAST(SQLStatement p_Stmt)
public void printSQL(java.util.List sqlQueryStmts)
SQLQueryObject.getSQL().
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||