public interface Database extends PrioritizedService, AutoCloseable
Modifier and Type | Field and Description |
---|---|
static String |
databaseChangeLogLockTableName |
static String |
databaseChangeLogTableName |
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
Modifier and Type | Method and Description |
---|---|
void |
addReservedWords(Collection<String> words) |
void |
close() |
void |
commit() |
String |
correctObjectName(String name,
Class<? extends DatabaseObject> objectType)
Fix the object name to the format the database expects, handling changes in case, etc.
|
CatalogAndSchema |
correctSchema(CatalogAndSchema schema)
Deprecated.
|
boolean |
createsIndexesForForeignKeys() |
boolean |
dataTypeIsNotModifiable(String typeName)
Types like int4 in postgres cannot have a modifier.
|
boolean |
disableForeignKeyChecks() |
boolean |
doesTagExist(String tag)
Deprecated.
Use
ChangeLogHistoryService.tagExists(String) instead |
void |
dropDatabaseObjects(CatalogAndSchema schema)
Drops all objects in a specified schema.
|
void |
enableForeignKeyChecks() |
String |
escapeColumnName(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.
|
String |
escapeColumnName(String catalogName,
String schemaName,
String tableName,
String columnName,
boolean quoteNamesThatMayBeFunctions)
Deprecated.
Know if you should quote the name or not, and use
escapeColumnName(String, String, String, String) which will quote things that look like functions, or leave it along as you see fit. Don't rely on this function guessing. |
String |
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.
|
String |
escapeConstraintName(String constraintName) |
String |
escapeDataTypeName(String dataTypeName) |
String |
escapeIndexName(String catalogName,
String schemaName,
String indexName) |
String |
escapeObjectName(String objectName,
Class<? extends DatabaseObject> objectType) |
String |
escapeObjectName(String catalogName,
String schemaName,
String objectName,
Class<? extends DatabaseObject> objectType) |
String |
escapeSequenceName(String catalogName,
String schemaName,
String sequenceName) |
String |
escapeStringForDatabase(String string) |
String |
escapeTableName(String catalogName,
String schemaName,
String tableName) |
String |
escapeViewName(String catalogName,
String schemaName,
String viewName) |
void |
execute(SqlStatement[] statements,
List<SqlVisitor> sqlVisitors) |
void |
executeRollbackStatements(Change change,
List<SqlVisitor> sqlVisitors) |
void |
executeRollbackStatements(SqlStatement[] statements,
List<SqlVisitor> sqlVisitors) |
void |
executeStatements(Change change,
DatabaseChangeLog changeLog,
List<SqlVisitor> sqlVisitors) |
String |
generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
Some function names are placeholders that need to be replaced with the specific database value.
|
String |
generatePrimaryKeyName(String tableName) |
boolean |
getAutoCommitMode()
Auto-commit mode to run in
|
String |
getAutoIncrementClause(BigInteger startWith,
BigInteger incrementBy,
String generationType,
Boolean defaultOnNull)
Returns database-specific auto-increment DDL clause.
|
String |
getConcatSql(String... values)
Returns SQL to concat the passed values.
|
DatabaseConnection |
getConnection() |
String |
getCurrentDateTimeFunction()
Returns database-specific function for generating the current date/time.
|
String |
getDatabaseChangeLogLockTableName() |
String |
getDatabaseChangeLogTableName() |
int |
getDatabaseMajorVersion() |
int |
getDatabaseMinorVersion() |
String |
getDatabaseProductName()
Returns the name of the database product according to the underlying database.
|
String |
getDatabaseProductVersion() |
int |
getDataTypeMaxParameters(String dataTypeName) |
List<DatabaseFunction> |
getDateFunctions()
Returns list of database native date functions
|
String |
getDateLiteral(Date date) |
String |
getDateLiteral(Date defaultDateValue) |
String |
getDateLiteral(String isoDate) |
String |
getDateTimeLiteral(Timestamp timeStamp) |
String |
getDefaultCatalogName() |
String |
getDefaultDriver(String url)
If this database understands the given url, return the default driver class name.
|
int |
getDefaultFractionalDigitsForTimestamp()
When a TIMESTAMP column without the parameter "number of fractional digits" is created, what is the default
value?
|
Integer |
getDefaultPort() |
Integer |
getDefaultScaleForNativeDataType(String nativeDataType)
Returns the default precision for a given native data type, e.g.
|
CatalogAndSchema |
getDefaultSchema() |
String |
getDefaultSchemaName() |
default String |
getDisplayName() |
Integer |
getFetchSize() |
String |
getLineComment() |
String |
getLiquibaseCatalogName() |
String |
getLiquibaseSchemaName() |
String |
getLiquibaseTablespaceName() |
int |
getMaxFractionalDigitsForTimestamp()
Determines the maximum precision (number of fractional digits) for TIMESTAMP columns for the given database.
|
ObjectQuotingStrategy |
getObjectQuotingStrategy() |
boolean |
getOutputDefaultCatalog() |
boolean |
getOutputDefaultSchema()
Should the schema be included in identifiers even if it is the default schema?
|
RanChangeSet |
getRanChangeSet(ChangeSet changeSet) |
List<RanChangeSet> |
getRanChangeSetList()
Returns the ChangeSets that have been run against the current database.
|
Date |
getRanDate(ChangeSet changeSet) |
ChangeSet.RunStatus |
getRunStatus(ChangeSet changeSet)
Returns the run status for the given ChangeSet
|
CatalogAndSchema.CatalogAndSchemaCase |
getSchemaAndCatalogCase() |
String |
getShortName()
Returns an all-lower-case short name of the product.
|
String |
getSystemSchema() |
String |
getTimeLiteral(Time time) |
String |
getViewDefinition(CatalogAndSchema schema,
String name) |
boolean |
isAutoCommit() |
boolean |
isCaseSensitive() |
boolean |
isCorrectDatabaseImplementation(DatabaseConnection conn)
Is this AbstractDatabase subclass the correct one to use for the given connection.
|
boolean |
isDefaultCatalog(String catalog)
If the database supports catalogs, test if a given catalog name equals to the default catalog of the current
logged in user.
|
boolean |
isDefaultSchema(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.
|
boolean |
isFunction(String string) |
boolean |
isLiquibaseObject(DatabaseObject object) |
boolean |
isReservedWord(String string) |
boolean |
isSafeToRunUpdate() |
boolean |
isSystemObject(DatabaseObject example) |
void |
markChangeSetExecStatus(ChangeSet changeSet,
ChangeSet.ExecType execType)
After the changeset has been ran against the database this method will update the change log table
with the information.
|
Date |
parseDate(String dateAsString) |
void |
removeRanStatus(ChangeSet changeSet) |
boolean |
requiresExplicitNullForColumns()
Does the database require explicit NULL for nullable columns?
|
boolean |
requiresPassword() |
boolean |
requiresUsername() |
void |
resetInternalState() |
void |
rollback() |
void |
saveRollbackStatement(Change change,
List<SqlVisitor> sqlVisitors,
Writer writer) |
void |
saveStatements(Change change,
List<SqlVisitor> sqlVisitors,
Writer writer) |
void |
setAutoCommit(boolean b) |
void |
setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo) |
void |
setConnection(DatabaseConnection conn) |
void |
setCurrentDateTimeFunction(String function) |
void |
setDatabaseChangeLogLockTableName(String tableName)
Set the table name of the change log lock to the given table name
|
void |
setDatabaseChangeLogTableName(String tableName)
Set the table name of the change log to the given table name
|
void |
setDefaultCatalogName(String catalogName) |
void |
setDefaultSchemaName(String schemaName) |
void |
setLiquibaseCatalogName(String catalogName) |
void |
setLiquibaseSchemaName(String schemaName) |
void |
setLiquibaseTablespaceName(String tablespaceName) |
void |
setObjectQuotingStrategy(ObjectQuotingStrategy quotingStrategy) |
void |
setOutputDefaultCatalog(boolean outputDefaultCatalog) |
void |
setOutputDefaultSchema(boolean outputDefaultSchema)
Whether the default schema should be included in generated SQL
|
boolean |
supportsAutoIncrement() |
boolean |
supportsBatchUpdates()
Does the database support batched DML (INSERT/UPDATE/DELETE/MERGE/...) statements sent in a single call to
the database?
|
boolean |
supportsCatalogInObjectName(Class<? extends DatabaseObject> type) |
boolean |
supportsCatalogs() |
boolean |
supportsDDLInTransaction()
Determines if the database supports DDL within a transaction or not.
|
boolean |
supportsDropTableCascadeConstraints() |
boolean |
supportsForeignKeyDisable() |
boolean |
supportsInitiallyDeferrableColumns()
Returns whether this database support initially deferrable columns.
|
boolean |
supportsNotNullConstraintNames()
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.
|
boolean |
supportsPrimaryKeyNames() |
boolean |
supportsRestrictForeignKeys() |
boolean |
supportsSchemas() |
boolean |
supportsSequences() |
boolean |
supportsTablespaces() |
void |
tag(String tagString)
Deprecated.
Use
ChangeLogHistoryService.tag(String) instead |
String |
unescapeDataTypeName(String dataTypeName) |
String |
unescapeDataTypeString(String dataTypeString) |
ValidationErrors |
validate() |
getPriority
static final String databaseChangeLogTableName
static final String databaseChangeLogLockTableName
boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException
DatabaseException
String getDefaultDriver(String url)
DatabaseConnection getConnection()
void setConnection(DatabaseConnection conn)
boolean requiresUsername()
boolean requiresPassword()
boolean getAutoCommitMode()
boolean supportsDDLInTransaction()
String getDatabaseProductName()
String getDatabaseProductVersion() throws DatabaseException
DatabaseException
int getDatabaseMajorVersion() throws DatabaseException
DatabaseException
int getDatabaseMinorVersion() throws DatabaseException
DatabaseException
String getShortName()
default String getDisplayName()
String getDefaultCatalogName()
void setDefaultCatalogName(String catalogName) throws DatabaseException
DatabaseException
String getDefaultSchemaName()
Integer getDefaultScaleForNativeDataType(String nativeDataType)
nativeDataType
- the name of the native data type (case-insensitive).void setDefaultSchemaName(String schemaName) throws DatabaseException
DatabaseException
Integer getDefaultPort()
Integer getFetchSize()
String getLiquibaseCatalogName()
void setLiquibaseCatalogName(String catalogName)
String getLiquibaseSchemaName()
void setLiquibaseSchemaName(String schemaName)
boolean supportsInitiallyDeferrableColumns()
boolean supportsSequences()
boolean supportsDropTableCascadeConstraints()
boolean supportsAutoIncrement()
String getCurrentDateTimeFunction()
void setCurrentDateTimeFunction(String function)
String getLineComment()
String getAutoIncrementClause(BigInteger startWith, BigInteger incrementBy, String generationType, Boolean defaultOnNull)
String getDatabaseChangeLogTableName()
void setDatabaseChangeLogTableName(String tableName)
tableName
- String getDatabaseChangeLogLockTableName()
void setDatabaseChangeLogLockTableName(String tableName)
tableName
- String getLiquibaseTablespaceName()
void setLiquibaseTablespaceName(String tablespaceName)
void setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo)
void dropDatabaseObjects(CatalogAndSchema schema) throws LiquibaseException
schema
- schema (catalog+)schema to dropLiquibaseException
- if any problem occurs@Deprecated void tag(String tagString) throws DatabaseException
ChangeLogHistoryService.tag(String)
insteadDatabaseException
@Deprecated boolean doesTagExist(String tag) throws DatabaseException
ChangeLogHistoryService.tagExists(String)
insteadDatabaseException
boolean isSystemObject(DatabaseObject example)
boolean isLiquibaseObject(DatabaseObject object)
String getViewDefinition(CatalogAndSchema schema, String name) throws DatabaseException
DatabaseException
String escapeObjectName(String catalogName, String schemaName, String objectName, Class<? extends DatabaseObject> objectType)
String escapeObjectName(String objectName, Class<? extends DatabaseObject> objectType)
int getMaxFractionalDigitsForTimestamp()
int getDefaultFractionalDigitsForTimestamp()
String escapeColumnName(String catalogName, String schemaName, String tableName, String columnName)
schemaName
- tableName
- columnName
- column nameString escapeColumnName(String catalogName, String schemaName, String tableName, String columnName, boolean quoteNamesThatMayBeFunctions)
escapeColumnName(String, String, String, String)
which will quote things that look like functions, or leave it along as you see fit. Don't rely on this function guessing.escapeColumnName(String, String, String, String)
but allows control over whether function-like names should be left unquoted.String escapeColumnNameList(String columnNames)
columnNames
- list of column namesboolean supportsTablespaces()
boolean supportsCatalogs()
CatalogAndSchema.CatalogAndSchemaCase getSchemaAndCatalogCase()
boolean supportsSchemas()
boolean supportsCatalogInObjectName(Class<? extends DatabaseObject> type)
String escapeSequenceName(String catalogName, String schemaName, String sequenceName)
ChangeSet.RunStatus getRunStatus(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
RanChangeSet getRanChangeSet(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
void markChangeSetExecStatus(ChangeSet changeSet, ChangeSet.ExecType execType) throws DatabaseException
DatabaseException
List<RanChangeSet> getRanChangeSetList() throws DatabaseException
DatabaseException
Date getRanDate(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
void removeRanStatus(ChangeSet changeSet) throws DatabaseException
DatabaseException
void commit() throws DatabaseException
DatabaseException
void rollback() throws DatabaseException
DatabaseException
void close() throws DatabaseException
close
in interface AutoCloseable
DatabaseException
boolean supportsRestrictForeignKeys()
boolean isAutoCommit() throws DatabaseException
DatabaseException
void setAutoCommit(boolean b) throws DatabaseException
DatabaseException
boolean isSafeToRunUpdate() throws DatabaseException
DatabaseException
void executeStatements(Change change, DatabaseChangeLog changeLog, List<SqlVisitor> sqlVisitors) throws LiquibaseException
LiquibaseException
void execute(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) throws LiquibaseException
LiquibaseException
void saveStatements(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException, LiquibaseException
IOException
LiquibaseException
void executeRollbackStatements(Change change, List<SqlVisitor> sqlVisitors) throws LiquibaseException
LiquibaseException
void executeRollbackStatements(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) throws LiquibaseException
LiquibaseException
void saveRollbackStatement(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException, LiquibaseException
IOException
LiquibaseException
Date parseDate(String dateAsString) throws DateParseException
DateParseException
List<DatabaseFunction> getDateFunctions()
void resetInternalState()
boolean supportsForeignKeyDisable()
boolean disableForeignKeyChecks() throws DatabaseException
DatabaseException
void enableForeignKeyChecks() throws DatabaseException
DatabaseException
boolean isCaseSensitive()
boolean isReservedWord(String string)
CatalogAndSchema correctSchema(CatalogAndSchema schema)
CatalogAndSchema.standardize(Database)
String correctObjectName(String name, Class<? extends DatabaseObject> objectType)
boolean isFunction(String string)
int getDataTypeMaxParameters(String dataTypeName)
CatalogAndSchema getDefaultSchema()
boolean dataTypeIsNotModifiable(String typeName)
typeName
- type nameString generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
databaseFunction
- database function to check.ObjectQuotingStrategy getObjectQuotingStrategy()
void setObjectQuotingStrategy(ObjectQuotingStrategy quotingStrategy)
boolean createsIndexesForForeignKeys()
boolean getOutputDefaultSchema()
void setOutputDefaultSchema(boolean outputDefaultSchema)
boolean isDefaultSchema(String catalog, String schema)
catalog
- catalog name to be testedschema
- schema name to be testedboolean isDefaultCatalog(String catalog)
catalog
- catalog name to be testedboolean getOutputDefaultCatalog()
void setOutputDefaultCatalog(boolean outputDefaultCatalog)
boolean supportsPrimaryKeyNames()
boolean supportsNotNullConstraintNames()
boolean supportsBatchUpdates() throws DatabaseException
DatabaseException
boolean requiresExplicitNullForColumns()
String getSystemSchema()
void addReservedWords(Collection<String> words)
ValidationErrors validate()
Copyright © 2023 Liquibase.org. All rights reserved.