Top Description Fields Constructors Methods
liquibase.database

public abstract Class AbstractJdbcDatabase

extends Object
implements Database
Class Inheritance
All Implemented Interfaces
liquibase.database.Database, java.lang.AutoCloseable, liquibase.servicelocator.PrioritizedService
Known Direct Subclasses
liquibase.database.core.AbstractDb2Database, liquibase.database.core.DerbyDatabase, liquibase.database.core.FirebirdDatabase, liquibase.database.core.H2Database, liquibase.database.core.HsqlDatabase, liquibase.database.core.InformixDatabase, liquibase.database.core.Ingres9Database, liquibase.database.core.MSSQLDatabase, liquibase.database.core.MySQLDatabase, liquibase.database.core.OracleDatabase, liquibase.database.core.PostgresDatabase, liquibase.database.core.SnowflakeDatabase, liquibase.database.core.SQLiteDatabase, liquibase.database.core.SybaseASADatabase, liquibase.database.core.SybaseDatabase, liquibase.database.core.UnsupportedDatabase
Static Imports
liquibase.util.StringUtil.join

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 TypeField and Description
private final Map<String, Object>
private boolean
protected Boolean
private DatabaseConnection
private static final Pattern
private static final String
protected String
private String
private String
private static final Pattern
private static final String
private static final Pattern
private static final String
protected List<DatabaseFunction>
private static final int
protected BigInteger
protected BigInteger
protected String
private boolean
protected String
private static final int
private String
private String
private String
private static final Pattern
private static final String
private static final Pattern
private static final String
private static final Pattern
private static final String
private boolean
private boolean
private Boolean
protected ObjectQuotingStrategy
private final Set<String>
protected String
protected String
sequenceNextValueFunction

The sequence name will be substituted into the string e.g. NEXTVAL('%s')

private static final Pattern
private static final String
private static final Pattern
private static final String
private static final Pattern
private static final String
protected List<String>
protected Boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
protected boolean
public void
close()

Implements liquibase.database.Database.close.

Closes this resource, relinquishing any underlying resources.

public void
public String
correctObjectName(final String objectName, final Class<? extends DatabaseObject> objectType)

Implements liquibase.database.Database.correctObjectName.

Fix the object name to the format the database expects, handling changes in case, etc.

public CatalogAndSchema
correctSchema(final String catalog, final String schema)
Deprecated

public CatalogAndSchema
correctSchema(final CatalogAndSchema schema)

Implements liquibase.database.Database.correctSchema.

Deprecated

Returns a new CatalogAndSchema adjusted for this database.

public boolean
public boolean
dataTypeIsNotModifiable(final String
type name
typeName
)

Implements liquibase.database.Database.dataTypeIsNotModifiable.

Types like int4 in postgres cannot have a modifier.

public boolean
public boolean
public void
dropDatabaseObjects(final CatalogAndSchema
schema (catalog+)schema to drop
schemaToDrop
)

Implements liquibase.database.Database.dropDatabaseObjects.

Drops all objects in a specified schema.

public void
public boolean
equals(final Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public String
escapeColumnName(final String catalogName, final String schemaName, final String tableName, final String
column name
columnName
)

Implements liquibase.database.Database.escapeColumnName.

Escapes a single column name in a database-dependent manner so reserved words can be used as a column name (i.e. "return").

public String
escapeColumnName(String catalogName, String schemaName, String tableName, String columnName, boolean quoteNamesThatMayBeFunctions)

Implements liquibase.database.Database.escapeColumnName.

Similar to escapeColumnName(String, String, String, String) but allows control over whether function-like names should be left unquoted.

public String
escapeColumnNameList(final String
list of column names
columnNames
)

Implements liquibase.database.Database.escapeColumnNameList.

Escapes a list of column names in a database-dependent manner so reserved words can be used as a column name (i.e. "return").

public String
public String
public String
escapeIndexName(final String catalogName, final String schemaName, final String indexName)

Implements liquibase.database.Database.escapeIndexName.

public String
escapeObjectName(String catalogName, String schemaName, final String objectName, final Class<? extends DatabaseObject> objectType)

Implements liquibase.database.Database.escapeObjectName.

public String
escapeObjectName(String objectName, final Class<? extends DatabaseObject> objectType)

Implements liquibase.database.Database.escapeObjectName.

public String
escapeSequenceName(final String catalogName, final String schemaName, final String sequenceName)

Implements liquibase.database.Database.escapeSequenceName.

public String
public String
escapeTableName(final String catalogName, final String schemaName, final String tableName)

Implements liquibase.database.Database.escapeTableName.

public String
escapeViewName(final String catalogName, final String schemaName, final String viewName)

Implements liquibase.database.Database.escapeViewName.

public void
execute(final SqlStatement[] statements, final List<SqlVisitor> sqlVisitors)

Implements liquibase.database.Database.execute.

public void
public void
public void
executeStatements(final Change change, final DatabaseChangeLog changeLog, final List<SqlVisitor> sqlVisitors)

Implements liquibase.database.Database.executeStatements.

protected List<SqlVisitor>
filterRollbackVisitors(final List<SqlVisitor> visitors)

Takes a list of SqlVisitors and returns a new list with only the SqlVisitors set to apply to rollbacks

protected boolean
protected boolean
public String
generateDatabaseFunctionValue(final DatabaseFunction
database function to check.
databaseFunction
)

Implements liquibase.database.Database.generateDatabaseFunctionValue.

Some function names are placeholders that need to be replaced with the specific database value.

public String
public Object
get(String key)

public boolean
getAutoCommitMode()

Implements liquibase.database.Database.getAutoCommitMode.

Auto-commit mode to run in

protected String
public String
getAutoIncrementClause(final BigInteger startWith, final BigInteger incrementBy, final String generationType, final Boolean defaultOnNull)

Implements liquibase.database.Database.getAutoIncrementClause.

Returns database-specific auto-increment DDL clause.

protected String
protected String
getAutoIncrementClause(final String generationType, final Boolean defaultOnNull)

Default implementation.

protected String
protected String
protected String
public String
getConcatSql(final String... values)

Implements liquibase.database.Database.getConcatSql.

Returns SQL to concat the passed values.

public DatabaseConnection
protected String
protected String
getConnectionSchemaName()

Overwrite this method to get the default schema name for the connection.

protected SqlStatement
getConnectionSchemaNameCallStatement()

Used to obtain the connection schema name through a statement Override this method to change the statement.

public DatabaseObject[]
public String
getCurrentDateTimeFunction()

Implements liquibase.database.Database.getCurrentDateTimeFunction.

Returns database-specific function for generating the current date/time.

public String
public String
public int
public int
public String
getDatabaseProductName()

Implements liquibase.database.Database.getDatabaseProductName.

Returns the name of the database product according to the underlying database.

public String
public int
public List<DatabaseFunction>
getDateFunctions()

Implements liquibase.database.Database.getDateFunctions.

Returns list of database native date functions

public String
getDateLiteral(final String isoDate)

Implements liquibase.database.Database.getDateLiteral.

Return a date literal with the same value as a string formatted using ISO 8601.

public String
public String
public String
public String
protected abstract String
public int

Returns:

the default precision / number of maximum digits in a timestamp if nothing else is specified.
getDefaultFractionalDigitsForTimestamp
()

Implements liquibase.database.Database.getDefaultFractionalDigitsForTimestamp.

SQL Standard (Foundation) says: "...if <timestamp precision> is not specified, then 6 is implicit."

public Integer
getDefaultScaleForNativeDataType(String
the name of the native data type (case-insensitive).
nativeDataType
)

Implements liquibase.database.Database.getDefaultScaleForNativeDataType.

Returns the default precision for a given native data type, e.g. "datetime2" for Microsoft SQL Server.

public CatalogAndSchema
public String
public Integer
public String
public final String
getJdbcCatalogName(final Schema schema)

public String
public final String
getJdbcSchemaName(final Schema schema)

public String
getLineComment()

Implements liquibase.database.Database.getLineComment.

Returns database-specific line comment string.

public String
public String
public String
public int

Returns:

the maximum number of supported fractional digits in TIMESTAMP columns
getMaxFractionalDigitsForTimestamp
()

Implements liquibase.database.Database.getMaxFractionalDigitsForTimestamp.

Most relational databases support 9 fractional digits, and subclasses must overwrite this method if they support less than that.

public String
public ObjectQuotingStrategy
public boolean
public boolean
getOutputDefaultSchema()

Implements liquibase.database.Database.getOutputDefaultSchema.

Should the schema be included in identifiers even if it is the default schema?

protected String
protected String
protected String
public RanChangeSet
public List<RanChangeSet>
getRanChangeSetList()

Implements liquibase.database.Database.getRanChangeSetList.

Returns the ChangeSets that have been run against the current database.

public Date
protected String
getRawDatabaseChangeLogLockTableName()

Method used by extensions to get raw dbcll table name

protected String
getRawDatabaseChangeLogTableName()

Method used by extensions to get raw dbcl table name

public ChangeSet.RunStatus
getRunStatus(final ChangeSet changeSet)

Implements liquibase.database.Database.getRunStatus.

Returns the run status for the given ChangeSet

public CatalogAndSchema.CatalogAndSchemaCase

Returns:

UPPER_CASE by default
getSchemaAndCatalogCase
()

Implements liquibase.database.Database.getSchemaAndCatalogCase.

This logic is used when db support catalogs

public CatalogAndSchema
getSchemaFromJdbcInfo(final String rawCatalogName, final String rawSchemaName)

public String
protected Set<String>
getSystemTables()

Returns system (undroppable) views.

protected Set<String>
getSystemViews()

Returns system (undroppable) views.

public String
public String
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
public boolean
protected boolean
protected boolean
isCurrentTimeFunction(final String functionValue)

protected boolean
isDateOnly(final String
value to check.
isoDate
)

Returns true if the String conforms to an ISO 8601 date, e.g. 2016-12-31.

protected boolean
isDateTime(final String
value to check.
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.

public boolean
isDefaultCatalog(final String
catalog name to be tested
catalog
)

Implements liquibase.database.Database.isDefaultCatalog.

If the database supports catalogs, test if a given catalog name equals to the default catalog of the current logged in user.

public boolean
isDefaultSchema(final String
catalog name to be tested
catalog
,
final String
schema name to be tested
schema
)

Implements liquibase.database.Database.isDefaultSchema.

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.

public boolean
public boolean
public boolean
public boolean

Returns:

true if the database connection URL contains "localhost" or "127.0.0.1", otherwise false.
isSafeToRunUpdate
()

Implements liquibase.database.Database.isSafeToRunUpdate.

Default implementation of the isSafeToRunUpdate() method.

public boolean
public boolean
isSystemView(CatalogAndSchema schema, final String viewName)

protected boolean
isTimeOnly(final String
value to check
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(final String
value to check
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.

public boolean
public void
markChangeSetExecStatus(final ChangeSet changeSet, final ChangeSet.ExecType execType)

Implements liquibase.database.Database.markChangeSetExecStatus.

After the changeset has been ran against the database this method will update the change log table with the information.

protected boolean
mustQuoteObjectName(String objectName, Class<? extends DatabaseObject> objectType)

public Date
private CatalogAndSchema.CatalogAndSchemaCase
public String
quoteObject(final String objectName, final Class<? extends DatabaseObject> objectType)

public void
public boolean
requiresExplicitNullForColumns()

Implements liquibase.database.Database.requiresExplicitNullForColumns.

Does the database require explicit NULL for nullable columns?

public boolean
public boolean
public void
public void
public void
saveRollbackStatement(final Change change, final List<SqlVisitor> sqlVisitors, final Writer writer)

Implements liquibase.database.Database.saveRollbackStatement.

public void
saveStatements(final Change change, final List<SqlVisitor> sqlVisitors, final Writer writer)

Implements liquibase.database.Database.saveStatements.

public AbstractJdbcDatabase
set(String key, Object value)

public void
public void
public void
setCaseSensitive(Boolean caseSensitive)

public void
public void
public void
setDatabaseChangeLogLockTableName(final String tableName)

Implements liquibase.database.Database.setDatabaseChangeLogLockTableName.

Set the table name of the change log lock to the given table name

public void
setDatabaseChangeLogTableName(final String
the name of the change log table to set
tableName
)

Implements liquibase.database.Database.setDatabaseChangeLogTableName.

Sets the table name of the change log to the given table name.

public void
public void
public void
public void
public void
public void
public void
public void
setOutputDefaultSchema(final boolean outputDefaultSchema)

Implements liquibase.database.Database.setOutputDefaultSchema.

Whether the default schema should be included in generated SQL

protected boolean
startsWithNumeric(final String objectName)

public boolean
public boolean
supportsBatchUpdates()

Implements liquibase.database.Database.supportsBatchUpdates.

Does the database support batched DML (INSERT/UPDATE/DELETE/MERGE/...) statements sent in a single call to the database?

public boolean
public boolean
public boolean

Returns:

True if the database supports DDL within a transaction, otherwise false.
supportsDDLInTransaction
()

Implements liquibase.database.Database.supportsDDLInTransaction.

Determines if the database supports DDL within a transaction or not.

public boolean
public boolean
public boolean
supportsNotNullConstraintNames()

Implements liquibase.database.Database.supportsNotNullConstraintNames.

Does this database treat NOT NULL as an own kind of CONSTRAINT (in addition of simply being a column property)?

public boolean
public boolean
public boolean
public boolean
supportsSequences()

Implements liquibase.database.Database.supportsSequences.

Does the database type support sequence.

public void
tag(final String tagString)

Implements liquibase.database.Database.tag.

Tags the database changelog with the given string.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public String
public String
public ValidationErrors
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait