Package liquibase.database.core
Class AbstractDb2Database
- java.lang.Object
-
- liquibase.database.AbstractJdbcDatabase
-
- liquibase.database.core.AbstractDb2Database
-
- All Implemented Interfaces:
AutoCloseable
,Database
,PrioritizedService
- Direct Known Subclasses:
DB2Database
,Db2zDatabase
public abstract class AbstractDb2Database extends AbstractJdbcDatabase
-
-
Field Summary
-
Fields inherited from class liquibase.database.AbstractJdbcDatabase
caseSensitive, currentDateTimeFunction, dateFunctions, defaultAutoIncrementBy, defaultAutoIncrementStartWith, defaultCatalogName, defaultSchemaName, quotingStrategy, sequenceCurrentValueFunction, sequenceNextValueFunction, unmodifiableDataTypes, unquotedObjectsAreUppercased
-
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
Constructors Constructor Description AbstractDb2Database()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
generatePrimaryKeyName(String tableName)
String
getDateLiteral(String isoDate)
Return an DB2 date literal with the same value as a string formatted using ISO 8601.String
getDefaultCatalogName()
protected String
getDefaultDatabaseProductName()
String
getDefaultDriver(String url)
If this database understands the given url, return the default driver class name.Integer
getDefaultPort()
String
getJdbcCatalogName(CatalogAndSchema schema)
String
getJdbcSchemaName(CatalogAndSchema schema)
int
getMaxFractionalDigitsForTimestamp()
Most relational databases support 9 fractional digits, and subclasses must overwrite this method if they support less than that.int
getPriority()
CatalogAndSchema.CatalogAndSchemaCase
getSchemaAndCatalogCase()
DB2 database are not case sensitive.CatalogAndSchema
getSchemaFromJdbcInfo(String rawCatalogName, String rawSchemaName)
String
getViewDefinition(CatalogAndSchema schema, String viewName)
boolean
isSystemObject(DatabaseObject example)
boolean
jdbcCallsCatalogsSchemas()
protected boolean
mustQuoteObjectName(String objectName, Class<? extends DatabaseObject> objectType)
Date
parseDate(String dateAsString)
boolean
supportsCatalogs()
boolean
supportsInitiallyDeferrableColumns()
Returns whether this database support initially deferrable columns.boolean
supportsSchemas()
boolean
supportsTablespaces()
-
Methods inherited from class liquibase.database.AbstractJdbcDatabase
addReservedWords, canCreateChangeLogTable, close, commit, correctObjectName, correctSchema, correctSchema, createsIndexesForForeignKeys, dataTypeIsNotModifiable, disableForeignKeyChecks, doesTagExist, dropDatabaseObjects, enableForeignKeyChecks, equals, escapeColumnName, escapeColumnName, escapeColumnNameList, escapeConstraintName, escapeDataTypeName, escapeIndexName, escapeObjectName, escapeObjectName, escapeSequenceName, escapeStringForDatabase, escapeTableName, escapeViewName, execute, executeRollbackStatements, executeRollbackStatements, executeStatements, filterRollbackVisitors, generateAutoIncrementBy, generateAutoIncrementStartWith, generateDatabaseFunctionValue, get, getAutoCommitMode, getAutoIncrementByClause, getAutoIncrementClause, getAutoIncrementClause, getAutoIncrementClause, getAutoIncrementClosing, getAutoIncrementOpening, getAutoIncrementStartWithClause, getConcatSql, getConnection, getConnectionCatalogName, getConnectionSchemaName, getConnectionSchemaNameCallStatement, getContainingObjects, getCurrentDateTimeFunction, getDatabaseChangeLogLockTableName, getDatabaseChangeLogTableName, getDatabaseMajorVersion, getDatabaseMinorVersion, getDatabaseProductName, getDatabaseProductVersion, getDataTypeMaxParameters, getDateFunctions, getDateLiteral, getDateLiteral, getDateTimeLiteral, getDefaultFractionalDigitsForTimestamp, getDefaultScaleForNativeDataType, getDefaultSchema, getDefaultSchemaName, getFetchSize, getJdbcCatalogName, getJdbcSchemaName, getLineComment, getLiquibaseCatalogName, getLiquibaseSchemaName, getLiquibaseTablespaceName, getName, getObjectQuotingStrategy, getOutputDefaultCatalog, getOutputDefaultSchema, getQuotingEndCharacter, getQuotingEndReplacement, getQuotingStartCharacter, getRanChangeSet, getRanChangeSetList, getRanDate, getRawDatabaseChangeLogLockTableName, getRawDatabaseChangeLogTableName, getRunStatus, getSystemSchema, getSystemTables, getSystemViews, getTimeLiteral, hashCode, isAutoCommit, isCaseSensitive, isCatalogOrSchemaType, isCurrentTimeFunction, isDateOnly, isDateTime, isDefaultCatalog, isDefaultSchema, isFunction, isLiquibaseObject, isReservedWord, isSafeToRunUpdate, isSystemView, isTimeOnly, isTimestamp, markChangeSetExecStatus, quoteObject, removeRanStatus, requiresExplicitNullForColumns, requiresPassword, requiresUsername, resetInternalState, rollback, saveRollbackStatement, saveStatements, set, setAutoCommit, setCanCacheLiquibaseTableInfo, setCaseSensitive, setConnection, setCurrentDateTimeFunction, setDatabaseChangeLogLockTableName, setDatabaseChangeLogTableName, setDefaultCatalogName, setDefaultSchemaName, setLiquibaseCatalogName, setLiquibaseSchemaName, setLiquibaseTablespaceName, setObjectQuotingStrategy, setOutputDefaultCatalog, setOutputDefaultSchema, startsWithNumeric, supportsAutoIncrement, supportsBatchUpdates, supportsCatalogInObjectName, supportsDDLInTransaction, supportsDropTableCascadeConstraints, supportsForeignKeyDisable, supportsNotNullConstraintNames, supportsPrimaryKeyNames, supportsRestrictForeignKeys, supportsSequences, tag, toString, unescapeDataTypeName, unescapeDataTypeString, 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, dropDatabaseObjects, failOnDefferable, getDisplayName, getShortName, isCorrectDatabaseImplementation, supportsCreateIfNotExists, supportsDatabaseChangeLogHistory, temporarilySetObjectQuotingStrategy
-
-
-
-
Method Detail
-
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.
-
getPriority
public int getPriority()
-
getDefaultPort
public Integer getDefaultPort()
-
supportsSchemas
public boolean supportsSchemas()
- Specified by:
supportsSchemas
in interfaceDatabase
- Overrides:
supportsSchemas
in classAbstractJdbcDatabase
-
supportsCatalogs
public boolean supportsCatalogs()
- Specified by:
supportsCatalogs
in interfaceDatabase
- Overrides:
supportsCatalogs
in classAbstractJdbcDatabase
-
getDefaultDatabaseProductName
protected String getDefaultDatabaseProductName()
- Specified by:
getDefaultDatabaseProductName
in classAbstractJdbcDatabase
-
getDefaultCatalogName
public String getDefaultCatalogName()
- Specified by:
getDefaultCatalogName
in interfaceDatabase
- Overrides:
getDefaultCatalogName
in classAbstractJdbcDatabase
-
supportsInitiallyDeferrableColumns
public boolean supportsInitiallyDeferrableColumns()
Description copied from interface:Database
Returns whether this database support initially deferrable columns.
-
getDateLiteral
public String getDateLiteral(String isoDate)
Return an DB2 date literal with the same value as a string formatted using ISO 8601. Convert an ISO8601 date string to one of the following results: to_date('1995-05-23', 'YYYY-MM-DD') to_date('1995-05-23 09:23:59', 'YYYY-MM-DD HH24:MI:SS') 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
- Overrides:
getDateLiteral
in classAbstractJdbcDatabase
-
supportsTablespaces
public boolean supportsTablespaces()
-
getViewDefinition
public String getViewDefinition(CatalogAndSchema schema, String viewName) throws DatabaseException
- Specified by:
getViewDefinition
in interfaceDatabase
- Overrides:
getViewDefinition
in classAbstractJdbcDatabase
- Throws:
DatabaseException
-
parseDate
public Date parseDate(String dateAsString) throws DateParseException
- Specified by:
parseDate
in interfaceDatabase
- Overrides:
parseDate
in classAbstractJdbcDatabase
- Throws:
DateParseException
-
generatePrimaryKeyName
public String generatePrimaryKeyName(String tableName)
- Specified by:
generatePrimaryKeyName
in interfaceDatabase
- Overrides:
generatePrimaryKeyName
in classAbstractJdbcDatabase
-
getSchemaFromJdbcInfo
public CatalogAndSchema getSchemaFromJdbcInfo(String rawCatalogName, String rawSchemaName)
- Overrides:
getSchemaFromJdbcInfo
in classAbstractJdbcDatabase
-
getJdbcCatalogName
public String getJdbcCatalogName(CatalogAndSchema schema)
- Overrides:
getJdbcCatalogName
in classAbstractJdbcDatabase
-
getJdbcSchemaName
public String getJdbcSchemaName(CatalogAndSchema schema)
- Overrides:
getJdbcSchemaName
in classAbstractJdbcDatabase
-
jdbcCallsCatalogsSchemas
public boolean jdbcCallsCatalogsSchemas()
- Overrides:
jdbcCallsCatalogsSchemas
in classAbstractJdbcDatabase
-
isSystemObject
public boolean isSystemObject(DatabaseObject example)
- Specified by:
isSystemObject
in interfaceDatabase
- Overrides:
isSystemObject
in classAbstractJdbcDatabase
-
mustQuoteObjectName
protected boolean mustQuoteObjectName(String objectName, Class<? extends DatabaseObject> objectType)
- Overrides:
mustQuoteObjectName
in classAbstractJdbcDatabase
-
getSchemaAndCatalogCase
public CatalogAndSchema.CatalogAndSchemaCase getSchemaAndCatalogCase()
DB2 database are not case sensitive. However schemas and catalogs are case sensitive- Specified by:
getSchemaAndCatalogCase
in interfaceDatabase
- Overrides:
getSchemaAndCatalogCase
in classAbstractJdbcDatabase
- Returns:
- UPPER_CASE by default
-
getMaxFractionalDigitsForTimestamp
public int getMaxFractionalDigitsForTimestamp()
Description copied from class:AbstractJdbcDatabase
Most relational databases support 9 fractional digits, and subclasses must overwrite this method if they support less than that.- Specified by:
getMaxFractionalDigitsForTimestamp
in interfaceDatabase
- Overrides:
getMaxFractionalDigitsForTimestamp
in classAbstractJdbcDatabase
- Returns:
- the maximum number of supported fractional digits in TIMESTAMP columns
-
-