Package liquibase.database.core
Class OracleDatabase
java.lang.Object
liquibase.database.AbstractJdbcDatabase
liquibase.database.core.OracleDatabase
- All Implemented Interfaces:
AutoCloseable
,Database
,PrioritizedService
Encapsulates Oracle database support.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final int
static final int
static final int
static final String
static final Pattern
protected final int
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
ConstructorDescriptionDefault constructor for an object that represents the Oracle Database DBMS. -
Method Summary
Modifier and TypeMethodDescriptionboolean
correctObjectName
(String objectName, Class<? extends DatabaseObject> objectType) Fix the object name to the format the database expects, handling changes in case, etc.generateDatabaseFunctionValue
(DatabaseFunction databaseFunction) Some function names are placeholders that need to be replaced with the specific database value.generatePrimaryKeyName
(String tableName) protected String
getAutoIncrementClause
(String generationType, Boolean defaultOnNull) Default implementation.protected String
int
int
int
getDataTypeMaxParameters
(String dataTypeName) getDateLiteral
(String isoDate) Returns an Oracle date literal with the same value as a string formatted using ISO 8601.protected String
getDefaultDriver
(String url) If this database understands the given url, return the default driver class name.int
Returns the maximum number of bytes (NOT: characters) for an identifier.getJdbcCatalogName
(CatalogAndSchema schema) getJdbcSchemaName
(CatalogAndSchema schema) int
Returns an all-lower-case short name of the product.getSystemTableWhereClause
(String tableNameColumn) boolean
Is this AbstractDatabase subclass the correct one to use for the given connection.boolean
isReservedWord
(String objectName) boolean
isSystemObject
(DatabaseObject example) boolean
isValidOracleIdentifier
(String identifier, Class<? extends DatabaseObject> type) Tests if the given String would be a valid identifier in Oracle DBMS.boolean
void
boolean
supports
(Class<? extends DatabaseObject> object) Whether this database supports the specified object type.boolean
boolean
Does the particular database implementation support the database changelog history feature and associated table?boolean
Returns whether this database support initially deferrable columns.boolean
Does this database treat NOT NULL as an own kind of CONSTRAINT (in addition of simply being a column property)?boolean
boolean
Oracle supports catalogs in liquibase termsboolean
Does the database type support sequence.boolean
validate()
Methods inherited from class liquibase.database.AbstractJdbcDatabase
addReservedWords, canCreateChangeLogTable, close, commit, 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, getRawDatabaseChangeLogLockTableName, getRawDatabaseChangeLogTableName, getRunStatus, getSchemaAndCatalogCase, getSchemaFromJdbcInfo, getSystemSchema, getSystemTables, getSystemViews, getTimeLiteral, getViewDefinition, hashCode, isAutoCommit, isCaseSensitive, isCatalogOrSchemaType, 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, setPreviousAutoCommit, 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
addCompleteSqlToScope, afterUpdate, checkDatabaseConnection, dropDatabaseObjects, failOnDefferable, generateConnectCommandSuccessMessage, getDisplayName, supportsCreateIfNotExists, temporarilySetObjectQuotingStrategy
-
Field Details
-
PROXY_USER_PATTERN
-
PRODUCT_NAME
- See Also:
-
SHORT_IDENTIFIERS_LENGTH
protected final int SHORT_IDENTIFIERS_LENGTH- See Also:
-
LONG_IDENTIFIERS_LEGNTH
protected final int LONG_IDENTIFIERS_LEGNTH- See Also:
-
ORACLE_12C_MAJOR_VERSION
public static final int ORACLE_12C_MAJOR_VERSION- See Also:
-
ORACLE_23C_MAJOR_VERSION
public static final int ORACLE_23C_MAJOR_VERSION- See Also:
-
-
Constructor Details
-
OracleDatabase
public OracleDatabase()Default constructor for an object that represents the Oracle Database DBMS.
-
-
Method Details
-
getPriority
public int getPriority() -
setConnection
- Specified by:
setConnection
in interfaceDatabase
- Overrides:
setConnection
in classAbstractJdbcDatabase
-
getShortName
Description copied from interface:Database
Returns an all-lower-case short name of the product. Used for end-user selecting of database type such as the DBMS precondition. -
getDefaultDatabaseProductName
- Specified by:
getDefaultDatabaseProductName
in classAbstractJdbcDatabase
-
getDatabaseMajorVersion
- Specified by:
getDatabaseMajorVersion
in interfaceDatabase
- Overrides:
getDatabaseMajorVersion
in classAbstractJdbcDatabase
- Throws:
DatabaseException
-
getDatabaseMinorVersion
- Specified by:
getDatabaseMinorVersion
in interfaceDatabase
- Overrides:
getDatabaseMinorVersion
in classAbstractJdbcDatabase
- Throws:
DatabaseException
-
getDefaultPort
-
getJdbcCatalogName
- Overrides:
getJdbcCatalogName
in classAbstractJdbcDatabase
-
getJdbcSchemaName
- Overrides:
getJdbcSchemaName
in classAbstractJdbcDatabase
-
getAutoIncrementClause
Description copied from class:AbstractJdbcDatabase
Default implementation. Intended for override in database specific cases- Overrides:
getAutoIncrementClause
in classAbstractJdbcDatabase
-
generatePrimaryKeyName
- Specified by:
generatePrimaryKeyName
in interfaceDatabase
- Overrides:
generatePrimaryKeyName
in classAbstractJdbcDatabase
-
supportsInitiallyDeferrableColumns
public boolean supportsInitiallyDeferrableColumns()Description copied from interface:Database
Returns whether this database support initially deferrable columns. -
isReservedWord
- Specified by:
isReservedWord
in interfaceDatabase
- Overrides:
isReservedWord
in classAbstractJdbcDatabase
-
supportsSequences
public boolean supportsSequences()Description copied from class:AbstractJdbcDatabase
Does the database type support sequence.- Specified by:
supportsSequences
in interfaceDatabase
- Overrides:
supportsSequences
in classAbstractJdbcDatabase
-
supports
Description copied from interface:Database
Whether this database supports the specified object type. It is invoking the deprecated methods to ensure that extensions are not broken, but once those are removed it will return only true- Parameters:
object
- the object type to check- Returns:
- true if the database supports the object type, false otherwise
-
supportsSchemas
public boolean supportsSchemas()Oracle supports catalogs in liquibase terms- Specified by:
supportsSchemas
in interfaceDatabase
- Overrides:
supportsSchemas
in classAbstractJdbcDatabase
- Returns:
- false
-
getConnectionCatalogName
- Overrides:
getConnectionCatalogName
in classAbstractJdbcDatabase
- Throws:
DatabaseException
-
isCorrectDatabaseImplementation
Description copied from interface:Database
Is this AbstractDatabase subclass the correct one to use for the given connection.- Throws:
DatabaseException
-
getDefaultDriver
Description copied from interface:Database
If this database understands the given url, return the default driver class name. Otherwise return null. -
getDefaultCatalogName
- Specified by:
getDefaultCatalogName
in interfaceDatabase
- Overrides:
getDefaultCatalogName
in classAbstractJdbcDatabase
-
getDateLiteral
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:
getDateLiteral
in interfaceDatabase
- Overrides:
getDateLiteral
in classAbstractJdbcDatabase
-
isSystemObject
- Specified by:
isSystemObject
in interfaceDatabase
- Overrides:
isSystemObject
in classAbstractJdbcDatabase
-
supportsTablespaces
public boolean supportsTablespaces() -
supportsAutoIncrement
public boolean supportsAutoIncrement()- Specified by:
supportsAutoIncrement
in interfaceDatabase
- Overrides:
supportsAutoIncrement
in classAbstractJdbcDatabase
-
supportsRestrictForeignKeys
public boolean supportsRestrictForeignKeys()- Specified by:
supportsRestrictForeignKeys
in interfaceDatabase
- Overrides:
supportsRestrictForeignKeys
in classAbstractJdbcDatabase
-
getDataTypeMaxParameters
- Specified by:
getDataTypeMaxParameters
in interfaceDatabase
- Overrides:
getDataTypeMaxParameters
in classAbstractJdbcDatabase
-
getSystemTableWhereClause
-
jdbcCallsCatalogsSchemas
public boolean jdbcCallsCatalogsSchemas()- Overrides:
jdbcCallsCatalogsSchemas
in classAbstractJdbcDatabase
-
getUserDefinedTypes
-
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
- Overrides:
generateDatabaseFunctionValue
in classAbstractJdbcDatabase
- Parameters:
databaseFunction
- database function to check.- Returns:
- the string value to use for an update or generate
-
validate
- Specified by:
validate
in interfaceDatabase
- Overrides:
validate
in classAbstractJdbcDatabase
-
getDbaRecycleBinWarning
-
canAccessDbaRecycleBin
public boolean canAccessDbaRecycleBin() -
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
- Overrides:
supportsNotNullConstraintNames
in classAbstractJdbcDatabase
- Returns:
- true if the database supports naming NOT NULL constraints, false if not.
-
isValidOracleIdentifier
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
-
supportsDatabaseChangeLogHistory
public boolean supportsDatabaseChangeLogHistory()Description copied from interface:Database
Does the particular database implementation support the database changelog history feature and associated table?- Returns:
- true if supported, false otherwise
-
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
- Overrides:
correctObjectName
in classAbstractJdbcDatabase
-