- All Implemented Interfaces:
Dialect
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic enumNested classes/interfaces inherited from class org.seasar.doma.jdbc.dialect.StandardDialect
StandardDialect.StandardCriteriaBuilder, StandardDialect.StandardExpressionFunctions, StandardDialect.StandardJdbcMappingVisitor, StandardDialect.StandardScriptBlockContext, StandardDialect.StandardSqlLogFormattingVisitor -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final charthe quotation mark of the endstatic final MysqlDialect.MySqlVersionprotected static final charthe quotation mark of the startthe set of SQLState code that represents unique violationprotected final MysqlDialect.MySqlVersionFields inherited from class org.seasar.doma.jdbc.dialect.StandardDialect
expressionFunctions, jdbcMappingVisitor, sqlLogFormattingVisitor, UNIQUE_CONSTRAINT_VIOLATION_STATE_CODES -
Constructor Summary
ConstructorsConstructorDescriptionMysqlDialect(ExpressionFunctions expressionFunctions) MysqlDialect(ExpressionFunctions expressionFunctions, MysqlDialect.MySqlVersion version) MysqlDialect(MysqlDialect.MySqlVersion version) MysqlDialect(JdbcMappingVisitor jdbcMappingVisitor) MysqlDialect(JdbcMappingVisitor jdbcMappingVisitor, MysqlDialect.MySqlVersion version) MysqlDialect(JdbcMappingVisitor jdbcMappingVisitor, SqlLogFormattingVisitor sqlLogFormattingVisitor) MysqlDialect(JdbcMappingVisitor jdbcMappingVisitor, SqlLogFormattingVisitor sqlLogFormattingVisitor, ExpressionFunctions expressionFunctions) MysqlDialect(JdbcMappingVisitor jdbcMappingVisitor, SqlLogFormattingVisitor sqlLogFormattingVisitor, ExpressionFunctions expressionFunctions, MysqlDialect.MySqlVersion version) MysqlDialect(JdbcMappingVisitor jdbcMappingVisitor, SqlLogFormattingVisitor sqlLogFormattingVisitor, MysqlDialect.MySqlVersion version) MysqlDialect(SqlLogFormattingVisitor sqlLogFormattingVisitor) MysqlDialect(SqlLogFormattingVisitor sqlLogFormattingVisitor, MysqlDialect.MySqlVersion version) -
Method Summary
Modifier and TypeMethodDescriptionapplyQuote(String name) Encloses the name with quotation marks.Creates the context object to process an SQL block in a script.Returns the criteria builder for this dialect.getName()Returns the name of this dialect.Returns the delimiter that is used as the end of an SQL block in a script.getUpsertAssembler(UpsertAssemblerContext context) Returns the UpsertAssembler implementation for the given context.booleanisUniqueConstraintViolated(SQLException sqlException) Determines whether the given SQLException represents a unique constraint violation.booleanDetermines whether this object supports alias reference in DELETE clause as follows:booleanDetermines whether this dialect supports retrieving auto-generated keys viaStatement.getGeneratedKeys().booleanDetermines whether this dialect supports retrieving generated values from batch executions.booleanDetermines whether this dialect supports the IDENTITY column.booleanDetermines if this dialect supports the SQL RETURNING clause in database operations.booleansupportsSelectForUpdate(SelectForUpdateType type, boolean withTargets) Determines whether this dialect supports pessimistic locking with the specified options.protected SqlNodetoCountCalculatingSqlNode(SqlNode sqlNode) protected SqlNodetoCountGettingSqlNode(SqlNode sqlNode) protected SqlNodetoForUpdateSqlNode(SqlNode sqlNode, SelectForUpdateType forUpdateType, int waitSeconds, String... aliases) protected SqlNodetoPagingSqlNode(SqlNode sqlNode, long offset, long limit) Methods inherited from class org.seasar.doma.jdbc.dialect.StandardDialect
getAutoGeneratedKeysType, getCauseSQLException, getDeleteAssembler, getErrorCode, getExpressionFunctions, getIdentityReservationSql, getIdentitySelectSql, getInsertAssembler, getJdbcMappingVisitor, getMultiInsertAssembler, getResultSetType, getRootCause, getSequenceNextValSql, getSqlLogFormattingVisitor, getSQLState, getUpdateAssembler, includesIdentityColumn, removeQuote, supportsBatchUpdateResults, supportsIdentityReservation, supportsResultSetReturningAsOutParameter, supportsSequence, transformSelectSqlNode, transformSelectSqlNodeForGettingCountMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.seasar.doma.jdbc.dialect.Dialect
includesIdentityColumn, supportsAliasInDeleteStatement, supportsAliasInUpdateClause, supportsAliasInUpdateStatement, supportsAutoIncrementWhenInsertingMultipleRows, supportsModOperator, supportsMultiRowInsertStatement, supportsParenthesesForSetOperands, supportsUpsertEmulationWithMergeStatement
-
Field Details
-
UNIQUE_CONSTRAINT_VIOLATION_ERROR_CODES
the set of SQLState code that represents unique violation -
OPEN_QUOTE
protected static final char OPEN_QUOTEthe quotation mark of the start- See Also:
-
CLOSE_QUOTE
protected static final char CLOSE_QUOTEthe quotation mark of the end- See Also:
-
DEFAULT_VERSION
-
version
-
-
Constructor Details
-
MysqlDialect
public MysqlDialect() -
MysqlDialect
-
MysqlDialect
-
MysqlDialect
-
MysqlDialect
-
MysqlDialect
public MysqlDialect(SqlLogFormattingVisitor sqlLogFormattingVisitor, MysqlDialect.MySqlVersion version) -
MysqlDialect
-
MysqlDialect
-
MysqlDialect
public MysqlDialect(JdbcMappingVisitor jdbcMappingVisitor, SqlLogFormattingVisitor sqlLogFormattingVisitor) -
MysqlDialect
public MysqlDialect(JdbcMappingVisitor jdbcMappingVisitor, SqlLogFormattingVisitor sqlLogFormattingVisitor, MysqlDialect.MySqlVersion version) -
MysqlDialect
public MysqlDialect(JdbcMappingVisitor jdbcMappingVisitor, SqlLogFormattingVisitor sqlLogFormattingVisitor, ExpressionFunctions expressionFunctions) -
MysqlDialect
public MysqlDialect(JdbcMappingVisitor jdbcMappingVisitor, SqlLogFormattingVisitor sqlLogFormattingVisitor, ExpressionFunctions expressionFunctions, MysqlDialect.MySqlVersion version)
-
-
Method Details
-
getName
Description copied from interface:DialectReturns the name of this dialect.The dialect name typically identifies the database system that this dialect supports. This name can be used for logging, debugging, or to make decisions based on the specific database being used.
Each dialect implementation should return a unique and descriptive name.
- Specified by:
getNamein interfaceDialect- Overrides:
getNamein classStandardDialect- Returns:
- the name of this dialect
-
isUniqueConstraintViolated
Description copied from interface:DialectDetermines whether the given SQLException represents a unique constraint violation.Different database systems use different error codes and states to indicate unique constraint violations. This method abstracts these differences.
- Specified by:
isUniqueConstraintViolatedin interfaceDialect- Overrides:
isUniqueConstraintViolatedin classStandardDialect- Parameters:
sqlException- the SQL exception to analyze- Returns:
trueif the exception represents a unique constraint violation,falseotherwise
-
supportsAutoGeneratedKeys
public boolean supportsAutoGeneratedKeys()Description copied from interface:DialectDetermines whether this dialect supports retrieving auto-generated keys viaStatement.getGeneratedKeys().This feature allows retrieving values that were automatically generated during an insert operation, such as identity column values, without executing a separate query.
- Specified by:
supportsAutoGeneratedKeysin interfaceDialect- Overrides:
supportsAutoGeneratedKeysin classStandardDialect- Returns:
trueif this dialect supports retrieving auto-generated keys,falseotherwise
-
supportsIdentity
public boolean supportsIdentity()Description copied from interface:DialectDetermines whether this dialect supports the IDENTITY column.An IDENTITY column is a column that automatically generates a unique value for each row when data is inserted. The exact implementation varies by database system.
- Specified by:
supportsIdentityin interfaceDialect- Overrides:
supportsIdentityin classStandardDialect- Returns:
trueif this dialect supports IDENTITY columns,falseotherwise
-
supportsSelectForUpdate
Description copied from interface:DialectDetermines whether this dialect supports pessimistic locking with the specified options.Pessimistic locking (SELECT FOR UPDATE) prevents other transactions from modifying selected rows. Different database systems support different variations of this feature.
- Specified by:
supportsSelectForUpdatein interfaceDialect- Overrides:
supportsSelectForUpdatein classStandardDialect- Parameters:
type- the type of pessimistic locking (e.g., standard FOR UPDATE, NOWAIT, WAIT)withTargets-trueif specific columns are targeted for locking,falsefor row-level locking- Returns:
trueif this dialect supports the specified locking options,falseotherwise
-
supportsAliasInDeleteClause
public boolean supportsAliasInDeleteClause()Description copied from interface:DialectDetermines whether this object supports alias reference in DELETE clause as follows:DELETE t FROM employee t
- Returns:
true, if this object supports it
-
supportsBatchExecutionReturningGeneratedValues
public boolean supportsBatchExecutionReturningGeneratedValues()Description copied from interface:DialectDetermines whether this dialect supports retrieving generated values from batch executions.Some database systems can return auto-generated values (like identity columns) even when executing statements in batch mode, while others cannot.
The default implementation returns
false.- Returns:
trueif this dialect supports retrieving generated values from batch executions,falseotherwise
-
toCountCalculatingSqlNode
- Overrides:
toCountCalculatingSqlNodein classStandardDialect
-
toPagingSqlNode
- Overrides:
toPagingSqlNodein classStandardDialect
-
toForUpdateSqlNode
protected SqlNode toForUpdateSqlNode(SqlNode sqlNode, SelectForUpdateType forUpdateType, int waitSeconds, String... aliases) - Overrides:
toForUpdateSqlNodein classStandardDialect
-
toCountGettingSqlNode
- Overrides:
toCountGettingSqlNodein classStandardDialect
-
getScriptBlockDelimiter
Description copied from interface:DialectReturns the delimiter that is used as the end of an SQL block in a script.- Specified by:
getScriptBlockDelimiterin interfaceDialect- Overrides:
getScriptBlockDelimiterin classStandardDialect- Returns:
- the delimiter
-
createScriptBlockContext
Description copied from interface:DialectCreates the context object to process an SQL block in a script.- Specified by:
createScriptBlockContextin interfaceDialect- Overrides:
createScriptBlockContextin classStandardDialect- Returns:
- the context object
-
applyQuote
Description copied from interface:DialectEncloses the name with quotation marks.- Specified by:
applyQuotein interfaceDialect- Overrides:
applyQuotein classStandardDialect- Parameters:
name- the name of a database object such as a table, a column, and so on- Returns:
- the name that is enclosed with quotation marks
-
getCriteriaBuilder
Description copied from interface:DialectReturns the criteria builder for this dialect.The criteria builder is used to construct SQL queries using the criteria API, which provides a type-safe way to build queries programmatically. The returned builder will generate SQL that is compatible with the specific database dialect.
- Specified by:
getCriteriaBuilderin interfaceDialect- Overrides:
getCriteriaBuilderin classStandardDialect- Returns:
- the criteria builder for this dialect
-
getUpsertAssembler
Description copied from interface:DialectReturns the UpsertAssembler implementation for the given context.- Specified by:
getUpsertAssemblerin interfaceDialect- Overrides:
getUpsertAssemblerin classStandardDialect- Parameters:
context- the UpsertAssemblerContext object- Returns:
- the UpsertAssembler object for the given context
-
supportsReturning
public boolean supportsReturning()Description copied from interface:DialectDetermines if this dialect supports the SQL RETURNING clause in database operations.The RETURNING clause allows a DML statement (INSERT, UPDATE, DELETE) to return data from rows that were affected by the operation. This feature is particularly useful for retrieving auto-generated values or updated columns in a single database operation, without requiring a separate SELECT statement.
The default implementation returns
true, but dialect implementations for databases that don't support this feature should override this method to returnfalse.- Returns:
trueif the RETURNING clause is supported by this dialect,falseotherwise
-