Package org.teiid.translator.jdbc
Class JDBCExecutionFactory
- java.lang.Object
-
- org.teiid.translator.ExecutionFactory<DataSource,Connection>
-
- org.teiid.translator.jdbc.JDBCExecutionFactory
-
- Direct Known Subclasses:
ActianVectorInHadoopExecutionFactory,BaseDB2ExecutionFactory,BaseSybaseExecutionFactory,ExasolExecutionFactory,H2ExecutionFactory,HanaExecutionFactory,HsqlExecutionFactory,InformixExecutionFactory,IngresExecutionFactory,InterSystemsCacheExecutionFactory,MetaMatrixExecutionFactory,ModeShapeExecutionFactory,MySQLExecutionFactory,NetezzaExecutionFactory,OracleExecutionFactory,PIExecutionFactory,PostgreSQLExecutionFactory,SimpleJDBCExecutionFactory,TeiidExecutionFactory,TeradataExecutionFactory,VerticaExecutionFactory
@Translator(name="jdbc-ansi", description="JDBC ANSI translator, can used with any ANSI compatible JDBC Driver") public class JDBCExecutionFactory extends ExecutionFactory<DataSource,Connection>
JDBC implementation of Connector interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJDBCExecutionFactory.StructRetrieval-
Nested classes/interfaces inherited from class org.teiid.translator.ExecutionFactory
ExecutionFactory.Format, ExecutionFactory.NullOrder, ExecutionFactory.SupportedJoinCriteria, ExecutionFactory.TransactionSupport
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_DEPENDENT_PREDICATESstatic intDEFAULT_MAX_IN_CRITERIAstatic TimeZoneDEFAULT_TIME_ZONEprotected SQLDialectdialect-
Fields inherited from class org.teiid.translator.ExecutionFactory
DEFAULT_MAX_FROM_GROUPS, DEFAULT_MAX_IN_CRITERIA_SIZE, DEFAULT_MAX_PROJECTED_COLUMNS
-
-
Constructor Summary
Constructors Constructor Description JDBCExecutionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanaddSourceComment()Returns true to indicate that SQL should include a comment indicating the session and request ids.protected voidafterInitialConnectionObtained(Connection connection)Called exactly once for this source.voidbindValue(PreparedStatement stmt, Object param, Class<?> paramType, int i)Sets prepared statement parameter i with param.voidcloseConnection(Connection connection, DataSource factory)protected ObjectconvertObject(Object object)ProcedureExecutioncreateDirectExecution(List<Argument> arguments, Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)protected JDBCMetadataProcessorcreateMetadataProcessor()Deprecated.ProcedureExecutioncreateProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)ResultSetExecutioncreateResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)StringcreateTempTable(String prefix, List<ColumnReference> cols, ExecutionContext context, Connection connection)Create a temp table with the given name prefix and columnsJDBCUpdateExecutioncreateUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)ResultSetexecuteStoredProcedure(CallableStatement statement, List<Argument> preparedValues, Class<?> returnType)This is a generic implementation.StringformatDateValue(Date dateObject)Format the dateObject (of type date, time, or timestamp) into a string using the DatabaseTimeZone.StringformatDateValue(Date dateObject, boolean useTimezone)Format the dateObject (of type date, time, or timestamp) into a string optionally using the DatabaseTimeZone.StringgetCommentFormat()ConnectiongetConnection(DataSource ds)StringgetCreateTemporaryTablePostfix(boolean inTransaction)StringgetCreateTemporaryTableString(boolean inTransaction)StringgetCreateTempTableSQL(String name, List<ColumnReference> cols, boolean transactional)CalendargetDatabaseCalendar()Gets the database calendar.StringgetDatabaseTimeZone()StringgetDatabaseVersion()ExecutionFactory.NullOrdergetDefaultNullOrder()List<String>getDefaultSupportedFunctions()SQLDialectgetDialect()Map<String,FunctionModifier>getFunctionModifiers()Return a map of function name to FunctionModifier.StringgetHibernateDialectClassName()StringgetLateralKeyword()StringgetLikeRegexString()Get the predicate name for LIKE_REGEXintgetMaxPreparedInsertBatchSize()Get the max number of inserts to perform in one batch.voidgetMetadata(MetadataFactory metadataFactory, Connection conn)MetadataProcessor<Connection>getMetadataProcessor()StringgetRemovePushdownCharacters()StringgetSetOperationString(SetQuery.Operation operation)Returns the name for a givenSetQuery.OperationStringgetSourceComment(ExecutionContext context, Command command)Returns the source comment for the given commandSQLConversionVisitorgetSQLConversionVisitor()Create theSQLConversionVisitorthat will perform translation.JDBCExecutionFactory.StructRetrievalgetStructRetrieval()List<String>getSupportedFunctions()StringgetTemporaryTableName(String prefix)intgetTimestampNanoPrecision()Return the precision of timestamp literals.protected VersiongetVersion()Get the database version as a comparable objectbooleanhasTimeType()Return false to indicate that time support should be emulated with timestamps.voidinitCapabilities(Connection connection)voidintializeConnectionAfterCancel(Connection c)Implemented if theConnectionneeds initialized after a statement cancelprotected booleanisCharacterType(Class<?> type)booleanisDefaultTimeZone()booleanisEnableDependentJoins()booleanisExtendedAscii()protected booleanisNonAscii(String val)protected booleanisNonAscii(Expression obj)protected booleanisNonAsciiFunction(Function f)booleanisSourceRequired()booleanisSourceRequiredForCapabilities()booleanisTrimStrings()voidloadedTemporaryTable(String tableName, ExecutionContext context, Connection connection)Called after the temporary table has been loadedvoidobtainedConnection(Connection connection)Provides a hook to call source specific logic when a connection is obtained.booleanpreserveNullTyping()Return true if null literals should retain a type (typically handled by a cast).voidregisterFunctionModifier(String name, FunctionModifier modifier)Add theFunctionModifierto the set of known modifiers.protected voidregisterSpecificTypeOfOutParameter(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 typesStringreplaceElementName(String group, String element)Override to return a name other than the default [group.]elementGeographyTyperetrieveGeographyValue(CallableStatement results, int parameterIndex)ObjectretrieveGeographyValue(ResultSet results, int paramIndex)The default strategy assumes a blob value containing wkbGeometryTyperetrieveGeometryValue(CallableStatement results, int parameterIndex)ObjectretrieveGeometryValue(ResultSet results, int paramIndex)The default strategy assumes a blob value containing wkbObjectretrieveValue(CallableStatement results, int parameterIndex, Class<?> expectedType)Retrieve the value for the given parameter indexObjectretrieveValue(ResultSet results, int columnIndex, Class<?> expectedType)Retrieve the value on the current resultset row for the given column index.voidsetCommentFormat(String commentFormat)voidsetDatabaseTimeZone(String databaseTimeZone)voidsetDatabaseVersion(String version)Sets the database version.voidsetDatabaseVersion(Version version)voidsetEnableDependentJoins(boolean enableDependentJoins)voidsetFetchSize(Command command, ExecutionContext context, Statement statement, int fetchSize)Set the fetch size on the given statement.voidsetMaxPreparedInsertBatchSize(int maxInsertBatchSize)voidsetRemovePushdownCharacters(String removePushdownCharacters)voidsetStructRetrieval(JDBCExecutionFactory.StructRetrieval structRetrieval)voidsetTrimStrings(boolean trimStrings)voidsetUseBindingsForDependentJoin(boolean useBindingsForDependentJoin)voidsetUseBindVariables(boolean useBindVariables)voidsetUseCommentsInSourceQuery(boolean useCommentsInSourceQuery)voidstart()booleansupportsAggregatesAvg()booleansupportsAggregatesCount()booleansupportsAggregatesCountStar()booleansupportsAggregatesDistinct()booleansupportsAggregatesMax()booleansupportsAggregatesMin()booleansupportsAggregatesSum()booleansupportsAliasedTable()booleansupportsBatchedUpdates()protected booleansupportsBooleanExpressions()if boolean expressions are directly supported.booleansupportsBulkUpdate()booleansupportsCompareCriteriaEquals()booleansupportsCompareCriteriaOrdered()booleansupportsCorrelatedSubqueries()booleansupportsDependentJoins()booleansupportsExistsCriteria()booleansupportsFullDependentJoins()booleansupportsGeneratedKeys()protected booleansupportsGeneratedKeys(ExecutionContext context, Command command)booleansupportsGroupBy()booleansupportsHaving()booleansupportsInCriteria()booleansupportsInCriteriaSubquery()booleansupportsInlineViews()booleansupportsInsertWithQueryExpression()booleansupportsIsNullCriteria()booleansupportsLikeCriteria()booleansupportsLikeCriteriaEscapeCharacter()booleansupportsNotCriteria()booleansupportsOrCriteria()booleansupportsOrderByUnrelated()booleansupportsProcedureParameterExpression()booleansupportsQuantifiedCompareCriteriaAll()booleansupportsQuantifiedCompareCriteriaSome()booleansupportsScalarSubqueries()booleansupportsSearchedCaseExpressions()booleansupportsSelectExpression()booleansupportsSelfJoins()booleansupportsSetQueryOrderBy()booleansupportsUnions()booleantempTableRequiresTransaction()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<?>translateGeographyLiteral(Literal l)Translate GEOGRAPHY literal into an expression that will convert to database geography type.List<?>translateGeographyParameter(Parameter p)Translate GEOGRAPHY parameter into an expression that will convert to database geography type.ExpressiontranslateGeographySelect(Expression expr)Translate GEOGRAPHY column reference into an expression that will return WKB and possibly the SRID.List<?>translateGeometryLiteral(Literal l)Translate GEOMETRY literal into an expression that will convert to database geometry type.List<?>translateGeometryParameter(Parameter p)Translate GEOMETRY parameter into an expression that will convert to database geometry type.ExpressiontranslateGeometrySelect(Expression expr)Translate GEOMETRY column reference into an expression that will return WKB and possibly the SRID.List<?>translateLimit(Limit limit, ExecutionContext context)Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.StringtranslateLiteralBinaryType(BinaryType obj)Subclasses should override this method to provide a different sql translation of the literal varbinary value.StringtranslateLiteralBoolean(Boolean booleanValue)Subclasses should override this method to provide a different sql translation of the literal boolean value.StringtranslateLiteralDate(Date dateValue)Subclasses should override this method to provide a different sql translation of the literal date value.StringtranslateLiteralTime(Time timeValue)Subclasses should override this method to provide a different sql translation of the literal time value.StringtranslateLiteralTimestamp(Timestamp timestampValue)Subclasses should override this method to provide a different sql translation of the literal timestamp value.booleanuseAsInGroupAlias()Indicates whether group alias should be of the form "...FROM groupA AS X" or "...FROM groupA X".booleanuseBindingsForDependentJoin()booleanuseBindVariables()booleanuseColumnNamesForGeneratedKeys()booleanuseCommentsInSourceQuery()booleanuseNBindingType()booleanuseParensForJoins()Set to true to indicate that every branch of a join should have parenthesis.booleanuseParensForSetQueries()Set to true to indicate that every branch of a set query should have parenthesis, i.e.booleanusePreparedStatements()Use PreparedStatements (or CallableStatements) as appropriate for all commands.booleanuseScientificNotation()protected booleanusesDatabaseVersion()booleanuseSelectLimit()Returns whether the limit clause is applied to the select clause.booleanuseStreamsForLobs()If streams should be used for Blob/Clob sets onPreparedStatementsbooleanuseUnicodePrefix()booleanuseWithRollup()-
Methods inherited from class org.teiid.translator.ExecutionFactory
addPushDownFunction, areLobsUsableAfterClose, createExecution, getCacheDirective, getCollationLocale, getConnection, getDirectQueryProcedureName, getExcludedCommonTableExpressionName, getInstance, getLanguageFactory, getMaxDependentInPredicates, getMaxFromGroups, getMaxInCriteriaSize, getMaxProjectedColumns, getNativeQueryProcedureName, getPushDownFunctions, getRequiredLikeEscape, getSupportedJoinCriteria, getTransactionSupport, getTypeFacility, isCopyLobs, isForkable, isImmutable, isSourceRequiredForMetadata, isThreadBound, requiresCriteria, returnsSingleUpdateCount, setCollationLocale, setCopyLobs, setDirectQueryProcedureName, setExcludedCommonTableExpressionName, setImmutable, setMaxDependentInPredicates, setMaxInCriteriaSize, setNativeQueryProcedureName, setRequiresCriteria, setSourceRequired, setSourceRequiredForMetadata, setSupportedJoinCriteria, setSupportsDirectQueryProcedure, setSupportsFullOuterJoins, setSupportsInnerJoins, setSupportsNativeQueries, setSupportsOrderBy, setSupportsOuterJoins, setSupportsSelectDistinct, setThreadBound, setTransactionSupport, supportsAdvancedOlapOperations, supportsAggregatesCountBig, supportsAggregatesEnhancedNumeric, supportsArrayAgg, supportsArrayType, supportsCommonTableExpressions, supportsCompareCriteriaOrderedExclusive, supportsConvert, supportsCorrelatedSubqueryLimit, supportsDirectQueryProcedure, supportsElementaryOlapOperations, supportsExcept, supportsFormatLiteral, supportsFullOuterJoins, supportsFunctionsInGroupBy, supportsGeographyType, supportsGroupByMultipleDistinctAggregates, supportsGroupByRollup, supportsInnerJoins, supportsIntersect, supportsIsDistinctCriteria, supportsLateralJoin, supportsLateralJoinCondition, supportsLikeRegex, supportsListAgg, supportsMultipleOpenExecutions, supportsNativeQueries, supportsOnlyCorrelatedSubqueries, supportsOnlyFormatLiterals, supportsOnlyLateralJoinProcedure, supportsOnlyLiteralComparison, supportsOnlySingleTableGroupBy, supportsOnlyTimestampAddLiteral, supportsOrderBy, supportsOrderByNullOrdering, supportsOrderByWithExtendedGrouping, supportsOuterJoins, supportsPartialFiltering, supportsProcedureTable, supportsRecursiveCommonTableExpressions, supportsRowLimit, supportsRowOffset, supportsScalarSubqueryProjection, supportsSelectDistinct, supportsSelectExpressionArrayType, supportsSelectWithoutFrom, supportsSetQueryLimitOffset, supportsSimilarTo, supportsStringAgg, supportsSubqueryCommonTableExpressions, supportsSubqueryInOn, supportsUpsert, supportsWindowDistinctAggregates, supportsWindowFrameClause, supportsWindowFunctionCumeDist, supportsWindowFunctionNthValue, supportsWindowFunctionNtile, supportsWindowFunctionPercentRank, supportsWindowOrderByWithAggregates, useAnsiJoin
-
-
-
-
Field Detail
-
DEFAULT_MAX_IN_CRITERIA
public static final int DEFAULT_MAX_IN_CRITERIA
- See Also:
- Constant Field Values
-
DEFAULT_MAX_DEPENDENT_PREDICATES
public static final int DEFAULT_MAX_DEPENDENT_PREDICATES
- See Also:
- Constant Field Values
-
DEFAULT_TIME_ZONE
public static final TimeZone DEFAULT_TIME_ZONE
-
dialect
protected SQLDialect dialect
-
-
Method Detail
-
start
public void start() throws TranslatorException- Overrides:
startin classExecutionFactory<DataSource,Connection>- Throws:
TranslatorException
-
getDatabaseVersion
@TranslatorProperty(display="Database Version", description="Database Version") public String getDatabaseVersion()
-
setDatabaseVersion
public void setDatabaseVersion(String version)
Sets the database version. See alsogetVersion()- Parameters:
version-
-
setDatabaseVersion
public void setDatabaseVersion(Version version)
-
getVersion
protected Version getVersion()
Get the database version as a comparable object- Returns:
-
useBindVariables
@TranslatorProperty(display="Use Bind Variables", description="Use prepared statements and bind variables", advanced=true) public boolean useBindVariables()
-
setUseBindVariables
public void setUseBindVariables(boolean useBindVariables)
-
getDatabaseTimeZone
@TranslatorProperty(display="Database time zone", description="Time zone of the database, if different than Integration Server", advanced=true) public String getDatabaseTimeZone()
-
setDatabaseTimeZone
public void setDatabaseTimeZone(String databaseTimeZone)
-
isTrimStrings
@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()
-
setTrimStrings
public void setTrimStrings(boolean trimStrings)
-
useCommentsInSourceQuery
@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()
-
setUseCommentsInSourceQuery
public void setUseCommentsInSourceQuery(boolean useCommentsInSourceQuery)
-
isSourceRequired
public boolean isSourceRequired()
- Overrides:
isSourceRequiredin classExecutionFactory<DataSource,Connection>
-
isSourceRequiredForCapabilities
public boolean isSourceRequiredForCapabilities()
- Overrides:
isSourceRequiredForCapabilitiesin classExecutionFactory<DataSource,Connection>
-
usesDatabaseVersion
protected boolean usesDatabaseVersion()
-
initCapabilities
public void initCapabilities(Connection connection) throws TranslatorException
- Overrides:
initCapabilitiesin classExecutionFactory<DataSource,Connection>- Throws:
TranslatorException
-
createResultSetExecution
public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn) throws TranslatorException
- Overrides:
createResultSetExecutionin classExecutionFactory<DataSource,Connection>- Throws:
TranslatorException
-
createDirectExecution
public ProcedureExecution createDirectExecution(List<Argument> arguments, Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn) throws TranslatorException
- Overrides:
createDirectExecutionin classExecutionFactory<DataSource,Connection>- Throws:
TranslatorException
-
createProcedureExecution
public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn) throws TranslatorException
- Overrides:
createProcedureExecutionin classExecutionFactory<DataSource,Connection>- Throws:
TranslatorException
-
createUpdateExecution
public JDBCUpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn) throws TranslatorException
- Overrides:
createUpdateExecutionin classExecutionFactory<DataSource,Connection>- Throws:
TranslatorException
-
getConnection
public Connection getConnection(DataSource ds) throws TranslatorException
- Overrides:
getConnectionin classExecutionFactory<DataSource,Connection>- Throws:
TranslatorException
-
closeConnection
public void closeConnection(Connection connection, DataSource factory)
- Overrides:
closeConnectionin classExecutionFactory<DataSource,Connection>
-
getMetadata
public void getMetadata(MetadataFactory metadataFactory, Connection conn) throws TranslatorException
- Overrides:
getMetadatain classExecutionFactory<DataSource,Connection>- Throws:
TranslatorException
-
createMetadataProcessor
@Deprecated protected JDBCMetadataProcessor createMetadataProcessor()
Deprecated.- See Also:
getMetadataProcessor()
-
getMetadataProcessor
public MetadataProcessor<Connection> getMetadataProcessor()
- Overrides:
getMetadataProcessorin classExecutionFactory<DataSource,Connection>
-
getSupportedFunctions
public List<String> getSupportedFunctions()
- Overrides:
getSupportedFunctionsin classExecutionFactory<DataSource,Connection>
-
supportsGroupBy
public boolean supportsGroupBy()
- Overrides:
supportsGroupByin classExecutionFactory<DataSource,Connection>
-
supportsAggregatesAvg
public boolean supportsAggregatesAvg()
- Overrides:
supportsAggregatesAvgin classExecutionFactory<DataSource,Connection>
-
supportsAggregatesCount
public boolean supportsAggregatesCount()
- Overrides:
supportsAggregatesCountin classExecutionFactory<DataSource,Connection>
-
supportsAggregatesCountStar
public boolean supportsAggregatesCountStar()
- Overrides:
supportsAggregatesCountStarin classExecutionFactory<DataSource,Connection>
-
supportsAggregatesDistinct
public boolean supportsAggregatesDistinct()
- Overrides:
supportsAggregatesDistinctin classExecutionFactory<DataSource,Connection>
-
supportsAggregatesMax
public boolean supportsAggregatesMax()
- Overrides:
supportsAggregatesMaxin classExecutionFactory<DataSource,Connection>
-
supportsAggregatesMin
public boolean supportsAggregatesMin()
- Overrides:
supportsAggregatesMinin classExecutionFactory<DataSource,Connection>
-
supportsAggregatesSum
public boolean supportsAggregatesSum()
- Overrides:
supportsAggregatesSumin classExecutionFactory<DataSource,Connection>
-
supportsAliasedTable
public boolean supportsAliasedTable()
- Overrides:
supportsAliasedTablein classExecutionFactory<DataSource,Connection>
-
supportsCompareCriteriaEquals
public boolean supportsCompareCriteriaEquals()
- Overrides:
supportsCompareCriteriaEqualsin classExecutionFactory<DataSource,Connection>
-
supportsCorrelatedSubqueries
public boolean supportsCorrelatedSubqueries()
- Overrides:
supportsCorrelatedSubqueriesin classExecutionFactory<DataSource,Connection>
-
supportsExistsCriteria
public boolean supportsExistsCriteria()
- Overrides:
supportsExistsCriteriain classExecutionFactory<DataSource,Connection>
-
supportsInCriteria
public boolean supportsInCriteria()
- Overrides:
supportsInCriteriain classExecutionFactory<DataSource,Connection>
-
supportsInCriteriaSubquery
public boolean supportsInCriteriaSubquery()
- Overrides:
supportsInCriteriaSubqueryin classExecutionFactory<DataSource,Connection>
-
supportsIsNullCriteria
public boolean supportsIsNullCriteria()
- Overrides:
supportsIsNullCriteriain classExecutionFactory<DataSource,Connection>
-
supportsLikeCriteria
public boolean supportsLikeCriteria()
- Overrides:
supportsLikeCriteriain classExecutionFactory<DataSource,Connection>
-
supportsLikeCriteriaEscapeCharacter
public boolean supportsLikeCriteriaEscapeCharacter()
- Overrides:
supportsLikeCriteriaEscapeCharacterin classExecutionFactory<DataSource,Connection>
-
supportsNotCriteria
public boolean supportsNotCriteria()
- Overrides:
supportsNotCriteriain classExecutionFactory<DataSource,Connection>
-
supportsOrCriteria
public boolean supportsOrCriteria()
- Overrides:
supportsOrCriteriain classExecutionFactory<DataSource,Connection>
-
supportsOrderByUnrelated
public boolean supportsOrderByUnrelated()
- Overrides:
supportsOrderByUnrelatedin classExecutionFactory<DataSource,Connection>
-
supportsQuantifiedCompareCriteriaAll
public boolean supportsQuantifiedCompareCriteriaAll()
- Overrides:
supportsQuantifiedCompareCriteriaAllin classExecutionFactory<DataSource,Connection>
-
supportsScalarSubqueries
public boolean supportsScalarSubqueries()
- Overrides:
supportsScalarSubqueriesin classExecutionFactory<DataSource,Connection>
-
supportsSearchedCaseExpressions
public boolean supportsSearchedCaseExpressions()
- Overrides:
supportsSearchedCaseExpressionsin classExecutionFactory<DataSource,Connection>
-
supportsSelfJoins
public boolean supportsSelfJoins()
- Overrides:
supportsSelfJoinsin classExecutionFactory<DataSource,Connection>
-
supportsInlineViews
public boolean supportsInlineViews()
- Overrides:
supportsInlineViewsin classExecutionFactory<DataSource,Connection>
-
supportsQuantifiedCompareCriteriaSome
public boolean supportsQuantifiedCompareCriteriaSome()
- Overrides:
supportsQuantifiedCompareCriteriaSomein classExecutionFactory<DataSource,Connection>
-
supportsSetQueryOrderBy
public boolean supportsSetQueryOrderBy()
- Overrides:
supportsSetQueryOrderByin classExecutionFactory<DataSource,Connection>
-
supportsUnions
public boolean supportsUnions()
- Overrides:
supportsUnionsin classExecutionFactory<DataSource,Connection>
-
supportsBulkUpdate
public boolean supportsBulkUpdate()
- Overrides:
supportsBulkUpdatein classExecutionFactory<DataSource,Connection>
-
supportsBatchedUpdates
public boolean supportsBatchedUpdates()
- Overrides:
supportsBatchedUpdatesin classExecutionFactory<DataSource,Connection>
-
supportsCompareCriteriaOrdered
public boolean supportsCompareCriteriaOrdered()
- Overrides:
supportsCompareCriteriaOrderedin classExecutionFactory<DataSource,Connection>
-
supportsHaving
public boolean supportsHaving()
- Overrides:
supportsHavingin classExecutionFactory<DataSource,Connection>
-
supportsSelectExpression
public boolean supportsSelectExpression()
- Overrides:
supportsSelectExpressionin classExecutionFactory<DataSource,Connection>
-
supportsInsertWithQueryExpression
public boolean supportsInsertWithQueryExpression()
- Overrides:
supportsInsertWithQueryExpressionin classExecutionFactory<DataSource,Connection>
-
getMaxPreparedInsertBatchSize
@TranslatorProperty(display="Max Prepared Insert Batch Size", description="The max size of a prepared insert batch. Default 2048.", advanced=true) public int getMaxPreparedInsertBatchSize()
Get the max number of inserts to perform in one batch.- Returns:
-
setMaxPreparedInsertBatchSize
public void setMaxPreparedInsertBatchSize(int maxInsertBatchSize)
-
getDatabaseCalendar
public Calendar getDatabaseCalendar()
Gets the database calendar. This will be set to the time zone specified by the propertysetDatabaseTimeZone(String), or the local time zone if none is specified.- Returns:
- the database calendar
-
translate
public List<?> translate(LanguageObject obj, ExecutionContext context)
Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation. Override with care.- Returns:
- list of translated parts
-
supportsBooleanExpressions
protected boolean supportsBooleanExpressions()
if boolean expressions are directly supported. will generally be false if there is no boolean datatype- Returns:
-
translateGeometrySelect
public Expression translateGeometrySelect(Expression expr)
Translate GEOMETRY column reference into an expression that will return WKB and possibly the SRID.- Parameters:
expr-- Returns:
-
translateGeographySelect
public Expression translateGeographySelect(Expression expr)
Translate GEOGRAPHY column reference into an expression that will return WKB and possibly the SRID.- Parameters:
expr-- Returns:
-
translateGeometryLiteral
public List<?> translateGeometryLiteral(Literal l)
Translate GEOMETRY literal into an expression that will convert to database geometry type.- Parameters:
l-- Returns:
-
translateGeographyLiteral
public List<?> translateGeographyLiteral(Literal l)
Translate GEOGRAPHY literal into an expression that will convert to database geography type.- Parameters:
l-- Returns:
-
translateGeometryParameter
public List<?> translateGeometryParameter(Parameter p)
Translate GEOMETRY parameter into an expression that will convert to database geometry type.- Parameters:
p-- Returns:
-
translateGeographyParameter
public List<?> translateGeographyParameter(Parameter p)
Translate GEOGRAPHY parameter into an expression that will convert to database geography type.- Parameters:
p-- Returns:
-
retrieveGeometryValue
public Object retrieveGeometryValue(ResultSet results, int paramIndex) throws SQLException
The default strategy assumes a blob value containing wkb- Parameters:
results-paramIndex-- Returns:
- Throws:
SQLException
-
retrieveGeographyValue
public Object retrieveGeographyValue(ResultSet results, int paramIndex) throws SQLException
The default strategy assumes a blob value containing wkb- Parameters:
results-paramIndex-- Returns:
- Throws:
SQLException
-
retrieveGeometryValue
public GeometryType retrieveGeometryValue(CallableStatement results, int parameterIndex) throws SQLException
- Throws:
SQLException
-
retrieveGeographyValue
public GeographyType retrieveGeographyValue(CallableStatement results, int parameterIndex) throws SQLException
- Throws:
SQLException
-
translateCommand
public List<?> translateCommand(Command command, ExecutionContext context)
Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.- Parameters:
command-context-- Returns:
- a list of translated parts
-
translateLimit
public List<?> translateLimit(Limit limit, ExecutionContext context)
Return a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.- Parameters:
limit-context-- Returns:
- a list of translated parts
-
getFunctionModifiers
public Map<String,FunctionModifier> getFunctionModifiers()
Return a map of function name to FunctionModifier.- Returns:
- Map of function name to FunctionModifier.
-
registerFunctionModifier
public void registerFunctionModifier(String name, FunctionModifier modifier)
Add theFunctionModifierto the set of known modifiers.- Parameters:
name-modifier-
-
translateLiteralBoolean
public String translateLiteralBoolean(Boolean booleanValue)
Subclasses should override this method to provide a different sql translation of the literal boolean value. By default, a boolean literal is represented as:'0'or'1'.- Parameters:
booleanValue- Boolean value, never null- Returns:
- Translated string
-
translateLiteralDate
public String translateLiteralDate(Date dateValue)
Subclasses should override this method to provide a different sql translation of the literal date value. By default, a date literal is represented as:{d '2002-12-31'}- Parameters:
dateValue- Date value, never null- Returns:
- Translated string
-
translateLiteralTime
public String translateLiteralTime(Time timeValue)
Subclasses should override this method to provide a different sql translation of the literal time value. By default, a time literal is represented as:{t '23:59:59'}SeehasTimeType()to represent literal times as timestamps.- Parameters:
timeValue- Time value, never null- Returns:
- Translated string
-
translateLiteralTimestamp
public String translateLiteralTimestamp(Timestamp timestampValue)
Subclasses should override this method to provide a different sql translation of the literal timestamp value. By default, a timestamp literal is represented as:{ts '2002-12-31 23:59:59'}. SeegetTimestampNanoPrecision()to control the literal precision.- Parameters:
timestampValue- Timestamp value, never null- Returns:
- Translated string
-
formatDateValue
public String formatDateValue(Date dateObject, boolean useTimezone)
Format the dateObject (of type date, time, or timestamp) into a string optionally using the DatabaseTimeZone.- Parameters:
dateObject-- Returns:
- Formatted string
-
formatDateValue
public String formatDateValue(Date dateObject)
Format the dateObject (of type date, time, or timestamp) into a string using the DatabaseTimeZone.- Parameters:
dateObject-- Returns:
- Formatted string
-
translateLiteralBinaryType
public String translateLiteralBinaryType(BinaryType obj)
Subclasses should override this method to provide a different sql translation of the literal varbinary value. By default, a varbinary literal is represented as:X'hex value'- Parameters:
obj- value, never null- Returns:
- Translated string
-
addSourceComment
public boolean addSourceComment()
Returns true to indicate that SQL should include a comment indicating the session and request ids.
-
useAsInGroupAlias
public boolean useAsInGroupAlias()
Indicates whether group alias should be of the form "...FROM groupA AS X" or "...FROM groupA X". Certain data sources (such as Oracle) may not support the first form.- Returns:
- boolean
-
usePreparedStatements
public boolean usePreparedStatements()
Use PreparedStatements (or CallableStatements) as appropriate for all commands. Bind values will be determined byLiteral.setBindEligible(boolean)can be used to force a literal to be a bind value.
-
useParensForSetQueries
public boolean useParensForSetQueries()
Set to true to indicate that every branch of a set query should have parenthesis, i.e. (query) union (query)- Returns:
- true if parenthesis should be used for each set branch
-
hasTimeType
public boolean hasTimeType()
Return false to indicate that time support should be emulated with timestamps.- Returns:
- true if database has a time type
-
getSetOperationString
public String getSetOperationString(SetQuery.Operation operation)
Returns the name for a givenSetQuery.Operation- Parameters:
operation-- Returns:
- the name for the set operation
-
getSourceComment
public String getSourceComment(ExecutionContext context, Command command)
Returns the source comment for the given command- Parameters:
context-command-- Returns:
- the comment
-
replaceElementName
public String replaceElementName(String group, String element)
Override to return a name other than the default [group.]element- Parameters:
group-element-- Returns:
- thre replacement name
-
getTimestampNanoPrecision
public int getTimestampNanoPrecision()
Return the precision of timestamp literals. Defaults to 9.- Returns:
- digits of timestamp nano precision.
-
executeStoredProcedure
public ResultSet executeStoredProcedure(CallableStatement statement, List<Argument> preparedValues, Class<?> returnType) throws SQLException
This is a generic implementation. Because different databases handle stored procedures differently, subclasses should override this method if necessary.- Throws:
SQLException
-
registerSpecificTypeOfOutParameter
protected void registerSpecificTypeOfOutParameter(CallableStatement statement, Class<?> runtimeType, int index) throws SQLException
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- Throws:
SQLException
-
bindValue
public void bindValue(PreparedStatement stmt, Object param, Class<?> paramType, int i) throws SQLException
Sets prepared statement parameter i with param. Performs special handling to translate dates using the database time zone and to translate biginteger, float, and char to JDBC safe objects.- Parameters:
stmt-param-paramType-i-- Throws:
SQLException
-
useStreamsForLobs
public boolean useStreamsForLobs()
If streams should be used for Blob/Clob sets onPreparedStatements- Returns:
-
retrieveValue
public Object retrieveValue(ResultSet results, int columnIndex, Class<?> expectedType) throws SQLException
Retrieve the value on the current resultset row for the given column index.- Parameters:
results-columnIndex-expectedType-- Returns:
- the value
- Throws:
SQLException
-
retrieveValue
public Object retrieveValue(CallableStatement results, int parameterIndex, Class<?> expectedType) throws SQLException
Retrieve the value for the given parameter index- Parameters:
results-parameterIndex-expectedType-- Returns:
- the value
- Throws:
SQLException
-
convertObject
protected Object convertObject(Object object) throws SQLException
- Throws:
SQLException
-
afterInitialConnectionObtained
protected void afterInitialConnectionObtained(Connection connection)
Called exactly once for this source.- Parameters:
connection-
-
obtainedConnection
public void obtainedConnection(Connection connection)
Provides a hook to call source specific logic when a connection is obtained. defect request 13979 & 13978
-
getSQLConversionVisitor
public SQLConversionVisitor getSQLConversionVisitor()
Create theSQLConversionVisitorthat will perform translation. Typical custom JDBC connectors will not need to create custom conversion visitors, rather implementors should override existingJDBCExecutionFactorymethods.- Returns:
- the
SQLConversionVisitor
-
useParensForJoins
public boolean useParensForJoins()
Set to true to indicate that every branch of a join should have parenthesis.- Returns:
- true if every branch of a join should use parenthesis
-
getDefaultNullOrder
public ExecutionFactory.NullOrder getDefaultNullOrder()
- Overrides:
getDefaultNullOrderin classExecutionFactory<DataSource,Connection>
-
useSelectLimit
public boolean useSelectLimit()
Returns whether the limit clause is applied to the select clause.- Returns:
- true if the limit clause is part of the select
-
getLikeRegexString
public String getLikeRegexString()
Get the predicate name for LIKE_REGEX- Returns:
-
setFetchSize
public void setFetchSize(Command command, ExecutionContext context, Statement statement, int fetchSize) throws SQLException
Set the fetch size on the given statement.- Parameters:
context-command-statement-fetchSize-- Throws:
SQLException
-
supportsGeneratedKeys
public boolean supportsGeneratedKeys()
-
getStructRetrieval
@TranslatorProperty(display="Struct retrieval", description="Struct retrieval mode (OBJECT, COPY, ARRAY)", advanced=true) public JDBCExecutionFactory.StructRetrieval getStructRetrieval()
-
setStructRetrieval
public void setStructRetrieval(JDBCExecutionFactory.StructRetrieval structRetrieval)
-
supportsGeneratedKeys
protected boolean supportsGeneratedKeys(ExecutionContext context, Command command)
- Parameters:
context-command-- Returns:
- true if generated keys can be returned
-
createTempTable
public String createTempTable(String prefix, List<ColumnReference> cols, ExecutionContext context, Connection connection) throws SQLException
Create a temp table with the given name prefix and columns- Parameters:
prefix-cols-context-connection-- Returns:
- the name of the table created
- Throws:
SQLException
-
getCreateTempTableSQL
public String getCreateTempTableSQL(String name, List<ColumnReference> cols, boolean transactional)
-
getTemporaryTableName
public String getTemporaryTableName(String prefix)
- Parameters:
prefix-- Returns:
- a valid temporary table name
-
getCreateTemporaryTablePostfix
public String getCreateTemporaryTablePostfix(boolean inTransaction)
- Parameters:
inTransaction-- Returns:
- the post script for the temp table create
-
getCreateTemporaryTableString
public String getCreateTemporaryTableString(boolean inTransaction)
- Parameters:
inTransaction-- Returns:
- the temp table creation ddl
-
getDialect
public SQLDialect getDialect()
-
getHibernateDialectClassName
public String getHibernateDialectClassName()
-
supportsDependentJoins
public boolean supportsDependentJoins()
- Overrides:
supportsDependentJoinsin classExecutionFactory<DataSource,Connection>
-
supportsFullDependentJoins
public boolean supportsFullDependentJoins()
- Overrides:
supportsFullDependentJoinsin classExecutionFactory<DataSource,Connection>
-
tempTableRequiresTransaction
public boolean tempTableRequiresTransaction()
-
loadedTemporaryTable
public void loadedTemporaryTable(String tableName, ExecutionContext context, Connection connection) throws SQLException
Called after the temporary table has been loaded- Parameters:
tableName-context-connection-- Throws:
SQLException
-
isEnableDependentJoins
@TranslatorProperty(display="Enable Dependent Joins", description="Enable Dependent Join Pushdown", advanced=true) public boolean isEnableDependentJoins()
-
setEnableDependentJoins
public void setEnableDependentJoins(boolean enableDependentJoins)
-
useWithRollup
public boolean useWithRollup()
- Returns:
- true if the rollup syntax is WITH ROLLUP
-
getCommentFormat
@TranslatorProperty(display="Comment Format", description="Comment format string used with useCommentsInSourceQuery") public String getCommentFormat()
-
setCommentFormat
public void setCommentFormat(String commentFormat)
-
useScientificNotation
public boolean useScientificNotation()
- Returns:
- true if scientific notation should be used for float/double types
-
useUnicodePrefix
public boolean useUnicodePrefix()
- Returns:
- true if the N prefix an N* type binding should be used for strings containing non-ascii characters
-
useNBindingType
public boolean useNBindingType()
- Returns:
- true if an N type (NVARCHAR, NCLOB) should be used when a non-ascii value is encountered
-
isExtendedAscii
public boolean isExtendedAscii()
- Returns:
- true if the database code page includes extended characters values in the 128-255 range
-
isNonAscii
protected boolean isNonAscii(String val)
- Parameters:
val-- Returns:
- true if the string is non-ascii
-
isNonAscii
protected boolean isNonAscii(Expression obj)
- Parameters:
obj-- Returns:
- true if the string expression is possibly non-ascii
-
isCharacterType
protected boolean isCharacterType(Class<?> type)
- Parameters:
type-- Returns:
- true if type is for characters
-
isNonAsciiFunction
protected boolean isNonAsciiFunction(Function f)
- Parameters:
f-- Returns:
- true if the function is a conversion function to a non-ascii string type An implementation is not required if no such function exists, or the source can handle unicode string using the standard types.
-
intializeConnectionAfterCancel
public void intializeConnectionAfterCancel(Connection c) throws SQLException
Implemented if theConnectionneeds initialized after a statement cancel- Parameters:
c-- Throws:
SQLException
-
useBindingsForDependentJoin
@TranslatorProperty(display="Use Bindings For Dependent Join", description="If PreparedStatement bindings should be used for dependent join values.") public boolean useBindingsForDependentJoin()
- Overrides:
useBindingsForDependentJoinin classExecutionFactory<DataSource,Connection>
-
setUseBindingsForDependentJoin
public void setUseBindingsForDependentJoin(boolean useBindingsForDependentJoin)
-
useColumnNamesForGeneratedKeys
public boolean useColumnNamesForGeneratedKeys()
- Returns:
- true if column names are required to retrieve generated keys
-
getLateralKeyword
public String getLateralKeyword()
-
getRemovePushdownCharacters
@TranslatorProperty(display="Remove Pushdown Characters", description="A case-sensitive regular expression of character strings to remove from string values that are pushed down.") public String getRemovePushdownCharacters()
-
setRemovePushdownCharacters
public void setRemovePushdownCharacters(String removePushdownCharacters)
-
isDefaultTimeZone
public boolean isDefaultTimeZone()
- Returns:
- true if the translator is using the VM default TimeZone
-
supportsProcedureParameterExpression
public boolean supportsProcedureParameterExpression()
- Overrides:
supportsProcedureParameterExpressionin classExecutionFactory<DataSource,Connection>
-
preserveNullTyping
public boolean preserveNullTyping()
Return true if null literals should retain a type (typically handled by a cast).- Returns:
-
-