|
Teiid 8.3.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.teiid.translator.ExecutionFactory<DataSource,Connection>
org.teiid.translator.jdbc.JDBCExecutionFactory
@Translator(name="jdbc-ansi",
description="JDBC ANSI translator, can used with any ANSI compatible JDBC Driver")
public class JDBCExecutionFactoryJDBC implementation of Connector interface.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.teiid.translator.ExecutionFactory |
|---|
ExecutionFactory.Format, ExecutionFactory.NullOrder, ExecutionFactory.SupportedJoinCriteria |
| Field Summary | |
|---|---|
static int |
DEFAULT_MAX_DEPENDENT_PREDICATES
|
static int |
DEFAULT_MAX_IN_CRITERIA
|
static TimeZone |
DEFAULT_TIME_ZONE
|
| Fields inherited from class org.teiid.translator.ExecutionFactory |
|---|
DEFAULT_MAX_FROM_GROUPS, DEFAULT_MAX_IN_CRITERIA_SIZE |
| Constructor Summary | |
|---|---|
JDBCExecutionFactory()
|
|
| Method Summary | |
|---|---|
boolean |
addSourceComment()
Returns true to indicate that SQL should include a comment indicating the session and request ids. |
protected void |
afterInitialConnectionObtained(Connection connection)
Called exactly once for this source. |
void |
bindValue(PreparedStatement stmt,
Object param,
Class<?> paramType,
int i)
Sets prepared statement parameter i with param. |
void |
closeConnection(Connection connection,
DataSource factory)
Closes a connection object from the given connection factory. |
ProcedureExecution |
createDirectExecution(List<Argument> arguments,
Command command,
ExecutionContext executionContext,
RuntimeMetadata metadata,
Connection conn)
|
protected JDBCMetdataProcessor |
createMetadataProcessor()
|
ProcedureExecution |
createProcedureExecution(Call command,
ExecutionContext executionContext,
RuntimeMetadata metadata,
Connection conn)
|
ResultSetExecution |
createResultSetExecution(QueryExpression command,
ExecutionContext executionContext,
RuntimeMetadata metadata,
Connection conn)
|
UpdateExecution |
createUpdateExecution(Command command,
ExecutionContext executionContext,
RuntimeMetadata metadata,
Connection conn)
|
ResultSet |
executeStoredProcedure(CallableStatement statement,
List<Argument> preparedValues,
Class<?> returnType)
This is a generic implementation. |
String |
formatDateValue(Date dateObject)
Format the dateObject (of type date, time, or timestamp) into a string using the DatabaseTimeZone format. |
Connection |
getConnection(DataSource ds)
Return a connection object from the given connection factory. |
Calendar |
getDatabaseCalendar()
Gets the database calendar. |
String |
getDatabaseTimeZone()
|
String |
getDatabaseVersion()
|
ExecutionFactory.NullOrder |
getDefaultNullOrder()
Returns the default null ordering |
List<String> |
getDefaultSupportedFunctions()
|
Map<String,FunctionModifier> |
getFunctionModifiers()
Return a map of function name to FunctionModifier. |
String |
getLikeRegexString()
Get the predicate name for LIKE_REGEX |
int |
getMaxPreparedInsertBatchSize()
Get the max number of inserts to perform in one batch. |
void |
getMetadata(MetadataFactory metadataFactory,
Connection conn)
Implement to provide metadata to the metadata for use by the engine. |
String |
getSetOperationString(SetQuery.Operation operation)
Returns the name for a given SetQuery.Operation |
String |
getSourceComment(ExecutionContext context,
Command command)
Returns the source comment for the given command |
SQLConversionVisitor |
getSQLConversionVisitor()
Create the SQLConversionVisitor that will perform translation. |
List<String> |
getSupportedFunctions()
Get list of all supported function names. |
int |
getTimestampNanoPrecision()
Return the precision of timestamp literals. |
boolean |
hasTimeType()
Return false to indicate that time support should be emulated with timestamps. |
boolean |
isSourceRequired()
Flag that indicates if a underlying source connection required for this execution factory to work |
boolean |
isTrimStrings()
|
void |
obtainedConnection(Connection connection)
Provides a hook to call source specific logic when a connection is obtained. |
static List<String> |
parseName(String tableName,
char escape,
char delim)
|
void |
registerFunctionModifier(String name,
FunctionModifier modifier)
Add the FunctionModifier to the set of known modifiers. |
protected void |
registerSpecificTypeOfOutParameter(CallableStatement statement,
Class<?> runtimeType,
int index)
For registering specific output parameter types we need to translate these into the appropriate java.sql.Types output parameters We will need to match these up with the appropriate standard sql types |
String |
replaceElementName(String group,
String element)
Override to return a name other than the default [group.]element |
Object |
retrieveValue(CallableStatement results,
int parameterIndex,
Class<?> expectedType)
Retrieve the value for the given parameter index |
Object |
retrieveValue(ResultSet results,
int columnIndex,
Class<?> expectedType)
Retrieve the value on the current resultset row for the given column index. |
void |
setDatabaseTimeZone(String databaseTimeZone)
|
void |
setDatabaseVersion(String version)
|
void |
setFetchSize(Command command,
ExecutionContext context,
Statement statement,
int fetchSize)
Set the fetch size on the given statement. |
void |
setMaxPreparedInsertBatchSize(int maxInsertBatchSize)
|
void |
setTrimStrings(boolean trimStrings)
|
void |
setUseBindVariables(boolean useBindVariables)
|
void |
setUseCommentsInSourceQuery(boolean useCommentsInSourceQuery)
|
void |
start()
Initialize the connector with supplied configuration |
boolean |
supportsAggregatesAvg()
Support indicates connector can accept the AVG aggregate function |
boolean |
supportsAggregatesCount()
Support indicates connector can accept the COUNT aggregate function |
boolean |
supportsAggregatesCountStar()
Support indicates connector can accept the COUNT(*) aggregate function |
boolean |
supportsAggregatesDistinct()
Support indicates connector can accept DISTINCT within aggregate functions |
boolean |
supportsAggregatesMax()
Support indicates connector can accept the MAX aggregate function |
boolean |
supportsAggregatesMin()
Support indicates connector can accept the MIN aggregate function |
boolean |
supportsAggregatesSum()
Support indicates connector can accept the SUM aggregate function |
boolean |
supportsAliasedTable()
Support indicates connector can accept groups with aliases |
boolean |
supportsBatchedUpdates()
Whether the source supports BatchedUpdates |
boolean |
supportsBulkUpdate()
Whether the source supports updates with multiple value sets |
boolean |
supportsCompareCriteriaEquals()
Support indicates connector accepts criteria of form (element = constant) |
boolean |
supportsCompareCriteriaOrdered()
Support indicates connector accepts criteria of form (element <=|>= constant) The query engine will may pushdown queries containing < or > if NOT is also supported. |
boolean |
supportsCorrelatedSubqueries()
Support indicates connector can accept correlated subqueries wherever subqueries are accepted |
boolean |
supportsExistsCriteria()
Support indicates connector accepts the EXISTS criteria |
boolean |
supportsGeneratedKeys()
|
boolean |
supportsGroupBy()
Whether the source supports an explicit GROUP BY clause |
boolean |
supportsHaving()
Whether the source supports the HAVING clause |
boolean |
supportsInCriteria()
Support indicates connector accepts criteria of form (element IN set) |
boolean |
supportsInCriteriaSubquery()
Support indicates connector accepts IN criteria with a subquery on the right side |
boolean |
supportsInlineViews()
Support indicates connector can accept inline views (subqueries in the FROM clause). |
boolean |
supportsInsertWithQueryExpression()
Support indicates that the connector can accept INSERTs with values specified by a SetQuery or Select |
boolean |
supportsIsNullCriteria()
Support indicates connector accepts criteria of form (element IS NULL) |
boolean |
supportsLikeCriteria()
Support indicates connector accepts criteria of form (element LIKE constant) |
boolean |
supportsLikeCriteriaEscapeCharacter()
Support indicates connector accepts criteria of form (element LIKE constant ESCAPE char) |
boolean |
supportsNotCriteria()
Support indicates connector accepts logical criteria NOT |
boolean |
supportsOrCriteria()
Support indicates connector accepts logical criteria connected by OR |
boolean |
supportsOrderByUnrelated()
Support indicates connector accepts ORDER BY clause with columns not from the select |
boolean |
supportsQuantifiedCompareCriteriaAll()
Support indicates connector accepts the quantified comparison criteria that use ALL |
boolean |
supportsQuantifiedCompareCriteriaSome()
Support indicates connector accepts the quantified comparison criteria that use SOME |
boolean |
supportsScalarSubqueries()
Support indicates connector can accept scalar subqueries in the SELECT, WHERE, and HAVING clauses |
boolean |
supportsSearchedCaseExpressions()
Support indicates connector can accept queries with searched CASE WHEN |
boolean |
supportsSelectExpression()
Support indicates connector can accept expressions other than element symbols in the SELECT clause. |
boolean |
supportsSelfJoins()
Support indicates connector can accept self-joins where a group is joined to itself with aliases. |
boolean |
supportsSetQueryOrderBy()
Support indicates that the connector supports an ORDER BY on a SetQuery. |
boolean |
supportsUnions()
Support indicates that the connector supports the UNION of two queries. |
List<?> |
translate(LanguageObject obj,
ExecutionContext context)
Return a List of translated parts ( LanguageObjects and Objects), or null
if to rely on the default translation. |
List<?> |
translateCommand(Command command,
ExecutionContext context)
Return a List of translated parts ( LanguageObjects and Objects), or null
if to rely on the default translation. |
List<?> |
translateLimit(Limit limit,
ExecutionContext context)
Return a List of translated parts ( LanguageObjects and Objects), or null
if to rely on the default translation. |
String |
translateLiteralBoolean(Boolean booleanValue)
Subclasses should override this method to provide a different sql translation of the literal boolean value. |
String |
translateLiteralDate(Date dateValue)
Subclasses should override this method to provide a different sql translation of the literal date value. |
String |
translateLiteralTime(Time timeValue)
Subclasses should override this method to provide a different sql translation of the literal time value. |
String |
translateLiteralTimestamp(Timestamp timestampValue)
Subclasses should override this method to provide a different sql translation of the literal timestamp value. |
boolean |
useAsInGroupAlias()
Indicates whether group alias should be of the form "...FROM groupA AS X" or "...FROM groupA X". |
boolean |
useBindVariables()
|
boolean |
useCommentsInSourceQuery()
|
boolean |
useParensForJoins()
Set to true to indicate that every branch of a join should have parenthesis. |
boolean |
useParensForSetQueries()
Set to true to indicate that every branch of a set query should have parenthesis, i.e. |
boolean |
usePreparedStatements()
Use PreparedStatements (or CallableStatements) as appropriate for all commands. |
boolean |
useSelectLimit()
Returns whether the limit clause is applied to the select clause. |
boolean |
useStreamsForLobs()
If streams should be used for Blob/Clob sets on PreparedStatements |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_MAX_IN_CRITERIA
public static final int DEFAULT_MAX_DEPENDENT_PREDICATES
public static final TimeZone DEFAULT_TIME_ZONE
| Constructor Detail |
|---|
public JDBCExecutionFactory()
| Method Detail |
|---|
public void start()
throws TranslatorException
ExecutionFactory
start in class ExecutionFactory<DataSource,Connection>TranslatorException
@TranslatorProperty(display="Database Version",
description="Database Version")
public String getDatabaseVersion()
public void setDatabaseVersion(String version)
@TranslatorProperty(display="Use Bind Variables",
description="Use prepared statements and bind variables",
advanced=true)
public boolean useBindVariables()
public void setUseBindVariables(boolean useBindVariables)
@TranslatorProperty(display="Database time zone",
description="Time zone of the database, if different than Integration Server",
advanced=true)
public String getDatabaseTimeZone()
public void setDatabaseTimeZone(String databaseTimeZone)
@TranslatorProperty(display="Trim string flag",
description="Right Trim fixed character types returned as Strings - note that the native type must be char or nchar and the source must support the rtrim function.",
advanced=true)
public boolean isTrimStrings()
public void setTrimStrings(boolean trimStrings)
@TranslatorProperty(display="Use informational comments in Source Queries",
description="This will embed a /*comment*/ leading comment with session/request id in source SQL query for informational purposes",
advanced=true)
public boolean useCommentsInSourceQuery()
public void setUseCommentsInSourceQuery(boolean useCommentsInSourceQuery)
public boolean isSourceRequired()
ExecutionFactory
isSourceRequired in class ExecutionFactory<DataSource,Connection>
public ResultSetExecution createResultSetExecution(QueryExpression command,
ExecutionContext executionContext,
RuntimeMetadata metadata,
Connection conn)
throws TranslatorException
createResultSetExecution in class ExecutionFactory<DataSource,Connection>TranslatorException
public ProcedureExecution createDirectExecution(List<Argument> arguments,
Command command,
ExecutionContext executionContext,
RuntimeMetadata metadata,
Connection conn)
throws TranslatorException
createDirectExecution in class ExecutionFactory<DataSource,Connection>TranslatorException
public ProcedureExecution createProcedureExecution(Call command,
ExecutionContext executionContext,
RuntimeMetadata metadata,
Connection conn)
throws TranslatorException
createProcedureExecution in class ExecutionFactory<DataSource,Connection>TranslatorException
public UpdateExecution createUpdateExecution(Command command,
ExecutionContext executionContext,
RuntimeMetadata metadata,
Connection conn)
throws TranslatorException
createUpdateExecution in class ExecutionFactory<DataSource,Connection>TranslatorException
public Connection getConnection(DataSource ds)
throws TranslatorException
ExecutionFactoryConnectionFactory. Subclasses should override, if they use
another type of connection factory.
getConnection in class ExecutionFactory<DataSource,Connection>TranslatorExceptionExecutionFactory.getConnection(Object, ExecutionContext)
public void closeConnection(Connection connection,
DataSource factory)
ExecutionFactoryConnection. Subclasses should override, if they use
another type of connection.
closeConnection in class ExecutionFactory<DataSource,Connection>
public void getMetadata(MetadataFactory metadataFactory,
Connection conn)
throws TranslatorException
ExecutionFactory
getMetadata in class ExecutionFactory<DataSource,Connection>conn - may be null if the source is not required
TranslatorException - to indicate a recoverable error, otherwise a RuntimeExceptionExecutionFactory.isSourceRequiredForMetadata()protected JDBCMetdataProcessor createMetadataProcessor()
public List<String> getSupportedFunctions()
ExecutionFactory
getSupportedFunctions in class ExecutionFactory<DataSource,Connection>for a listing of system pushdown functions. Note that
not all system functions are listed as some functions will use a common name
such as CONCAT vs. the || operator, and other functions will be rewritten and
not pushed down, such as SPACE.public List<String> getDefaultSupportedFunctions()
public boolean supportsGroupBy()
ExecutionFactory
supportsGroupBy in class ExecutionFactory<DataSource,Connection>public boolean supportsAggregatesAvg()
ExecutionFactory
supportsAggregatesAvg in class ExecutionFactory<DataSource,Connection>public boolean supportsAggregatesCount()
ExecutionFactory
supportsAggregatesCount in class ExecutionFactory<DataSource,Connection>public boolean supportsAggregatesCountStar()
ExecutionFactory
supportsAggregatesCountStar in class ExecutionFactory<DataSource,Connection>public boolean supportsAggregatesDistinct()
ExecutionFactory
supportsAggregatesDistinct in class ExecutionFactory<DataSource,Connection>public boolean supportsAggregatesMax()
ExecutionFactory
supportsAggregatesMax in class ExecutionFactory<DataSource,Connection>public boolean supportsAggregatesMin()
ExecutionFactory
supportsAggregatesMin in class ExecutionFactory<DataSource,Connection>public boolean supportsAggregatesSum()
ExecutionFactory
supportsAggregatesSum in class ExecutionFactory<DataSource,Connection>public boolean supportsAliasedTable()
ExecutionFactory
supportsAliasedTable in class ExecutionFactory<DataSource,Connection>public boolean supportsCompareCriteriaEquals()
ExecutionFactory
supportsCompareCriteriaEquals in class ExecutionFactory<DataSource,Connection>public boolean supportsCorrelatedSubqueries()
ExecutionFactory
supportsCorrelatedSubqueries in class ExecutionFactory<DataSource,Connection>public boolean supportsExistsCriteria()
ExecutionFactory
supportsExistsCriteria in class ExecutionFactory<DataSource,Connection>public boolean supportsInCriteria()
ExecutionFactory
supportsInCriteria in class ExecutionFactory<DataSource,Connection>public boolean supportsInCriteriaSubquery()
ExecutionFactory
supportsInCriteriaSubquery in class ExecutionFactory<DataSource,Connection>public boolean supportsIsNullCriteria()
ExecutionFactory
supportsIsNullCriteria in class ExecutionFactory<DataSource,Connection>public boolean supportsLikeCriteria()
ExecutionFactory
supportsLikeCriteria in class ExecutionFactory<DataSource,Connection>public boolean supportsLikeCriteriaEscapeCharacter()
ExecutionFactory
supportsLikeCriteriaEscapeCharacter in class ExecutionFactory<DataSource,Connection>public boolean supportsNotCriteria()
ExecutionFactory
supportsNotCriteria in class ExecutionFactory<DataSource,Connection>public boolean supportsOrCriteria()
ExecutionFactory
supportsOrCriteria in class ExecutionFactory<DataSource,Connection>public boolean supportsOrderByUnrelated()
ExecutionFactory
supportsOrderByUnrelated in class ExecutionFactory<DataSource,Connection>public boolean supportsQuantifiedCompareCriteriaAll()
ExecutionFactory
supportsQuantifiedCompareCriteriaAll in class ExecutionFactory<DataSource,Connection>public boolean supportsScalarSubqueries()
ExecutionFactory
supportsScalarSubqueries in class ExecutionFactory<DataSource,Connection>public boolean supportsSearchedCaseExpressions()
ExecutionFactory
supportsSearchedCaseExpressions in class ExecutionFactory<DataSource,Connection>public boolean supportsSelfJoins()
ExecutionFactoryExecutionFactory.supportsAliasedTable().
supportsSelfJoins in class ExecutionFactory<DataSource,Connection>public boolean supportsInlineViews()
ExecutionFactory
supportsInlineViews in class ExecutionFactory<DataSource,Connection>public boolean supportsQuantifiedCompareCriteriaSome()
ExecutionFactory
supportsQuantifiedCompareCriteriaSome in class ExecutionFactory<DataSource,Connection>public boolean supportsSetQueryOrderBy()
ExecutionFactory
supportsSetQueryOrderBy in class ExecutionFactory<DataSource,Connection>public boolean supportsUnions()
ExecutionFactory
supportsUnions in class ExecutionFactory<DataSource,Connection>public boolean supportsBulkUpdate()
ExecutionFactory
supportsBulkUpdate in class ExecutionFactory<DataSource,Connection>public boolean supportsBatchedUpdates()
ExecutionFactoryBatchedUpdates
supportsBatchedUpdates in class ExecutionFactory<DataSource,Connection>public boolean supportsCompareCriteriaOrdered()
ExecutionFactory
supportsCompareCriteriaOrdered in class ExecutionFactory<DataSource,Connection>public boolean supportsHaving()
ExecutionFactory
supportsHaving in class ExecutionFactory<DataSource,Connection>public boolean supportsSelectExpression()
ExecutionFactory
supportsSelectExpression in class ExecutionFactory<DataSource,Connection>public boolean supportsInsertWithQueryExpression()
ExecutionFactorySetQuery or Select
supportsInsertWithQueryExpression in class ExecutionFactory<DataSource,Connection>
@TranslatorProperty(display="Max Prepared Insert Batch Size",
description="The max size of a prepared insert batch. Default 2048.",
advanced=true)
public int getMaxPreparedInsertBatchSize()
public void setMaxPreparedInsertBatchSize(int maxInsertBatchSize)
public Calendar getDatabaseCalendar()
JDBCPropertyNames#DATABASE_TIME_ZONE, or
the local time zone if none is specified.
public List<?> translate(LanguageObject obj,
ExecutionContext context)
LanguageObjects and Objects), or null
if to rely on the default translation. Override with care.
command - context -
public List<?> translateCommand(Command command,
ExecutionContext context)
LanguageObjects and Objects), or null
if to rely on the default translation.
command - context -
public List<?> translateLimit(Limit limit,
ExecutionContext context)
LanguageObjects and Objects), or null
if to rely on the default translation.
limit - context -
public Map<String,FunctionModifier> getFunctionModifiers()
public void registerFunctionModifier(String name,
FunctionModifier modifier)
FunctionModifier to the set of known modifiers.
name - modifier - public String translateLiteralBoolean(Boolean booleanValue)
'0' or '1'.
booleanValue - Boolean value, never null
public String translateLiteralDate(Date dateValue)
{d '2002-12-31'}
dateValue - Date value, never null
public String translateLiteralTime(Time timeValue)
{t '23:59:59'}
See hasTimeType() to represent literal times as timestamps.
timeValue - Time value, never null
public String translateLiteralTimestamp(Timestamp timestampValue)
{ts '2002-12-31 23:59:59'}.
See getTimestampNanoPrecision() to control the literal
precision.
timestampValue - Timestamp value, never null
public String formatDateValue(Date dateObject)
dateObject -
public boolean addSourceComment()
public boolean useAsInGroupAlias()
public boolean usePreparedStatements()
BindValueVisitor. Literal#setBindValue(boolean)
can be used to force a literal to be a bind value.
public boolean useParensForSetQueries()
public boolean hasTimeType()
public String getSetOperationString(SetQuery.Operation operation)
SetQuery.Operation
operation -
public String getSourceComment(ExecutionContext context,
Command command)
context - command -
public String replaceElementName(String group,
String element)
group - element -
public int getTimestampNanoPrecision()
public ResultSet executeStoredProcedure(CallableStatement statement,
List<Argument> preparedValues,
Class<?> returnType)
throws SQLException
SQLException
protected void registerSpecificTypeOfOutParameter(CallableStatement statement,
Class<?> runtimeType,
int index)
throws SQLException
cstmt - parameter -
SQLException
public void bindValue(PreparedStatement stmt,
Object param,
Class<?> paramType,
int i)
throws SQLException
stmt - param - paramType - i - cal -
SQLExceptionpublic boolean useStreamsForLobs()
PreparedStatements
public Object retrieveValue(ResultSet results,
int columnIndex,
Class<?> expectedType)
throws SQLException
results - columnIndex - expectedType -
SQLException
public Object retrieveValue(CallableStatement results,
int parameterIndex,
Class<?> expectedType)
throws SQLException
results - parameterIndex - expectedType -
SQLExceptionprotected void afterInitialConnectionObtained(Connection connection)
connection - public void obtainedConnection(Connection connection)
public SQLConversionVisitor getSQLConversionVisitor()
SQLConversionVisitor that will perform translation. Typical custom
JDBC connectors will not need to create custom conversion visitors, rather implementors
should override existing JDBCExecutionFactory methods.
SQLConversionVisitorpublic boolean useParensForJoins()
public ExecutionFactory.NullOrder getDefaultNullOrder()
ExecutionFactory
getDefaultNullOrder in class ExecutionFactory<DataSource,Connection>ExecutionFactory.NullOrderpublic boolean useSelectLimit()
public static List<String> parseName(String tableName,
char escape,
char delim)
public String getLikeRegexString()
public void setFetchSize(Command command,
ExecutionContext context,
Statement statement,
int fetchSize)
throws SQLException
context - command - statement - fetchSize -
SQLExceptionpublic boolean supportsGeneratedKeys()
|
Teiid 8.3.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||