public class MockDatabase extends Object implements Database, InternalDatabase
databaseChangeLogLockTableName, databaseChangeLogTableName
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
Constructor and Description |
---|
MockDatabase() |
public int getPriority()
getPriority
in interface PrioritizedService
public Schema getSchema()
public String getName()
public CatalogAndSchema getDefaultSchema()
getDefaultSchema
in interface Database
public Integer getDefaultPort()
getDefaultPort
in interface Database
public DatabaseObject[] getContainingObjects()
public boolean equals(DatabaseObject otherObject, Database accordingTo)
public void setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo)
setCanCacheLiquibaseTableInfo
in interface Database
public boolean requiresUsername()
requiresUsername
in interface Database
public boolean requiresPassword()
requiresPassword
in interface Database
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException
Database
isCorrectDatabaseImplementation
in interface Database
DatabaseException
public String getDefaultDriver(String url)
Database
getDefaultDriver
in interface Database
public DatabaseConnection getConnection()
getConnection
in interface Database
public void setConnection(Connection conn)
public void setConnection(DatabaseConnection conn)
setConnection
in interface Database
public boolean getAutoCommitMode()
Database
getAutoCommitMode
in interface Database
public boolean isAutoCommit() throws DatabaseException
isAutoCommit
in interface Database
DatabaseException
public boolean isCaseSensitive()
isCaseSensitive
in interface Database
public void setCaseSensitive(boolean caseSensitive)
public void setAutoCommit(boolean b) throws DatabaseException
setAutoCommit
in interface Database
DatabaseException
public boolean supportsDDLInTransaction()
Database
supportsDDLInTransaction
in interface Database
public String getDatabaseProductName()
getDatabaseProductName
in interface Database
public String getDatabaseProductVersion() throws DatabaseException
getDatabaseProductVersion
in interface Database
DatabaseException
public int getDatabaseMajorVersion() throws DatabaseException
getDatabaseMajorVersion
in interface Database
DatabaseException
public int getDatabaseMinorVersion() throws DatabaseException
getDatabaseMinorVersion
in interface Database
DatabaseException
public String getShortName()
Database
getShortName
in interface Database
public String getDriverName() throws DatabaseException
DatabaseException
public String getConnectionURL() throws DatabaseException
DatabaseException
public String getConnectionUsername() throws DatabaseException
DatabaseException
public String getDefaultCatalogName()
getDefaultCatalogName
in interface Database
public void setDefaultCatalogName(String catalogName) throws DatabaseException
setDefaultCatalogName
in interface Database
DatabaseException
public String getDefaultSchemaName()
getDefaultSchemaName
in interface Database
public void setDefaultSchemaName(String schemaName) throws DatabaseException
setDefaultSchemaName
in interface Database
DatabaseException
public boolean supportsInitiallyDeferrableColumns()
Database
supportsInitiallyDeferrableColumns
in interface Database
public boolean supportsSequences()
supportsSequences
in interface Database
public boolean supportsDropTableCascadeConstraints()
supportsDropTableCascadeConstraints
in interface Database
public boolean supportsAutoIncrement()
supportsAutoIncrement
in interface Database
public String getDateLiteral(String isoDate)
getDateLiteral
in interface Database
public String getDateLiteral(Date date)
getDateLiteral
in interface Database
public String getTimeLiteral(Time time)
getTimeLiteral
in interface Database
public String getDateTimeLiteral(Timestamp timeStamp)
getDateTimeLiteral
in interface Database
public String getCurrentDateTimeFunction()
Database
getCurrentDateTimeFunction
in interface Database
public void setCurrentDateTimeFunction(String function)
setCurrentDateTimeFunction
in interface Database
public String getLineComment()
getLineComment
in interface Database
public String getAutoIncrementClause(BigInteger startWith, BigInteger incrementBy)
getAutoIncrementClause
in interface Database
public SqlStatement getCommitSQL()
public String getDatabaseChangeLogTableName()
getDatabaseChangeLogTableName
in interface Database
Database.getDatabaseChangeLogTableName()
public String getDatabaseChangeLogLockTableName()
getDatabaseChangeLogLockTableName
in interface Database
Database.getDatabaseChangeLogLockTableName()
public void setDatabaseChangeLogLockTableName(String tableName)
setDatabaseChangeLogLockTableName
in interface Database
Database.setDatabaseChangeLogLockTableName(java.lang.String)
public void setDatabaseChangeLogTableName(String tableName)
setDatabaseChangeLogTableName
in interface Database
Database.setDatabaseChangeLogTableName(java.lang.String)
public String getConcatSql(String... values)
Database
getConcatSql
in interface Database
public boolean acquireLock(Liquibase liquibase) throws LockException
LockException
public void releaseLock() throws LockException
LockException
public DatabaseChangeLogLock[] listLocks() throws LockException
LockException
public void dropDatabaseObjects(CatalogAndSchema schema) throws DatabaseException
dropDatabaseObjects
in interface Database
DatabaseException
public void tag(String tagString) throws DatabaseException
tag
in interface Database
DatabaseException
public boolean doesTagExist(String tag) throws DatabaseException
doesTagExist
in interface Database
DatabaseException
public boolean isSystemObject(DatabaseObject example)
isSystemObject
in interface Database
public boolean isLiquibaseObject(DatabaseObject object)
isLiquibaseObject
in interface Database
public boolean supportsTablespaces()
supportsTablespaces
in interface Database
public String getViewDefinition(CatalogAndSchema schema, String name) throws DatabaseException
getViewDefinition
in interface Database
DatabaseException
public String getDatabaseProductName(DatabaseConnection conn) throws DatabaseException
DatabaseException
public String getDateLiteral(Date defaultDateValue)
getDateLiteral
in interface Database
public String escapeTableName(String catalogName, String schemaName, String tableName)
escapeTableName
in interface Database
public String escapeIndexName(String catalogName, String schemaName, String indexName)
escapeIndexName
in interface Database
public String escapeColumnName(String catalogName, String schemaName, String tableName, String columnName)
Database
escapeColumnName
in interface Database
columnName
- column namepublic String escapeColumnName(String catalogName, String schemaName, String tableName, String columnName, boolean quoteNamesThatMayBeFunctions)
escapeColumnName
in interface Database
public String escapeColumnNameList(String columnNames)
Database
escapeColumnNameList
in interface Database
columnNames
- list of column namespublic String escapeSequenceName(String catalogName, String schemaName, String sequenceName)
escapeSequenceName
in interface Database
public String convertRequestedSchemaToSchema(String requestedSchema) throws DatabaseException
DatabaseException
public String convertRequestedSchemaToCatalog(String requestedSchema) throws DatabaseException
DatabaseException
public boolean supportsSchemas()
supportsSchemas
in interface Database
public void setSupportsSchemas(boolean supportsSchemas)
public boolean supportsCatalogs()
supportsCatalogs
in interface Database
public void setSupportsCatalogs(boolean supportsCatalogs)
public boolean supportsCatalogInObjectName()
public String generatePrimaryKeyName(String tableName)
generatePrimaryKeyName
in interface Database
public String escapeViewName(String catalogName, String schemaName, String viewName)
escapeViewName
in interface Database
public boolean acquireLock() throws LockException
LockException
public ChangeSet.RunStatus getRunStatus(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
getRunStatus
in interface Database
DatabaseException
DatabaseHistoryException
public RanChangeSet getRanChangeSet(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
getRanChangeSet
in interface Database
DatabaseException
DatabaseHistoryException
public void markChangeSetExecStatus(ChangeSet changeSet, ChangeSet.ExecType execType) throws DatabaseException
markChangeSetExecStatus
in interface Database
DatabaseException
public List<RanChangeSet> getRanChangeSetList() throws DatabaseException
getRanChangeSetList
in interface Database
DatabaseException
public Date getRanDate(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
getRanDate
in interface Database
DatabaseException
DatabaseHistoryException
public void removeRanStatus(ChangeSet changeSet) throws DatabaseException
removeRanStatus
in interface Database
DatabaseException
public SqlStatement getSelectChangeLogLockSQL() throws DatabaseException
DatabaseException
public String escapeStringForDatabase(String string)
escapeStringForDatabase
in interface Database
public void close() throws DatabaseException
close
in interface Database
DatabaseException
public boolean supportsRestrictForeignKeys()
supportsRestrictForeignKeys
in interface Database
public String escapeConstraintName(String constraintName)
escapeConstraintName
in interface Database
public boolean isSafeToRunUpdate() throws DatabaseException
isSafeToRunUpdate
in interface Database
DatabaseException
public String escapeObjectName(String objectName, Class<? extends DatabaseObject> objectType)
escapeObjectName
in interface Database
public String escapeObjectName(String catalogName, String schemaName, String objectName, Class<? extends DatabaseObject> objectType)
escapeObjectName
in interface Database
public void executeStatements(Change change, DatabaseChangeLog changeLog, List<SqlVisitor> sqlVisitors) throws LiquibaseException
executeStatements
in interface Database
LiquibaseException
public void execute(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) throws LiquibaseException
execute
in interface Database
LiquibaseException
public void saveStatements(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException, StatementNotSupportedOnDatabaseException, LiquibaseException
saveStatements
in interface Database
IOException
StatementNotSupportedOnDatabaseException
LiquibaseException
public void executeRollbackStatements(Change change, List<SqlVisitor> sqlVisitors) throws LiquibaseException, RollbackImpossibleException
executeRollbackStatements
in interface Database
LiquibaseException
RollbackImpossibleException
public void executeRollbackStatements(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) throws LiquibaseException, RollbackImpossibleException
executeRollbackStatements
in interface Database
LiquibaseException
RollbackImpossibleException
public void saveRollbackStatement(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException, RollbackImpossibleException, StatementNotSupportedOnDatabaseException, LiquibaseException
saveRollbackStatement
in interface Database
IOException
RollbackImpossibleException
StatementNotSupportedOnDatabaseException
LiquibaseException
public String getLiquibaseCatalogName()
getLiquibaseCatalogName
in interface Database
public void setLiquibaseCatalogName(String catalogName)
setLiquibaseCatalogName
in interface Database
public String getLiquibaseSchemaName()
getLiquibaseSchemaName
in interface Database
public void setLiquibaseSchemaName(String schemaName)
setLiquibaseSchemaName
in interface Database
public String getLiquibaseTablespaceName()
getLiquibaseTablespaceName
in interface Database
public void setLiquibaseTablespaceName(String tablespaceName)
setLiquibaseTablespaceName
in interface Database
public Date parseDate(String dateAsString) throws DateParseException
parseDate
in interface Database
DateParseException
public List<DatabaseFunction> getDateFunctions()
Database
getDateFunctions
in interface Database
public void resetInternalState()
resetInternalState
in interface Database
public boolean supportsForeignKeyDisable()
supportsForeignKeyDisable
in interface Database
public boolean disableForeignKeyChecks() throws DatabaseException
disableForeignKeyChecks
in interface Database
DatabaseException
public void enableForeignKeyChecks() throws DatabaseException
enableForeignKeyChecks
in interface Database
DatabaseException
public void updateChecksum(ChangeSet changeSet) throws DatabaseException
DatabaseException
public boolean isReservedWord(String string)
isReservedWord
in interface Database
public CatalogAndSchema correctSchema(CatalogAndSchema schema)
Database
correctSchema
in interface Database
public String correctObjectName(String name, Class<? extends DatabaseObject> objectType)
Database
correctObjectName
in interface Database
public String correctObjectName(String name, Class<? extends DatabaseObject> objectType, boolean quoteCorrectedName)
public boolean isFunction(String string)
isFunction
in interface Database
public int getDataTypeMaxParameters(String dataTypeName)
getDataTypeMaxParameters
in interface Database
public CatalogAndSchema getSchemaFromJdbcInfo(String rawCatalogName, String rawSchemaName)
public String getJdbcCatalogName(CatalogAndSchema schema)
public String getJdbcSchemaName(CatalogAndSchema schema)
public boolean dataTypeIsNotModifiable(String typeName)
Database
dataTypeIsNotModifiable
in interface Database
typeName
- type namepublic String generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
Database
generateDatabaseFunctionValue
in interface Database
databaseFunction
- database function to check.public void setObjectQuotingStrategy(ObjectQuotingStrategy quotingStrategy)
setObjectQuotingStrategy
in interface Database
public ObjectQuotingStrategy getObjectQuotingStrategy()
getObjectQuotingStrategy
in interface Database
public boolean supportsCatalogInObjectName(Class<? extends DatabaseObject> type)
supportsCatalogInObjectName
in interface Database
public boolean createsIndexesForForeignKeys()
createsIndexesForForeignKeys
in interface Database
public void setOutputDefaultSchema(boolean outputDefaultSchema)
Database
setOutputDefaultSchema
in interface Database
public boolean getOutputDefaultSchema()
getOutputDefaultSchema
in interface Database
public boolean getOutputDefaultCatalog()
getOutputDefaultCatalog
in interface Database
public void setOutputDefaultCatalog(boolean outputDefaultCatalog)
setOutputDefaultCatalog
in interface Database
public boolean isDefaultSchema(String catalog, String schema)
isDefaultSchema
in interface Database
public boolean isDefaultCatalog(String catalog)
isDefaultCatalog
in interface Database
public boolean supportsPrimaryKeyNames()
supportsPrimaryKeyNames
in interface Database
public String getSystemSchema()
getSystemSchema
in interface Database
public void addReservedWords(Collection<String> words)
addReservedWords
in interface Database
public String escapeDataTypeName(String dataTypeName)
escapeDataTypeName
in interface Database
public String unescapeDataTypeName(String dataTypeName)
unescapeDataTypeName
in interface Database
public String unescapeDataTypeString(String dataTypeString)
unescapeDataTypeString
in interface Database
Copyright © 2016 Liquibase.org. All rights reserved.