Class SybaseDialect
- java.lang.Object
-
- org.hibernate.dialect.Dialect
-
- org.hibernate.dialect.AbstractTransactSQLDialect
-
- org.hibernate.dialect.SybaseDialect
-
- All Implemented Interfaces:
ConversionContext
- Direct Known Subclasses:
SybaseASEDialect
public class SybaseDialect extends AbstractTransactSQLDialect
Superclass for all Sybase dialects.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.hibernate.dialect.Dialect
Dialect.SizeStrategy, Dialect.SizeStrategyImpl
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
jtdsDriver
-
Fields inherited from class org.hibernate.dialect.Dialect
CLOSED_QUOTE, LEGACY_LOB_MERGE_STRATEGY, LOG_BASE2OF10, NEW_LOCATOR_LOB_MERGE_STRATEGY, QUOTE, STANDARD_DEFAULT_BATCH_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGY
-
-
Constructor Summary
Constructors Constructor Description SybaseDialect()
SybaseDialect(DatabaseVersion version)
SybaseDialect(DialectResolutionInfo info)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendDatetimeFormat(SqlAppender appender, String format)
Translate the given datetime format string from the pattern language defined by Java'sDateTimeFormatter
to whatever pattern language is understood by the native datetime formatting function for this database (often theto_char()
function).IdentifierHelper
buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData)
Build the IdentifierHelper indicated by this Dialect for handling identifier conversions.boolean
canCreateSchema()
Does this dialect support schema creation?String
castPattern(CastType from, CastType to)
Obtain a pattern for the SQL equivalent to acast()
function call.void
contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Allows the Dialect to contribute additional typesString
extractPattern(TemporalUnit unit)
Obtain a pattern for the SQL equivalent to anextract()
function call.String
getCurrentSchemaCommand()
Get the SQL command used to retrieve the current schema name.int
getInExpressionCountLimit()
Return the limit that the underlying database places on the number of elements in anIN
predicate.int
getMaxIdentifierLength()
What is the maximum identifier length supported by the dialect?NameQualifierSupport
getNameQualifierSupport()
By default interpret this based on DatabaseMetaData.NationalizationSupport
getNationalizationSupport()
Determines whether this database requires the use of explicit nationalized character data types.String
getNullColumnString()
The keyword used to specify a nullable column.SqlAstTranslatorFactory
getSqlAstTranslatorFactory()
Return an SqlAstTranslatorFactory specific for the Dialect.SqmTranslatorFactory
getSqmTranslatorFactory()
Return an SqmToSqlAstConverterFactory specific for the Dialect.void
initializeFunctionRegistry(QueryEngine queryEngine)
Initialize the given registry with any dialect-specific functions.JdbcType
resolveSqlTypeDescriptor(String columnTypeName, int jdbcTypeCode, int precision, int scale, JdbcTypeRegistry jdbcTypeRegistry)
boolean
supportsFractionalTimestampArithmetic()
Whether the database supports adding a fractional interval to a timestamp e.g.boolean
supportsNullPrecedence()
String
timestampaddPattern(TemporalUnit unit, jakarta.persistence.TemporalType temporalType, IntervalType intervalType)
Obtain a pattern for the SQL equivalent to atimestampadd()
function call.String
timestampdiffPattern(TemporalUnit unit, jakarta.persistence.TemporalType fromTemporalType, jakarta.persistence.TemporalType toTemporalType)
Obtain a pattern for the SQL equivalent to atimestampdiff()
function call.String
translateExtractField(TemporalUnit unit)
Return the name used to identify the given field as an argument to theextract()
function, or of this dialect's equivalent function.String
trimPattern(TrimSpec specification, char character)
Obtain a pattern for the SQL equivalent to atrim()
function call.-
Methods inherited from class org.hibernate.dialect.AbstractTransactSQLDialect
appendBinaryLiteral, appendLockHint, applyLocksToSql, columnType, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, getAddColumnString, getCurrentTimestampSelectString, getDefaultStatementBatchSize, getFallbackSqmInsertStrategy, getFallbackSqmMutationStrategy, getForUpdateString, getIdentityColumnSupport, getNullOrdering, getPreferredSqlTypeCodeForBoolean, getResultSet, getSelectGUIDString, getSupportedTemporaryTableKind, getTemporaryTableAfterUseAction, getTemporaryTableBeforeUseAction, getTemporaryTableCreateCommand, getWriteRowLockStrategy, isCurrentTimestampSelectStringCallable, qualifyIndexName, registerResultSetOutParameter, replaceLtrimRtrim, supportsCurrentTimestampSelection, supportsExistsInSelect, supportsPartitionBy, supportsTupleDistinctCounts
-
Methods inherited from class org.hibernate.dialect.Dialect
addSqlHintOrComment, appendArrayLiteral, appendBooleanValueString, appendDateTimeLiteral, appendDateTimeLiteral, appendDateTimeLiteral, appendIntervalLiteral, appendLiteral, appendUUIDLiteral, augmentPhysicalTableTypes, augmentRecognizedTableTypes, buildSQLExceptionConversionDelegate, canCreateCatalog, castType, checkVersion, closeQuote, currentDate, currentLocalTime, currentLocalTimestamp, currentTime, currentTimestamp, currentTimestampWithTimeZone, defaultScrollMode, dropConstraints, equivalentTypes, escapeComment, forceLobAsLastValue, generatedAs, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAlterTableString, getArrayTypeName, getAuxiliaryDatabaseObjectExporter, getBooleanCheckCondition, getCallableStatementSupport, getCascadeConstraintsString, getCaseInsensitiveLike, getColumnAliasExtractor, getColumnComment, getCreateCatalogCommand, getCreateMultisetTableString, getCreateSchemaCommand, getCreateTableString, getCreateTemporaryTableColumnAnnotation, getDefaultBatchLoadSizingStrategy, getDefaultDecimalPrecision, getDefaultLobLength, getDefaultNonContextualLobCreation, getDefaultProperties, getDefaultTimestampPrecision, getDefaultUseGetGeneratedKeys, getDoublePrecision, getDropCatalogCommand, getDropForeignKeyString, getDropSchemaCommand, getDropTableString, getEnumCheckCondition, getFloatPrecision, getForeignKeyExporter, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateSkipLockedString, getForUpdateSkipLockedString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getFractionalSecondPrecisionInNanos, getGroupBySelectItemReferenceStrategy, getHqlTranslator, getIndexExporter, getKeywords, getLimitHandler, getLobMergeStrategy, getLockingStrategy, getLockRowIdentifier, getLowercaseFunction, getMaxAliasLength, getMaxNVarcharLength, getMaxVarbinaryLength, getMaxVarcharLength, getMinimumSupportedVersion, getNativeIdentifierGeneratorStrategy, getNoColumnsInsertString, getNullColumnString, getPreferredSqlTypeCodeForArray, getQueryHintString, getQueryHintString, getQuerySequencesString, getReadLockString, getReadLockString, getReadRowLockStrategy, getResultSet, getResultSet, getSchemaNameResolver, getSelectClauseNullString, getSequenceExporter, getSequenceInformationExtractor, getSequenceSupport, getSizeStrategy, getTableComment, getTableExporter, getTableTypeString, getTemporaryTableCreateOptions, getTemporaryTableDdlTransactionHandling, getTemporaryTableDropCommand, getTemporaryTableExporter, getTemporaryTableTruncateCommand, getTimeZoneSupport, getUniqueDelegate, getUniqueKeyExporter, getVersion, getViolatedConstraintNameExtractor, getWriteLockString, getWriteLockString, hasAlterTable, hasDataTypeBeforeGeneratedAs, hasSelfReferentialForeignKeyBug, initDefaultProperties, inlineLiteral, isAnsiNullOn, isEmptyStringTreatedAsNull, isJdbcLogWarningsEnabledByDefault, isLockTimeoutParameterized, openQuote, prependComment, quote, registerColumnTypes, registerDefaultKeywords, registerKeyword, registerKeywords, registerResultSetOutParameter, requiresFloatCastingOfIntegerDivision, requiresParensForTupleCounts, requiresParensForTupleDistinctCounts, resolveSqlTypeCode, resolveSqlTypeCode, resolveSqlTypeLength, supportsBindAsCallableArgument, supportsBitType, supportsCascadeDelete, supportsCaseInsensitiveLike, supportsCircularCascadeDeleteConstraints, supportsColumnCheck, supportsCommentOn, supportsDistinctFromPredicate, supportsExpectedLobUsagePattern, supportsFetchClause, supportsIfExistsAfterAlterTable, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsBeforeConstraintName, supportsIfExistsBeforeTableName, supportsJdbcConnectionLobCreation, supportsLateral, supportsLobValueChangePropagation, supportsLockTimeouts, supportsNamedParameters, supportsNoColumnsInsert, supportsNonQueryWithCTE, supportsNoWait, supportsOffsetInSubquery, supportsOrderByInSubquery, supportsOrdinalSelectItemReference, supportsOuterJoinForUpdate, supportsParametersInInsertSelect, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsSkipLocked, supportsStandardArrays, supportsSubqueryInSelect, supportsSubqueryOnMutatingTable, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTemporalLiteralOffset, supportsTemporaryTablePrimaryKey, supportsTemporaryTables, supportsTruncateWithCast, supportsTupleCounts, supportsUnboundedLobLocatorMaterialization, supportsUnionAll, supportsUnionInSubquery, supportsValuesList, supportsValuesListForInsert, supportsWait, supportsWindowFunctions, toBooleanValueString, toQuotedIdentifier, toString, transformSelectString, translateDurationField, useFollowOnLocking, useInputStreamToInsertBlob
-
-
-
-
Constructor Detail
-
SybaseDialect
public SybaseDialect()
-
SybaseDialect
public SybaseDialect(DatabaseVersion version)
-
SybaseDialect
public SybaseDialect(DialectResolutionInfo info)
-
-
Method Detail
-
resolveSqlTypeDescriptor
public JdbcType resolveSqlTypeDescriptor(String columnTypeName, int jdbcTypeCode, int precision, int scale, JdbcTypeRegistry jdbcTypeRegistry)
- Overrides:
resolveSqlTypeDescriptor
in classAbstractTransactSQLDialect
-
getSqmTranslatorFactory
public SqmTranslatorFactory getSqmTranslatorFactory()
Description copied from class:Dialect
Return an SqmToSqlAstConverterFactory specific for the Dialect. Returnnull
to use Hibernate's standard translator. Note thatQueryEngineOptions.getCustomSqmTranslatorFactory()
has higher precedence as it comes directly from the user config- Overrides:
getSqmTranslatorFactory
in classDialect
- See Also:
StandardSqmTranslator
,QueryEngine.getSqmTranslatorFactory()
-
getSqlAstTranslatorFactory
public SqlAstTranslatorFactory getSqlAstTranslatorFactory()
Description copied from class:Dialect
Return an SqlAstTranslatorFactory specific for the Dialect. Returnnull
to use Hibernate's standard translator.- Overrides:
getSqlAstTranslatorFactory
in classDialect
- See Also:
StandardSqlAstTranslatorFactory
,JdbcEnvironment.getSqlAstTranslatorFactory()
-
supportsNullPrecedence
public boolean supportsNullPrecedence()
- Overrides:
supportsNullPrecedence
in classDialect
-
getInExpressionCountLimit
public int getInExpressionCountLimit()
Description copied from class:Dialect
Return the limit that the underlying database places on the number of elements in anIN
predicate. If the database defines no such limits, simply return zero or less-than-zero.- Overrides:
getInExpressionCountLimit
in classDialect
- Returns:
- int The limit, or zero-or-less to indicate no limit.
-
contributeTypes
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Description copied from class:Dialect
Allows the Dialect to contribute additional types- Overrides:
contributeTypes
in classDialect
- Parameters:
typeContributions
- Callback to contribute the typesserviceRegistry
- The service registry
-
getNationalizationSupport
public NationalizationSupport getNationalizationSupport()
Description copied from class:Dialect
Determines whether this database requires the use of explicit nationalized character data types.That is, whether the use of
Types.NCHAR
,Types.NVARCHAR
, andTypes.NCLOB
is required for nationalized character data (Unicode).- Overrides:
getNationalizationSupport
in classDialect
-
initializeFunctionRegistry
public void initializeFunctionRegistry(QueryEngine queryEngine)
Description copied from class:Dialect
Initialize the given registry with any dialect-specific functions.Support for certain SQL functions is required, and if the database does not support a required function, then the dialect must define a way to emulate it.
These required functions include the functions defined by the JPA query language specification:
- avg(arg) - aggregate function
- count([distinct ]arg) - aggregate function
- max(arg) - aggregate function
- min(arg) - aggregate function
- sum(arg) - aggregate function
- coalesce(arg0, arg1, ...)
- nullif(arg0, arg1)
- lower(arg)
- upper(arg)
- length(arg)
- concat(arg0, arg1, ...)
- locate(pattern, string[, start])
- substring(string, start[, length])
- trim([[spec ][character ]from] string)
- abs(arg)
- mod(arg0, arg1)
- sqrt(arg)
- current date
- current time
- current timestamp
- any(arg) - aggregate function
- every(arg) - aggregate function
- cast(arg as Type)
- extract(field from arg)
- ln(arg)
- exp(arg)
- power(arg0, arg1)
- floor(arg)
- ceiling(arg)
- position(pattern in string)
- substring(string from start[ for length])
- overlay(string placing replacement from start[ for length])
- local date
- local time
- local datetime
- offset datetime
- instant
- left(string, length)
- right(string, length)
- replace(string, pattern, replacement)
- pad(string with length spec[ character])
- log10(arg)
- sign(arg)
- sin(arg)
- cos(arg)
- tan(arg)
- asin(arg)
- acos(arg)
- atan(arg)
- atan2(arg0, arg1)
- round(arg0, arg1)
- least(arg0, arg1, ...)
- greatest(arg0, arg1, ...)
- format(datetime as pattern)
- collate(string as collation)
- str(arg) - synonym of cast(a as String)
- ifnull(arg0, arg1) - synonym of coalesce(a, b)
- second(arg) - synonym of extract(second from a)
- minute(arg) - synonym of extract(minute from a)
- hour(arg) - synonym of extract(hour from a)
- day(arg) - synonym of extract(day from a)
- month(arg) - synonym of extract(month from a)
- year(arg) - synonym of extract(year from a)
- Overrides:
initializeFunctionRegistry
in classAbstractTransactSQLDialect
-
getNullColumnString
public String getNullColumnString()
Description copied from class:Dialect
The keyword used to specify a nullable column.- Overrides:
getNullColumnString
in classDialect
- Returns:
- String
-
canCreateSchema
public boolean canCreateSchema()
Description copied from class:Dialect
Does this dialect support schema creation?- Overrides:
canCreateSchema
in classDialect
- Returns:
- True if the dialect supports schema creation; false otherwise.
-
getCurrentSchemaCommand
public String getCurrentSchemaCommand()
Description copied from class:Dialect
Get the SQL command used to retrieve the current schema name. Works in conjunction withDialect.getSchemaNameResolver()
, unless the return from there does not need this information. E.g., a custom impl might make use of the Java 1.7 addition of theConnection.getSchema()
method- Overrides:
getCurrentSchemaCommand
in classDialect
- Returns:
- The current schema retrieval SQL
-
getMaxIdentifierLength
public int getMaxIdentifierLength()
Description copied from class:Dialect
What is the maximum identifier length supported by the dialect?- Overrides:
getMaxIdentifierLength
in classDialect
- Returns:
- The maximum length.
-
castPattern
public String castPattern(CastType from, CastType to)
Description copied from class:Dialect
Obtain a pattern for the SQL equivalent to acast()
function call. The resulting pattern must contain ?1 and ?2 placeholders for the arguments.- Overrides:
castPattern
in classDialect
- Parameters:
from
- aCastType
indicating the type of the value argumentto
- aCastType
indicating the type the value argument is cast to
-
translateExtractField
public String translateExtractField(TemporalUnit unit)
Description copied from class:Dialect
Return the name used to identify the given field as an argument to theextract()
function, or of this dialect's equivalent function.This method does not need to handle
TemporalUnit.NANOSECOND
,TemporalUnit.NATIVE
,TemporalUnit.OFFSET
,TemporalUnit.DATE
,TemporalUnit.TIME
,TemporalUnit.WEEK_OF_YEAR
, norTemporalUnit.WEEK_OF_MONTH
, which are already desugared byExtractFunction
.- Overrides:
translateExtractField
in classDialect
-
extractPattern
public String extractPattern(TemporalUnit unit)
Description copied from class:Dialect
Obtain a pattern for the SQL equivalent to anextract()
function call. The resulting pattern must contain ?1 and ?2 placeholders for the arguments.This method does not need to handle
TemporalUnit.NANOSECOND
,TemporalUnit.NATIVE
,TemporalUnit.OFFSET
,TemporalUnit.DATE
,TemporalUnit.TIME
,TemporalUnit.WEEK_OF_YEAR
, orTemporalUnit.WEEK_OF_MONTH
, which are already desugared byExtractFunction
.- Overrides:
extractPattern
in classDialect
- Parameters:
unit
- the first argument
-
supportsFractionalTimestampArithmetic
public boolean supportsFractionalTimestampArithmetic()
Description copied from class:Dialect
Whether the database supports adding a fractional interval to a timestamp e.g. `timestamp + 0.5 second`- Overrides:
supportsFractionalTimestampArithmetic
in classDialect
-
timestampaddPattern
public String timestampaddPattern(TemporalUnit unit, jakarta.persistence.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 classDialect
- 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
-
timestampdiffPattern
public String timestampdiffPattern(TemporalUnit unit, jakarta.persistence.TemporalType fromTemporalType, jakarta.persistence.TemporalType toTemporalType)
Description copied from class:Dialect
Obtain a pattern for the SQL equivalent to atimestampdiff()
function call. The resulting pattern must contain ?1, ?2, and ?3 placeholders for the arguments.- Overrides:
timestampdiffPattern
in classDialect
- Parameters:
unit
- the first argumentfromTemporalType
- true if the first argument is a timestamp, false if a datetoTemporalType
- true if the second argument is
-
trimPattern
public String trimPattern(TrimSpec specification, char character)
Description copied from class:Dialect
Obtain a pattern for the SQL equivalent to atrim()
function call. The resulting pattern must contain a ?1 placeholder for the argument of typeString
.- Overrides:
trimPattern
in classAbstractTransactSQLDialect
- Parameters:
specification
-leading
ortrailing
character
- the character to trim
-
appendDatetimeFormat
public void appendDatetimeFormat(SqlAppender appender, String format)
Description copied from class:Dialect
Translate the given datetime format string from the pattern language defined by Java'sDateTimeFormatter
to whatever pattern language is understood by the native datetime formatting function for this database (often theto_char()
function).Since it's never possible to translate all of the pattern letter sequences understood by
DateTimeFormatter
, only the following subset of pattern letters is accepted by Hibernate:- G: era
- y: year of era
- Y: year of week-based year
- M: month of year
- w: week of week-based year (ISO week number)
- W: week of month
- E: day of week (name)
- e: day of week (number)
- d: day of month
- D: day of year
- a: AM/PM
- H: hour of day (24 hour time)
- h: hour of AM/PM (12 hour time)
- m: minutes
- s: seconds
- z,Z,x: timezone offset
Appends a pattern accepted by the function that formats dates and times in this dialect to a SQL fragment that is being constructed.
- Overrides:
appendDatetimeFormat
in classDialect
-
buildIdentifierHelper
public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData) throws SQLException
Description copied from class:Dialect
Build the IdentifierHelper indicated by this Dialect for handling identifier conversions. Returningnull
is allowed and indicates that Hibernate should fallback to building a "standard" helper. In the fallback path, any changes made to the IdentifierHelperBuilder during this call will still be incorporated into the built IdentifierHelper. The incoming builder will have the following set:IdentifierHelperBuilder.isGloballyQuoteIdentifiers()
IdentifierHelperBuilder.getUnquotedCaseStrategy()
- initialized to UPPERIdentifierHelperBuilder.getQuotedCaseStrategy()
- initialized to MIXED
- Call
IdentifierHelperBuilder.applyIdentifierCasing(DatabaseMetaData)
- Call
IdentifierHelperBuilder.applyReservedWords(DatabaseMetaData)
- Applies
AnsiSqlKeywords.sql2003()
as reserved words - Applies the {#link #sqlKeywords} collected here as reserved words
- Applies the Dialect's NameQualifierSupport, if it defines one
- Overrides:
buildIdentifierHelper
in classDialect
- Parameters:
builder
- A semi-configured IdentifierHelper builder.dbMetaData
- Access to the metadata returned from the driver if needed and if available. WARNING: may benull
- Returns:
- The IdentifierHelper instance to use, or
null
to indicate Hibernate should use its fallback path - Throws:
SQLException
- Accessing the DatabaseMetaData can throw it. Just re-throw and Hibernate will handle.- See Also:
Dialect.getNameQualifierSupport()
-
getNameQualifierSupport
public NameQualifierSupport getNameQualifierSupport()
Description copied from class:Dialect
By default interpret this based on DatabaseMetaData.- Overrides:
getNameQualifierSupport
in classDialect
- Returns:
- The NameQualifierSupport.
-
-