Package liquibase.database.core
Class MockDatabase
- java.lang.Object
-
- liquibase.database.core.MockDatabase
-
- All Implemented Interfaces:
AutoCloseable
,Database
,InternalDatabase
,PrioritizedService
public class MockDatabase extends Object implements Database, InternalDatabase
A DBMS that effectively does nothing, but it is useful for tests where everything should work in the same way for all databases.
-
-
Field Summary
-
Fields inherited from interface liquibase.database.Database
COMPLETE_SQL_SCOPE_KEY, databaseChangeLogLockTableName, databaseChangeLogTableName
-
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description MockDatabase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acquireLock()
boolean
acquireLock(Liquibase liquibase)
void
addReservedWords(Collection<String> words)
void
close()
void
commit()
String
convertRequestedSchemaToCatalog(String requestedSchema)
String
convertRequestedSchemaToSchema(String requestedSchema)
String
correctObjectName(String name, Class<? extends DatabaseObject> objectType)
Fix the object name to the format the database expects, handling changes in case, etc.String
correctObjectName(String name, Class<? extends DatabaseObject> objectType, boolean quoteCorrectedName)
CatalogAndSchema
correctSchema(CatalogAndSchema schema)
Returns a new CatalogAndSchema adjusted for this database.boolean
createsIndexesForForeignKeys()
boolean
dataTypeIsNotModifiable(String typeName)
Types like int4 in postgres cannot have a modifier.boolean
disableForeignKeyChecks()
boolean
doesTagExist(String tag)
void
dropDatabaseObjects(CatalogAndSchema schema)
Drops all objects in a specified schema.void
enableForeignKeyChecks()
boolean
equals(DatabaseObject otherObject, Database accordingTo)
String
escapeColumnName(String catalogName, String schemaName, String tableName, String columnName)
Escapes a single column name in a database-dependent manner so reserved words can be used as a column name (i.e.String
escapeColumnName(String catalogName, String schemaName, String tableName, String columnName, boolean quoteNamesThatMayBeFunctions)
Similar toDatabase.escapeColumnName(String, String, String, String)
but allows control over whether function-like names should be left unquoted.String
escapeColumnNameList(String columnNames)
Escapes a list of column names in a database-dependent manner so reserved words can be used as a column name (i.e.String
escapeConstraintName(String constraintName)
String
escapeDataTypeName(String dataTypeName)
String
escapeIndexName(String catalogName, String schemaName, String indexName)
String
escapeObjectName(String objectName, Class<? extends DatabaseObject> objectType)
String
escapeObjectName(String catalogName, String schemaName, String objectName, Class<? extends DatabaseObject> objectType)
String
escapeSequenceName(String catalogName, String schemaName, String sequenceName)
String
escapeStringForDatabase(String string)
String
escapeTableName(String catalogName, String schemaName, String tableName)
String
escapeViewName(String catalogName, String schemaName, String viewName)
void
execute(SqlStatement[] statements, List<SqlVisitor> sqlVisitors)
void
executeRollbackStatements(Change change, List<SqlVisitor> sqlVisitors)
void
executeRollbackStatements(SqlStatement[] statements, List<SqlVisitor> sqlVisitors)
void
executeStatements(Change change, DatabaseChangeLog changeLog, List<SqlVisitor> sqlVisitors)
String
generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
Some function names are placeholders that need to be replaced with the specific database value.String
generatePrimaryKeyName(String tableName)
boolean
getAutoCommitMode()
Auto-commit mode to run inString
getAutoIncrementClause(BigInteger startWith, BigInteger incrementBy, String generationType, Boolean defaultOnNull)
Returns database-specific auto-increment DDL clause.SqlStatement
getCommitSQL()
String
getConcatSql(String... values)
Returns SQL to concat the passed values.DatabaseConnection
getConnection()
String
getConnectionURL()
String
getConnectionUsername()
DatabaseObject[]
getContainingObjects()
String
getCurrentDateTimeFunction()
Returns database-specific function for generating the current date/time.String
getDatabaseChangeLogLockTableName()
String
getDatabaseChangeLogTableName()
int
getDatabaseMajorVersion()
int
getDatabaseMinorVersion()
String
getDatabaseProductName()
Returns the name of the database product according to the underlying database.String
getDatabaseProductName(DatabaseConnection conn)
String
getDatabaseProductVersion()
int
getDataTypeMaxParameters(String dataTypeName)
List<DatabaseFunction>
getDateFunctions()
Returns list of database native date functionsString
getDateLiteral(String isoDate)
String
getDateLiteral(Date date)
String
getDateLiteral(Date defaultDateValue)
String
getDateTimeLiteral(Timestamp timeStamp)
String
getDefaultCatalogName()
String
getDefaultDriver(String url)
If this database understands the given url, return the default driver class name.int
getDefaultFractionalDigitsForTimestamp()
When a TIMESTAMP column without the parameter "number of fractional digits" is created, what is the default value?Integer
getDefaultPort()
Integer
getDefaultScaleForNativeDataType(String nativeDataType)
Returns the default precision for a given native data type, e.g.CatalogAndSchema
getDefaultSchema()
String
getDefaultSchemaName()
String
getDriverName()
Integer
getFetchSize()
String
getJdbcCatalogName(CatalogAndSchema schema)
String
getJdbcCatalogName(Schema schema)
String
getJdbcSchemaName(CatalogAndSchema schema)
String
getJdbcSchemaName(Schema schema)
String
getLineComment()
String
getLiquibaseCatalogName()
String
getLiquibaseSchemaName()
String
getLiquibaseTablespaceName()
int
getMaxFractionalDigitsForTimestamp()
Determines the maximum precision (number of fractional digits) for TIMESTAMP columns for the given database.String
getName()
ObjectQuotingStrategy
getObjectQuotingStrategy()
boolean
getOutputDefaultCatalog()
boolean
getOutputDefaultSchema()
Should the schema be included in identifiers even if it is the default schema?int
getPriority()
RanChangeSet
getRanChangeSet(ChangeSet changeSet)
List<RanChangeSet>
getRanChangeSetList()
Returns the ChangeSets that have been run against the current database.Date
getRanDate(ChangeSet changeSet)
ChangeSet.RunStatus
getRunStatus(ChangeSet changeSet)
Returns the run status for the given ChangeSetSchema
getSchema()
CatalogAndSchema.CatalogAndSchemaCase
getSchemaAndCatalogCase()
CatalogAndSchema
getSchemaFromJdbcInfo(String rawCatalogName, String rawSchemaName)
SqlStatement
getSelectChangeLogLockSQL()
String
getShortName()
Returns an all-lower-case short name of the product.String
getSystemSchema()
String
getTimeLiteral(Time time)
String
getViewDefinition(CatalogAndSchema schema, String name)
boolean
isAutoCommit()
boolean
isCaseSensitive()
boolean
isCorrectDatabaseImplementation(DatabaseConnection conn)
Is this AbstractDatabase subclass the correct one to use for the given connection.boolean
isDefaultCatalog(String catalog)
If the database supports catalogs, test if a given catalog name equals to the default catalog of the current logged in user.boolean
isDefaultSchema(String catalog, String schema)
If the database supports schemas, test if a given combination of catalog and schema name equals to the default catalog and schema of the current logged in user.boolean
isFunction(String string)
boolean
isLiquibaseObject(DatabaseObject object)
boolean
isReservedWord(String string)
boolean
isSafeToRunUpdate()
boolean
isSystemObject(DatabaseObject example)
DatabaseChangeLogLock[]
listLocks()
void
markChangeSetExecStatus(ChangeSet changeSet, ChangeSet.ExecType execType)
After the changeset has been ran against the database this method will update the change log table with the information.Date
parseDate(String dateAsString)
void
releaseLock()
void
removeRanStatus(ChangeSet changeSet)
boolean
requiresExplicitNullForColumns()
Does the database require explicit NULL for nullable columns?boolean
requiresPassword()
boolean
requiresUsername()
void
resetInternalState()
void
rollback()
void
saveRollbackStatement(Change change, List<SqlVisitor> sqlVisitors, Writer writer)
void
saveStatements(Change change, List<SqlVisitor> sqlVisitors, Writer writer)
void
setAutoCommit(boolean b)
void
setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo)
void
setCaseSensitive(boolean caseSensitive)
void
setConnection(Connection conn)
void
setConnection(DatabaseConnection conn)
void
setCurrentDateTimeFunction(String function)
void
setDatabaseChangeLogLockTableName(String tableName)
Does nothingvoid
setDatabaseChangeLogTableName(String tableName)
Does nothingvoid
setDefaultCatalogName(String catalogName)
void
setDefaultSchemaName(String schemaName)
void
setLiquibaseCatalogName(String catalogName)
void
setLiquibaseSchemaName(String schemaName)
void
setLiquibaseTablespaceName(String tablespaceName)
void
setObjectQuotingStrategy(ObjectQuotingStrategy quotingStrategy)
void
setOutputDefaultCatalog(boolean outputDefaultCatalog)
void
setOutputDefaultSchema(boolean outputDefaultSchema)
Whether the default schema should be included in generated SQLvoid
setSupportsCatalogs(boolean supportsCatalogs)
void
setSupportsSchemas(boolean supportsSchemas)
void
setSupportsSequences(boolean supportsSequences)
boolean
supportsAutoIncrement()
boolean
supportsBatchUpdates()
Does the database support batched DML (INSERT/UPDATE/DELETE/MERGE/...) statements sent in a single call to the database?boolean
supportsCatalogInObjectName()
boolean
supportsCatalogInObjectName(Class<? extends DatabaseObject> type)
boolean
supportsCatalogs()
boolean
supportsCreateIfNotExists(Class<? extends DatabaseObject> type)
Does the database support the "if not exits" syntax?boolean
supportsDDLInTransaction()
Determines if the database supports DDL within a transaction or not.boolean
supportsDropTableCascadeConstraints()
boolean
supportsForeignKeyDisable()
boolean
supportsInitiallyDeferrableColumns()
Returns whether this database support initially deferrable columns.boolean
supportsNotNullConstraintNames()
Does this database treat NOT NULL as an own kind of CONSTRAINT (in addition of simply being a column property)? This will affect the CONSTRAINT clause SQL generators.boolean
supportsPrimaryKeyNames()
boolean
supportsRestrictForeignKeys()
boolean
supportsSchemas()
boolean
supportsSequences()
boolean
supportsTablespaces()
void
tag(String tagString)
Tags the database changelog with the given string.String
toString()
String
unescapeDataTypeName(String dataTypeName)
String
unescapeDataTypeString(String dataTypeString)
void
updateChecksum(ChangeSet changeSet)
ValidationErrors
validate()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface liquibase.database.Database
addCompleteSqlToScope, afterUpdate, dropDatabaseObjects, failOnDefferable, getDisplayName, supportsDatabaseChangeLogHistory, temporarilySetObjectQuotingStrategy
-
-
-
-
Method Detail
-
getDefaultScaleForNativeDataType
public Integer getDefaultScaleForNativeDataType(String nativeDataType)
Description copied from interface:Database
Returns the default precision for a given native data type, e.g. "datetime2" for Microsoft SQL Server.- Specified by:
getDefaultScaleForNativeDataType
in interfaceDatabase
- Parameters:
nativeDataType
- the name of the native data type (case-insensitive).- Returns:
- The default precision of the native data type, or null if the type is unknown to this database.
-
getPriority
public int getPriority()
- Specified by:
getPriority
in interfacePrioritizedService
-
getSchema
public Schema getSchema()
-
getName
public String getName()
-
getDefaultSchema
public CatalogAndSchema getDefaultSchema()
- Specified by:
getDefaultSchema
in interfaceDatabase
-
getDefaultPort
public Integer getDefaultPort()
- Specified by:
getDefaultPort
in interfaceDatabase
-
getContainingObjects
public DatabaseObject[] getContainingObjects()
-
equals
public boolean equals(DatabaseObject otherObject, Database accordingTo)
-
setCanCacheLiquibaseTableInfo
public void setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo)
- Specified by:
setCanCacheLiquibaseTableInfo
in interfaceDatabase
-
requiresUsername
public boolean requiresUsername()
- Specified by:
requiresUsername
in interfaceDatabase
-
requiresPassword
public boolean requiresPassword()
- Specified by:
requiresPassword
in interfaceDatabase
-
isCorrectDatabaseImplementation
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn)
Description copied from interface:Database
Is this AbstractDatabase subclass the correct one to use for the given connection.- Specified by:
isCorrectDatabaseImplementation
in interfaceDatabase
-
getDefaultDriver
public String getDefaultDriver(String url)
Description copied from interface:Database
If this database understands the given url, return the default driver class name. Otherwise return null.- Specified by:
getDefaultDriver
in interfaceDatabase
-
getConnection
public DatabaseConnection getConnection()
- Specified by:
getConnection
in interfaceDatabase
-
setConnection
public void setConnection(DatabaseConnection conn)
- Specified by:
setConnection
in interfaceDatabase
-
setConnection
public void setConnection(Connection conn)
-
getAutoCommitMode
public boolean getAutoCommitMode()
Description copied from interface:Database
Auto-commit mode to run in- Specified by:
getAutoCommitMode
in interfaceDatabase
-
isAutoCommit
public boolean isAutoCommit()
- Specified by:
isAutoCommit
in interfaceDatabase
-
setAutoCommit
public void setAutoCommit(boolean b)
- Specified by:
setAutoCommit
in interfaceDatabase
-
isCaseSensitive
public boolean isCaseSensitive()
- Specified by:
isCaseSensitive
in interfaceDatabase
-
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive)
-
supportsDDLInTransaction
public boolean supportsDDLInTransaction()
Description copied from interface:Database
Determines if the database supports DDL within a transaction or not.- Specified by:
supportsDDLInTransaction
in interfaceDatabase
- Returns:
- True if the database supports DDL within a transaction, otherwise false.
-
getDatabaseProductName
public String getDatabaseProductName()
Description copied from interface:Database
Returns the name of the database product according to the underlying database.- Specified by:
getDatabaseProductName
in interfaceDatabase
-
getDatabaseProductVersion
public String getDatabaseProductVersion()
- Specified by:
getDatabaseProductVersion
in interfaceDatabase
-
getDatabaseMajorVersion
public int getDatabaseMajorVersion()
- Specified by:
getDatabaseMajorVersion
in interfaceDatabase
-
getDatabaseMinorVersion
public int getDatabaseMinorVersion()
- Specified by:
getDatabaseMinorVersion
in interfaceDatabase
-
getShortName
public String getShortName()
Description copied from interface:Database
Returns an all-lower-case short name of the product. Used for end-user selecting of database type such as the DBMS precondition.- Specified by:
getShortName
in interfaceDatabase
-
getDriverName
public String getDriverName()
-
getConnectionURL
public String getConnectionURL()
-
getConnectionUsername
public String getConnectionUsername()
-
getDefaultCatalogName
public String getDefaultCatalogName()
- Specified by:
getDefaultCatalogName
in interfaceDatabase
-
setDefaultCatalogName
public void setDefaultCatalogName(String catalogName)
- Specified by:
setDefaultCatalogName
in interfaceDatabase
-
getDefaultSchemaName
public String getDefaultSchemaName()
- Specified by:
getDefaultSchemaName
in interfaceDatabase
-
setDefaultSchemaName
public void setDefaultSchemaName(String schemaName)
- Specified by:
setDefaultSchemaName
in interfaceDatabase
-
supportsInitiallyDeferrableColumns
public boolean supportsInitiallyDeferrableColumns()
Description copied from interface:Database
Returns whether this database support initially deferrable columns.- Specified by:
supportsInitiallyDeferrableColumns
in interfaceDatabase
-
supportsSequences
public boolean supportsSequences()
- Specified by:
supportsSequences
in interfaceDatabase
-
setSupportsSequences
public void setSupportsSequences(boolean supportsSequences)
-
supportsDropTableCascadeConstraints
public boolean supportsDropTableCascadeConstraints()
- Specified by:
supportsDropTableCascadeConstraints
in interfaceDatabase
-
supportsAutoIncrement
public boolean supportsAutoIncrement()
- Specified by:
supportsAutoIncrement
in interfaceDatabase
-
getDateLiteral
public String getDateLiteral(String isoDate)
- Specified by:
getDateLiteral
in interfaceDatabase
-
getDateLiteral
public String getDateLiteral(Date date)
- Specified by:
getDateLiteral
in interfaceDatabase
-
getTimeLiteral
public String getTimeLiteral(Time time)
- Specified by:
getTimeLiteral
in interfaceDatabase
-
getDateTimeLiteral
public String getDateTimeLiteral(Timestamp timeStamp)
- Specified by:
getDateTimeLiteral
in interfaceDatabase
-
getCurrentDateTimeFunction
public String getCurrentDateTimeFunction()
Description copied from interface:Database
Returns database-specific function for generating the current date/time.- Specified by:
getCurrentDateTimeFunction
in interfaceDatabase
-
setCurrentDateTimeFunction
public void setCurrentDateTimeFunction(String function)
- Specified by:
setCurrentDateTimeFunction
in interfaceDatabase
-
getLineComment
public String getLineComment()
- Specified by:
getLineComment
in interfaceDatabase
-
getAutoIncrementClause
public String getAutoIncrementClause(BigInteger startWith, BigInteger incrementBy, String generationType, Boolean defaultOnNull)
Description copied from interface:Database
Returns database-specific auto-increment DDL clause.- Specified by:
getAutoIncrementClause
in interfaceDatabase
-
getCommitSQL
public SqlStatement getCommitSQL()
-
getDatabaseChangeLogTableName
public String getDatabaseChangeLogTableName()
- Specified by:
getDatabaseChangeLogTableName
in interfaceDatabase
- See Also:
Database.getDatabaseChangeLogTableName()
-
setDatabaseChangeLogTableName
public void setDatabaseChangeLogTableName(String tableName)
Does nothing- Specified by:
setDatabaseChangeLogTableName
in interfaceDatabase
- Parameters:
tableName
- the name of the change log table to set- See Also:
Database.setDatabaseChangeLogTableName(java.lang.String)
-
getDatabaseChangeLogLockTableName
public String getDatabaseChangeLogLockTableName()
- Specified by:
getDatabaseChangeLogLockTableName
in interfaceDatabase
- See Also:
Database.getDatabaseChangeLogLockTableName()
-
setDatabaseChangeLogLockTableName
public void setDatabaseChangeLogLockTableName(String tableName)
Does nothing- Specified by:
setDatabaseChangeLogLockTableName
in interfaceDatabase
- See Also:
Database.setDatabaseChangeLogLockTableName(java.lang.String)
-
getConcatSql
public String getConcatSql(String... values)
Description copied from interface:Database
Returns SQL to concat the passed values.- Specified by:
getConcatSql
in interfaceDatabase
-
acquireLock
public boolean acquireLock(Liquibase liquibase)
-
releaseLock
public void releaseLock()
-
listLocks
public DatabaseChangeLogLock[] listLocks()
-
dropDatabaseObjects
public void dropDatabaseObjects(CatalogAndSchema schema)
Description copied from interface:Database
Drops all objects in a specified schema.- Specified by:
dropDatabaseObjects
in interfaceDatabase
- Parameters:
schema
- schema (catalog+)schema to drop
-
tag
public void tag(String tagString)
Description copied from interface:Database
Tags the database changelog with the given string.
-
doesTagExist
public boolean doesTagExist(String tag)
- Specified by:
doesTagExist
in interfaceDatabase
-
isSystemObject
public boolean isSystemObject(DatabaseObject example)
- Specified by:
isSystemObject
in interfaceDatabase
-
isLiquibaseObject
public boolean isLiquibaseObject(DatabaseObject object)
- Specified by:
isLiquibaseObject
in interfaceDatabase
-
supportsTablespaces
public boolean supportsTablespaces()
- Specified by:
supportsTablespaces
in interfaceDatabase
-
getViewDefinition
public String getViewDefinition(CatalogAndSchema schema, String name)
- Specified by:
getViewDefinition
in interfaceDatabase
-
getDatabaseProductName
public String getDatabaseProductName(DatabaseConnection conn)
-
getDateLiteral
public String getDateLiteral(Date defaultDateValue)
- Specified by:
getDateLiteral
in interfaceDatabase
-
escapeTableName
public String escapeTableName(String catalogName, String schemaName, String tableName)
- Specified by:
escapeTableName
in interfaceDatabase
-
escapeIndexName
public String escapeIndexName(String catalogName, String schemaName, String indexName)
- Specified by:
escapeIndexName
in interfaceDatabase
-
escapeColumnName
public String escapeColumnName(String catalogName, String schemaName, String tableName, String columnName)
Description copied from interface:Database
Escapes a single column name in a database-dependent manner so reserved words can be used as a column name (i.e. "return").- Specified by:
escapeColumnName
in interfaceDatabase
columnName
- column name- Returns:
- escaped column name
-
escapeColumnName
public String escapeColumnName(String catalogName, String schemaName, String tableName, String columnName, boolean quoteNamesThatMayBeFunctions)
Description copied from interface:Database
Similar toDatabase.escapeColumnName(String, String, String, String)
but allows control over whether function-like names should be left unquoted.- Specified by:
escapeColumnName
in interfaceDatabase
-
escapeColumnNameList
public String escapeColumnNameList(String columnNames)
Description copied from interface:Database
Escapes a list of column names in a database-dependent manner so reserved words can be used as a column name (i.e. "return").- Specified by:
escapeColumnNameList
in interfaceDatabase
- Parameters:
columnNames
- list of column names- Returns:
- escaped column name list
-
escapeSequenceName
public String escapeSequenceName(String catalogName, String schemaName, String sequenceName)
- Specified by:
escapeSequenceName
in interfaceDatabase
-
convertRequestedSchemaToSchema
public String convertRequestedSchemaToSchema(String requestedSchema)
-
convertRequestedSchemaToCatalog
public String convertRequestedSchemaToCatalog(String requestedSchema)
-
supportsSchemas
public boolean supportsSchemas()
- Specified by:
supportsSchemas
in interfaceDatabase
-
setSupportsSchemas
public void setSupportsSchemas(boolean supportsSchemas)
-
supportsCatalogs
public boolean supportsCatalogs()
- Specified by:
supportsCatalogs
in interfaceDatabase
-
getSchemaAndCatalogCase
public CatalogAndSchema.CatalogAndSchemaCase getSchemaAndCatalogCase()
- Specified by:
getSchemaAndCatalogCase
in interfaceDatabase
-
setSupportsCatalogs
public void setSupportsCatalogs(boolean supportsCatalogs)
-
supportsCatalogInObjectName
public boolean supportsCatalogInObjectName()
-
generatePrimaryKeyName
public String generatePrimaryKeyName(String tableName)
- Specified by:
generatePrimaryKeyName
in interfaceDatabase
-
escapeViewName
public String escapeViewName(String catalogName, String schemaName, String viewName)
- Specified by:
escapeViewName
in interfaceDatabase
-
acquireLock
public boolean acquireLock()
-
getRunStatus
public ChangeSet.RunStatus getRunStatus(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
Description copied from interface:Database
Returns the run status for the given ChangeSet- Specified by:
getRunStatus
in interfaceDatabase
- Throws:
DatabaseException
DatabaseHistoryException
-
getRanChangeSet
public RanChangeSet getRanChangeSet(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
- Specified by:
getRanChangeSet
in interfaceDatabase
- Throws:
DatabaseException
DatabaseHistoryException
-
markChangeSetExecStatus
public void markChangeSetExecStatus(ChangeSet changeSet, ChangeSet.ExecType execType) throws DatabaseException
Description copied from interface:Database
After the changeset has been ran against the database this method will update the change log table with the information.- Specified by:
markChangeSetExecStatus
in interfaceDatabase
- Throws:
DatabaseException
-
getRanChangeSetList
public List<RanChangeSet> getRanChangeSetList() throws DatabaseException
Description copied from interface:Database
Returns the ChangeSets that have been run against the current database.- Specified by:
getRanChangeSetList
in interfaceDatabase
- Throws:
DatabaseException
-
getRanDate
public Date getRanDate(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
- Specified by:
getRanDate
in interfaceDatabase
- Throws:
DatabaseException
DatabaseHistoryException
-
removeRanStatus
public void removeRanStatus(ChangeSet changeSet) throws DatabaseException
- Specified by:
removeRanStatus
in interfaceDatabase
- Throws:
DatabaseException
-
getSelectChangeLogLockSQL
public SqlStatement getSelectChangeLogLockSQL()
-
escapeStringForDatabase
public String escapeStringForDatabase(String string)
- Specified by:
escapeStringForDatabase
in interfaceDatabase
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDatabase
-
supportsRestrictForeignKeys
public boolean supportsRestrictForeignKeys()
- Specified by:
supportsRestrictForeignKeys
in interfaceDatabase
-
escapeConstraintName
public String escapeConstraintName(String constraintName)
- Specified by:
escapeConstraintName
in interfaceDatabase
-
isSafeToRunUpdate
public boolean isSafeToRunUpdate()
- Specified by:
isSafeToRunUpdate
in interfaceDatabase
-
escapeObjectName
public String escapeObjectName(String objectName, Class<? extends DatabaseObject> objectType)
- Specified by:
escapeObjectName
in interfaceDatabase
-
escapeObjectName
public String escapeObjectName(String catalogName, String schemaName, String objectName, Class<? extends DatabaseObject> objectType)
- Specified by:
escapeObjectName
in interfaceDatabase
-
executeStatements
public void executeStatements(Change change, DatabaseChangeLog changeLog, List<SqlVisitor> sqlVisitors)
- Specified by:
executeStatements
in interfaceDatabase
-
execute
public void execute(SqlStatement[] statements, List<SqlVisitor> sqlVisitors)
-
saveStatements
public void saveStatements(Change change, List<SqlVisitor> sqlVisitors, Writer writer)
- Specified by:
saveStatements
in interfaceDatabase
-
executeRollbackStatements
public void executeRollbackStatements(Change change, List<SqlVisitor> sqlVisitors)
- Specified by:
executeRollbackStatements
in interfaceDatabase
-
executeRollbackStatements
public void executeRollbackStatements(SqlStatement[] statements, List<SqlVisitor> sqlVisitors)
- Specified by:
executeRollbackStatements
in interfaceDatabase
-
saveRollbackStatement
public void saveRollbackStatement(Change change, List<SqlVisitor> sqlVisitors, Writer writer)
- Specified by:
saveRollbackStatement
in interfaceDatabase
-
getLiquibaseCatalogName
public String getLiquibaseCatalogName()
- Specified by:
getLiquibaseCatalogName
in interfaceDatabase
-
setLiquibaseCatalogName
public void setLiquibaseCatalogName(String catalogName)
- Specified by:
setLiquibaseCatalogName
in interfaceDatabase
-
getLiquibaseSchemaName
public String getLiquibaseSchemaName()
- Specified by:
getLiquibaseSchemaName
in interfaceDatabase
-
setLiquibaseSchemaName
public void setLiquibaseSchemaName(String schemaName)
- Specified by:
setLiquibaseSchemaName
in interfaceDatabase
-
getLiquibaseTablespaceName
public String getLiquibaseTablespaceName()
- Specified by:
getLiquibaseTablespaceName
in interfaceDatabase
-
setLiquibaseTablespaceName
public void setLiquibaseTablespaceName(String tablespaceName)
- Specified by:
setLiquibaseTablespaceName
in interfaceDatabase
-
getDateFunctions
public List<DatabaseFunction> getDateFunctions()
Description copied from interface:Database
Returns list of database native date functions- Specified by:
getDateFunctions
in interfaceDatabase
-
resetInternalState
public void resetInternalState()
- Specified by:
resetInternalState
in interfaceDatabase
-
supportsForeignKeyDisable
public boolean supportsForeignKeyDisable()
- Specified by:
supportsForeignKeyDisable
in interfaceDatabase
-
disableForeignKeyChecks
public boolean disableForeignKeyChecks()
- Specified by:
disableForeignKeyChecks
in interfaceDatabase
-
enableForeignKeyChecks
public void enableForeignKeyChecks()
- Specified by:
enableForeignKeyChecks
in interfaceDatabase
-
updateChecksum
public void updateChecksum(ChangeSet changeSet)
-
isReservedWord
public boolean isReservedWord(String string)
- Specified by:
isReservedWord
in interfaceDatabase
-
correctSchema
public CatalogAndSchema correctSchema(CatalogAndSchema schema)
Description copied from interface:Database
Returns a new CatalogAndSchema adjusted for this database. Examples of adjustments include: fixes for case issues, replacing null schema or catalog names with the default values removing set schema or catalog names if they are not supported- Specified by:
correctSchema
in interfaceDatabase
-
correctObjectName
public String correctObjectName(String name, Class<? extends DatabaseObject> objectType)
Description copied from interface:Database
Fix the object name to the format the database expects, handling changes in case, etc.- Specified by:
correctObjectName
in interfaceDatabase
-
correctObjectName
public String correctObjectName(String name, Class<? extends DatabaseObject> objectType, boolean quoteCorrectedName)
-
getFetchSize
public Integer getFetchSize()
- Specified by:
getFetchSize
in interfaceDatabase
-
isFunction
public boolean isFunction(String string)
- Specified by:
isFunction
in interfaceDatabase
-
getDataTypeMaxParameters
public int getDataTypeMaxParameters(String dataTypeName)
- Specified by:
getDataTypeMaxParameters
in interfaceDatabase
-
getSchemaFromJdbcInfo
public CatalogAndSchema getSchemaFromJdbcInfo(String rawCatalogName, String rawSchemaName)
-
getJdbcCatalogName
public String getJdbcCatalogName(CatalogAndSchema schema)
-
getJdbcSchemaName
public String getJdbcSchemaName(CatalogAndSchema schema)
-
dataTypeIsNotModifiable
public boolean dataTypeIsNotModifiable(String typeName)
Description copied from interface:Database
Types like int4 in postgres cannot have a modifier. e.g. int4(10) Checks whether the type is allowed to have a modifier- Specified by:
dataTypeIsNotModifiable
in interfaceDatabase
- Parameters:
typeName
- type name- Returns:
- Whether data type can have a modifier
-
generateDatabaseFunctionValue
public String generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
Description copied from interface:Database
Some function names are placeholders that need to be replaced with the specific database value. e.g. nextSequenceValue(sequenceName) should be replaced with NEXT_VAL('sequenceName') for Postgresql- Specified by:
generateDatabaseFunctionValue
in interfaceDatabase
- Parameters:
databaseFunction
- database function to check.- Returns:
- the string value to use for an update or generate
-
getObjectQuotingStrategy
public ObjectQuotingStrategy getObjectQuotingStrategy()
- Specified by:
getObjectQuotingStrategy
in interfaceDatabase
-
setObjectQuotingStrategy
public void setObjectQuotingStrategy(ObjectQuotingStrategy quotingStrategy)
- Specified by:
setObjectQuotingStrategy
in interfaceDatabase
-
supportsCatalogInObjectName
public boolean supportsCatalogInObjectName(Class<? extends DatabaseObject> type)
- Specified by:
supportsCatalogInObjectName
in interfaceDatabase
-
createsIndexesForForeignKeys
public boolean createsIndexesForForeignKeys()
- Specified by:
createsIndexesForForeignKeys
in interfaceDatabase
-
getOutputDefaultSchema
public boolean getOutputDefaultSchema()
Description copied from interface:Database
Should the schema be included in identifiers even if it is the default schema?- Specified by:
getOutputDefaultSchema
in interfaceDatabase
- Returns:
- true (if the schema should be included in every case) or false (omit if default schema)
-
setOutputDefaultSchema
public void setOutputDefaultSchema(boolean outputDefaultSchema)
Description copied from interface:Database
Whether the default schema should be included in generated SQL- Specified by:
setOutputDefaultSchema
in interfaceDatabase
-
getOutputDefaultCatalog
public boolean getOutputDefaultCatalog()
- Specified by:
getOutputDefaultCatalog
in interfaceDatabase
-
setOutputDefaultCatalog
public void setOutputDefaultCatalog(boolean outputDefaultCatalog)
- Specified by:
setOutputDefaultCatalog
in interfaceDatabase
-
isDefaultSchema
public boolean isDefaultSchema(String catalog, String schema)
Description copied from interface:Database
If the database supports schemas, test if a given combination of catalog and schema name equals to the default catalog and schema of the current logged in user.- Specified by:
isDefaultSchema
in interfaceDatabase
- Parameters:
catalog
- catalog name to be testedschema
- schema name to be tested- Returns:
- if the database supports catalogs: true if it is the default schema, false if not. If it does not support schemas, the behaviour of this method is undefined (please call supportsSchemas first!)
-
isDefaultCatalog
public boolean isDefaultCatalog(String catalog)
Description copied from interface:Database
If the database supports catalogs, test if a given catalog name equals to the default catalog of the current logged in user.- Specified by:
isDefaultCatalog
in interfaceDatabase
- Parameters:
catalog
- catalog name to be tested- Returns:
- if the database supports catalogs: true if it is the default catalog, false if not. If it does not support catalogs, the behaviour of this method is undefined (please call supportsCatalog first!)
-
supportsPrimaryKeyNames
public boolean supportsPrimaryKeyNames()
- Specified by:
supportsPrimaryKeyNames
in interfaceDatabase
-
getSystemSchema
public String getSystemSchema()
- Specified by:
getSystemSchema
in interfaceDatabase
-
addReservedWords
public void addReservedWords(Collection<String> words)
- Specified by:
addReservedWords
in interfaceDatabase
-
escapeDataTypeName
public String escapeDataTypeName(String dataTypeName)
- Specified by:
escapeDataTypeName
in interfaceDatabase
-
unescapeDataTypeName
public String unescapeDataTypeName(String dataTypeName)
- Specified by:
unescapeDataTypeName
in interfaceDatabase
-
unescapeDataTypeString
public String unescapeDataTypeString(String dataTypeString)
- Specified by:
unescapeDataTypeString
in interfaceDatabase
-
validate
public ValidationErrors validate()
-
supportsNotNullConstraintNames
public boolean supportsNotNullConstraintNames()
Description copied from interface:Database
Does this database treat NOT NULL as an own kind of CONSTRAINT (in addition of simply being a column property)? This will affect the CONSTRAINT clause SQL generators.- Specified by:
supportsNotNullConstraintNames
in interfaceDatabase
- Returns:
- true if the database supports naming NOT NULL constraints, false if not.
-
supportsBatchUpdates
public boolean supportsBatchUpdates()
Description copied from interface:Database
Does the database support batched DML (INSERT/UPDATE/DELETE/MERGE/...) statements sent in a single call to the database?- Specified by:
supportsBatchUpdates
in interfaceDatabase
- Returns:
- true if the database has this capability for all DML statements, false in all other cases
-
getMaxFractionalDigitsForTimestamp
public int getMaxFractionalDigitsForTimestamp()
Description copied from interface:Database
Determines the maximum precision (number of fractional digits) for TIMESTAMP columns for the given database. Might not always be able to give an exact answer since, for some DBMS, it depends on the actual software version if fractional digits are supported. A warning should be logged in this case.- Specified by:
getMaxFractionalDigitsForTimestamp
in interfaceDatabase
- Returns:
- the number of allowed fractional digits for TIMESTAMP columns. May return 0.
-
getDefaultFractionalDigitsForTimestamp
public int getDefaultFractionalDigitsForTimestamp()
Description copied from interface:Database
When a TIMESTAMP column without the parameter "number of fractional digits" is created, what is the default value?- Specified by:
getDefaultFractionalDigitsForTimestamp
in interfaceDatabase
- Returns:
- The default number of fractional digits for TIMESTAMP columns
-
requiresExplicitNullForColumns
public boolean requiresExplicitNullForColumns()
Description copied from interface:Database
Does the database require explicit NULL for nullable columns?- Specified by:
requiresExplicitNullForColumns
in interfaceDatabase
- Returns:
- true if the database behaves incorrectly if NULL is not explicitly specified, false if it behaves like any good RDBMS should.
-
supportsCreateIfNotExists
public boolean supportsCreateIfNotExists(Class<? extends DatabaseObject> type)
Description copied from interface:Database
Does the database support the "if not exits" syntax?- Specified by:
supportsCreateIfNotExists
in interfaceDatabase
- Parameters:
type
- the DatabaseObject type to be checked.- Returns:
- true if the "if not exists" syntax is supported, false otherwise.
-
-