public class MySQLDatabase extends AbstractJdbcDatabase
caseSensitive, currentDateTimeFunction, dateFunctions, defaultAutoIncrementBy, defaultAutoIncrementStartWith, defaultCatalogName, defaultSchemaName, quotingStrategy, sequenceCurrentValueFunction, sequenceNextValueFunction, unmodifiableDataTypes, unquotedObjectsAreUppercased
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
Constructor and Description |
---|
MySQLDatabase() |
Modifier and Type | Method and Description |
---|---|
String |
correctObjectName(String name,
Class<? extends DatabaseObject> objectType)
Fix the object name to the format the database expects, handling changes in case, etc.
|
boolean |
createsIndexesForForeignKeys() |
boolean |
disableForeignKeyChecks() |
void |
enableForeignKeyChecks() |
String |
escapeIndexName(String catalogName,
String schemaName,
String indexName) |
String |
escapeStringForDatabase(String string) |
protected boolean |
generateAutoIncrementBy(BigInteger incrementBy) |
protected boolean |
generateAutoIncrementStartWith(BigInteger startWith) |
protected String |
getAutoIncrementClause() |
protected String |
getAutoIncrementClosing() |
protected String |
getAutoIncrementOpening() |
protected String |
getAutoIncrementStartWithClause() |
String |
getConcatSql(String... values)
Returns SQL to concat the passed values.
|
int |
getDatabasePatchVersion() |
protected String |
getDefaultDatabaseProductName() |
String |
getDefaultDriver(String url)
If this database understands the given url, return the default driver class name.
|
int |
getDefaultFractionalDigitsForTimestamp()
Returns the default timestamp fractional digits if nothing is specified.
|
Integer |
getDefaultPort() |
protected Boolean |
getHasJdbcConstraintDeferrableBug()
returns true if the JDBC drivers suffers from a bug where constraints are reported as DEFERRABLE, even though
MySQL/MariaDB do not support this feature.
|
String |
getLineComment()
Returns database-specific line comment string.
|
int |
getMaxFractionalDigitsForTimestamp()
Most relational databases support 9 fractional digits, and subclasses must overwrite this method if they
support less than that.
|
protected String |
getMinimumVersionForFractionalDigitsForTimestamp() |
int |
getPriority() |
protected String |
getQuotingEndCharacter() |
protected String |
getQuotingStartCharacter() |
CatalogAndSchema |
getSchemaFromJdbcInfo(String rawCatalogName,
String rawSchemaName) |
String |
getShortName()
Returns an all-lower-case short name of the product.
|
String |
getTableOptionAutoIncrementStartWithClause(BigInteger startWith) |
Boolean |
hasBugJdbcConstraintsDeferrable()
Tests if this MySQL / MariaDB database has a bug where the JDBC driver returns constraints as
DEFERRABLE INITIAL IMMEDIATE even though neither MySQL nor MariaDB support DEFERRABLE CONSTRAINTs at all.
|
boolean |
isCorrectDatabaseImplementation(DatabaseConnection conn)
Is this AbstractDatabase subclass the correct one to use for the given connection.
|
boolean |
isReservedWord(String string) |
protected boolean |
mustQuoteObjectName(String objectName,
Class<? extends DatabaseObject> objectType) |
protected void |
setHasJdbcConstraintDeferrableBug(Boolean hasJdbcConstraintDeferrableBug) |
boolean |
supportsCatalogs() |
boolean |
supportsForeignKeyDisable() |
boolean |
supportsInitiallyDeferrableColumns()
Returns whether this database support initially deferrable columns.
|
boolean |
supportsSchemas() |
boolean |
supportsSequences()
Does the database type support sequence.
|
boolean |
supportsTablespaces() |
addReservedWords, canCreateChangeLogTable, close, commit, correctSchema, correctSchema, dataTypeIsNotModifiable, doesTagExist, dropDatabaseObjects, equals, escapeColumnName, escapeColumnName, escapeColumnNameList, escapeConstraintName, escapeDataTypeName, escapeObjectName, escapeObjectName, escapeSequenceName, escapeTableName, escapeViewName, execute, executeRollbackStatements, executeRollbackStatements, executeStatements, filterRollbackVisitors, generateDatabaseFunctionValue, generatePrimaryKeyName, get, getAutoCommitMode, getAutoIncrementByClause, getAutoIncrementClause, getAutoIncrementClause, getConnection, getConnectionCatalogName, getConnectionSchemaName, getConnectionSchemaNameCallStatement, getContainingObjects, getCurrentDateTimeFunction, getDatabaseChangeLogLockTableName, getDatabaseChangeLogTableName, getDatabaseMajorVersion, getDatabaseMinorVersion, getDatabaseProductName, getDatabaseProductVersion, getDataTypeMaxParameters, getDateFunctions, getDateLiteral, getDateLiteral, getDateLiteral, getDateTimeLiteral, getDefaultCatalogName, getDefaultScaleForNativeDataType, getDefaultSchema, getDefaultSchemaName, getFetchSize, getJdbcCatalogName, getJdbcCatalogName, getJdbcSchemaName, getJdbcSchemaName, getLiquibaseCatalogName, getLiquibaseSchemaName, getLiquibaseTablespaceName, getName, getObjectQuotingStrategy, getOutputDefaultCatalog, getOutputDefaultSchema, getQuotingEndReplacement, getRanChangeSet, getRanChangeSetList, getRanDate, getRunStatus, getSchemaAndCatalogCase, getSystemSchema, getSystemTables, getSystemViews, getTimeLiteral, getViewDefinition, hashCode, isAutoCommit, isCaseSensitive, isDateOnly, isDateTime, isDefaultCatalog, isDefaultSchema, isFunction, isLiquibaseObject, isSafeToRunUpdate, isSystemObject, isSystemView, isTimeOnly, isTimestamp, jdbcCallsCatalogsSchemas, markChangeSetExecStatus, parseDate, quoteObject, removeRanStatus, requiresExplicitNullForColumns, requiresPassword, requiresUsername, resetInternalState, rollback, saveRollbackStatement, saveStatements, set, setAutoCommit, setCanCacheLiquibaseTableInfo, setCaseSensitive, setConnection, setCurrentDateTimeFunction, setDatabaseChangeLogLockTableName, setDatabaseChangeLogTableName, setDefaultCatalogName, setDefaultSchemaName, setLiquibaseCatalogName, setLiquibaseSchemaName, setLiquibaseTablespaceName, setObjectQuotingStrategy, setOutputDefaultCatalog, setOutputDefaultSchema, startsWithNumeric, supportsAutoIncrement, supportsBatchUpdates, supportsCatalogInObjectName, supportsDDLInTransaction, supportsDropTableCascadeConstraints, supportsNotNullConstraintNames, supportsPrimaryKeyNames, supportsRestrictForeignKeys, tag, toString, unescapeDataTypeName, unescapeDataTypeString, validate
public String getShortName()
Database
public String correctObjectName(String name, Class<? extends DatabaseObject> objectType)
Database
correctObjectName
in interface Database
correctObjectName
in class AbstractJdbcDatabase
protected String getDefaultDatabaseProductName()
getDefaultDatabaseProductName
in class AbstractJdbcDatabase
public Integer getDefaultPort()
public int getPriority()
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException
Database
DatabaseException
public String getDefaultDriver(String url)
Database
public boolean supportsSequences()
AbstractJdbcDatabase
supportsSequences
in interface Database
supportsSequences
in class AbstractJdbcDatabase
public boolean supportsInitiallyDeferrableColumns()
Database
protected boolean mustQuoteObjectName(String objectName, Class<? extends DatabaseObject> objectType)
mustQuoteObjectName
in class AbstractJdbcDatabase
public String getLineComment()
AbstractJdbcDatabase
getLineComment
in interface Database
getLineComment
in class AbstractJdbcDatabase
protected String getAutoIncrementClause()
getAutoIncrementClause
in class AbstractJdbcDatabase
protected boolean generateAutoIncrementStartWith(BigInteger startWith)
generateAutoIncrementStartWith
in class AbstractJdbcDatabase
public String getTableOptionAutoIncrementStartWithClause(BigInteger startWith)
protected boolean generateAutoIncrementBy(BigInteger incrementBy)
generateAutoIncrementBy
in class AbstractJdbcDatabase
protected String getAutoIncrementOpening()
getAutoIncrementOpening
in class AbstractJdbcDatabase
protected String getAutoIncrementClosing()
getAutoIncrementClosing
in class AbstractJdbcDatabase
protected String getAutoIncrementStartWithClause()
getAutoIncrementStartWithClause
in class AbstractJdbcDatabase
public String getConcatSql(String... values)
Database
getConcatSql
in interface Database
getConcatSql
in class AbstractJdbcDatabase
public boolean supportsTablespaces()
public boolean supportsSchemas()
supportsSchemas
in interface Database
supportsSchemas
in class AbstractJdbcDatabase
public boolean supportsCatalogs()
supportsCatalogs
in interface Database
supportsCatalogs
in class AbstractJdbcDatabase
public String escapeIndexName(String catalogName, String schemaName, String indexName)
escapeIndexName
in interface Database
escapeIndexName
in class AbstractJdbcDatabase
public boolean supportsForeignKeyDisable()
supportsForeignKeyDisable
in interface Database
supportsForeignKeyDisable
in class AbstractJdbcDatabase
public boolean disableForeignKeyChecks() throws DatabaseException
disableForeignKeyChecks
in interface Database
disableForeignKeyChecks
in class AbstractJdbcDatabase
DatabaseException
public void enableForeignKeyChecks() throws DatabaseException
enableForeignKeyChecks
in interface Database
enableForeignKeyChecks
in class AbstractJdbcDatabase
DatabaseException
public CatalogAndSchema getSchemaFromJdbcInfo(String rawCatalogName, String rawSchemaName)
getSchemaFromJdbcInfo
in class AbstractJdbcDatabase
public String escapeStringForDatabase(String string)
escapeStringForDatabase
in interface Database
escapeStringForDatabase
in class AbstractJdbcDatabase
public boolean createsIndexesForForeignKeys()
createsIndexesForForeignKeys
in interface Database
createsIndexesForForeignKeys
in class AbstractJdbcDatabase
public boolean isReservedWord(String string)
isReservedWord
in interface Database
isReservedWord
in class AbstractJdbcDatabase
public int getDatabasePatchVersion() throws DatabaseException
DatabaseException
public Boolean hasBugJdbcConstraintsDeferrable() throws DatabaseException
DatabaseException
protected Boolean getHasJdbcConstraintDeferrableBug()
protected void setHasJdbcConstraintDeferrableBug(Boolean hasJdbcConstraintDeferrableBug)
public int getMaxFractionalDigitsForTimestamp()
AbstractJdbcDatabase
getMaxFractionalDigitsForTimestamp
in interface Database
getMaxFractionalDigitsForTimestamp
in class AbstractJdbcDatabase
protected String getMinimumVersionForFractionalDigitsForTimestamp()
protected String getQuotingStartCharacter()
getQuotingStartCharacter
in class AbstractJdbcDatabase
protected String getQuotingEndCharacter()
getQuotingEndCharacter
in class AbstractJdbcDatabase
public int getDefaultFractionalDigitsForTimestamp()
Returns the default timestamp fractional digits if nothing is specified.
https://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.html : "The fsp value, if given, must be in the range 0 to 6. A value of 0 signifies that there is no fractional part. If omitted, the default precision is 0. (This differs from the STANDARD SQL default of 6, for compatibility with previous MySQL versions.)"getDefaultFractionalDigitsForTimestamp
in interface Database
getDefaultFractionalDigitsForTimestamp
in class AbstractJdbcDatabase
Copyright © 2020 Liquibase.org. All rights reserved.