Package liquibase.database
Class AbstractJdbcDatabase
java.lang.Object
liquibase.database.AbstractJdbcDatabase
- All Implemented Interfaces:
AutoCloseable
,Database
,PrioritizedService
- Direct Known Subclasses:
AbstractDb2Database
,DerbyDatabase
,FirebirdDatabase
,H2Database
,HsqlDatabase
,InformixDatabase
,Ingres9Database
,MSSQLDatabase
,MySQLDatabase
,OracleDatabase
,PostgresDatabase
,SnowflakeDatabase
,SQLiteDatabase
,SybaseASADatabase
,SybaseDatabase
,UnsupportedDatabase
AbstractJdbcDatabase is extended by all supported databases as a facade to the underlying database.
The physical connection can be retrieved from the AbstractJdbcDatabase implementation, as well as any
database-specific characteristics such as the datatype for "boolean" fields.
-
Field Summary
Modifier and TypeFieldDescriptionprotected Boolean
protected String
protected List<DatabaseFunction>
protected BigInteger
protected BigInteger
protected String
protected String
protected ObjectQuotingStrategy
protected String
protected String
The sequence name will be substituted into the string e.g.protected Boolean
Fields inherited from interface liquibase.database.Database
COMPLETE_SQL_SCOPE_KEY
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addReservedWords
(Collection<String> words) protected boolean
void
close()
void
commit()
correctObjectName
(String objectName, Class<? extends DatabaseObject> objectType) Fix the object name to the format the database expects, handling changes in case, etc.correctSchema
(String catalog, String schema) Deprecated.correctSchema
(CatalogAndSchema schema) Deprecated.boolean
boolean
dataTypeIsNotModifiable
(String typeName) Types like int4 in postgres cannot have a modifier. e.g. int4(10) Checks whether the type is allowed to have a modifierboolean
boolean
doesTagExist
(String tag) void
dropDatabaseObjects
(CatalogAndSchema schemaToDrop) Drops all objects in a specified schema.void
boolean
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.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.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.escapeConstraintName
(String constraintName) escapeDataTypeName
(String dataTypeName) escapeIndexName
(String catalogName, String schemaName, String indexName) escapeObjectName
(String objectName, Class<? extends DatabaseObject> objectType) escapeObjectName
(String catalogName, String schemaName, String objectName, Class<? extends DatabaseObject> objectType) escapeSequenceName
(String catalogName, String schemaName, String sequenceName) escapeStringForDatabase
(String string) escapeTableName
(String catalogName, String schemaName, String tableName) 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) protected List<SqlVisitor>
filterRollbackVisitors
(List<SqlVisitor> visitors) Takes a list of SqlVisitors and returns a new list with only the SqlVisitors set to apply to rollbacksprotected boolean
generateAutoIncrementBy
(BigInteger incrementBy) protected boolean
generateAutoIncrementStartWith
(BigInteger startWith) generateDatabaseFunctionValue
(DatabaseFunction databaseFunction) Some function names are placeholders that need to be replaced with the specific database value.generatePrimaryKeyName
(String tableName) boolean
Auto-commit mode to run inprotected String
protected String
protected String
getAutoIncrementClause
(String generationType, Boolean defaultOnNull) Default implementation.getAutoIncrementClause
(BigInteger startWith, BigInteger incrementBy, String generationType, Boolean defaultOnNull) Returns database-specific auto-increment DDL clause.protected String
protected String
protected String
getConcatSql
(String... values) Returns SQL to concat the passed values.protected String
protected String
Overwrite this method to get the default schema name for the connection.protected SqlStatement
Used to obtain the connection schema name through a statement Override this method to change the statement.Returns database-specific function for generating the current date/time.int
int
Returns the name of the database product according to the underlying database.int
getDataTypeMaxParameters
(String dataTypeName) Returns list of database native date functionsgetDateLiteral
(String isoDate) Return a date literal with the same value as a string formatted using ISO 8601.getDateLiteral
(Date date) getDateLiteral
(Date date) getDateTimeLiteral
(Timestamp date) protected abstract String
int
SQL Standard (Foundation) says: "...ifis not specified, then 6 is implicit." getDefaultScaleForNativeDataType
(String nativeDataType) Returns the default precision for a given native data type, e.g.getJdbcCatalogName
(CatalogAndSchema schema) final String
getJdbcCatalogName
(Schema schema) getJdbcSchemaName
(CatalogAndSchema schema) final String
getJdbcSchemaName
(Schema schema) Returns database-specific line comment string.int
Most relational databases support 9 fractional digits, and subclasses must overwrite this method if they support less than that.getName()
boolean
boolean
Should the schema be included in identifiers even if it is the default schema?protected String
protected String
protected String
getRanChangeSet
(ChangeSet changeSet) Returns the ChangeSets that have been run against the current database.getRanDate
(ChangeSet changeSet) protected String
Method used by extensions to get raw dbcll table nameprotected String
Method used by extensions to get raw dbcl table namegetRunStatus
(ChangeSet changeSet) Returns the run status for the given ChangeSetThis logic is used when db support catalogsgetSchemaFromJdbcInfo
(String rawCatalogName, String rawSchemaName) Returns system (undroppable) views.Returns system (undroppable) views.getTimeLiteral
(Time date) getViewDefinition
(CatalogAndSchema schema, String viewName) int
hashCode()
boolean
boolean
protected boolean
isCatalogOrSchemaType
(Class<? extends DatabaseObject> objectType) protected boolean
isCurrentTimeFunction
(String functionValue) protected boolean
isDateOnly
(String isoDate) Returns true if the String conforms to an ISO 8601 date, e.g. 2016-12-31.protected boolean
isDateTime
(String isoDate) Returns true if the String conforms to an ISO 8601 date plus a time (hours, minutes, whole seconds and optionally fraction of a second) in UTC, e.g. 2016-12-31T18:43:59.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
Default implementation of theisSafeToRunUpdate()
method.boolean
isSystemObject
(DatabaseObject example) boolean
isSystemView
(CatalogAndSchema schema, String viewName) protected boolean
isTimeOnly
(String isoDate) Returns true if the String conforms to an ISO 8601 time (hours, minutes and whole seconds) in UTC, e.g. 18:43:59.protected boolean
isTimestamp
(String isoDate) Returns true if the String conforms to an ISO 8601 date plus a timestamp (hours, minutes, seconds and at least one decimal fraction) in UTC, e.g. 2016-12-31T18:43:59.3 or 2016-12-31T18:43:59.345.boolean
void
markChangeSetExecStatus
(ChangeSet changeSet, ChangeSet.ExecType execType) After the changeset has been run against the database this method will update the change log table with the information.protected boolean
mustQuoteObjectName
(String objectName, Class<? extends DatabaseObject> objectType) quoteObject
(String objectName, Class<? extends DatabaseObject> objectType) void
removeRanStatus
(ChangeSet changeSet) boolean
Does the database require explicit NULL for nullable columns?boolean
boolean
void
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
void
setCurrentDateTimeFunction
(String function) void
setDatabaseChangeLogLockTableName
(String tableName) Set the table name of the change log lock to the given table namevoid
setDatabaseChangeLogTableName
(String tableName) Sets the table name of the change log to the given table name.void
setDefaultCatalogName
(String defaultCatalogName) void
setDefaultSchemaName
(String schemaName) void
setLiquibaseCatalogName
(String catalogName) void
setLiquibaseSchemaName
(String schemaName) void
setLiquibaseTablespaceName
(String tablespace) void
setObjectQuotingStrategy
(ObjectQuotingStrategy quotingStrategy) void
setOutputDefaultCatalog
(boolean outputDefaultCatalog) void
setOutputDefaultSchema
(boolean outputDefaultSchema) Whether the default schema should be included in generated SQLvoid
setPreviousAutoCommit
(Boolean previousAutoCommit) Used for TEST onlyprotected boolean
startsWithNumeric
(String objectName) boolean
boolean
Does the database support batched DML (INSERT/UPDATE/DELETE/MERGE/...) statements sent in a single call to the database?boolean
supportsCatalogInObjectName
(Class<? extends DatabaseObject> type) boolean
Whether this database supports catalogsboolean
Determines if the database supports DDL within a transaction or not.boolean
boolean
boolean
Does this database treat NOT NULL as an own kind of CONSTRAINT (in addition of simply being a column property)?boolean
boolean
boolean
Whether this database supports schemasboolean
Does the database type support sequence.void
Tags the database changelog with the given string.toString()
unescapeDataTypeName
(String dataTypeName) unescapeDataTypeString
(String dataTypeString) validate()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface liquibase.database.Database
addCompleteSqlToScope, afterUpdate, checkDatabaseConnection, dropDatabaseObjects, failOnDefferable, generateConnectCommandSuccessMessage, getDefaultDriver, getDefaultPort, getDisplayName, getShortName, isCorrectDatabaseImplementation, supports, supportsCreateIfNotExists, supportsDatabaseChangeLogHistory, supportsInitiallyDeferrableColumns, supportsTablespaces, temporarilySetObjectQuotingStrategy
Methods inherited from interface liquibase.servicelocator.PrioritizedService
getPriority
-
Field Details
-
defaultCatalogName
-
defaultSchemaName
-
currentDateTimeFunction
-
sequenceNextValueFunction
The sequence name will be substituted into the string e.g. NEXTVAL('%s') -
sequenceCurrentValueFunction
-
dateFunctions
-
unmodifiableDataTypes
-
defaultAutoIncrementStartWith
-
defaultAutoIncrementBy
-
unquotedObjectsAreUppercased
-
quotingStrategy
-
caseSensitive
-
-
Constructor Details
-
AbstractJdbcDatabase
public AbstractJdbcDatabase()
-
-
Method Details
-
getName
-
requiresPassword
public boolean requiresPassword()- Specified by:
requiresPassword
in interfaceDatabase
-
requiresUsername
public boolean requiresUsername()- Specified by:
requiresUsername
in interfaceDatabase
-
getContainingObjects
-
getConnection
- Specified by:
getConnection
in interfaceDatabase
-
setConnection
- Specified by:
setConnection
in interfaceDatabase
-
getAutoCommitMode
public boolean getAutoCommitMode()Description copied from interface:Database
Auto-commit mode to run in- Specified by:
getAutoCommitMode
in interfaceDatabase
-
setPreviousAutoCommit
Used for TEST only- Parameters:
previousAutoCommit
-
-
addReservedWords
- Specified by:
addReservedWords
in interfaceDatabase
-
supportsDDLInTransaction
public boolean supportsDDLInTransaction()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
Description copied from interface:Database
Returns the name of the database product according to the underlying database.- Specified by:
getDatabaseProductName
in interfaceDatabase
-
getDefaultDatabaseProductName
-
getDatabaseProductVersion
- Specified by:
getDatabaseProductVersion
in interfaceDatabase
- Throws:
DatabaseException
-
getDatabaseMajorVersion
- Specified by:
getDatabaseMajorVersion
in interfaceDatabase
- Throws:
DatabaseException
-
getDatabaseMinorVersion
- Specified by:
getDatabaseMinorVersion
in interfaceDatabase
- Throws:
DatabaseException
-
getDefaultCatalogName
- Specified by:
getDefaultCatalogName
in interfaceDatabase
-
setDefaultCatalogName
- Specified by:
setDefaultCatalogName
in interfaceDatabase
-
getConnectionCatalogName
- Throws:
DatabaseException
-
correctSchema
Deprecated. -
correctSchema
Deprecated.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
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
-
isCatalogOrSchemaType
-
getDefaultSchema
- Specified by:
getDefaultSchema
in interfaceDatabase
-
getDefaultSchemaName
- Specified by:
getDefaultSchemaName
in interfaceDatabase
-
getDefaultScaleForNativeDataType
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.
-
setDefaultSchemaName
- Specified by:
setDefaultSchemaName
in interfaceDatabase
-
getConnectionSchemaName
Overwrite this method to get the default schema name for the connection. If you only need to change the statement that obtains the current schema then override- See Also:
-
getConnectionSchemaNameCallStatement
Used to obtain the connection schema name through a statement Override this method to change the statement. Only override this if getConnectionSchemaName is left unchanged or is using this method.- See Also:
-
getFetchSize
- Specified by:
getFetchSize
in interfaceDatabase
-
getSystemTables
Returns system (undroppable) views. -
getSystemViews
Returns system (undroppable) views. -
supportsSequences
public boolean supportsSequences()Does the database type support sequence.- Specified by:
supportsSequences
in interfaceDatabase
-
supportsAutoIncrement
public boolean supportsAutoIncrement()- Specified by:
supportsAutoIncrement
in interfaceDatabase
-
getDateLiteral
Return a date literal with the same value as a string formatted using ISO 8601. Note: many databases accept date literals in ISO8601 format with the 'T' replaced with a space. Only databases which do not accept these strings should need to override this method. Implementation restriction: Currently, only the following subsets of ISO8601 are supported: yyyy-MM-dd hh:mm:ss yyyy-MM-ddThh:mm:ss- Specified by:
getDateLiteral
in interfaceDatabase
-
getDateTimeLiteral
- Specified by:
getDateTimeLiteral
in interfaceDatabase
-
getDateLiteral
- Specified by:
getDateLiteral
in interfaceDatabase
-
getTimeLiteral
- Specified by:
getTimeLiteral
in interfaceDatabase
-
getDateLiteral
- Specified by:
getDateLiteral
in interfaceDatabase
-
parseDate
- Specified by:
parseDate
in interfaceDatabase
- Throws:
DateParseException
-
isDateOnly
Returns true if the String conforms to an ISO 8601 date, e.g. 2016-12-31. (Or, if it is a "NOW" or "TODAY" type value)- Parameters:
isoDate
- value to check.
-
isDateTime
Returns true if the String conforms to an ISO 8601 date plus a time (hours, minutes, whole seconds and optionally fraction of a second) in UTC, e.g. 2016-12-31T18:43:59. (Or, if it is a "NOW" or "TODAY" type value.) The "T" may be replaced by a space. CAUTION: Does NOT recognize values with a timezone information (...[+-Z]...)- Parameters:
isoDate
- value to check.
-
isTimestamp
Returns true if the String conforms to an ISO 8601 date plus a timestamp (hours, minutes, seconds and at least one decimal fraction) in UTC, e.g. 2016-12-31T18:43:59.3 or 2016-12-31T18:43:59.345. (Or, if it is a "NOW" or "TODAY" type value). CAUTION: Does NOT recognize values with a timezone information (...[+-Z]...) The "T" may be replaced by a space.- Parameters:
isoDate
- value to check
-
isTimeOnly
Returns true if the String conforms to an ISO 8601 time (hours, minutes and whole seconds) in UTC, e.g. 18:43:59. (Or, if it is a "NOW" or "TODAY" type value). CAUTION: Does NOT recognize values with a timezone information (...[+-Z]...)- Parameters:
isoDate
- value to check
-
getLineComment
Returns database-specific line comment string.- 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
-
getAutoIncrementClause
-
getAutoIncrementClause
Default implementation. Intended for override in database specific cases -
generateAutoIncrementStartWith
-
generateAutoIncrementBy
-
getAutoIncrementOpening
-
getAutoIncrementClosing
-
getAutoIncrementStartWithClause
-
getAutoIncrementByClause
-
getConcatSql
Description copied from interface:Database
Returns SQL to concat the passed values.- Specified by:
getConcatSql
in interfaceDatabase
-
getDatabaseChangeLogTableName
- Specified by:
getDatabaseChangeLogTableName
in interfaceDatabase
-
setDatabaseChangeLogTableName
Description copied from interface:Database
Sets the table name of the change log to the given table name.- Specified by:
setDatabaseChangeLogTableName
in interfaceDatabase
- Parameters:
tableName
- the name of the change log table to set
-
getRawDatabaseChangeLogTableName
Method used by extensions to get raw dbcl table name -
getDatabaseChangeLogLockTableName
- Specified by:
getDatabaseChangeLogLockTableName
in interfaceDatabase
-
setDatabaseChangeLogLockTableName
Description copied from interface:Database
Set the table name of the change log lock to the given table name- Specified by:
setDatabaseChangeLogLockTableName
in interfaceDatabase
-
getRawDatabaseChangeLogLockTableName
Method used by extensions to get raw dbcll table name -
getLiquibaseTablespaceName
- Specified by:
getLiquibaseTablespaceName
in interfaceDatabase
-
setLiquibaseTablespaceName
- Specified by:
setLiquibaseTablespaceName
in interfaceDatabase
-
canCreateChangeLogTable
- Throws:
DatabaseException
-
setCanCacheLiquibaseTableInfo
public void setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo) - Specified by:
setCanCacheLiquibaseTableInfo
in interfaceDatabase
-
getLiquibaseCatalogName
- Specified by:
getLiquibaseCatalogName
in interfaceDatabase
-
setLiquibaseCatalogName
- Specified by:
setLiquibaseCatalogName
in interfaceDatabase
-
getLiquibaseSchemaName
- Specified by:
getLiquibaseSchemaName
in interfaceDatabase
-
setLiquibaseSchemaName
- Specified by:
setLiquibaseSchemaName
in interfaceDatabase
-
isCaseSensitive
public boolean isCaseSensitive()- Specified by:
isCaseSensitive
in interfaceDatabase
-
setCaseSensitive
-
isReservedWord
- Specified by:
isReservedWord
in interfaceDatabase
-
startsWithNumeric
-
dropDatabaseObjects
Description copied from interface:Database
Drops all objects in a specified schema.- Specified by:
dropDatabaseObjects
in interfaceDatabase
- Parameters:
schemaToDrop
- schema (catalog+)schema to drop- Throws:
LiquibaseException
- if any problem occurs
-
supportsDropTableCascadeConstraints
public boolean supportsDropTableCascadeConstraints()- Specified by:
supportsDropTableCascadeConstraints
in interfaceDatabase
-
isSystemObject
- Specified by:
isSystemObject
in interfaceDatabase
-
isSystemView
-
isLiquibaseObject
- Specified by:
isLiquibaseObject
in interfaceDatabase
-
tag
Description copied from interface:Database
Tags the database changelog with the given string.- Specified by:
tag
in interfaceDatabase
- Throws:
DatabaseException
-
doesTagExist
- Specified by:
doesTagExist
in interfaceDatabase
- Throws:
DatabaseException
-
toString
-
getViewDefinition
- Specified by:
getViewDefinition
in interfaceDatabase
- Throws:
DatabaseException
-
escapeTableName
- Specified by:
escapeTableName
in interfaceDatabase
-
escapeObjectName
public String escapeObjectName(String catalogName, String schemaName, String objectName, Class<? extends DatabaseObject> objectType) - Specified by:
escapeObjectName
in interfaceDatabase
-
escapeObjectName
- Specified by:
escapeObjectName
in interfaceDatabase
-
mustQuoteObjectName
protected boolean mustQuoteObjectName(String objectName, Class<? extends DatabaseObject> objectType) -
getQuotingStartCharacter
-
getQuotingEndCharacter
-
getQuotingEndReplacement
-
quoteObject
-
escapeIndexName
- Specified by:
escapeIndexName
in interfaceDatabase
-
escapeSequenceName
- Specified by:
escapeSequenceName
in interfaceDatabase
-
escapeConstraintName
- Specified by:
escapeConstraintName
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
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
-
supportsSchemas
public boolean supportsSchemas()Description copied from interface:Database
Whether this database supports schemas- Specified by:
supportsSchemas
in interfaceDatabase
-
supportsCatalogs
public boolean supportsCatalogs()Description copied from interface:Database
Whether this database supports catalogs- Specified by:
supportsCatalogs
in interfaceDatabase
-
jdbcCallsCatalogsSchemas
public boolean jdbcCallsCatalogsSchemas() -
supportsCatalogInObjectName
- Specified by:
supportsCatalogInObjectName
in interfaceDatabase
-
generatePrimaryKeyName
- Specified by:
generatePrimaryKeyName
in interfaceDatabase
-
escapeViewName
- Specified by:
escapeViewName
in interfaceDatabase
-
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
-
getRanChangeSetList
Description copied from interface:Database
Returns the ChangeSets that have been run against the current database.- Specified by:
getRanChangeSetList
in interfaceDatabase
- Throws:
DatabaseException
-
getRanDate
- Specified by:
getRanDate
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 run against the database this method will update the change log table with the information.- Specified by:
markChangeSetExecStatus
in interfaceDatabase
- Throws:
DatabaseException
-
removeRanStatus
- Specified by:
removeRanStatus
in interfaceDatabase
- Throws:
DatabaseException
-
escapeStringForDatabase
- Specified by:
escapeStringForDatabase
in interfaceDatabase
-
commit
- Specified by:
commit
in interfaceDatabase
- Throws:
DatabaseException
-
rollback
- Specified by:
rollback
in interfaceDatabase
- Throws:
DatabaseException
-
equals
-
hashCode
public int hashCode() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDatabase
- Throws:
DatabaseException
-
supportsRestrictForeignKeys
public boolean supportsRestrictForeignKeys()- Specified by:
supportsRestrictForeignKeys
in interfaceDatabase
-
isAutoCommit
- Specified by:
isAutoCommit
in interfaceDatabase
- Throws:
DatabaseException
-
setAutoCommit
- Specified by:
setAutoCommit
in interfaceDatabase
- Throws:
DatabaseException
-
isSafeToRunUpdate
Default implementation of theisSafeToRunUpdate()
method. It checks if the database connection URL contains "localhost" or "127.0.0.1". If the database returns anull
URL, the method returnsfalse
because it's not known whether it's safe to run the update.- Specified by:
isSafeToRunUpdate
in interfaceDatabase
- Returns:
true
if the database connection URL contains "localhost" or "127.0.0.1", otherwisefalse
.- Throws:
DatabaseException
- if there is an error accessing the database
-
executeStatements
public void executeStatements(Change change, DatabaseChangeLog changeLog, List<SqlVisitor> sqlVisitors) throws LiquibaseException - Specified by:
executeStatements
in interfaceDatabase
- Throws:
LiquibaseException
-
execute
public void execute(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) throws LiquibaseException - Specified by:
execute
in interfaceDatabase
- Throws:
LiquibaseException
-
saveStatements
public void saveStatements(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException - Specified by:
saveStatements
in interfaceDatabase
- Throws:
IOException
-
executeRollbackStatements
public void executeRollbackStatements(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) throws LiquibaseException - Specified by:
executeRollbackStatements
in interfaceDatabase
- Throws:
LiquibaseException
-
executeRollbackStatements
public void executeRollbackStatements(Change change, List<SqlVisitor> sqlVisitors) throws LiquibaseException - Specified by:
executeRollbackStatements
in interfaceDatabase
- Throws:
LiquibaseException
-
saveRollbackStatement
public void saveRollbackStatement(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException, LiquibaseException - Specified by:
saveRollbackStatement
in interfaceDatabase
- Throws:
IOException
LiquibaseException
-
filterRollbackVisitors
Takes a list of SqlVisitors and returns a new list with only the SqlVisitors set to apply to rollbacks -
getDateFunctions
Description copied from interface:Database
Returns list of database native date functions- Specified by:
getDateFunctions
in interfaceDatabase
-
isFunction
- Specified by:
isFunction
in interfaceDatabase
-
resetInternalState
public void resetInternalState()- Specified by:
resetInternalState
in interfaceDatabase
-
supportsForeignKeyDisable
public boolean supportsForeignKeyDisable()- Specified by:
supportsForeignKeyDisable
in interfaceDatabase
-
disableForeignKeyChecks
- Specified by:
disableForeignKeyChecks
in interfaceDatabase
- Throws:
DatabaseException
-
enableForeignKeyChecks
- Specified by:
enableForeignKeyChecks
in interfaceDatabase
- Throws:
DatabaseException
-
createsIndexesForForeignKeys
public boolean createsIndexesForForeignKeys()- Specified by:
createsIndexesForForeignKeys
in interfaceDatabase
-
getDataTypeMaxParameters
- Specified by:
getDataTypeMaxParameters
in interfaceDatabase
-
getSchemaFromJdbcInfo
-
getJdbcCatalogName
-
getJdbcSchemaName
-
getJdbcCatalogName
-
getJdbcSchemaName
-
dataTypeIsNotModifiable
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
-
getObjectQuotingStrategy
- Specified by:
getObjectQuotingStrategy
in interfaceDatabase
-
setObjectQuotingStrategy
- Specified by:
setObjectQuotingStrategy
in interfaceDatabase
-
generateDatabaseFunctionValue
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
-
isCurrentTimeFunction
-
getCurrentDateTimeFunction
Description copied from interface:Database
Returns database-specific function for generating the current date/time.- Specified by:
getCurrentDateTimeFunction
in interfaceDatabase
-
setCurrentDateTimeFunction
- Specified by:
setCurrentDateTimeFunction
in interfaceDatabase
-
isDefaultSchema
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
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!)
-
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
-
supportsPrimaryKeyNames
public boolean supportsPrimaryKeyNames()- Specified by:
supportsPrimaryKeyNames
in interfaceDatabase
-
getSystemSchema
- Specified by:
getSystemSchema
in interfaceDatabase
-
escapeDataTypeName
- Specified by:
escapeDataTypeName
in interfaceDatabase
-
unescapeDataTypeName
- Specified by:
unescapeDataTypeName
in interfaceDatabase
-
unescapeDataTypeString
- Specified by:
unescapeDataTypeString
in interfaceDatabase
-
get
-
set
-
validate
-
getMaxFractionalDigitsForTimestamp
public int getMaxFractionalDigitsForTimestamp()Most relational databases support 9 fractional digits, and subclasses must overwrite this method if they support less than that.- Specified by:
getMaxFractionalDigitsForTimestamp
in interfaceDatabase
- Returns:
- the maximum number of supported fractional digits in TIMESTAMP columns
-
getDefaultFractionalDigitsForTimestamp
public int getDefaultFractionalDigitsForTimestamp()SQL Standard (Foundation) says: "...ifis not specified, then 6 is implicit." - Specified by:
getDefaultFractionalDigitsForTimestamp
in interfaceDatabase
- Returns:
- the default precision / number of maximum digits in a timestamp if nothing else is specified.
-
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
- Throws:
DatabaseException
-
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.
-
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.
-
getSchemaAndCatalogCase
This logic is used when db support catalogs- Specified by:
getSchemaAndCatalogCase
in interfaceDatabase
- Returns:
- UPPER_CASE by default
-