public class MySQLDialect extends Dialect
CLOSED_QUOTE, DEFAULT_BATCH_SIZE, LEGACY_LOB_MERGE_STRATEGY, NEW_LOCATOR_LOB_MERGE_STRATEGY, NO_BATCH, QUOTE, STANDARD_DEFAULT_BATCH_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGY
Constructor and Description |
---|
MySQLDialect()
Constructs a MySQLDialect
|
Modifier and Type | Method and Description |
---|---|
boolean |
areStringComparisonsCaseInsensitive()
Are string comparisons implicitly case insensitive.
|
SQLExceptionConversionDelegate |
buildSQLExceptionConversionDelegate()
Build an instance of a
SQLExceptionConversionDelegate for
interpreting dialect-specific error or SQLState codes. |
boolean |
canCreateCatalog()
Does this dialect support catalog creation?
|
boolean |
canCreateSchema()
Does this dialect support schema creation?
|
char |
closeQuote()
The character specific to this dialect used to close a quoted identifier.
|
boolean |
dropConstraints()
Do we need to drop constraints before dropping tables in this dialect?
|
protected String |
escapeLiteral(String literal)
Escape String literal.
|
protected String |
fixedPointNumberCastTarget()
Determine the cast target for
Types.NUMERIC |
protected String |
floatingPointNumberCastTarget()
Determine the cast target for
Types.FLOAT and Types.REAL (DOUBLE) |
String |
getAddColumnString()
The syntax used to add a column to a table (optional).
|
String |
getAddForeignKeyConstraintString(String constraintName,
String[] foreignKey,
String referencedTable,
String[] primaryKey,
boolean referencesPrimaryKey)
The syntax used to add a foreign key constraint to a table.
|
String |
getCastTypeName(int code)
Get the name of the database type appropriate for casting operations
(via the CAST() SQL function) for the given
Types typecode. |
String |
getColumnComment(String comment)
Get the comment into a form supported for column definition.
|
String[] |
getCreateCatalogCommand(String catalogName)
Get the SQL command used to create the named catalog
|
String[] |
getCreateSchemaCommand(String schemaName)
Get the SQL command used to create the named schema
|
String |
getCurrentTimestampSelectString()
Retrieve the command used to retrieve the current timestamp from the
database.
|
MultiTableBulkIdStrategy |
getDefaultMultiTableBulkIdStrategy() |
protected MySQLStorageEngine |
getDefaultMySQLStorageEngine() |
String[] |
getDropCatalogCommand(String catalogName)
Get the SQL command used to drop the named catalog
|
String |
getDropForeignKeyString() |
String[] |
getDropSchemaCommand(String schemaName)
Get the SQL command used to drop the named schema
|
protected String |
getEngineKeyword() |
String |
getForUpdateString()
Get the string to append to SELECT statements to acquire locks
for this dialect.
|
IdentityColumnSupport |
getIdentityColumnSupport()
Get the appropriate
IdentityColumnSupport |
LimitHandler |
getLimitHandler()
Returns the delegate managing LIMIT clause.
|
String |
getLimitString(String sql,
boolean hasOffset)
Apply s limit clause to the query.
|
String |
getNotExpression(String expression)
Negate an expression
|
String |
getReadLockString(int timeout)
Get the string to append to SELECT statements to acquire READ locks
for this dialect.
|
ResultSet |
getResultSet(CallableStatement ps)
Given a callable statement previously processed by
Dialect.registerResultSetOutParameter(java.sql.CallableStatement, int) ,
extract the ResultSet from the OUT parameter. |
String |
getSelectGUIDString()
Get the command used to select a GUID from the underlying database.
|
String |
getTableComment(String comment)
Get the comment into a form supported for table definition.
|
String |
getTableTypeString() |
UniqueDelegate |
getUniqueDelegate()
Get the UniqueDelegate supported by this dialect
|
String |
getWriteLockString(int timeout)
Get the string to append to SELECT statements to acquire WRITE locks
for this dialect.
|
boolean |
hasSelfReferentialForeignKeyBug()
Does the database/driver have bug in deleting rows that refer to other rows being deleted in the same query?
|
boolean |
isCurrentTimestampSelectStringCallable()
Should the value returned by
Dialect.getCurrentTimestampSelectString()
be treated as callable. |
boolean |
isJdbcLogWarningsEnabledByDefault()
Does the fetching JDBC statement warning for logging is enabled by default
|
char |
openQuote()
The character specific to this dialect used to begin a quoted identifier.
|
boolean |
qualifyIndexName()
Do we need to qualify index names with the schema name?
|
int |
registerResultSetOutParameter(CallableStatement statement,
int col)
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of
returning
ResultSet *by position*. |
protected void |
registerVarcharTypes() |
String |
renderOrderByElement(String expression,
String collation,
String order,
NullPrecedence nulls)
Renders an ordering fragment
|
protected String |
smallIntegerCastTarget()
|
boolean |
supportsCascadeDelete()
Does this dialect support cascaded delete on foreign key definitions?
|
boolean |
supportsCurrentTimestampSelection()
Does this dialect support a way to retrieve the database's current
timestamp value?
|
boolean |
supportsEmptyInList()
Does this dialect support empty IN lists?
For example, is [where XYZ in ()] a supported construct?
|
boolean |
supportsIfExistsBeforeTableName()
For dropping a table, can the phrase "if exists" be applied before the table name?
NOTE : Only one or the other (or neither) of this and
Dialect.supportsIfExistsAfterTableName() should return true |
boolean |
supportsLimit()
Does this dialect support some form of limiting query results
via a SQL clause?
|
boolean |
supportsLobValueChangePropogation()
Does the dialect support propagating changes to LOB
values back to the database? Talking about mutating the
internal value of the locator as opposed to supplying a new
locator instance...
|
boolean |
supportsLockTimeouts()
Informational metadata about whether this dialect is known to support
specifying timeouts for requested lock acquisitions.
|
boolean |
supportsRowValueConstructorSyntax()
Is this dialect known to support what ANSI-SQL terms "row value
constructor" syntax; sometimes called tuple syntax.
|
boolean |
supportsSubqueryOnMutatingTable()
Does this dialect support referencing the table being mutated in
a subquery.
|
addSqlHintOrComment, appendLockHint, appendLockHint, applyLocksToSql, augmentRecognizedTableTypes, bindLimitParametersFirst, bindLimitParametersInReverseOrder, buildIdentifierHelper, buildSQLExceptionConverter, cast, cast, cast, contributeTypes, convertToFirstRowValue, createCaseFragment, createOuterJoinFragment, defaultScrollMode, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, forceLimitUsage, forceLobAsLastValue, forUpdateOfColumns, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAddUniqueConstraintString, getAlterTableString, getAuxiliaryDatabaseObjectExporter, getCallableStatementSupport, getCascadeConstraintsString, getCaseInsensitiveLike, getColumnAliasExtractor, getCreateMultisetTableString, getCreateSequenceString, getCreateSequenceString, getCreateSequenceStrings, getCreateSequenceStrings, getCreateTableString, getCrossJoinSeparator, getCurrentSchemaCommand, getCurrentTimestampSQLFunctionName, getDefaultBatchLoadSizingStrategy, getDefaultProperties, getDialect, getDialect, getDropSequenceString, getDropSequenceStrings, getDropTableString, getForeignKeyExporter, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateSkipLockedString, getForUpdateSkipLockedString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getFunctions, getHibernateTypeName, getHibernateTypeName, getIndexExporter, getInExpressionCountLimit, getKeywords, getLimitString, getLobMergeStrategy, getLockingStrategy, getLowercaseFunction, getMaxAliasLength, getNameQualifierSupport, getNativeIdentifierGeneratorClass, getNativeIdentifierGeneratorStrategy, getNoColumnsInsertString, getNullColumnString, getQueryHintString, getQueryHintString, getQuerySequencesString, getReadLockString, getResultSet, getResultSet, getSchemaNameResolver, getSelectClauseNullString, getSelectSequenceNextValString, getSequenceExporter, getSequenceInformationExtractor, getSequenceNextValString, getSqlTypeDescriptorOverride, getTableExporter, getTypeName, getTypeName, getUniqueKeyExporter, getViolatedConstraintNameExtracter, getWriteLockString, hasAlterTable, inlineLiteral, isLegacyLimitHandlerBehaviorEnabled, isLockTimeoutParameterized, isTypeNameRegistered, prependComment, quote, registerColumnType, registerColumnType, registerFunction, registerHibernateType, registerHibernateType, registerKeyword, registerResultSetOutParameter, remapSqlTypeDescriptor, replaceResultVariableInOrderByClauseWithPosition, requiresCastingOfParametersInSelectClause, requiresParensForTupleDistinctCounts, supportsBindAsCallableArgument, supportsCaseInsensitiveLike, supportsCircularCascadeDeleteConstraints, supportsColumnCheck, supportsCommentOn, supportsExistsInSelect, supportsExpectedLobUsagePattern, supportsIfExistsAfterAlterTable, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsBeforeConstraintName, supportsLimitOffset, supportsNamedParameters, supportsNationalizedTypes, supportsNonQueryWithCTE, supportsNotNullUnique, supportsNoWait, supportsOuterJoinForUpdate, supportsParametersInInsertSelect, supportsPartitionBy, supportsPooledSequences, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsRowValueConstructorSyntaxInInList, supportsSequences, supportsSkipLocked, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTupleCounts, supportsTupleDistinctCounts, supportsTuplesInSubqueries, supportsUnboundedLobLocatorMaterialization, supportsUnionAll, supportsUnique, supportsUniqueConstraintInCreateAlterTable, supportsValuesList, supportsVariableLimit, toBooleanValueString, toString, transformSelectString, useFollowOnLocking, useFollowOnLocking, useInputStreamToInsertBlob, useMaxForLimit
protected void registerVarcharTypes()
public String getAddColumnString()
Dialect
getAddColumnString
in class Dialect
public boolean qualifyIndexName()
Dialect
qualifyIndexName
in class Dialect
public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey)
Dialect
getAddForeignKeyConstraintString
in class Dialect
constraintName
- The FK constraint name.foreignKey
- The names of the columns comprising the FKreferencedTable
- The table referenced by the FKprimaryKey
- The explicit columns in the referencedTable referenced
by this FK.referencesPrimaryKey
- if false, constraint should be
explicit about which column names the constraint refers topublic boolean supportsLimit()
Dialect
supportsLimit
in class Dialect
public String getDropForeignKeyString()
getDropForeignKeyString
in class Dialect
public LimitHandler getLimitHandler()
Dialect
getLimitHandler
in class Dialect
public String getLimitString(String sql, boolean hasOffset)
Dialect
variable
limit clauses when they support limits. Thus, when building the
select command we do not actually need to know the limit or the offest
since we will just be using placeholders.
Here we do still pass along whether or not an offset was specified
so that dialects not supporting offsets can generate proper exceptions.
In general, dialects will override one or the other of this method and
Dialect.getLimitString(String, int, int)
.getLimitString
in class Dialect
sql
- The query to which to apply the limit.hasOffset
- Is the query requesting an offset?public char closeQuote()
Dialect
closeQuote
in class Dialect
public char openQuote()
Dialect
public boolean canCreateCatalog()
Dialect
canCreateCatalog
in class Dialect
public String[] getCreateCatalogCommand(String catalogName)
Dialect
getCreateCatalogCommand
in class Dialect
catalogName
- The name of the catalog to be created.public String[] getDropCatalogCommand(String catalogName)
Dialect
getDropCatalogCommand
in class Dialect
catalogName
- The name of the catalog to be dropped.public boolean canCreateSchema()
Dialect
canCreateSchema
in class Dialect
public String[] getCreateSchemaCommand(String schemaName)
Dialect
getCreateSchemaCommand
in class Dialect
schemaName
- The name of the schema to be created.public String[] getDropSchemaCommand(String schemaName)
Dialect
getDropSchemaCommand
in class Dialect
schemaName
- The name of the schema to be dropped.public boolean supportsIfExistsBeforeTableName()
Dialect
Dialect.supportsIfExistsAfterTableName()
should return truesupportsIfExistsBeforeTableName
in class Dialect
true
if the "if exists" can be applied before the table namepublic String getSelectGUIDString()
Dialect
getSelectGUIDString
in class Dialect
public String getTableComment(String comment)
Dialect
getTableComment
in class Dialect
comment
- The comment to applypublic String getColumnComment(String comment)
Dialect
getColumnComment
in class Dialect
comment
- The comment to applypublic MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy()
getDefaultMultiTableBulkIdStrategy
in class Dialect
public String getCastTypeName(int code)
Dialect
Types
typecode.getCastTypeName
in class Dialect
code
- The Types
typecodeprotected String smallIntegerCastTarget()
protected String floatingPointNumberCastTarget()
Types.FLOAT
and Types.REAL
(DOUBLE)protected String fixedPointNumberCastTarget()
Types.NUMERIC
public boolean supportsCurrentTimestampSelection()
Dialect
supportsCurrentTimestampSelection
in class Dialect
public boolean isCurrentTimestampSelectStringCallable()
Dialect
Dialect.getCurrentTimestampSelectString()
be treated as callable. Typically this indicates that JDBC escape
syntax is being used...isCurrentTimestampSelectStringCallable
in class Dialect
Dialect.getCurrentTimestampSelectString()
return
is callable; false otherwise.public String getCurrentTimestampSelectString()
Dialect
getCurrentTimestampSelectString
in class Dialect
public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException
Dialect
ResultSet
*by position*. Pre-Java 8, registering such ResultSet-returning
parameters varied greatly across database and drivers; hence its inclusion as part of the Dialect contract.registerResultSetOutParameter
in class Dialect
statement
- The callable statement.col
- The bind position at which to register the output param.SQLException
- Indicates problems registering the param.public ResultSet getResultSet(CallableStatement ps) throws SQLException
Dialect
Dialect.registerResultSetOutParameter(java.sql.CallableStatement, int)
,
extract the ResultSet
from the OUT parameter.getResultSet
in class Dialect
ps
- The callable statement.SQLException
- Indicates problems extracting the result set.public UniqueDelegate getUniqueDelegate()
Dialect
getUniqueDelegate
in class Dialect
public boolean supportsRowValueConstructorSyntax()
Dialect
supportsRowValueConstructorSyntax
in class Dialect
public String renderOrderByElement(String expression, String collation, String order, NullPrecedence nulls)
Dialect
renderOrderByElement
in class Dialect
expression
- The SQL order expression. In case of @OrderBy
annotation user receives property placeholder
(e.g. attribute name enclosed in '{' and '}' signs).collation
- Collation string in format collate IDENTIFIER
, or null
if expression has not been explicitly specified.order
- Order direction. Possible values: asc
, desc
, or null
if expression has not been explicitly specified.nulls
- Nulls precedence. Default value: NullPrecedence.NONE
.ORDER BY
clause.public String getForUpdateString()
Dialect
getForUpdateString
in class Dialect
public String getWriteLockString(int timeout)
Dialect
getWriteLockString
in class Dialect
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.public String getReadLockString(int timeout)
Dialect
getReadLockString
in class Dialect
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.public boolean supportsEmptyInList()
Dialect
supportsEmptyInList
in class Dialect
public boolean areStringComparisonsCaseInsensitive()
Dialect
areStringComparisonsCaseInsensitive
in class Dialect
public boolean supportsLobValueChangePropogation()
Dialect
Blob.setBinaryStream(long)
,
Blob.setBytes(long, byte[])
,
Blob.setBytes(long, byte[], int, int)
,
or Blob.truncate(long)
.
For CLOBs, the internal value might be changed by:
Clob.setAsciiStream(long)
,
Clob.setCharacterStream(long)
,
Clob.setString(long, String)
,
Clob.setString(long, String, int, int)
,
or Clob.truncate(long)
.
NOTE : I do not know the correct answer currently for
databases which (1) are not part of the cruise control process
or (2) do not Dialect.supportsExpectedLobUsagePattern()
.supportsLobValueChangePropogation
in class Dialect
public boolean supportsSubqueryOnMutatingTable()
Dialect
supportsSubqueryOnMutatingTable
in class Dialect
public boolean supportsLockTimeouts()
Dialect
supportsLockTimeouts
in class Dialect
public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate()
Dialect
SQLExceptionConversionDelegate
for
interpreting dialect-specific error or SQLState codes.
When Dialect.buildSQLExceptionConverter()
returns null, the default
SQLExceptionConverter
is used to interpret SQLState and
error codes. If this method is overridden to return a non-null value,
the default SQLExceptionConverter
will use the returned
SQLExceptionConversionDelegate
in addition to the following
standard delegates:
buildSQLExceptionConversionDelegate
in class Dialect
public String getNotExpression(String expression)
Dialect
getNotExpression
in class Dialect
expression
- The expression to negatepublic IdentityColumnSupport getIdentityColumnSupport()
Dialect
IdentityColumnSupport
getIdentityColumnSupport
in class Dialect
public boolean isJdbcLogWarningsEnabledByDefault()
Dialect
isJdbcLogWarningsEnabledByDefault
in class Dialect
public boolean supportsCascadeDelete()
Dialect
supportsCascadeDelete
in class Dialect
true
indicates that the dialect does support cascaded delete on foreign keys.public String getTableTypeString()
getTableTypeString
in class Dialect
protected String getEngineKeyword()
public boolean hasSelfReferentialForeignKeyBug()
Dialect
hasSelfReferentialForeignKeyBug
in class Dialect
true
if the database/driver has this bugpublic boolean dropConstraints()
Dialect
dropConstraints
in class Dialect
protected MySQLStorageEngine getDefaultMySQLStorageEngine()
protected String escapeLiteral(String literal)
Dialect
escapeLiteral
in class Dialect
Copyright © 2019 JBoss by Red Hat. All rights reserved.