|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.datatools.modelbase.sql.query.util.SQLQuerySourceFormat
public class SQLQuerySourceFormat
The SQLQuerySourceFormat can be used to provide settings
regarding the SQL source text for parsing or source generation from
a SQLQueryObject model representation.
The SQLQuerySourceFormat will be maintained during the lifecycle of a
QueryStatement instance (via reference to SQLQuerySourceInfo,
see SQLQueryObject.getSourceInfo(),
SQLQuerySourceInfo.getSqlFormat()),
where all SQLQueryObject elements of one
QueryStatement share one instance of a
SQLQuerySourceFormat. That way the settings you specify for the
parse are still available for generating the SQL source text for a
QueryStatement.
Most source format options can be modified during the life cycle of a
QueryStatement, exceptions are marked with a * below.
Source format options:
preserveSourceFormat = the option to preserve the
input source formating when SQL source text is generated
statementTerminator = the character separating multiple
SQL statements
hostVariablePrefix = the character that preceedes a
host language variable
parameterMarker = the character that identifies a
host language parameter
delimitedIdentifierQuote* = the character that encloses
delimited identifiers whose writing in case will be preserved
omitSchema = the current schema
(omitted in SQL source, implicit to unqualified table references)
qualifyIdentifiers = the flag describing how
identifiers in the SQL source will be qualified
preserveComments = the option to preserve comments in
the parsed SQL source or/and the generated SQL source
generateCommentsForStatementOnly = the option to
generate comments for the SQL source only in the
context of the complete statement, or if set to false,
for single SQL Query objects outside the context of a statement
as well
QueryStatement
copyDefaultFormat() to see how to get a
SQLQuerySourceFormat with the default settings.
copyFields(SQLQuerySourceFormat) to see how to copy the values
from another SQLQuerySourceFormat.
| Field Summary | |
|---|---|
static char |
DELIMITED_IDENTIFIER_QUOTE_DEFAULT
Default value for delimitedIdentifierQuote: '"' |
static char |
HOSTVARIABLE_PREFIX_DEFAULT
Default value for hostVariablePrefix: ':' |
static char |
PARAMETER_MARKER_DEFAULT
Default value for parameterMarker: '?' |
static int |
QUALIFY_IDENTIFIERS_IN_CONTEXT
Default constant for setQualifyIdentifiers(int), and
getQualifyIdentifiers(), used for SQL source generation. |
static int |
QUALIFY_IDENTIFIERS_NEVER
Constant for setQualifyIdentifiers(int), and
getQualifyIdentifiers(), used for SQL source generation. |
static int |
QUALIFY_IDENTIFIERS_WITH_SCHEMA_NAMES
Constant for setQualifyIdentifiers(int), and
getQualifyIdentifiers(), used for SQL source generation. |
static int |
QUALIFY_IDENTIFIERS_WITH_TABLE_NAMES
Constant for setQualifyIdentifiers(int), and
getQualifyIdentifiers(), used for SQL source generation. |
static SQLQuerySourceFormat |
SQL_SOURCE_FORMAT_DEFAULT
Note: this SQLQuerySourceFormat's is
final that means modifications on its members are not allowed. |
static char |
STATEMENT_TERMINATOR_DEFAULT
Default value for statementTerminator: ';' |
| Method Summary | |
|---|---|
static SQLQuerySourceFormat |
copyDefaultFormat()
|
void |
copyFields(SQLQuerySourceFormat sourceFormat)
Copies the fields from the given SQLQuerySourceFormat
sourceFormat to this SQLQuerySourceFormat. |
static void |
copyFields(SQLQuerySourceFormat donor,
SQLQuerySourceFormat recipient)
Copies the fields from the given SQLQuerySourceFormat
donor
to the SQLQuerySourceFormat
recipient. |
static SQLQuerySourceFormat |
copySourceFormat(SQLQuerySourceFormat sourceFormat)
|
char |
getDelimitedIdentifierQuote()
|
char |
getHostVariablePrefix()
|
java.lang.String |
getOmitSchema()
|
char |
getParameterMarker()
|
int |
getQualifyIdentifiers()
Returns the policy on how identifiers in the SQL source will be qualified, compare to one of the constants QUALIFY_IDENTIFIERS_IN_CONTEXT,
, or . |
char |
getStatementTerminator()
|
boolean |
isGenerateCommentsForStatementOnly()
DOCME |
boolean |
isPreserveComments()
DOCME |
boolean |
isPreserveSourceFormat()
|
void |
setDelimitedIdentifierQuote(char delimitedIdentifierQuote)
Note: No modifications of that field allowed, after using this SQLQuerySourceFormat as a parameter for a parse!
The delimited identifier quote is stored within
the identifiers of the SQLQueryObjects and further
modifications of this SQLQuerySourceFormat's
delimitedIdentifierQuote, would result into wrong name
comparisons. |
void |
setGenerateCommentsForStatementOnly(boolean generateCommentsForStatementOnly)
DOCME |
void |
setHostVariablePrefix(char hostVariablePrefix)
|
void |
setOmitSchema(java.lang.String omitSchema)
|
void |
setParameterMarker(char parameterMarker)
|
void |
setPreserveComments(boolean preserveComments)
DOCME |
void |
setPreserveSourceFormat(boolean preserveSourceFormat)
|
void |
setQualifyIdentifiers(int qualifyIdentifiers)
Sets the policy on how identifiers in the SQL source will be qualified, default is QUALIFY_IDENTIFIERS_IN_CONTEXT. |
void |
setStatementTerminator(char statementTerminator)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final char STATEMENT_TERMINATOR_DEFAULT
statementTerminator: ';'
public static final char HOSTVARIABLE_PREFIX_DEFAULT
hostVariablePrefix: ':'
public static final char PARAMETER_MARKER_DEFAULT
parameterMarker: '?'
public static final char DELIMITED_IDENTIFIER_QUOTE_DEFAULT
delimitedIdentifierQuote: '"'
public static final int QUALIFY_IDENTIFIERS_IN_CONTEXT
setQualifyIdentifiers(int), and
getQualifyIdentifiers(), used for SQL source generation. Column
and table names will be qualified depending on the context of the SQL
statement.
public static final int QUALIFY_IDENTIFIERS_WITH_SCHEMA_NAMES
setQualifyIdentifiers(int), and
getQualifyIdentifiers(), used for SQL source generation. Table
names will always be qualified with schema names and column names with
table and schema names.
public static final int QUALIFY_IDENTIFIERS_WITH_TABLE_NAMES
setQualifyIdentifiers(int), and
getQualifyIdentifiers(), used for SQL source generation. Table
names will never be qualified with schema names and column names will
only be qualified with table names.
Note: this configuration can lead to incorrectly generated source for SQL statements!
public static final int QUALIFY_IDENTIFIERS_NEVER
setQualifyIdentifiers(int), and
getQualifyIdentifiers(), used for SQL source generation. Table
names will never be qualified with schema names and column names will
only be qualified with table names.
Note: this configuration can lead to incorrectly generated source for SQL statements!
public static final SQLQuerySourceFormat SQL_SOURCE_FORMAT_DEFAULT
Note: this SQLQuerySourceFormat's is
final that means modifications on its members are not allowed.
Every attempt to do so will raise an
UnsupportedOperationException. Use
to get a copy of
copyDefaultFormat()SQL_SOURCE_FORMAT_DEFAULT
SQLQuerySourceFormat properties:
preserveSourceFormat = false
statementTerminator = STATEMENT_TERMINATOR_DEFAULT
hostVariablePrefix = HOSTVARIABLE_PREFIX_DEFAULT
parameterMarker = PARAMETER_MARKER_DEFAULT
delimitedIdentifierQuote = DELIMITED_IDENTIFIER_QUOTE_DEFAULT
omitSchema = null;
qualifyIdentifiers = QUALIFY_IDENTIFIERS_IN_CONTEXT
preserveComments = true
generateCommentsForStatementOnly = true
copyDefaultFormat()| Method Detail |
|---|
public static SQLQuerySourceFormat copyDefaultFormat()
SQL_SOURCE_FORMAT_DEFAULTpublic static SQLQuerySourceFormat copySourceFormat(SQLQuerySourceFormat sourceFormat)
sourceFormat - the SQLQuerySourceFormat to be copied.
sourceFormat.
public static void copyFields(SQLQuerySourceFormat donor,
SQLQuerySourceFormat recipient)
SQLQuerySourceFormat
donor
to the SQLQuerySourceFormat
recipient.
donor - the SQLQuerySourceFormat whichs fields to copyrecipient - the SQLQuerySourceFormat whichs fields to be
overwrittenpublic void copyFields(SQLQuerySourceFormat sourceFormat)
SQLQuerySourceFormat
sourceFormat to this SQLQuerySourceFormat.
sourceFormat - the SQLQuerySourceFormat whichs fields to copypublic char getDelimitedIdentifierQuote()
public void setDelimitedIdentifierQuote(char delimitedIdentifierQuote)
SQLQuerySourceFormat as a parameter for a parse!
The delimited identifier quote is stored within
the identifiers of the SQLQueryObjects and further
modifications of this SQLQuerySourceFormat's
delimitedIdentifierQuote, would result into wrong name
comparisons.
If you need to modify it, make a copy of the current
SQLQuerySourceFormat by using
copySourceFormat(SQLQuerySourceFormat) to keep previously
parsed SQLQueryObjects reference to
this SQLQuerySourceFormat and its
delimitedIdentifierQuote valid.
delimitedIdentifierQuote - The delimitedIdentifierQuote to set.public char getHostVariablePrefix()
public void setHostVariablePrefix(char hostVariablePrefix)
hostVariablePrefix - The hostVariablePrefix to set.public char getParameterMarker()
public void setParameterMarker(char parameterMarker)
parameterMarker - The parameterMarker to set.public java.lang.String getOmitSchema()
public void setOmitSchema(java.lang.String omitSchema)
omitSchema - The omitSchema to set.public boolean isPreserveSourceFormat()
public void setPreserveSourceFormat(boolean preserveSourceFormat)
preserveSourceFormat - The preserveSourceFormat to set.public char getStatementTerminator()
public void setStatementTerminator(char statementTerminator)
statementTerminator - The statementTerminator to set.public int getQualifyIdentifiers()
QUALIFY_IDENTIFIERS_IN_CONTEXT,
, or .
QUALIFY_IDENTIFIERS_IN_CONTEXTpublic void setQualifyIdentifiers(int qualifyIdentifiers)
QUALIFY_IDENTIFIERS_IN_CONTEXT.
qualifyIdentifiers - The constant determining how the identifiers in
the SQL source will be qualified, default is
QUALIFY_IDENTIFIERS_IN_CONTEXTpublic boolean isPreserveComments()
public void setPreserveComments(boolean preserveComments)
preserveComments - The preserveComments to set.public boolean isGenerateCommentsForStatementOnly()
public void setGenerateCommentsForStatementOnly(boolean generateCommentsForStatementOnly)
generateCommentsForStatementOnly - The generateCommentsForStatementOnly to set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||