Package org.hibernate.dialect
Class TiDBDialect
- java.lang.Object
-
- org.hibernate.dialect.Dialect
-
- org.hibernate.dialect.MySQLDialect
-
- org.hibernate.dialect.TiDBDialect
-
- All Implemented Interfaces:
FunctionContributor
,TypeContributor
,ConversionContext
public class TiDBDialect extends MySQLDialect
A SQL dialect for TiDB.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.hibernate.dialect.Dialect
Dialect.SizeStrategy, Dialect.SizeStrategyImpl
-
-
Field Summary
-
Fields inherited from class org.hibernate.dialect.Dialect
CLOSED_QUOTE, FALSE_STRING_VALUES, LEGACY_LOB_MERGE_STRATEGY, LOG_BASE2OF10, NEW_LOCATOR_LOB_MERGE_STRATEGY, QUOTE, STANDARD_MULTI_KEY_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGY, TRUE_STRING_VALUES
-
-
Constructor Summary
Constructors Constructor Description TiDBDialect()
TiDBDialect(DatabaseVersion version)
TiDBDialect(DialectResolutionInfo info)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDual()
Returns a table expression that has one row.String
getForUpdateNowaitString()
Retrieves theFOR UPDATE NOWAIT
syntax specific to this dialect.String
getForUpdateNowaitString(String aliases)
Get theFOR UPDATE OF column_list NOWAIT
fragment appropriate for this dialect, given the aliases of the columns to be write locked.FunctionalDependencyAnalysisSupport
getFunctionalDependencyAnalysisSupport()
Get this dialect's level of support for primary key functional dependency analysis withinGROUP BY
andORDER BY
clauses.protected DatabaseVersion
getMinimumSupportedVersion()
Get the version of the SQL dialect that is the minimum supported by this implementation.DatabaseVersion
getMySQLVersion()
String
getQuerySequencesString()
Get theselect
command used retrieve the names of all sequences.String
getReadLockString(int timeout)
Get the string to append toSELECT
statements to acquire READ locks for this dialect.String
getReadLockString(String aliases, int timeout)
Get the string to append toSELECT
statements to acquire READ locks for this dialect, given the aliases of the columns to be read locked.SequenceInformationExtractor
getSequenceInformationExtractor()
ASequenceInformationExtractor
which is able to extractSequenceInformation
from the JDBC result set returned whenDialect.getQuerySequencesString()
is executed.SequenceSupport
getSequenceSupport()
No support for sequences.SqlAstTranslatorFactory
getSqlAstTranslatorFactory()
String
getWriteLockString(int timeout)
Get the string to append toSELECT
statements to acquire pessimistic WRITE locks for this dialect.protected void
registerDefaultKeywords()
Register the reserved words of ANSI-standard SQL as keywords.boolean
supportsCascadeDelete()
Does this dialect supporton delete
actions in foreign key definitions?boolean
supportsNoWait()
Does this dialect supportNO_WAIT
timeout.boolean
supportsRecursiveCTE()
Does this dialect/database support recursive CTEs?boolean
supportsSkipLocked()
Does this dialect supportSKIP_LOCKED
timeout.boolean
supportsWait()
Does this dialect supportWAIT
timeout.String
timestampaddPattern(TemporalUnit unit, TemporalType temporalType, IntervalType intervalType)
Obtain a pattern for the SQL equivalent to atimestampadd()
function call.-
Methods inherited from class org.hibernate.dialect.MySQLDialect
appendDatetimeFormat, appendDateTimeLiteral, appendDateTimeLiteral, appendDateTimeLiteral, appendLiteral, buildIdentifierHelper, buildSQLExceptionConversionDelegate, canCreateCatalog, canCreateSchema, canDisableConstraints, castPattern, castType, closeQuote, columnType, contributeTypes, createVersion, createVersion, currentTimestamp, datetimeFormat, dropConstraints, extractPattern, getAddForeignKeyConstraintString, getAlterColumnTypeString, getCharacterSetBytesPerCharacter, getColumnComment, getCreateCatalogCommand, getCreateSchemaCommand, getCurrentTimestampSelectString, getDefaultLobLength, getDefaultMySQLStorageEngine, getDisableConstraintsStatement, getDmlTargetColumnQualifierSupport, getDropCatalogCommand, getDropForeignKeyString, getDropSchemaCommand, getDropUniqueKeyString, getEnableConstraintsStatement, getEnumTypeDeclaration, getFallbackSqmInsertStrategy, getFallbackSqmMutationStrategy, getFloatPrecision, getForUpdateSkipLockedString, getForUpdateSkipLockedString, getForUpdateString, getFractionalSecondPrecisionInNanos, getGroupBySelectItemReferenceStrategy, getIdentityColumnSupport, getLimitHandler, getMaxAliasLength, getMaxIdentifierLength, getMaxVarbinaryLength, getMaxVarcharLength, getNameQualifierSupport, getNullColumnString, getNullOrdering, getPreferredSqlTypeCodeForBoolean, getQueryHintString, getResultSet, getSelectGUIDString, getSizeStrategy, getSupportedTemporaryTableKind, getTableComment, getTableTypeString, getTemporaryTableAfterUseAction, getTemporaryTableBeforeUseAction, getTemporaryTableCreateCommand, getTemporaryTableDropCommand, getViolatedConstraintNameExtractor, getWriteLockString, getWriteRowLockStrategy, hasSelfReferentialForeignKeyBug, initDefaultProperties, initializeFunctionRegistry, isCurrentTimestampSelectStringCallable, isJdbcLogWarningsEnabledByDefault, isNoBackslashEscapesEnabled, openQuote, qualifyIndexName, registerColumnTypes, registerResultSetOutParameter, resolveSqlTypeDescriptor, resolveSqlTypeLength, supportsAlterColumnType, supportsColumnCheck, supportsCommentOn, supportsCurrentTimestampSelection, supportsFromClauseInUpdate, supportsIfExistsBeforeTableName, supportsIsTrue, supportsLateral, supportsLobValueChangePropagation, supportsLockTimeouts, supportsNullPrecedence, supportsOffsetInSubquery, supportsSubqueryOnMutatingTable, supportsTemporalLiteralOffset, supportsWindowFunctions, timestampdiffPattern, useMaterializedLobWhenCapacityExceeded
-
Methods inherited from class org.hibernate.dialect.Dialect
addSqlHintOrComment, appendArrayLiteral, appendBinaryLiteral, appendBooleanValueString, appendIntervalLiteral, appendLockHint, appendUUIDLiteral, applyLocksToSql, augmentPhysicalTableTypes, augmentRecognizedTableTypes, buildStringToBooleanCast, buildStringToBooleanCastDecode, buildStringToBooleanDecode, canBatchTruncate, checkVersion, contribute, contributeFunctions, createOptionalTableUpdateOperation, currentDate, currentLocalTime, currentLocalTimestamp, currentTime, currentTimestampWithTimeZone, defaultScrollMode, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, doesRoundTemporalOnOverflow, equivalentTypes, escapeComment, forceLobAsLastValue, generatedAs, getAddColumnString, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAggregateSupport, getAlterTableString, getArrayTypeName, getAuxiliaryDatabaseObjectExporter, getBatchLoadSizingStrategy, getBeforeDropStatement, getCallableStatementSupport, getCascadeConstraintsString, getCaseInsensitiveLike, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getColumnAliasExtractor, getCreateEnumTypeCommand, getCreateEnumTypeCommand, getCreateIndexString, getCreateIndexTail, getCreateMultisetTableString, getCreateTableString, getCreateTemporaryTableColumnAnnotation, getCreateUserDefinedTypeExtensionsString, getCreateUserDefinedTypeKindString, getCrossReferenceParentTableFilter, getCurrentSchemaCommand, getDefaultDecimalPrecision, getDefaultIntervalSecondScale, getDefaultNonContextualLobCreation, getDefaultProperties, getDefaultStatementBatchSize, getDefaultTimestampPrecision, getDefaultUseGetGeneratedKeys, getDisableConstraintStatement, getDoublePrecision, getDropEnumTypeCommand, getDropEnumTypeCommand, getDropTableString, getEnableConstraintStatement, getEnumTypeDeclaration, getFallbackSchemaManagementTool, getForeignKeyExporter, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getFromDualForSelectOnly, getHqlTranslator, getIndexExporter, getInExpressionCountLimit, getKeywords, getLobMergeStrategy, getLockingStrategy, getLockRowIdentifier, getLowercaseFunction, getMaxNVarcharCapacity, getMaxNVarcharLength, getMaxVarbinaryCapacity, getMaxVarcharCapacity, getMultiKeyLoadSizingStrategy, getNationalizationSupport, getNativeIdentifierGeneratorStrategy, getNativeParameterMarkerStrategy, getNoColumnsInsertString, getNullColumnString, getParameterCountLimit, getPreferredSqlTypeCodeForArray, getQueryHintString, getReadRowLockStrategy, getResultSet, getResultSet, getRowIdColumnString, getSchemaNameResolver, getSelectClauseNullString, getSequenceExporter, getSqmTranslatorFactory, getTableCleaner, getTableExporter, getTableMigrator, getTemporaryTableCreateOptions, getTemporaryTableDdlTransactionHandling, getTemporaryTableExporter, getTemporaryTableTruncateCommand, getTimeoutInSeconds, getTimeZoneSupport, getTruncateTableStatement, getTruncateTableStatements, getUniqueDelegate, getUniqueKeyExporter, getUserDefinedTypeComment, getUserDefinedTypeExporter, getVersion, hasAlterTable, hasDataTypeBeforeGeneratedAs, inlineLiteral, isAnsiNullOn, isEmptyStringTreatedAsNull, isLob, isLockTimeoutParameterized, ordinal, prependComment, quote, quoteCollation, registerKeyword, registerKeywords, registerResultSetOutParameter, requiresCastForConcatenatingNonStrings, requiresFloatCastingOfIntegerDivision, requiresParensForTupleCounts, requiresParensForTupleDistinctCounts, resolveSqlTypeCode, resolveSqlTypeCode, rowId, rowIdSqlType, supportsBatchUpdates, supportsBindAsCallableArgument, supportsBitType, supportsCaseInsensitiveLike, supportsCircularCascadeDeleteConstraints, supportsConflictClauseForInsertCTE, supportsDistinctFromPredicate, supportsExistsInSelect, supportsExpectedLobUsagePattern, supportsFetchClause, supportsFractionalTimestampArithmetic, supportsIfExistsAfterAlterTable, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsAfterTypeName, supportsIfExistsBeforeConstraintName, supportsIfExistsBeforeTypeName, supportsInsertReturning, supportsInsertReturningGeneratedKeys, supportsInsertReturningRowId, supportsJdbcConnectionLobCreation, supportsMaterializedLobAccess, supportsNamedParameters, supportsNationalizedMethods, supportsNoColumnsInsert, supportsNonQueryWithCTE, supportsOrderByInSubquery, supportsOrdinalSelectItemReference, supportsOuterJoinForUpdate, supportsParametersInInsertSelect, supportsPartitionBy, supportsPredicateAsExpression, supportsRefCursors, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsStandardArrays, supportsStandardCurrentTimestampFunction, supportsSubqueryInSelect, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTemporaryTablePrimaryKey, supportsTemporaryTables, supportsTruncateWithCast, supportsTupleCounts, supportsTupleDistinctCounts, supportsUnboundedLobLocatorMaterialization, supportsUnionAll, supportsUnionInSubquery, supportsUpdateReturning, supportsValuesList, supportsValuesListForInsert, toBooleanValueString, toQuotedIdentifier, toString, transformSelectString, translateDurationField, translateExtractField, trimPattern, trimPattern, unquoteGetGeneratedKeys, useArrayForMultiValuedParameters, useConnectionToCreateLob, useCrossReferenceForeignKeys, useFollowOnLocking, useInputStreamToInsertBlob
-
-
-
-
Constructor Detail
-
TiDBDialect
public TiDBDialect()
-
TiDBDialect
public TiDBDialect(DatabaseVersion version)
-
TiDBDialect
public TiDBDialect(DialectResolutionInfo info)
-
-
Method Detail
-
getMySQLVersion
public DatabaseVersion getMySQLVersion()
- Overrides:
getMySQLVersion
in classMySQLDialect
-
getMinimumSupportedVersion
protected DatabaseVersion getMinimumSupportedVersion()
Description copied from class:Dialect
Get the version of the SQL dialect that is the minimum supported by this implementation.- Overrides:
getMinimumSupportedVersion
in classMySQLDialect
-
registerDefaultKeywords
protected void registerDefaultKeywords()
Description copied from class:Dialect
Register the reserved words of ANSI-standard SQL as keywords.- Overrides:
registerDefaultKeywords
in classMySQLDialect
- See Also:
AnsiSqlKeywords
-
supportsCascadeDelete
public boolean supportsCascadeDelete()
Description copied from class:Dialect
Does this dialect supporton delete
actions in foreign key definitions?- Overrides:
supportsCascadeDelete
in classMySQLDialect
- Returns:
true
if the dialect does support theon delete
clause.
-
getQuerySequencesString
public String getQuerySequencesString()
Description copied from class:Dialect
Get theselect
command used retrieve the names of all sequences.- Overrides:
getQuerySequencesString
in classDialect
- Returns:
- The select command; or null if sequences are not supported.
-
getSequenceSupport
public SequenceSupport getSequenceSupport()
Description copied from class:MySQLDialect
No support for sequences.- Overrides:
getSequenceSupport
in classMySQLDialect
-
getSequenceInformationExtractor
public SequenceInformationExtractor getSequenceInformationExtractor()
Description copied from class:Dialect
ASequenceInformationExtractor
which is able to extractSequenceInformation
from the JDBC result set returned whenDialect.getQuerySequencesString()
is executed.- Overrides:
getSequenceInformationExtractor
in classDialect
-
getSqlAstTranslatorFactory
public SqlAstTranslatorFactory getSqlAstTranslatorFactory()
Description copied from class:Dialect
- Overrides:
getSqlAstTranslatorFactory
in classMySQLDialect
- See Also:
StandardSqlAstTranslatorFactory
,JdbcEnvironment.getSqlAstTranslatorFactory()
-
supportsRecursiveCTE
public boolean supportsRecursiveCTE()
Description copied from class:Dialect
Does this dialect/database support recursive CTEs?- Overrides:
supportsRecursiveCTE
in classMySQLDialect
- Returns:
true
if recursive CTEs are supported
-
supportsSkipLocked
public boolean supportsSkipLocked()
Description copied from class:Dialect
Does this dialect supportSKIP_LOCKED
timeout.- Overrides:
supportsSkipLocked
in classMySQLDialect
- Returns:
true
if SKIP_LOCKED is supported
-
supportsNoWait
public boolean supportsNoWait()
Description copied from class:Dialect
Does this dialect supportNO_WAIT
timeout.- Overrides:
supportsNoWait
in classMySQLDialect
- Returns:
true
ifNO_WAIT
is supported
-
supportsWait
public boolean supportsWait()
Description copied from class:Dialect
Does this dialect supportWAIT
timeout.- Overrides:
supportsWait
in classMySQLDialect
- Returns:
true
ifWAIT
is supported
-
getReadLockString
public String getReadLockString(int timeout)
Description copied from class:Dialect
Get the string to append toSELECT
statements to acquire READ locks for this dialect.Location of the returned string is treated the same as
Dialect.getForUpdateString()
.- Overrides:
getReadLockString
in classMySQLDialect
- Parameters:
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.- Returns:
- The appropriate
LOCK
clause string.
-
getReadLockString
public String getReadLockString(String aliases, int timeout)
Description copied from class:Dialect
Get the string to append toSELECT
statements to acquire READ locks for this dialect, given the aliases of the columns to be read locked.Location of the returned string is treated the same as
Dialect.getForUpdateString()
.- Overrides:
getReadLockString
in classMySQLDialect
- Parameters:
aliases
- The columns to be read locked.timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.- Returns:
- The appropriate
LOCK
clause string.
-
getWriteLockString
public String getWriteLockString(int timeout)
Description copied from class:Dialect
Get the string to append toSELECT
statements to acquire pessimistic WRITE locks for this dialect.Location of the returned string is treated the same as
Dialect.getForUpdateString()
.- Overrides:
getWriteLockString
in classMySQLDialect
- Parameters:
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.- Returns:
- The appropriate
LOCK
clause string.
-
getForUpdateNowaitString
public String getForUpdateNowaitString()
Description copied from class:Dialect
Retrieves theFOR UPDATE NOWAIT
syntax specific to this dialect.- Overrides:
getForUpdateNowaitString
in classMySQLDialect
- Returns:
- The appropriate
FOR UPDATE NOWAIT
clause string.
-
getForUpdateNowaitString
public String getForUpdateNowaitString(String aliases)
Description copied from class:Dialect
Get theFOR UPDATE OF column_list NOWAIT
fragment appropriate for this dialect, given the aliases of the columns to be write locked.- Overrides:
getForUpdateNowaitString
in classMySQLDialect
- Parameters:
aliases
- The columns to be write locked.- Returns:
- The appropriate
FOR UPDATE OF colunm_list NOWAIT
clause string.
-
getFunctionalDependencyAnalysisSupport
public FunctionalDependencyAnalysisSupport getFunctionalDependencyAnalysisSupport()
Description copied from class:Dialect
Get this dialect's level of support for primary key functional dependency analysis withinGROUP BY
andORDER BY
clauses.- Overrides:
getFunctionalDependencyAnalysisSupport
in classMySQLDialect
-
timestampaddPattern
public String timestampaddPattern(TemporalUnit unit, TemporalType temporalType, IntervalType intervalType)
Description copied from class:Dialect
Obtain a pattern for the SQL equivalent to atimestampadd()
function call. The resulting pattern must contain ?1, ?2, and ?3 placeholders for the arguments.- Overrides:
timestampaddPattern
in classMySQLDialect
- Parameters:
unit
- The unit to add to the temporaltemporalType
- The type of the temporalintervalType
- The type of interval to add or null if it's not a native interval
-
getDual
public String getDual()
Description copied from class:Dialect
Returns a table expression that has one row.- Overrides:
getDual
in classMySQLDialect
- Returns:
- the SQL equivalent to Oracle's
dual
.
-
-