Package org.teiid.translator.jdbc.mysql
Class MySQLExecutionFactory
- java.lang.Object
-
- org.teiid.translator.ExecutionFactory<DataSource,Connection>
-
- org.teiid.translator.jdbc.JDBCExecutionFactory
-
- org.teiid.translator.jdbc.mysql.MySQLExecutionFactory
-
- Direct Known Subclasses:
MySQL5ExecutionFactory
@Translator(name="mysql", description="A translator for open source MySQL Database, used with any version lower than 5") public class MySQLExecutionFactory extends JDBCExecutionFactory
- Since:
- 4.3
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.teiid.translator.jdbc.JDBCExecutionFactory
JDBCExecutionFactory.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 VersionFIVE_0static VersionFIVE_6-
Fields inherited from class org.teiid.translator.jdbc.JDBCExecutionFactory
DEFAULT_MAX_DEPENDENT_PREDICATES, DEFAULT_MAX_IN_CRITERIA, DEFAULT_TIME_ZONE, dialect
-
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 MySQLExecutionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected JDBCMetadataProcessorcreateMetadataProcessor()Deprecated.StringgetHibernateDialectClassName()StringgetLikeRegexString()Get the predicate name for LIKE_REGEXMetadataProcessor<Connection>getMetadataProcessor()Get a MetadataProcessor for the translator to read the metadata.List<String>getSupportedFunctions()Get list of all supported function names.intgetTimestampNanoPrecision()Return the precision of timestamp literals.voidinitCapabilities(Connection connection)Will be called byExecutionFactory.start()with a null connection if a source connection is notExecutionFactory.isSourceRequiredForCapabilities()protected booleanisVersion5OrGreater()GeometryTyperetrieveGeometryValue(CallableStatement results, int parameterIndex)GeometryTyperetrieveGeometryValue(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.voidstart()Initialize the connector with supplied configurationbooleansupportsAggregatesDistinct()Support indicates connector can accept DISTINCT within aggregate functionsbooleansupportsAggregatesEnhancedNumeric()Support indicates connector can accept STDDEV_POP, STDDEV_VAR, VAR_POP, VAR_SAMPbooleansupportsGroupByRollup()booleansupportsInlineViews()Support indicates connector can accept inline views (subqueries in the FROM clause).booleansupportsLikeRegex()booleansupportsOrderByWithExtendedGrouping()booleansupportsRowLimit()Gets whether the connector can limit the number of rows returned by a query.booleansupportsRowOffset()Gets whether the connector supports a SQL clause (similar to the LIMIT with an offset) that can return result sets that start in the middle of the resulting rows returned by a querybooleansupportsSelectWithoutFrom()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.ExpressiontranslateGeometrySelect(Expression expr)Translate GEOMETRY column reference into an expression that will return WKB and possibly the SRID.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.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.protected booleanusesDatabaseVersion()booleanuseWithRollup()-
Methods inherited from class org.teiid.translator.jdbc.JDBCExecutionFactory
addSourceComment, afterInitialConnectionObtained, bindValue, closeConnection, convertObject, createDirectExecution, createProcedureExecution, createResultSetExecution, createTempTable, createUpdateExecution, executeStoredProcedure, formatDateValue, formatDateValue, getCommentFormat, getConnection, getCreateTemporaryTablePostfix, getCreateTemporaryTableString, getCreateTempTableSQL, getDatabaseCalendar, getDatabaseTimeZone, getDatabaseVersion, getDefaultNullOrder, getDefaultSupportedFunctions, getDialect, getFunctionModifiers, getLateralKeyword, getMaxPreparedInsertBatchSize, getMetadata, getRemovePushdownCharacters, getSetOperationString, getSourceComment, getSQLConversionVisitor, getStructRetrieval, getTemporaryTableName, getVersion, hasTimeType, intializeConnectionAfterCancel, isCharacterType, isDefaultTimeZone, isEnableDependentJoins, isExtendedAscii, isNonAscii, isNonAscii, isNonAsciiFunction, isSourceRequired, isSourceRequiredForCapabilities, isTrimStrings, loadedTemporaryTable, obtainedConnection, preserveNullTyping, registerFunctionModifier, registerSpecificTypeOfOutParameter, replaceElementName, retrieveGeographyValue, retrieveGeographyValue, setCommentFormat, setDatabaseTimeZone, setDatabaseVersion, setDatabaseVersion, setEnableDependentJoins, setFetchSize, setMaxPreparedInsertBatchSize, setRemovePushdownCharacters, setStructRetrieval, setTrimStrings, setUseBindingsForDependentJoin, setUseBindVariables, setUseCommentsInSourceQuery, supportsAggregatesAvg, supportsAggregatesCount, supportsAggregatesCountStar, supportsAggregatesMax, supportsAggregatesMin, supportsAggregatesSum, supportsAliasedTable, supportsBatchedUpdates, supportsBooleanExpressions, supportsBulkUpdate, supportsCompareCriteriaEquals, supportsCompareCriteriaOrdered, supportsCorrelatedSubqueries, supportsDependentJoins, supportsExistsCriteria, supportsFullDependentJoins, supportsGeneratedKeys, supportsGeneratedKeys, supportsGroupBy, supportsHaving, supportsInCriteria, supportsInCriteriaSubquery, supportsInsertWithQueryExpression, supportsIsNullCriteria, supportsLikeCriteria, supportsLikeCriteriaEscapeCharacter, supportsNotCriteria, supportsOrCriteria, supportsOrderByUnrelated, supportsProcedureParameterExpression, supportsQuantifiedCompareCriteriaAll, supportsQuantifiedCompareCriteriaSome, supportsScalarSubqueries, supportsSearchedCaseExpressions, supportsSelectExpression, supportsSelfJoins, supportsSetQueryOrderBy, supportsUnions, tempTableRequiresTransaction, translateGeographyLiteral, translateGeographyParameter, translateGeographySelect, translateGeometryLiteral, translateGeometryParameter, translateLimit, translateLiteralBinaryType, translateLiteralBoolean, useAsInGroupAlias, useBindingsForDependentJoin, useBindVariables, useColumnNamesForGeneratedKeys, useCommentsInSourceQuery, useNBindingType, usePreparedStatements, useScientificNotation, useSelectLimit, useStreamsForLobs, useUnicodePrefix
-
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, supportsArrayAgg, supportsArrayType, supportsCommonTableExpressions, supportsCompareCriteriaOrderedExclusive, supportsConvert, supportsCorrelatedSubqueryLimit, supportsDirectQueryProcedure, supportsElementaryOlapOperations, supportsExcept, supportsFormatLiteral, supportsFullOuterJoins, supportsFunctionsInGroupBy, supportsGeographyType, supportsGroupByMultipleDistinctAggregates, supportsInnerJoins, supportsIntersect, supportsIsDistinctCriteria, supportsLateralJoin, supportsLateralJoinCondition, supportsListAgg, supportsMultipleOpenExecutions, supportsNativeQueries, supportsOnlyCorrelatedSubqueries, supportsOnlyFormatLiterals, supportsOnlyLateralJoinProcedure, supportsOnlyLiteralComparison, supportsOnlyRelationshipStyleJoins, supportsOnlySingleTableGroupBy, supportsOnlyTimestampAddLiteral, supportsOrderBy, supportsOrderByNullOrdering, supportsOuterJoins, supportsPartialFiltering, supportsProcedureTable, supportsRecursiveCommonTableExpressions, supportsScalarSubqueryProjection, supportsSelectDistinct, supportsSelectExpressionArrayType, supportsSetQueryLimitOffset, supportsSimilarTo, supportsStringAgg, supportsSubqueryCommonTableExpressions, supportsSubqueryInOn, supportsUpsert, supportsWindowDistinctAggregates, supportsWindowFrameClause, supportsWindowFunctionCumeDist, supportsWindowFunctionNthValue, supportsWindowFunctionNtile, supportsWindowFunctionPercentRank, supportsWindowOrderByWithAggregates, useAnsiJoin
-
-
-
-
Method Detail
-
start
public void start() throws TranslatorExceptionDescription copied from class:ExecutionFactoryInitialize the connector with supplied configuration- Overrides:
startin classJDBCExecutionFactory- Throws:
TranslatorException
-
initCapabilities
public void initCapabilities(Connection connection) throws TranslatorException
Description copied from class:ExecutionFactoryWill be called byExecutionFactory.start()with a null connection if a source connection is notExecutionFactory.isSourceRequiredForCapabilities()- Overrides:
initCapabilitiesin classJDBCExecutionFactory- Throws:
TranslatorException
-
translateLiteralDate
public String translateLiteralDate(Date dateValue)
Description copied from class:JDBCExecutionFactorySubclasses 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'}- Overrides:
translateLiteralDatein classJDBCExecutionFactory- Parameters:
dateValue- Date value, never null- Returns:
- Translated string
-
translateLiteralTime
public String translateLiteralTime(Time timeValue)
Description copied from class:JDBCExecutionFactorySubclasses 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'}SeeJDBCExecutionFactory.hasTimeType()to represent literal times as timestamps.- Overrides:
translateLiteralTimein classJDBCExecutionFactory- Parameters:
timeValue- Time value, never null- Returns:
- Translated string
-
translateLiteralTimestamp
public String translateLiteralTimestamp(Timestamp timestampValue)
Description copied from class:JDBCExecutionFactorySubclasses 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'}. SeeJDBCExecutionFactory.getTimestampNanoPrecision()to control the literal precision.- Overrides:
translateLiteralTimestampin classJDBCExecutionFactory- Parameters:
timestampValue- Timestamp value, never null- Returns:
- Translated string
-
useParensForSetQueries
public boolean useParensForSetQueries()
Description copied from class:JDBCExecutionFactorySet to true to indicate that every branch of a set query should have parenthesis, i.e. (query) union (query)- Overrides:
useParensForSetQueriesin classJDBCExecutionFactory- Returns:
- true if parenthesis should be used for each set branch
-
getTimestampNanoPrecision
public int getTimestampNanoPrecision()
Description copied from class:JDBCExecutionFactoryReturn the precision of timestamp literals. Defaults to 9.- Overrides:
getTimestampNanoPrecisionin classJDBCExecutionFactory- Returns:
- digits of timestamp nano precision.
-
isVersion5OrGreater
protected boolean isVersion5OrGreater()
-
useParensForJoins
public boolean useParensForJoins()
Description copied from class:JDBCExecutionFactorySet to true to indicate that every branch of a join should have parenthesis.- Overrides:
useParensForJoinsin classJDBCExecutionFactory- Returns:
- true if every branch of a join should use parenthesis
-
getSupportedFunctions
public List<String> getSupportedFunctions()
Description copied from class:ExecutionFactoryGet list of all supported function names. Arithmetic functions have names like "+".- Overrides:
getSupportedFunctionsin classJDBCExecutionFactory- See Also:
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. Note: User defined functions should be specified fully qualified.
-
supportsAggregatesDistinct
public boolean supportsAggregatesDistinct()
Description copied from class:ExecutionFactorySupport indicates connector can accept DISTINCT within aggregate functions- Overrides:
supportsAggregatesDistinctin classJDBCExecutionFactory
-
supportsRowLimit
public boolean supportsRowLimit()
Description copied from class:ExecutionFactoryGets whether the connector can limit the number of rows returned by a query.- Overrides:
supportsRowLimitin classExecutionFactory<DataSource,Connection>
-
supportsRowOffset
public boolean supportsRowOffset()
Description copied from class:ExecutionFactoryGets whether the connector supports a SQL clause (similar to the LIMIT with an offset) that can return result sets that start in the middle of the resulting rows returned by a query- Overrides:
supportsRowOffsetin classExecutionFactory<DataSource,Connection>
-
supportsSelectWithoutFrom
public boolean supportsSelectWithoutFrom()
- Overrides:
supportsSelectWithoutFromin classExecutionFactory<DataSource,Connection>- Returns:
- true if the translator support SELECT without a FROM clause
-
getHibernateDialectClassName
public String getHibernateDialectClassName()
- Overrides:
getHibernateDialectClassNamein classJDBCExecutionFactory
-
getMetadataProcessor
public MetadataProcessor<Connection> getMetadataProcessor()
Description copied from class:ExecutionFactoryGet a MetadataProcessor for the translator to read the metadata. Typically this will return a new instance.- Overrides:
getMetadataProcessorin classJDBCExecutionFactory- Returns:
-
createMetadataProcessor
@Deprecated protected JDBCMetadataProcessor createMetadataProcessor()
Deprecated.- Overrides:
createMetadataProcessorin classJDBCExecutionFactory- See Also:
JDBCExecutionFactory.getMetadataProcessor()
-
translateGeometrySelect
public Expression translateGeometrySelect(Expression expr)
Description copied from class:JDBCExecutionFactoryTranslate GEOMETRY column reference into an expression that will return WKB and possibly the SRID.- Overrides:
translateGeometrySelectin classJDBCExecutionFactory- Returns:
-
retrieveGeometryValue
public GeometryType retrieveGeometryValue(ResultSet results, int paramIndex) throws SQLException
Description copied from class:JDBCExecutionFactoryThe default strategy assumes a blob value containing wkb- Overrides:
retrieveGeometryValuein classJDBCExecutionFactory- Returns:
- Throws:
SQLException
-
retrieveGeometryValue
public GeometryType retrieveGeometryValue(CallableStatement results, int parameterIndex) throws SQLException
- Overrides:
retrieveGeometryValuein classJDBCExecutionFactory- Throws:
SQLException
-
translate
public List<?> translate(LanguageObject obj, ExecutionContext context)
Description copied from class:JDBCExecutionFactoryReturn a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation. Override with care.- Overrides:
translatein classJDBCExecutionFactory- Returns:
- list of translated parts
-
translateCommand
public List<?> translateCommand(Command command, ExecutionContext context)
Description copied from class:JDBCExecutionFactoryReturn a List of translated parts (LanguageObjects and Objects), or null if to rely on the default translation.- Overrides:
translateCommandin classJDBCExecutionFactory- Returns:
- a list of translated parts
-
usesDatabaseVersion
protected boolean usesDatabaseVersion()
- Overrides:
usesDatabaseVersionin classJDBCExecutionFactory
-
supportsLikeRegex
public boolean supportsLikeRegex()
- Overrides:
supportsLikeRegexin classExecutionFactory<DataSource,Connection>- Returns:
- true if the LIKE_REGEX predicate is supported
-
getLikeRegexString
public String getLikeRegexString()
Description copied from class:JDBCExecutionFactoryGet the predicate name for LIKE_REGEX- Overrides:
getLikeRegexStringin classJDBCExecutionFactory- Returns:
-
supportsGroupByRollup
public boolean supportsGroupByRollup()
- Overrides:
supportsGroupByRollupin classExecutionFactory<DataSource,Connection>- Returns:
- true if the translator support GROUP BY ROLLUP
-
useWithRollup
public boolean useWithRollup()
- Overrides:
useWithRollupin classJDBCExecutionFactory- Returns:
- true if the rollup syntax is WITH ROLLUP
-
supportsOrderByWithExtendedGrouping
public boolean supportsOrderByWithExtendedGrouping()
- Overrides:
supportsOrderByWithExtendedGroupingin classExecutionFactory<DataSource,Connection>- Returns:
- true if order by is supported over a grouping with a rollup, cube, etc.
-
supportsInlineViews
public boolean supportsInlineViews()
Description copied from class:ExecutionFactorySupport indicates connector can accept inline views (subqueries in the FROM clause).- Overrides:
supportsInlineViewsin classJDBCExecutionFactory
-
supportsAggregatesEnhancedNumeric
public boolean supportsAggregatesEnhancedNumeric()
Description copied from class:ExecutionFactorySupport indicates connector can accept STDDEV_POP, STDDEV_VAR, VAR_POP, VAR_SAMP- Overrides:
supportsAggregatesEnhancedNumericin classExecutionFactory<DataSource,Connection>
-
retrieveValue
public Object retrieveValue(ResultSet results, int columnIndex, Class<?> expectedType) throws SQLException
Description copied from class:JDBCExecutionFactoryRetrieve the value on the current resultset row for the given column index.- Overrides:
retrieveValuein classJDBCExecutionFactory- Returns:
- the value
- Throws:
SQLException
-
retrieveValue
public Object retrieveValue(CallableStatement results, int parameterIndex, Class<?> expectedType) throws SQLException
Description copied from class:JDBCExecutionFactoryRetrieve the value for the given parameter index- Overrides:
retrieveValuein classJDBCExecutionFactory- Returns:
- the value
- Throws:
SQLException
-
-