Package liquibase.database.core
Class OracleDatabase
- java.lang.Object
-
- liquibase.database.AbstractJdbcDatabase
-
- liquibase.database.core.OracleDatabase
-
- All Implemented Interfaces:
AutoCloseable,Database,PrioritizedService
public class OracleDatabase extends AbstractJdbcDatabase
Encapsulates Oracle database support.
-
-
Field Summary
Fields Modifier and Type Field Description protected intLONG_IDENTIFIERS_LEGNTHstatic intORACLE_12C_MAJOR_VERSIONstatic StringPRODUCT_NAMEstatic PatternPROXY_USER_PATTERNprotected intSHORT_IDENTIFIERS_LENGTH-
Fields inherited from class liquibase.database.AbstractJdbcDatabase
caseSensitive, currentDateTimeFunction, dateFunctions, defaultAutoIncrementBy, defaultAutoIncrementStartWith, defaultCatalogName, defaultSchemaName, quotingStrategy, sequenceCurrentValueFunction, sequenceNextValueFunction, unmodifiableDataTypes, unquotedObjectsAreUppercased
-
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description OracleDatabase()Default constructor for an object that represents the Oracle Database DBMS.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanAccessDbaRecycleBin()StringgenerateDatabaseFunctionValue(DatabaseFunction databaseFunction)Some function names are placeholders that need to be replaced with the specific database value.StringgeneratePrimaryKeyName(String tableName)protected StringgetAutoIncrementClause(String generationType, Boolean defaultOnNull)Default implementation.protected StringgetConnectionCatalogName()intgetDatabaseMajorVersion()intgetDatabaseMinorVersion()intgetDataTypeMaxParameters(String dataTypeName)StringgetDateLiteral(String isoDate)Returns an Oracle date literal with the same value as a string formatted using ISO 8601.StringgetDbaRecycleBinWarning()StringgetDefaultCatalogName()protected StringgetDefaultDatabaseProductName()StringgetDefaultDriver(String url)If this database understands the given url, return the default driver class name.IntegergetDefaultPort()intgetIdentifierMaximumLength()Returns the maximum number of bytes (NOT: characters) for an identifier.StringgetJdbcCatalogName(CatalogAndSchema schema)StringgetJdbcSchemaName(CatalogAndSchema schema)intgetPriority()StringgetShortName()Returns an all-lower-case short name of the product.StringgetSystemTableWhereClause(String tableNameColumn)Set<String>getUserDefinedTypes()booleanisCorrectDatabaseImplementation(DatabaseConnection conn)Is this AbstractDatabase subclass the correct one to use for the given connection.booleanisReservedWord(String objectName)booleanisSystemObject(DatabaseObject example)booleanisValidOracleIdentifier(String identifier, Class<? extends DatabaseObject> type)Tests if the given String would be a valid identifier in Oracle DBMS.booleanjdbcCallsCatalogsSchemas()voidsetConnection(DatabaseConnection conn)booleansupportsAutoIncrement()booleansupportsInitiallyDeferrableColumns()Returns whether this database support initially deferrable columns.booleansupportsNotNullConstraintNames()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.booleansupportsRestrictForeignKeys()booleansupportsSchemas()Oracle supports catalogs in liquibase termsbooleansupportsSequences()Does the database type support sequence.booleansupportsTablespaces()ValidationErrorsvalidate()-
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, get, getAutoCommitMode, getAutoIncrementByClause, getAutoIncrementClause, getAutoIncrementClause, getAutoIncrementClosing, getAutoIncrementOpening, getAutoIncrementStartWithClause, getConcatSql, getConnection, getConnectionSchemaName, getConnectionSchemaNameCallStatement, getContainingObjects, getCurrentDateTimeFunction, getDatabaseChangeLogLockTableName, getDatabaseChangeLogTableName, getDatabaseProductName, getDatabaseProductVersion, getDateFunctions, getDateLiteral, getDateLiteral, getDateTimeLiteral, getDefaultFractionalDigitsForTimestamp, getDefaultScaleForNativeDataType, getDefaultSchema, getDefaultSchemaName, getFetchSize, getJdbcCatalogName, getJdbcSchemaName, getLineComment, getLiquibaseCatalogName, getLiquibaseSchemaName, getLiquibaseTablespaceName, getMaxFractionalDigitsForTimestamp, getName, getObjectQuotingStrategy, getOutputDefaultCatalog, getOutputDefaultSchema, getQuotingEndCharacter, getQuotingEndReplacement, getQuotingStartCharacter, getRanChangeSet, getRanChangeSetList, getRanDate, getRunStatus, getSchemaAndCatalogCase, getSchemaFromJdbcInfo, getSystemSchema, getSystemTables, getSystemViews, getTimeLiteral, getViewDefinition, hashCode, isAutoCommit, isCaseSensitive, isCurrentTimeFunction, isDateOnly, isDateTime, isDefaultCatalog, isDefaultSchema, isFunction, isLiquibaseObject, isSafeToRunUpdate, isSystemView, isTimeOnly, isTimestamp, markChangeSetExecStatus, mustQuoteObjectName, parseDate, quoteObject, removeRanStatus, requiresExplicitNullForColumns, requiresPassword, requiresUsername, resetInternalState, rollback, saveRollbackStatement, saveStatements, set, setAutoCommit, setCanCacheLiquibaseTableInfo, setCaseSensitive, setCurrentDateTimeFunction, setDatabaseChangeLogLockTableName, setDatabaseChangeLogTableName, setDefaultCatalogName, setDefaultSchemaName, setLiquibaseCatalogName, setLiquibaseSchemaName, setLiquibaseTablespaceName, setObjectQuotingStrategy, setOutputDefaultCatalog, setOutputDefaultSchema, startsWithNumeric, supportsBatchUpdates, supportsCatalogInObjectName, supportsCatalogs, supportsDDLInTransaction, supportsDropTableCascadeConstraints, supportsForeignKeyDisable, supportsPrimaryKeyNames, tag, toString, unescapeDataTypeName, unescapeDataTypeString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface liquibase.database.Database
getDisplayName
-
-
-
-
Field Detail
-
PROXY_USER_PATTERN
public static final Pattern PROXY_USER_PATTERN
-
PRODUCT_NAME
public static final String PRODUCT_NAME
- See Also:
- Constant Field Values
-
SHORT_IDENTIFIERS_LENGTH
protected final int SHORT_IDENTIFIERS_LENGTH
- See Also:
- Constant Field Values
-
LONG_IDENTIFIERS_LEGNTH
protected final int LONG_IDENTIFIERS_LEGNTH
- See Also:
- Constant Field Values
-
ORACLE_12C_MAJOR_VERSION
public static final int ORACLE_12C_MAJOR_VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPriority
public int getPriority()
-
setConnection
public void setConnection(DatabaseConnection conn)
- Specified by:
setConnectionin interfaceDatabase- Overrides:
setConnectionin classAbstractJdbcDatabase
-
getShortName
public String getShortName()
Description copied from interface:DatabaseReturns an all-lower-case short name of the product. Used for end-user selecting of database type such as the DBMS precondition.
-
getDefaultDatabaseProductName
protected String getDefaultDatabaseProductName()
- Specified by:
getDefaultDatabaseProductNamein classAbstractJdbcDatabase
-
getDatabaseMajorVersion
public int getDatabaseMajorVersion() throws DatabaseException- Specified by:
getDatabaseMajorVersionin interfaceDatabase- Overrides:
getDatabaseMajorVersionin classAbstractJdbcDatabase- Throws:
DatabaseException
-
getDatabaseMinorVersion
public int getDatabaseMinorVersion() throws DatabaseException- Specified by:
getDatabaseMinorVersionin interfaceDatabase- Overrides:
getDatabaseMinorVersionin classAbstractJdbcDatabase- Throws:
DatabaseException
-
getDefaultPort
public Integer getDefaultPort()
-
getJdbcCatalogName
public String getJdbcCatalogName(CatalogAndSchema schema)
- Overrides:
getJdbcCatalogNamein classAbstractJdbcDatabase
-
getJdbcSchemaName
public String getJdbcSchemaName(CatalogAndSchema schema)
- Overrides:
getJdbcSchemaNamein classAbstractJdbcDatabase
-
getAutoIncrementClause
protected String getAutoIncrementClause(String generationType, Boolean defaultOnNull)
Description copied from class:AbstractJdbcDatabaseDefault implementation. Intended for override in database specific cases- Overrides:
getAutoIncrementClausein classAbstractJdbcDatabase
-
generatePrimaryKeyName
public String generatePrimaryKeyName(String tableName)
- Specified by:
generatePrimaryKeyNamein interfaceDatabase- Overrides:
generatePrimaryKeyNamein classAbstractJdbcDatabase
-
supportsInitiallyDeferrableColumns
public boolean supportsInitiallyDeferrableColumns()
Description copied from interface:DatabaseReturns whether this database support initially deferrable columns.
-
isReservedWord
public boolean isReservedWord(String objectName)
- Specified by:
isReservedWordin interfaceDatabase- Overrides:
isReservedWordin classAbstractJdbcDatabase
-
supportsSequences
public boolean supportsSequences()
Description copied from class:AbstractJdbcDatabaseDoes the database type support sequence.- Specified by:
supportsSequencesin interfaceDatabase- Overrides:
supportsSequencesin classAbstractJdbcDatabase
-
supportsSchemas
public boolean supportsSchemas()
Oracle supports catalogs in liquibase terms- Specified by:
supportsSchemasin interfaceDatabase- Overrides:
supportsSchemasin classAbstractJdbcDatabase- Returns:
- false
-
getConnectionCatalogName
protected String getConnectionCatalogName() throws DatabaseException
- Overrides:
getConnectionCatalogNamein classAbstractJdbcDatabase- Throws:
DatabaseException
-
isCorrectDatabaseImplementation
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException
Description copied from interface:DatabaseIs this AbstractDatabase subclass the correct one to use for the given connection.- Throws:
DatabaseException
-
getDefaultDriver
public String getDefaultDriver(String url)
Description copied from interface:DatabaseIf this database understands the given url, return the default driver class name. Otherwise return null.
-
getDefaultCatalogName
public String getDefaultCatalogName()
- Specified by:
getDefaultCatalogNamein interfaceDatabase- Overrides:
getDefaultCatalogNamein classAbstractJdbcDatabase
-
getDateLiteral
public String getDateLiteral(String isoDate)
Returns an Oracle 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
- YYYY-MM-DDThh:mm:ss
- Specified by:
getDateLiteralin interfaceDatabase- Overrides:
getDateLiteralin classAbstractJdbcDatabase
-
isSystemObject
public boolean isSystemObject(DatabaseObject example)
- Specified by:
isSystemObjectin interfaceDatabase- Overrides:
isSystemObjectin classAbstractJdbcDatabase
-
supportsTablespaces
public boolean supportsTablespaces()
-
supportsAutoIncrement
public boolean supportsAutoIncrement()
- Specified by:
supportsAutoIncrementin interfaceDatabase- Overrides:
supportsAutoIncrementin classAbstractJdbcDatabase
-
supportsRestrictForeignKeys
public boolean supportsRestrictForeignKeys()
- Specified by:
supportsRestrictForeignKeysin interfaceDatabase- Overrides:
supportsRestrictForeignKeysin classAbstractJdbcDatabase
-
getDataTypeMaxParameters
public int getDataTypeMaxParameters(String dataTypeName)
- Specified by:
getDataTypeMaxParametersin interfaceDatabase- Overrides:
getDataTypeMaxParametersin classAbstractJdbcDatabase
-
jdbcCallsCatalogsSchemas
public boolean jdbcCallsCatalogsSchemas()
- Overrides:
jdbcCallsCatalogsSchemasin classAbstractJdbcDatabase
-
generateDatabaseFunctionValue
public String generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
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- Overrides:
generateDatabaseFunctionValuein classAbstractJdbcDatabase- Parameters:
databaseFunction- database function to check.- Returns:
- the string value to use for an update or generate
-
validate
public ValidationErrors validate()
- Specified by:
validatein interfaceDatabase- Overrides:
validatein classAbstractJdbcDatabase
-
getDbaRecycleBinWarning
public String getDbaRecycleBinWarning()
-
canAccessDbaRecycleBin
public boolean canAccessDbaRecycleBin()
-
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- Overrides:
supportsNotNullConstraintNamesin classAbstractJdbcDatabase- Returns:
- true if the database supports naming NOT NULL constraints, false if not.
-
isValidOracleIdentifier
public boolean isValidOracleIdentifier(String identifier, Class<? extends DatabaseObject> type)
Tests if the given String would be a valid identifier in Oracle DBMS. In Oracle, a valid identifier has the following form (case-insensitive comparison): 1st character: A-Z 2..n characters: A-Z0-9$_# The maximum length of an identifier differs by Oracle version and object type.
-
getIdentifierMaximumLength
public int getIdentifierMaximumLength()
Returns the maximum number of bytes (NOT: characters) for an identifier. For Oracle <=12c Release 20, this is 30 bytes, and starting from 12cR2, up to 128 (except for tablespaces, PDB names and some other rather rare object types).- Returns:
- the maximum length of an object identifier, in bytes
-
-