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
FieldsModifier and TypeFieldDescriptionprotected Booleanprotected Stringprotected List<DatabaseFunction>protected BigIntegerprotected BigIntegerprotected Stringprotected Stringprotected ObjectQuotingStrategyprotected Stringprotected StringThe sequence name will be substituted into the string e.g.protected BooleanFields inherited from interface liquibase.database.Database
COMPLETE_SQL_SCOPE_KEY, IGNORE_MISSING_REFERENCES_KEYFields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReservedWords(Collection<String> words) protected booleanvoidclose()voidcommit()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.booleanbooleandataTypeIsNotModifiable(String typeName) Types like int4 in postgres cannot have a modifier. e.g. int4(10) Checks whether the type is allowed to have a modifierbooleanbooleandoesTagExist(String tag) voiddropDatabaseObjects(CatalogAndSchema schemaToDrop) Drops all objects in a specified schema.voidbooleanescapeColumnName(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) voidexecute(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) voidexecuteRollbackStatements(Change change, List<SqlVisitor> sqlVisitors) voidexecuteRollbackStatements(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) voidexecuteStatements(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 booleangenerateAutoIncrementBy(BigInteger incrementBy) protected booleangenerateAutoIncrementStartWith(BigInteger startWith) generateDatabaseFunctionValue(DatabaseFunction databaseFunction) Some function names are placeholders that need to be replaced with the specific database value.generatePrimaryKeyName(String tableName) booleanAuto-commit mode to run inprotected Stringprotected Stringprotected StringgetAutoIncrementClause(String generationType, Boolean defaultOnNull) Default implementation.getAutoIncrementClause(BigInteger startWith, BigInteger incrementBy, String generationType, Boolean defaultOnNull) Returns database-specific auto-increment DDL clause.protected Stringprotected Stringprotected StringgetConcatSql(String... values) Returns SQL to concat the passed values.protected Stringprotected StringOverwrite this method to get the default schema name for the connection.protected SqlStatementUsed 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.intintReturns the name of the database product according to the underlying database.intgetDataTypeMaxParameters(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 StringintSQL 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 StringgetJdbcCatalogName(Schema schema) getJdbcSchemaName(CatalogAndSchema schema) final StringgetJdbcSchemaName(Schema schema) Returns database-specific line comment string.intMost relational databases support 9 fractional digits, and subclasses must overwrite this method if they support less than that.getName()booleanbooleanShould the schema be included in identifiers even if it is the default schema?protected Stringprotected Stringprotected StringgetRanChangeSet(ChangeSet changeSet) Returns the ChangeSets that have been run against the current database.getRanDate(ChangeSet changeSet) protected StringMethod used by extensions to get raw dbcll table nameprotected StringMethod 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) inthashCode()booleanbooleanprotected booleanisCatalogOrSchemaType(Class<? extends DatabaseObject> objectType) protected booleanisCurrentTimeFunction(String functionValue) protected booleanisDateOnly(String isoDate) Returns true if the String conforms to an ISO 8601 date, e.g. 2016-12-31.protected booleanisDateTime(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.booleanisDefaultCatalog(String catalog) If the database supports catalogs, test if a given catalog name equals to the default catalog of the current logged in user.booleanisDefaultSchema(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.booleanisFunction(String string) booleanisLiquibaseObject(DatabaseObject object) booleanisReservedWord(String string) booleanDefault implementation of theisSafeToRunUpdate()method.booleanisSystemObject(DatabaseObject example) booleanisSystemView(CatalogAndSchema schema, String viewName) protected booleanisTimeOnly(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 booleanisTimestamp(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.booleanvoidmarkChangeSetExecStatus(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 booleanmustQuoteObjectName(String objectName, Class<? extends DatabaseObject> objectType) quoteObject(String objectName, Class<? extends DatabaseObject> objectType) voidremoveRanStatus(ChangeSet changeSet) booleanDoes the database require explicit NULL for nullable columns?booleanbooleanvoidvoidrollback()voidsaveRollbackStatement(Change change, List<SqlVisitor> sqlVisitors, Writer writer) voidsaveStatements(Change change, List<SqlVisitor> sqlVisitors, Writer writer) voidsetAutoCommit(boolean b) voidsetCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo) voidsetCaseSensitive(Boolean caseSensitive) voidvoidsetCurrentDateTimeFunction(String function) voidsetDatabaseChangeLogLockTableName(String tableName) Set the table name of the change log lock to the given table namevoidsetDatabaseChangeLogTableName(String tableName) Sets the table name of the change log to the given table name.voidsetDefaultCatalogName(String defaultCatalogName) voidsetDefaultSchemaName(String schemaName) voidsetLiquibaseCatalogName(String catalogName) voidsetLiquibaseSchemaName(String schemaName) voidsetLiquibaseTablespaceName(String tablespace) voidsetObjectQuotingStrategy(ObjectQuotingStrategy quotingStrategy) voidsetOutputDefaultCatalog(boolean outputDefaultCatalog) voidsetOutputDefaultSchema(boolean outputDefaultSchema) Whether the default schema should be included in generated SQLvoidsetPreviousAutoCommit(Boolean previousAutoCommit) Used for TEST onlyprotected booleanstartsWithNumeric(String objectName) booleanbooleanDoes the database support batched DML (INSERT/UPDATE/DELETE/MERGE/...) statements sent in a single call to the database?booleansupportsCatalogInObjectName(Class<? extends DatabaseObject> type) booleanWhether this database supports catalogsbooleanDetermines if the database supports DDL within a transaction or not.booleanbooleanbooleanDoes this database treat NOT NULL as an own kind of CONSTRAINT (in addition of simply being a column property)?booleanbooleanbooleanWhether this database supports schemasbooleanDoes the database type support sequence.voidTags 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, waitMethods inherited from interface liquibase.database.Database
addCompleteSqlToScope, afterUpdate, checkDatabaseConnection, dropDatabaseObjects, escapeForLike, failOnDefferable, generateConnectCommandSuccessMessage, getDefaultDriver, getDefaultPort, getDisplayName, getShortName, isCorrectDatabaseImplementation, supports, supportsCreateIfNotExists, supportsDatabaseChangeLogHistory, supportsInitiallyDeferrableColumns, supportsTablespaces, temporarilySetObjectQuotingStrategyMethods 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:
requiresPasswordin interfaceDatabase
-
requiresUsername
public boolean requiresUsername()- Specified by:
requiresUsernamein interfaceDatabase
-
getContainingObjects
-
getConnection
- Specified by:
getConnectionin interfaceDatabase
-
setConnection
- Specified by:
setConnectionin interfaceDatabase
-
getAutoCommitMode
public boolean getAutoCommitMode()Description copied from interface:DatabaseAuto-commit mode to run in- Specified by:
getAutoCommitModein interfaceDatabase
-
setPreviousAutoCommit
Used for TEST only- Parameters:
previousAutoCommit-
-
addReservedWords
- Specified by:
addReservedWordsin interfaceDatabase
-
supportsDDLInTransaction
public boolean supportsDDLInTransaction()Determines if the database supports DDL within a transaction or not.- Specified by:
supportsDDLInTransactionin interfaceDatabase- Returns:
- True if the database supports DDL within a transaction, otherwise false.
-
getDatabaseProductName
Description copied from interface:DatabaseReturns the name of the database product according to the underlying database.- Specified by:
getDatabaseProductNamein interfaceDatabase
-
getDefaultDatabaseProductName
-
getDatabaseProductVersion
- Specified by:
getDatabaseProductVersionin interfaceDatabase- Throws:
DatabaseException
-
getDatabaseMajorVersion
- Specified by:
getDatabaseMajorVersionin interfaceDatabase- Throws:
DatabaseException
-
getDatabaseMinorVersion
- Specified by:
getDatabaseMinorVersionin interfaceDatabase- Throws:
DatabaseException
-
getDefaultCatalogName
- Specified by:
getDefaultCatalogNamein interfaceDatabase
-
setDefaultCatalogName
- Specified by:
setDefaultCatalogNamein interfaceDatabase
-
getConnectionCatalogName
- Throws:
DatabaseException
-
correctSchema
Deprecated. -
correctSchema
Deprecated.Description copied from interface:DatabaseReturns 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:
correctSchemain interfaceDatabase
-
correctObjectName
Description copied from interface:DatabaseFix the object name to the format the database expects, handling changes in case, etc.- Specified by:
correctObjectNamein interfaceDatabase
-
isCatalogOrSchemaType
-
getDefaultSchema
- Specified by:
getDefaultSchemain interfaceDatabase
-
getDefaultSchemaName
- Specified by:
getDefaultSchemaNamein interfaceDatabase
-
getDefaultScaleForNativeDataType
Description copied from interface:DatabaseReturns the default precision for a given native data type, e.g. "datetime2" for Microsoft SQL Server.- Specified by:
getDefaultScaleForNativeDataTypein 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:
setDefaultSchemaNamein 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:
getFetchSizein interfaceDatabase
-
getSystemTables
Returns system (undroppable) views. -
getSystemViews
Returns system (undroppable) views. -
supportsSequences
public boolean supportsSequences()Does the database type support sequence.- Specified by:
supportsSequencesin interfaceDatabase
-
supportsAutoIncrement
public boolean supportsAutoIncrement()- Specified by:
supportsAutoIncrementin 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:
getDateLiteralin interfaceDatabase
-
getDateTimeLiteral
- Specified by:
getDateTimeLiteralin interfaceDatabase
-
getDateLiteral
- Specified by:
getDateLiteralin interfaceDatabase
-
getTimeLiteral
- Specified by:
getTimeLiteralin interfaceDatabase
-
getDateLiteral
- Specified by:
getDateLiteralin interfaceDatabase
-
parseDate
- Specified by:
parseDatein 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:
getLineCommentin interfaceDatabase
-
getAutoIncrementClause
public String getAutoIncrementClause(BigInteger startWith, BigInteger incrementBy, String generationType, Boolean defaultOnNull) Description copied from interface:DatabaseReturns database-specific auto-increment DDL clause.- Specified by:
getAutoIncrementClausein interfaceDatabase
-
getAutoIncrementClause
-
getAutoIncrementClause
Default implementation. Intended for override in database specific cases -
generateAutoIncrementStartWith
-
generateAutoIncrementBy
-
getAutoIncrementOpening
-
getAutoIncrementClosing
-
getAutoIncrementStartWithClause
-
getAutoIncrementByClause
-
getConcatSql
Description copied from interface:DatabaseReturns SQL to concat the passed values.- Specified by:
getConcatSqlin interfaceDatabase
-
getDatabaseChangeLogTableName
- Specified by:
getDatabaseChangeLogTableNamein interfaceDatabase
-
setDatabaseChangeLogTableName
Description copied from interface:DatabaseSets the table name of the change log to the given table name.- Specified by:
setDatabaseChangeLogTableNamein 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:
getDatabaseChangeLogLockTableNamein interfaceDatabase
-
setDatabaseChangeLogLockTableName
Description copied from interface:DatabaseSet the table name of the change log lock to the given table name- Specified by:
setDatabaseChangeLogLockTableNamein interfaceDatabase
-
getRawDatabaseChangeLogLockTableName
Method used by extensions to get raw dbcll table name -
getLiquibaseTablespaceName
- Specified by:
getLiquibaseTablespaceNamein interfaceDatabase
-
setLiquibaseTablespaceName
- Specified by:
setLiquibaseTablespaceNamein interfaceDatabase
-
canCreateChangeLogTable
- Throws:
DatabaseException
-
setCanCacheLiquibaseTableInfo
public void setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo) - Specified by:
setCanCacheLiquibaseTableInfoin interfaceDatabase
-
getLiquibaseCatalogName
- Specified by:
getLiquibaseCatalogNamein interfaceDatabase
-
setLiquibaseCatalogName
- Specified by:
setLiquibaseCatalogNamein interfaceDatabase
-
getLiquibaseSchemaName
- Specified by:
getLiquibaseSchemaNamein interfaceDatabase
-
setLiquibaseSchemaName
- Specified by:
setLiquibaseSchemaNamein interfaceDatabase
-
isCaseSensitive
public boolean isCaseSensitive()- Specified by:
isCaseSensitivein interfaceDatabase
-
setCaseSensitive
-
isReservedWord
- Specified by:
isReservedWordin interfaceDatabase
-
startsWithNumeric
-
dropDatabaseObjects
Description copied from interface:DatabaseDrops all objects in a specified schema.- Specified by:
dropDatabaseObjectsin interfaceDatabase- Parameters:
schemaToDrop- schema (catalog+)schema to drop- Throws:
LiquibaseException- if any problem occurs
-
supportsDropTableCascadeConstraints
public boolean supportsDropTableCascadeConstraints()- Specified by:
supportsDropTableCascadeConstraintsin interfaceDatabase
-
isSystemObject
- Specified by:
isSystemObjectin interfaceDatabase
-
isSystemView
-
isLiquibaseObject
- Specified by:
isLiquibaseObjectin interfaceDatabase
-
tag
Description copied from interface:DatabaseTags the database changelog with the given string.- Specified by:
tagin interfaceDatabase- Throws:
DatabaseException
-
doesTagExist
- Specified by:
doesTagExistin interfaceDatabase- Throws:
DatabaseException
-
toString
-
getViewDefinition
- Specified by:
getViewDefinitionin interfaceDatabase- Throws:
DatabaseException
-
escapeTableName
- Specified by:
escapeTableNamein interfaceDatabase
-
escapeObjectName
public String escapeObjectName(String catalogName, String schemaName, String objectName, Class<? extends DatabaseObject> objectType) - Specified by:
escapeObjectNamein interfaceDatabase
-
escapeObjectName
- Specified by:
escapeObjectNamein interfaceDatabase
-
mustQuoteObjectName
protected boolean mustQuoteObjectName(String objectName, Class<? extends DatabaseObject> objectType) -
getQuotingStartCharacter
-
getQuotingEndCharacter
-
getQuotingEndReplacement
-
quoteObject
-
escapeIndexName
- Specified by:
escapeIndexNamein interfaceDatabase
-
escapeSequenceName
- Specified by:
escapeSequenceNamein interfaceDatabase
-
escapeConstraintName
- Specified by:
escapeConstraintNamein interfaceDatabase
-
escapeColumnName
public String escapeColumnName(String catalogName, String schemaName, String tableName, String columnName) Description copied from interface:DatabaseEscapes a single column name in a database-dependent manner so reserved words can be used as a column name (i.e. "return").- Specified by:
escapeColumnNamein interfaceDatabasecolumnName- column name- Returns:
- escaped column name
-
escapeColumnName
public String escapeColumnName(String catalogName, String schemaName, String tableName, String columnName, boolean quoteNamesThatMayBeFunctions) Description copied from interface:DatabaseSimilar toDatabase.escapeColumnName(String, String, String, String)but allows control over whether function-like names should be left unquoted.- Specified by:
escapeColumnNamein interfaceDatabase
-
escapeColumnNameList
Description copied from interface:DatabaseEscapes 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:
escapeColumnNameListin interfaceDatabase- Parameters:
columnNames- list of column names- Returns:
- escaped column name list
-
supportsSchemas
public boolean supportsSchemas()Description copied from interface:DatabaseWhether this database supports schemas- Specified by:
supportsSchemasin interfaceDatabase
-
supportsCatalogs
public boolean supportsCatalogs()Description copied from interface:DatabaseWhether this database supports catalogs- Specified by:
supportsCatalogsin interfaceDatabase
-
jdbcCallsCatalogsSchemas
public boolean jdbcCallsCatalogsSchemas() -
supportsCatalogInObjectName
- Specified by:
supportsCatalogInObjectNamein interfaceDatabase
-
generatePrimaryKeyName
- Specified by:
generatePrimaryKeyNamein interfaceDatabase
-
escapeViewName
- Specified by:
escapeViewNamein interfaceDatabase
-
getRunStatus
public ChangeSet.RunStatus getRunStatus(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException Description copied from interface:DatabaseReturns the run status for the given ChangeSet- Specified by:
getRunStatusin interfaceDatabase- Throws:
DatabaseExceptionDatabaseHistoryException
-
getRanChangeSet
public RanChangeSet getRanChangeSet(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException - Specified by:
getRanChangeSetin interfaceDatabase- Throws:
DatabaseExceptionDatabaseHistoryException
-
getRanChangeSetList
Description copied from interface:DatabaseReturns the ChangeSets that have been run against the current database.- Specified by:
getRanChangeSetListin interfaceDatabase- Throws:
DatabaseException
-
getRanDate
- Specified by:
getRanDatein interfaceDatabase- Throws:
DatabaseExceptionDatabaseHistoryException
-
markChangeSetExecStatus
public void markChangeSetExecStatus(ChangeSet changeSet, ChangeSet.ExecType execType) throws DatabaseException Description copied from interface:DatabaseAfter the changeset has been run against the database this method will update the change log table with the information.- Specified by:
markChangeSetExecStatusin interfaceDatabase- Throws:
DatabaseException
-
removeRanStatus
- Specified by:
removeRanStatusin interfaceDatabase- Throws:
DatabaseException
-
escapeStringForDatabase
- Specified by:
escapeStringForDatabasein interfaceDatabase
-
commit
- Specified by:
commitin interfaceDatabase- Throws:
DatabaseException
-
rollback
- Specified by:
rollbackin interfaceDatabase- Throws:
DatabaseException
-
equals
-
hashCode
public int hashCode() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDatabase- Throws:
DatabaseException
-
supportsRestrictForeignKeys
public boolean supportsRestrictForeignKeys()- Specified by:
supportsRestrictForeignKeysin interfaceDatabase
-
isAutoCommit
- Specified by:
isAutoCommitin interfaceDatabase- Throws:
DatabaseException
-
setAutoCommit
- Specified by:
setAutoCommitin 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 anullURL, the method returnsfalsebecause it's not known whether it's safe to run the update.- Specified by:
isSafeToRunUpdatein interfaceDatabase- Returns:
trueif 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:
executeStatementsin interfaceDatabase- Throws:
LiquibaseException
-
execute
public void execute(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) throws LiquibaseException - Specified by:
executein interfaceDatabase- Throws:
LiquibaseException
-
saveStatements
public void saveStatements(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException - Specified by:
saveStatementsin interfaceDatabase- Throws:
IOException
-
executeRollbackStatements
public void executeRollbackStatements(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) throws LiquibaseException - Specified by:
executeRollbackStatementsin interfaceDatabase- Throws:
LiquibaseException
-
executeRollbackStatements
public void executeRollbackStatements(Change change, List<SqlVisitor> sqlVisitors) throws LiquibaseException - Specified by:
executeRollbackStatementsin interfaceDatabase- Throws:
LiquibaseException
-
saveRollbackStatement
public void saveRollbackStatement(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException, LiquibaseException - Specified by:
saveRollbackStatementin interfaceDatabase- Throws:
IOExceptionLiquibaseException
-
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:DatabaseReturns list of database native date functions- Specified by:
getDateFunctionsin interfaceDatabase
-
isFunction
- Specified by:
isFunctionin interfaceDatabase
-
resetInternalState
public void resetInternalState()- Specified by:
resetInternalStatein interfaceDatabase
-
supportsForeignKeyDisable
public boolean supportsForeignKeyDisable()- Specified by:
supportsForeignKeyDisablein interfaceDatabase
-
disableForeignKeyChecks
- Specified by:
disableForeignKeyChecksin interfaceDatabase- Throws:
DatabaseException
-
enableForeignKeyChecks
- Specified by:
enableForeignKeyChecksin interfaceDatabase- Throws:
DatabaseException
-
createsIndexesForForeignKeys
public boolean createsIndexesForForeignKeys()- Specified by:
createsIndexesForForeignKeysin interfaceDatabase
-
getDataTypeMaxParameters
- Specified by:
getDataTypeMaxParametersin interfaceDatabase
-
getSchemaFromJdbcInfo
-
getJdbcCatalogName
-
getJdbcSchemaName
-
getJdbcCatalogName
-
getJdbcSchemaName
-
dataTypeIsNotModifiable
Description copied from interface:DatabaseTypes like int4 in postgres cannot have a modifier. e.g. int4(10) Checks whether the type is allowed to have a modifier- Specified by:
dataTypeIsNotModifiablein interfaceDatabase- Parameters:
typeName- type name- Returns:
- Whether data type can have a modifier
-
getObjectQuotingStrategy
- Specified by:
getObjectQuotingStrategyin interfaceDatabase
-
setObjectQuotingStrategy
- Specified by:
setObjectQuotingStrategyin interfaceDatabase
-
generateDatabaseFunctionValue
Description copied from interface:DatabaseSome 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:
generateDatabaseFunctionValuein interfaceDatabase- Parameters:
databaseFunction- database function to check.- Returns:
- the string value to use for an update or generate
-
isCurrentTimeFunction
-
getCurrentDateTimeFunction
Description copied from interface:DatabaseReturns database-specific function for generating the current date/time.- Specified by:
getCurrentDateTimeFunctionin interfaceDatabase
-
setCurrentDateTimeFunction
- Specified by:
setCurrentDateTimeFunctionin interfaceDatabase
-
isDefaultSchema
Description copied from interface:DatabaseIf 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:
isDefaultSchemain 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:DatabaseIf the database supports catalogs, test if a given catalog name equals to the default catalog of the current logged in user.- Specified by:
isDefaultCatalogin 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:DatabaseShould the schema be included in identifiers even if it is the default schema?- Specified by:
getOutputDefaultSchemain 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:DatabaseWhether the default schema should be included in generated SQL- Specified by:
setOutputDefaultSchemain interfaceDatabase
-
getOutputDefaultCatalog
public boolean getOutputDefaultCatalog()- Specified by:
getOutputDefaultCatalogin interfaceDatabase
-
setOutputDefaultCatalog
public void setOutputDefaultCatalog(boolean outputDefaultCatalog) - Specified by:
setOutputDefaultCatalogin interfaceDatabase
-
supportsPrimaryKeyNames
public boolean supportsPrimaryKeyNames()- Specified by:
supportsPrimaryKeyNamesin interfaceDatabase
-
getSystemSchema
- Specified by:
getSystemSchemain interfaceDatabase
-
escapeDataTypeName
- Specified by:
escapeDataTypeNamein interfaceDatabase
-
unescapeDataTypeName
- Specified by:
unescapeDataTypeNamein interfaceDatabase
-
unescapeDataTypeString
- Specified by:
unescapeDataTypeStringin 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:
getMaxFractionalDigitsForTimestampin 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:
getDefaultFractionalDigitsForTimestampin interfaceDatabase- Returns:
- the default precision / number of maximum digits in a timestamp if nothing else is specified.
-
supportsBatchUpdates
Description copied from interface:DatabaseDoes the database support batched DML (INSERT/UPDATE/DELETE/MERGE/...) statements sent in a single call to the database?- Specified by:
supportsBatchUpdatesin 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:DatabaseDoes 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:
supportsNotNullConstraintNamesin interfaceDatabase- Returns:
- true if the database supports naming NOT NULL constraints, false if not.
-
requiresExplicitNullForColumns
public boolean requiresExplicitNullForColumns()Description copied from interface:DatabaseDoes the database require explicit NULL for nullable columns?- Specified by:
requiresExplicitNullForColumnsin 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:
getSchemaAndCatalogCasein interfaceDatabase- Returns:
- UPPER_CASE by default
-