public class MySQLDatabase extends AbstractJdbcDatabase
Modifier and Type | Field and Description |
---|---|
static Pattern |
PRECISION_PATTERN
Pattern used to extract function precision like 3 in CURRENT_TIMESTAMP(3)
|
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) |
String |
generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
Some function names are placeholders that need to be replaced with the specific database value.
|
protected String |
getAutoIncrementClause() |
protected String |
getAutoIncrementClosing() |
protected String |
getAutoIncrementOpening() |
protected String |
getAutoIncrementStartWithClause() |
String |
getConcatSql(String... values)
Returns SQL to concat the passed values.
|
protected String |
getCurrentDateTimeFunction(int precision) |
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() |
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 |
isCorrectDatabaseImplementation(DatabaseConnection conn)
Is this AbstractDatabase subclass the correct one to use for the given connection.
|
boolean |
isMinimumMySQLVersion(String minimumVersion)
Check to see if this instance of a MySQL database is equal to or greater
than the specified version
|
boolean |
isReservedWord(String string) |
protected boolean |
mustQuoteObjectName(String objectName,
Class<? extends DatabaseObject> objectType) |
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() |
void |
warnAboutAlterColumn(String changeName,
Warnings warnings) |
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, 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, isCurrentTimeFunction, 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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getDisplayName
public static final Pattern PRECISION_PATTERN
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 int getMaxFractionalDigitsForTimestamp()
AbstractJdbcDatabase
getMaxFractionalDigitsForTimestamp
in interface Database
getMaxFractionalDigitsForTimestamp
in class AbstractJdbcDatabase
public boolean isMinimumMySQLVersion(String minimumVersion)
minimumVersion
- 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
protected String getCurrentDateTimeFunction(int precision)
public String generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
Database
generateDatabaseFunctionValue
in interface Database
generateDatabaseFunctionValue
in class AbstractJdbcDatabase
databaseFunction
- database function to check.Copyright © 2023 Liquibase.org. All rights reserved.