liquibase.database
Interface Database
- All Superinterfaces:
- DatabaseObject, PrioritizedService
- All Known Implementing Classes:
- AbstractDatabase, CacheDatabase, DB2Database, DB2iDatabase, DerbyDatabase, FirebirdDatabase, H2Database, HsqlDatabase, InformixDatabase, MaxDBDatabase, MSSQLDatabase, MySQLDatabase, OracleDatabase, PostgresDatabase, SQLiteDatabase, SybaseASADatabase, SybaseDatabase, UnsupportedDatabase
public interface Database
- extends DatabaseObject, PrioritizedService
Method Summary |
void |
checkDatabaseChangeLogLockTable()
|
void |
checkDatabaseChangeLogTable(boolean updateExistingNullChecksums,
DatabaseChangeLog databaseChangeLog,
String[] contexts)
|
void |
close()
|
void |
commit()
|
String |
convertRequestedSchemaToCatalog(String requestedSchema)
|
String |
convertRequestedSchemaToSchema(String requestedSchema)
|
boolean |
disableForeignKeyChecks()
|
boolean |
doesTagExist(String tag)
|
void |
dropDatabaseObjects(String schema)
|
void |
enableForeignKeyChecks()
|
String |
escapeColumnName(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 |
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 |
escapeDatabaseObject(String objectName)
|
String |
escapeIndexName(String schemaName,
String indexName)
|
String |
escapeSequenceName(String schemaName,
String sequenceName)
|
String |
escapeStringForDatabase(String string)
|
String |
escapeTableName(String schemaName,
String tableName)
Escapes the table name in a database-dependent manner so reserved words can be used as a table name (i.e. |
String |
escapeViewName(String schemaName,
String viewName)
|
void |
execute(SqlStatement[] statements,
List<SqlVisitor> sqlVisitors)
|
void |
executeRollbackStatements(Change change,
List<SqlVisitor> sqlVisitors)
|
void |
executeStatements(Change change,
DatabaseChangeLog changeLog,
List<SqlVisitor> sqlVisitors)
|
String |
generatePrimaryKeyName(String tableName)
|
boolean |
getAutoCommitMode()
Auto-commit mode to run in |
String |
getAutoIncrementClause(BigInteger startWith,
BigInteger incrementBy)
|
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()
|
List<DatabaseFunction> |
getDatabaseFunctions()
Returns list of database native functions |
int |
getDatabaseMajorVersion()
|
int |
getDatabaseMinorVersion()
|
String |
getDatabaseProductName()
|
String |
getDatabaseProductVersion()
|
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. |
String |
getDefaultSchemaName()
|
String |
getLineComment()
|
String |
getLiquibaseSchemaName()
|
int |
getNextChangeSetSequenceValue()
|
RanChangeSet |
getRanChangeSet(ChangeSet changeSet)
|
List<RanChangeSet> |
getRanChangeSetList()
|
Date |
getRanDate(ChangeSet changeSet)
|
ChangeSet.RunStatus |
getRunStatus(ChangeSet changeSet)
|
String |
getTimeLiteral(Time time)
|
String |
getTypeName()
Returns an all-lower-case short name of the product. |
String |
getViewDefinition(String schemaName,
String name)
|
boolean |
hasDatabaseChangeLogLockTable()
|
boolean |
hasDatabaseChangeLogTable()
|
boolean |
isAutoCommit()
|
boolean |
isCorrectDatabaseImplementation(DatabaseConnection conn)
Is this AbstractDatabase subclass the correct one to use for the given connection. |
boolean |
isLiquibaseTable(String tableName)
|
boolean |
isLocalDatabase()
|
boolean |
isReservedWord(String string)
|
boolean |
isSystemTable(String catalogName,
String schemaName,
String tableName)
|
boolean |
isSystemView(String catalogName,
String schemaName,
String name)
|
void |
markChangeSetExecStatus(ChangeSet changeSet,
ChangeSet.ExecType execType)
|
Date |
parseDate(String dateAsString)
|
void |
removeRanStatus(ChangeSet changeSet)
|
boolean |
requiresPassword()
|
boolean |
requiresUsername()
|
void |
reset()
|
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 |
setDefaultSchemaName(String schemaName)
|
boolean |
shouldQuoteValue(String value)
|
boolean |
supportsAutoIncrement()
|
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 |
supportsRestrictForeignKeys()
|
boolean |
supportsSchemas()
|
boolean |
supportsSequences()
|
boolean |
supportsTablespaces()
|
void |
tag(String tagString)
|
databaseChangeLogTableName
static final String databaseChangeLogTableName
databaseChangeLogLockTableName
static final String databaseChangeLogLockTableName
isCorrectDatabaseImplementation
boolean isCorrectDatabaseImplementation(DatabaseConnection conn)
throws DatabaseException
- Is this AbstractDatabase subclass the correct one to use for the given connection.
- Throws:
DatabaseException
getDefaultDriver
String getDefaultDriver(String url)
- If this database understands the given url, return the default driver class name. Otherwise return null.
getConnection
DatabaseConnection getConnection()
setConnection
void setConnection(DatabaseConnection conn)
requiresUsername
boolean requiresUsername()
requiresPassword
boolean requiresPassword()
getAutoCommitMode
boolean getAutoCommitMode()
- Auto-commit mode to run in
supportsDDLInTransaction
boolean supportsDDLInTransaction()
- Determines if the database supports DDL within a transaction or not.
- Returns:
- True if the database supports DDL within a transaction, otherwise false.
getDatabaseProductName
String getDatabaseProductName()
getDatabaseProductVersion
String getDatabaseProductVersion()
throws DatabaseException
- Throws:
DatabaseException
getDatabaseMajorVersion
int getDatabaseMajorVersion()
throws DatabaseException
- Throws:
DatabaseException
getDatabaseMinorVersion
int getDatabaseMinorVersion()
throws DatabaseException
- Throws:
DatabaseException
getTypeName
String getTypeName()
- Returns an all-lower-case short name of the product. Used for end-user selecting of database type
such as the DBMS precondition.
getDefaultCatalogName
String getDefaultCatalogName()
throws DatabaseException
- Throws:
DatabaseException
getDefaultSchemaName
String getDefaultSchemaName()
getLiquibaseSchemaName
String getLiquibaseSchemaName()
setDefaultSchemaName
void setDefaultSchemaName(String schemaName)
throws DatabaseException
- Throws:
DatabaseException
supportsInitiallyDeferrableColumns
boolean supportsInitiallyDeferrableColumns()
- Returns whether this database support initially deferrable columns.
supportsSequences
boolean supportsSequences()
supportsDropTableCascadeConstraints
boolean supportsDropTableCascadeConstraints()
supportsAutoIncrement
boolean supportsAutoIncrement()
getDateLiteral
String getDateLiteral(String isoDate)
getCurrentDateTimeFunction
String getCurrentDateTimeFunction()
- Returns database-specific function for generating the current date/time.
setCurrentDateTimeFunction
void setCurrentDateTimeFunction(String function)
getLineComment
String getLineComment()
getAutoIncrementClause
String getAutoIncrementClause(BigInteger startWith,
BigInteger incrementBy)
getDatabaseChangeLogTableName
String getDatabaseChangeLogTableName()
getDatabaseChangeLogLockTableName
String getDatabaseChangeLogLockTableName()
setDatabaseChangeLogTableName
void setDatabaseChangeLogTableName(String tableName)
- Set the table name of the change log to the given table name
- Parameters:
tableName
-
setDatabaseChangeLogLockTableName
void setDatabaseChangeLogLockTableName(String tableName)
- Set the table name of the change log lock to the given table name
- Parameters:
tableName
-
getConcatSql
String getConcatSql(String... values)
- Returns SQL to concat the passed values.
hasDatabaseChangeLogTable
boolean hasDatabaseChangeLogTable()
throws DatabaseException
- Throws:
DatabaseException
setCanCacheLiquibaseTableInfo
void setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo)
hasDatabaseChangeLogLockTable
boolean hasDatabaseChangeLogLockTable()
throws DatabaseException
- Throws:
DatabaseException
checkDatabaseChangeLogTable
void checkDatabaseChangeLogTable(boolean updateExistingNullChecksums,
DatabaseChangeLog databaseChangeLog,
String[] contexts)
throws DatabaseException
- Throws:
DatabaseException
checkDatabaseChangeLogLockTable
void checkDatabaseChangeLogLockTable()
throws DatabaseException
- Throws:
DatabaseException
dropDatabaseObjects
void dropDatabaseObjects(String schema)
throws DatabaseException
- Throws:
DatabaseException
tag
void tag(String tagString)
throws DatabaseException
- Throws:
DatabaseException
doesTagExist
boolean doesTagExist(String tag)
throws DatabaseException
- Throws:
DatabaseException
isSystemTable
boolean isSystemTable(String catalogName,
String schemaName,
String tableName)
isLiquibaseTable
boolean isLiquibaseTable(String tableName)
shouldQuoteValue
boolean shouldQuoteValue(String value)
supportsTablespaces
boolean supportsTablespaces()
getViewDefinition
String getViewDefinition(String schemaName,
String name)
throws DatabaseException
- Throws:
DatabaseException
isSystemView
boolean isSystemView(String catalogName,
String schemaName,
String name)
getDateLiteral
String getDateLiteral(Date date)
getTimeLiteral
String getTimeLiteral(Time time)
getDateTimeLiteral
String getDateTimeLiteral(Timestamp timeStamp)
getDateLiteral
String getDateLiteral(Date defaultDateValue)
escapeTableName
String escapeTableName(String schemaName,
String tableName)
- Escapes the table name in a database-dependent manner so reserved words can be used as a table name (i.e. "order").
Currently only escapes MS-SQL because other DBMSs store table names case-sensitively when escaping is used which
could confuse end-users. Pass null to schemaName to use the default schema
escapeIndexName
String escapeIndexName(String schemaName,
String indexName)
escapeDatabaseObject
String escapeDatabaseObject(String objectName)
escapeColumnName
String escapeColumnName(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. "return").
- Parameters:
schemaName
- tableName
- columnName
- column name
- Returns:
- escaped column name
escapeColumnNameList
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. "return").
- Parameters:
columnNames
- list of column names
- Returns:
- escaped column name list
convertRequestedSchemaToSchema
String convertRequestedSchemaToSchema(String requestedSchema)
throws DatabaseException
- Throws:
DatabaseException
convertRequestedSchemaToCatalog
String convertRequestedSchemaToCatalog(String requestedSchema)
throws DatabaseException
- Throws:
DatabaseException
supportsSchemas
boolean supportsSchemas()
generatePrimaryKeyName
String generatePrimaryKeyName(String tableName)
escapeSequenceName
String escapeSequenceName(String schemaName,
String sequenceName)
escapeViewName
String escapeViewName(String schemaName,
String viewName)
getRunStatus
ChangeSet.RunStatus getRunStatus(ChangeSet changeSet)
throws DatabaseException,
DatabaseHistoryException
- Throws:
DatabaseException
DatabaseHistoryException
getRanChangeSet
RanChangeSet getRanChangeSet(ChangeSet changeSet)
throws DatabaseException,
DatabaseHistoryException
- Throws:
DatabaseException
DatabaseHistoryException
markChangeSetExecStatus
void markChangeSetExecStatus(ChangeSet changeSet,
ChangeSet.ExecType execType)
throws DatabaseException
- Throws:
DatabaseException
getRanChangeSetList
List<RanChangeSet> getRanChangeSetList()
throws DatabaseException
- Throws:
DatabaseException
getRanDate
Date getRanDate(ChangeSet changeSet)
throws DatabaseException,
DatabaseHistoryException
- Throws:
DatabaseException
DatabaseHistoryException
removeRanStatus
void removeRanStatus(ChangeSet changeSet)
throws DatabaseException
- Throws:
DatabaseException
commit
void commit()
throws DatabaseException
- Throws:
DatabaseException
rollback
void rollback()
throws DatabaseException
- Throws:
DatabaseException
escapeStringForDatabase
String escapeStringForDatabase(String string)
close
void close()
throws DatabaseException
- Throws:
DatabaseException
supportsRestrictForeignKeys
boolean supportsRestrictForeignKeys()
escapeConstraintName
String escapeConstraintName(String constraintName)
isAutoCommit
boolean isAutoCommit()
throws DatabaseException
- Throws:
DatabaseException
setAutoCommit
void setAutoCommit(boolean b)
throws DatabaseException
- Throws:
DatabaseException
isLocalDatabase
boolean isLocalDatabase()
throws DatabaseException
- Throws:
DatabaseException
executeStatements
void executeStatements(Change change,
DatabaseChangeLog changeLog,
List<SqlVisitor> sqlVisitors)
throws LiquibaseException,
UnsupportedChangeException
- Throws:
LiquibaseException
UnsupportedChangeException
execute
void execute(SqlStatement[] statements,
List<SqlVisitor> sqlVisitors)
throws LiquibaseException
- Throws:
LiquibaseException
saveStatements
void saveStatements(Change change,
List<SqlVisitor> sqlVisitors,
Writer writer)
throws IOException,
UnsupportedChangeException,
StatementNotSupportedOnDatabaseException,
LiquibaseException
- Throws:
IOException
UnsupportedChangeException
StatementNotSupportedOnDatabaseException
LiquibaseException
executeRollbackStatements
void executeRollbackStatements(Change change,
List<SqlVisitor> sqlVisitors)
throws LiquibaseException,
UnsupportedChangeException,
RollbackImpossibleException
- Throws:
LiquibaseException
UnsupportedChangeException
RollbackImpossibleException
saveRollbackStatement
void saveRollbackStatement(Change change,
List<SqlVisitor> sqlVisitors,
Writer writer)
throws IOException,
UnsupportedChangeException,
RollbackImpossibleException,
StatementNotSupportedOnDatabaseException,
LiquibaseException
- Throws:
IOException
UnsupportedChangeException
RollbackImpossibleException
StatementNotSupportedOnDatabaseException
LiquibaseException
getNextChangeSetSequenceValue
int getNextChangeSetSequenceValue()
throws LiquibaseException
- Throws:
LiquibaseException
parseDate
Date parseDate(String dateAsString)
throws DateParseException
- Throws:
DateParseException
getDatabaseFunctions
List<DatabaseFunction> getDatabaseFunctions()
- Returns list of database native functions
reset
void reset()
supportsForeignKeyDisable
boolean supportsForeignKeyDisable()
disableForeignKeyChecks
boolean disableForeignKeyChecks()
throws DatabaseException
- Throws:
DatabaseException
enableForeignKeyChecks
void enableForeignKeyChecks()
throws DatabaseException
- Throws:
DatabaseException
isReservedWord
boolean isReservedWord(String string)
Copyright © 2012 Liquibase.org. All Rights Reserved.