public class MySQLDatabase extends AbstractJdbcDatabase
caseSensitive, currentDateTimeFunction, dateFunctions, defaultAutoIncrementBy, defaultAutoIncrementStartWith, defaultCatalogName, defaultSchemaName, quotingStrategy, sequenceCurrentValueFunction, sequenceNextValueFunction, unmodifiableDataTypes, unquotedObjectsAreUppercasedCOMPARATOR, 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, validatepublic String getShortName()
Databasepublic String correctObjectName(String name, Class<? extends DatabaseObject> objectType)
DatabasecorrectObjectName in interface DatabasecorrectObjectName in class AbstractJdbcDatabaseprotected String getDefaultDatabaseProductName()
getDefaultDatabaseProductName in class AbstractJdbcDatabasepublic Integer getDefaultPort()
public int getPriority()
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException
DatabaseDatabaseExceptionpublic String getDefaultDriver(String url)
Databasepublic boolean supportsSequences()
AbstractJdbcDatabasesupportsSequences in interface DatabasesupportsSequences in class AbstractJdbcDatabasepublic boolean supportsInitiallyDeferrableColumns()
Databaseprotected boolean mustQuoteObjectName(String objectName, Class<? extends DatabaseObject> objectType)
mustQuoteObjectName in class AbstractJdbcDatabasepublic String getLineComment()
AbstractJdbcDatabasegetLineComment in interface DatabasegetLineComment in class AbstractJdbcDatabaseprotected String getAutoIncrementClause()
getAutoIncrementClause in class AbstractJdbcDatabaseprotected boolean generateAutoIncrementStartWith(BigInteger startWith)
generateAutoIncrementStartWith in class AbstractJdbcDatabasepublic String getTableOptionAutoIncrementStartWithClause(BigInteger startWith)
protected boolean generateAutoIncrementBy(BigInteger incrementBy)
generateAutoIncrementBy in class AbstractJdbcDatabaseprotected String getAutoIncrementOpening()
getAutoIncrementOpening in class AbstractJdbcDatabaseprotected String getAutoIncrementClosing()
getAutoIncrementClosing in class AbstractJdbcDatabaseprotected String getAutoIncrementStartWithClause()
getAutoIncrementStartWithClause in class AbstractJdbcDatabasepublic String getConcatSql(String... values)
DatabasegetConcatSql in interface DatabasegetConcatSql in class AbstractJdbcDatabasepublic boolean supportsTablespaces()
public boolean supportsSchemas()
supportsSchemas in interface DatabasesupportsSchemas in class AbstractJdbcDatabasepublic boolean supportsCatalogs()
supportsCatalogs in interface DatabasesupportsCatalogs in class AbstractJdbcDatabasepublic String escapeIndexName(String catalogName, String schemaName, String indexName)
escapeIndexName in interface DatabaseescapeIndexName in class AbstractJdbcDatabasepublic boolean supportsForeignKeyDisable()
supportsForeignKeyDisable in interface DatabasesupportsForeignKeyDisable in class AbstractJdbcDatabasepublic boolean disableForeignKeyChecks()
throws DatabaseException
disableForeignKeyChecks in interface DatabasedisableForeignKeyChecks in class AbstractJdbcDatabaseDatabaseExceptionpublic void enableForeignKeyChecks()
throws DatabaseException
enableForeignKeyChecks in interface DatabaseenableForeignKeyChecks in class AbstractJdbcDatabaseDatabaseExceptionpublic CatalogAndSchema getSchemaFromJdbcInfo(String rawCatalogName, String rawSchemaName)
getSchemaFromJdbcInfo in class AbstractJdbcDatabasepublic String escapeStringForDatabase(String string)
escapeStringForDatabase in interface DatabaseescapeStringForDatabase in class AbstractJdbcDatabasepublic boolean createsIndexesForForeignKeys()
createsIndexesForForeignKeys in interface DatabasecreatesIndexesForForeignKeys in class AbstractJdbcDatabasepublic boolean isReservedWord(String string)
isReservedWord in interface DatabaseisReservedWord in class AbstractJdbcDatabasepublic int getDatabasePatchVersion()
throws DatabaseException
DatabaseExceptionpublic Boolean hasBugJdbcConstraintsDeferrable() throws DatabaseException
DatabaseExceptionprotected Boolean getHasJdbcConstraintDeferrableBug()
protected void setHasJdbcConstraintDeferrableBug(Boolean hasJdbcConstraintDeferrableBug)
public int getMaxFractionalDigitsForTimestamp()
AbstractJdbcDatabasegetMaxFractionalDigitsForTimestamp in interface DatabasegetMaxFractionalDigitsForTimestamp in class AbstractJdbcDatabaseprotected String getMinimumVersionForFractionalDigitsForTimestamp()
protected String getQuotingStartCharacter()
getQuotingStartCharacter in class AbstractJdbcDatabaseprotected String getQuotingEndCharacter()
getQuotingEndCharacter in class AbstractJdbcDatabasepublic 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 DatabasegetDefaultFractionalDigitsForTimestamp in class AbstractJdbcDatabaseCopyright © 2019 Liquibase.org. All rights reserved.