|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object liquibase.database.AbstractDatabase
public abstract class AbstractDatabase
AbstractDatabase is extended by all supported databases as a facade to the underlying database. The physical connection can be retrieved from the AbstractDatabase implementation, as well as any database-specific characteristics such as the datatype for "boolean" fields.
Field Summary | |
---|---|
protected String |
currentDateTimeFunction
|
protected List<DatabaseFunction> |
databaseFunctions
|
Fields inherited from interface liquibase.servicelocator.PrioritizedService |
---|
PRIORITY_DATABASE, PRIORITY_DEFAULT |
Constructor Summary | |
---|---|
protected |
AbstractDatabase()
|
Method Summary | |
---|---|
protected boolean |
canCreateChangeLogTable()
|
void |
checkDatabaseChangeLogLockTable()
This method will check the database ChangeLogLock table used to keep track of if a machine is updating the database. |
void |
checkDatabaseChangeLogTable(boolean updateExistingNullChecksums,
DatabaseChangeLog databaseChangeLog,
String... contexts)
This method will check the database ChangeLog table used to keep track of the changes in the file. |
void |
close()
|
void |
commit()
|
String |
convertRequestedSchemaToCatalog(String requestedSchema)
|
String |
convertRequestedSchemaToSchema(String requestedSchema)
|
boolean |
disableForeignKeyChecks()
|
boolean |
doesTagExist(String tag)
|
void |
dropDatabaseObjects(String schema)
Drops all objects owned by the connected user. |
void |
enableForeignKeyChecks()
|
boolean |
equals(Object o)
|
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()
Returns database-specific auto-increment DDL clause. |
String |
getConcatSql(String... values)
Returns SQL to concat the passed values. |
DatabaseConnection |
getConnection()
|
DatabaseObject[] |
getContainingObjects()
|
String |
getDatabaseChangeLogLockTableName()
|
String |
getDatabaseChangeLogTableName()
|
List<DatabaseFunction> |
getDatabaseFunctions()
Returns list of database native functions |
int |
getDatabaseMajorVersion()
|
int |
getDatabaseMinorVersion()
|
String |
getDatabaseProductName()
Returns the name of the database product according to the underlying database. |
String |
getDatabaseProductVersion()
|
String |
getDateLiteral(Date date)
|
String |
getDateLiteral(Date date)
|
String |
getDateLiteral(String isoDate)
Return a date literal with the same value as a string formatted using ISO 8601. |
String |
getDateTimeLiteral(Timestamp date)
|
String |
getDefaultCatalogName()
|
protected String |
getDefaultDatabaseSchemaName()
|
String |
getDefaultSchemaName()
|
String |
getLineComment()
Returns database-specific line comment string. |
String |
getLiquibaseSchemaName()
|
int |
getNextChangeSetSequenceValue()
|
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 |
protected Set<String> |
getSystemTablesAndViews()
Returns system (undroppable) tables and views. |
Table |
getTable(String schemaName,
String tableName)
|
String |
getTimeLiteral(Time date)
|
String |
getViewDefinition(String schemaName,
String viewName)
|
boolean |
hasDatabaseChangeLogLockTable()
|
boolean |
hasDatabaseChangeLogTable()
|
int |
hashCode()
|
boolean |
isAutoCommit()
|
protected boolean |
isDateOnly(String isoDate)
|
protected boolean |
isDateTime(String isoDate)
|
boolean |
isLiquibaseTable(String tableName)
|
boolean |
isLocalDatabase()
Default implementation, just look for "local" IPs |
boolean |
isReservedWord(String string)
|
boolean |
isSystemTable(String catalogName,
String schemaName,
String tableName)
|
boolean |
isSystemView(String catalogName,
String schemaName,
String viewName)
|
protected boolean |
isTimeOnly(String isoDate)
|
void |
markChangeSetExecStatus(ChangeSet changeSet,
ChangeSet.ExecType execType)
After the change set 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 |
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()
By default databases should support DDL within a transaction. |
boolean |
supportsDropTableCascadeConstraints()
|
boolean |
supportsForeignKeyDisable()
|
boolean |
supportsRestrictForeignKeys()
|
boolean |
supportsSchemas()
|
boolean |
supportsSequences()
Does the database type support sequence. |
void |
tag(String tagString)
Tags the database changelog with the given string. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface liquibase.database.Database |
---|
getCurrentDateTimeFunction, getDefaultDriver, getTypeName, isCorrectDatabaseImplementation, supportsInitiallyDeferrableColumns, supportsTablespaces |
Methods inherited from interface liquibase.servicelocator.PrioritizedService |
---|
getPriority |
Field Detail |
---|
protected String currentDateTimeFunction
protected List<DatabaseFunction> databaseFunctions
Constructor Detail |
---|
protected AbstractDatabase()
Method Detail |
---|
public boolean requiresPassword()
requiresPassword
in interface Database
public boolean requiresUsername()
requiresUsername
in interface Database
public DatabaseObject[] getContainingObjects()
getContainingObjects
in interface DatabaseObject
public DatabaseConnection getConnection()
getConnection
in interface Database
public void setConnection(DatabaseConnection conn)
setConnection
in interface Database
public boolean getAutoCommitMode()
getAutoCommitMode
in interface Database
public boolean supportsDDLInTransaction()
supportsDDLInTransaction
in interface Database
public String getDatabaseProductName()
getDatabaseProductName
in interface Database
public String getDatabaseProductVersion() throws DatabaseException
getDatabaseProductVersion
in interface Database
DatabaseException
public int getDatabaseMajorVersion() throws DatabaseException
getDatabaseMajorVersion
in interface Database
DatabaseException
public int getDatabaseMinorVersion() throws DatabaseException
getDatabaseMinorVersion
in interface Database
DatabaseException
public String getDefaultCatalogName() throws DatabaseException
getDefaultCatalogName
in interface Database
DatabaseException
protected String getDefaultDatabaseSchemaName() throws DatabaseException
DatabaseException
public String getDefaultSchemaName()
getDefaultSchemaName
in interface Database
public void setDefaultSchemaName(String schemaName) throws DatabaseException
setDefaultSchemaName
in interface Database
DatabaseException
protected Set<String> getSystemTablesAndViews()
public boolean supportsSequences()
supportsSequences
in interface Database
public boolean supportsAutoIncrement()
supportsAutoIncrement
in interface Database
public void setCurrentDateTimeFunction(String function)
setCurrentDateTimeFunction
in interface Database
public String getDateLiteral(String isoDate)
getDateLiteral
in interface Database
public String getDateTimeLiteral(Timestamp date)
getDateTimeLiteral
in interface Database
public String getDateLiteral(Date date)
getDateLiteral
in interface Database
public String getTimeLiteral(Time date)
getTimeLiteral
in interface Database
public String getDateLiteral(Date date)
getDateLiteral
in interface Database
public Date parseDate(String dateAsString) throws DateParseException
parseDate
in interface Database
DateParseException
protected boolean isDateOnly(String isoDate)
protected boolean isDateTime(String isoDate)
protected boolean isTimeOnly(String isoDate)
public String getLineComment()
getLineComment
in interface Database
public String getAutoIncrementClause()
getAutoIncrementClause
in interface Database
public String getConcatSql(String... values)
Database
getConcatSql
in interface Database
public String getDatabaseChangeLogTableName()
getDatabaseChangeLogTableName
in interface Database
Database.getDatabaseChangeLogTableName()
public String getDatabaseChangeLogLockTableName()
getDatabaseChangeLogLockTableName
in interface Database
Database.getDatabaseChangeLogLockTableName()
public void setDatabaseChangeLogTableName(String tableName)
Database
setDatabaseChangeLogTableName
in interface Database
Database.setDatabaseChangeLogTableName(java.lang.String)
public void setDatabaseChangeLogLockTableName(String tableName)
Database
setDatabaseChangeLogLockTableName
in interface Database
Database.setDatabaseChangeLogLockTableName(java.lang.String)
public void checkDatabaseChangeLogTable(boolean updateExistingNullChecksums, DatabaseChangeLog databaseChangeLog, String... contexts) throws DatabaseException
checkDatabaseChangeLogTable
in interface Database
updateExistingNullChecksums
- contexts
-
DatabaseException
protected boolean canCreateChangeLogTable() throws DatabaseException
DatabaseException
public void setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo)
setCanCacheLiquibaseTableInfo
in interface Database
public boolean hasDatabaseChangeLogTable() throws DatabaseException
hasDatabaseChangeLogTable
in interface Database
DatabaseException
public boolean hasDatabaseChangeLogLockTable() throws DatabaseException
hasDatabaseChangeLogLockTable
in interface Database
DatabaseException
public String getLiquibaseSchemaName()
getLiquibaseSchemaName
in interface Database
public void checkDatabaseChangeLogLockTable() throws DatabaseException
checkDatabaseChangeLogLockTable
in interface Database
DatabaseException
public boolean isReservedWord(String string)
isReservedWord
in interface Database
public void dropDatabaseObjects(String schema) throws DatabaseException
dropDatabaseObjects
in interface Database
schema
-
DatabaseException
public boolean supportsDropTableCascadeConstraints()
supportsDropTableCascadeConstraints
in interface Database
public boolean isSystemTable(String catalogName, String schemaName, String tableName)
isSystemTable
in interface Database
public boolean isSystemView(String catalogName, String schemaName, String viewName)
isSystemView
in interface Database
public boolean isLiquibaseTable(String tableName)
isLiquibaseTable
in interface Database
public void tag(String tagString) throws DatabaseException
tag
in interface Database
DatabaseException
public boolean doesTagExist(String tag) throws DatabaseException
doesTagExist
in interface Database
DatabaseException
public String toString()
toString
in class Object
public boolean shouldQuoteValue(String value)
shouldQuoteValue
in interface Database
public String getViewDefinition(String schemaName, String viewName) throws DatabaseException
getViewDefinition
in interface Database
DatabaseException
public String escapeTableName(String schemaName, String tableName)
Database
escapeTableName
in interface Database
public String escapeDatabaseObject(String objectName)
escapeDatabaseObject
in interface Database
public String escapeIndexName(String schemaName, String indexName)
escapeIndexName
in interface Database
public String escapeSequenceName(String schemaName, String sequenceName)
escapeSequenceName
in interface Database
public String escapeConstraintName(String constraintName)
escapeConstraintName
in interface Database
public String escapeColumnName(String schemaName, String tableName, String columnName)
Database
escapeColumnName
in interface Database
columnName
- column name
public String escapeColumnNameList(String columnNames)
Database
escapeColumnNameList
in interface Database
columnNames
- list of column names
public String convertRequestedSchemaToCatalog(String requestedSchema) throws DatabaseException
convertRequestedSchemaToCatalog
in interface Database
DatabaseException
public String convertRequestedSchemaToSchema(String requestedSchema) throws DatabaseException
convertRequestedSchemaToSchema
in interface Database
DatabaseException
public boolean supportsSchemas()
supportsSchemas
in interface Database
public String generatePrimaryKeyName(String tableName)
generatePrimaryKeyName
in interface Database
public String escapeViewName(String schemaName, String viewName)
escapeViewName
in interface Database
public ChangeSet.RunStatus getRunStatus(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
getRunStatus
in interface Database
DatabaseException
DatabaseHistoryException
public RanChangeSet getRanChangeSet(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
getRanChangeSet
in interface Database
DatabaseException
DatabaseHistoryException
public List<RanChangeSet> getRanChangeSetList() throws DatabaseException
getRanChangeSetList
in interface Database
DatabaseException
public Date getRanDate(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException
getRanDate
in interface Database
DatabaseException
DatabaseHistoryException
public void markChangeSetExecStatus(ChangeSet changeSet, ChangeSet.ExecType execType) throws DatabaseException
markChangeSetExecStatus
in interface Database
DatabaseException
public void removeRanStatus(ChangeSet changeSet) throws DatabaseException
removeRanStatus
in interface Database
DatabaseException
public String escapeStringForDatabase(String string)
escapeStringForDatabase
in interface Database
public void commit() throws DatabaseException
commit
in interface Database
DatabaseException
public void rollback() throws DatabaseException
rollback
in interface Database
DatabaseException
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public void close() throws DatabaseException
close
in interface Database
DatabaseException
public boolean supportsRestrictForeignKeys()
supportsRestrictForeignKeys
in interface Database
public boolean isAutoCommit() throws DatabaseException
isAutoCommit
in interface Database
DatabaseException
public void setAutoCommit(boolean b) throws DatabaseException
setAutoCommit
in interface Database
DatabaseException
public boolean isLocalDatabase() throws DatabaseException
isLocalDatabase
in interface Database
DatabaseException
public void executeStatements(Change change, DatabaseChangeLog changeLog, List<SqlVisitor> sqlVisitors) throws LiquibaseException, UnsupportedChangeException
executeStatements
in interface Database
LiquibaseException
UnsupportedChangeException
public void execute(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) throws LiquibaseException
execute
in interface Database
LiquibaseException
public void saveStatements(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException, UnsupportedChangeException, StatementNotSupportedOnDatabaseException, LiquibaseException
saveStatements
in interface Database
IOException
UnsupportedChangeException
StatementNotSupportedOnDatabaseException
LiquibaseException
public void executeRollbackStatements(Change change, List<SqlVisitor> sqlVisitors) throws LiquibaseException, UnsupportedChangeException, RollbackImpossibleException
executeRollbackStatements
in interface Database
LiquibaseException
UnsupportedChangeException
RollbackImpossibleException
public void saveRollbackStatement(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException, UnsupportedChangeException, RollbackImpossibleException, StatementNotSupportedOnDatabaseException, LiquibaseException
saveRollbackStatement
in interface Database
IOException
UnsupportedChangeException
RollbackImpossibleException
StatementNotSupportedOnDatabaseException
LiquibaseException
public int getNextChangeSetSequenceValue() throws LiquibaseException
getNextChangeSetSequenceValue
in interface Database
LiquibaseException
public Table getTable(String schemaName, String tableName) throws DatabaseException
DatabaseException
public List<DatabaseFunction> getDatabaseFunctions()
Database
getDatabaseFunctions
in interface Database
public void reset()
reset
in interface Database
public boolean supportsForeignKeyDisable()
supportsForeignKeyDisable
in interface Database
public boolean disableForeignKeyChecks() throws DatabaseException
disableForeignKeyChecks
in interface Database
DatabaseException
public void enableForeignKeyChecks() throws DatabaseException
enableForeignKeyChecks
in interface Database
DatabaseException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |