|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectliquibase.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
|
protected BigInteger |
defaultAutoIncrementBy
|
protected BigInteger |
defaultAutoIncrementStartWith
|
| 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)
|
protected boolean |
generateAutoIncrementBy(BigInteger incrementBy)
|
protected boolean |
generateAutoIncrementStartWith(BigInteger startWith)
|
String |
generatePrimaryKeyName(String tableName)
|
boolean |
getAutoCommitMode()
Auto-commit mode to run in |
protected String |
getAutoIncrementByClause()
|
protected String |
getAutoIncrementClause()
|
String |
getAutoIncrementClause(BigInteger startWith,
BigInteger incrementBy)
Returns database-specific auto-increment DDL clause. |
protected String |
getAutoIncrementClosing()
|
protected String |
getAutoIncrementOpening()
|
protected String |
getAutoIncrementStartWithClause()
|
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
protected BigInteger defaultAutoIncrementStartWith
protected BigInteger defaultAutoIncrementBy
| Constructor Detail |
|---|
protected AbstractDatabase()
| Method Detail |
|---|
public boolean requiresPassword()
requiresPassword in interface Databasepublic boolean requiresUsername()
requiresUsername in interface Databasepublic DatabaseObject[] getContainingObjects()
getContainingObjects in interface DatabaseObjectpublic DatabaseConnection getConnection()
getConnection in interface Databasepublic void setConnection(DatabaseConnection conn)
setConnection in interface Databasepublic boolean getAutoCommitMode()
getAutoCommitMode in interface Databasepublic boolean supportsDDLInTransaction()
supportsDDLInTransaction in interface Databasepublic String getDatabaseProductName()
getDatabaseProductName in interface Database
public String getDatabaseProductVersion()
throws DatabaseException
getDatabaseProductVersion in interface DatabaseDatabaseException
public int getDatabaseMajorVersion()
throws DatabaseException
getDatabaseMajorVersion in interface DatabaseDatabaseException
public int getDatabaseMinorVersion()
throws DatabaseException
getDatabaseMinorVersion in interface DatabaseDatabaseException
public String getDefaultCatalogName()
throws DatabaseException
getDefaultCatalogName in interface DatabaseDatabaseException
protected String getDefaultDatabaseSchemaName()
throws DatabaseException
DatabaseExceptionpublic String getDefaultSchemaName()
getDefaultSchemaName in interface Database
public void setDefaultSchemaName(String schemaName)
throws DatabaseException
setDefaultSchemaName in interface DatabaseDatabaseExceptionprotected Set<String> getSystemTablesAndViews()
public boolean supportsSequences()
supportsSequences in interface Databasepublic boolean supportsAutoIncrement()
supportsAutoIncrement in interface Databasepublic void setCurrentDateTimeFunction(String function)
setCurrentDateTimeFunction in interface Databasepublic String getDateLiteral(String isoDate)
getDateLiteral in interface Databasepublic String getDateTimeLiteral(Timestamp date)
getDateTimeLiteral in interface Databasepublic String getDateLiteral(Date date)
getDateLiteral in interface Databasepublic String getTimeLiteral(Time date)
getTimeLiteral in interface Databasepublic String getDateLiteral(Date date)
getDateLiteral in interface Database
public Date parseDate(String dateAsString)
throws DateParseException
parseDate in interface DatabaseDateParseExceptionprotected boolean isDateOnly(String isoDate)
protected boolean isDateTime(String isoDate)
protected boolean isTimeOnly(String isoDate)
public String getLineComment()
getLineComment in interface Database
public String getAutoIncrementClause(BigInteger startWith,
BigInteger incrementBy)
getAutoIncrementClause in interface Databaseprotected String getAutoIncrementClause()
protected boolean generateAutoIncrementStartWith(BigInteger startWith)
protected boolean generateAutoIncrementBy(BigInteger incrementBy)
protected String getAutoIncrementOpening()
protected String getAutoIncrementClosing()
protected String getAutoIncrementStartWithClause()
protected String getAutoIncrementByClause()
public String getConcatSql(String... values)
Database
getConcatSql in interface Databasepublic String getDatabaseChangeLogTableName()
getDatabaseChangeLogTableName in interface DatabaseDatabase.getDatabaseChangeLogTableName()public String getDatabaseChangeLogLockTableName()
getDatabaseChangeLogLockTableName in interface DatabaseDatabase.getDatabaseChangeLogLockTableName()public void setDatabaseChangeLogTableName(String tableName)
Database
setDatabaseChangeLogTableName in interface DatabaseDatabase.setDatabaseChangeLogTableName(java.lang.String)public void setDatabaseChangeLogLockTableName(String tableName)
Database
setDatabaseChangeLogLockTableName in interface DatabaseDatabase.setDatabaseChangeLogLockTableName(java.lang.String)
public void checkDatabaseChangeLogTable(boolean updateExistingNullChecksums,
DatabaseChangeLog databaseChangeLog,
String... contexts)
throws DatabaseException
checkDatabaseChangeLogTable in interface DatabaseupdateExistingNullChecksums - contexts -
DatabaseException
protected boolean canCreateChangeLogTable()
throws DatabaseException
DatabaseExceptionpublic void setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo)
setCanCacheLiquibaseTableInfo in interface Database
public boolean hasDatabaseChangeLogTable()
throws DatabaseException
hasDatabaseChangeLogTable in interface DatabaseDatabaseException
public boolean hasDatabaseChangeLogLockTable()
throws DatabaseException
hasDatabaseChangeLogLockTable in interface DatabaseDatabaseExceptionpublic String getLiquibaseSchemaName()
getLiquibaseSchemaName in interface Database
public void checkDatabaseChangeLogLockTable()
throws DatabaseException
checkDatabaseChangeLogLockTable in interface DatabaseDatabaseExceptionpublic boolean isReservedWord(String string)
isReservedWord in interface Database
public void dropDatabaseObjects(String schema)
throws DatabaseException
dropDatabaseObjects in interface Databaseschema -
DatabaseExceptionpublic 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 Databasepublic boolean isLiquibaseTable(String tableName)
isLiquibaseTable in interface Database
public void tag(String tagString)
throws DatabaseException
tag in interface DatabaseDatabaseException
public boolean doesTagExist(String tag)
throws DatabaseException
doesTagExist in interface DatabaseDatabaseExceptionpublic String toString()
toString in class Objectpublic boolean shouldQuoteValue(String value)
shouldQuoteValue in interface Database
public String getViewDefinition(String schemaName,
String viewName)
throws DatabaseException
getViewDefinition in interface DatabaseDatabaseException
public String escapeTableName(String schemaName,
String tableName)
Database
escapeTableName in interface Databasepublic 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 Databasepublic String escapeConstraintName(String constraintName)
escapeConstraintName in interface Database
public String escapeColumnName(String schemaName,
String tableName,
String columnName)
Database
escapeColumnName in interface DatabasecolumnName - column name
public String escapeColumnNameList(String columnNames)
Database
escapeColumnNameList in interface DatabasecolumnNames - list of column names
public String convertRequestedSchemaToCatalog(String requestedSchema)
throws DatabaseException
convertRequestedSchemaToCatalog in interface DatabaseDatabaseException
public String convertRequestedSchemaToSchema(String requestedSchema)
throws DatabaseException
convertRequestedSchemaToSchema in interface DatabaseDatabaseExceptionpublic boolean supportsSchemas()
supportsSchemas in interface Databasepublic 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 DatabaseDatabaseException
DatabaseHistoryException
public RanChangeSet getRanChangeSet(ChangeSet changeSet)
throws DatabaseException,
DatabaseHistoryException
getRanChangeSet in interface DatabaseDatabaseException
DatabaseHistoryException
public List<RanChangeSet> getRanChangeSetList()
throws DatabaseException
getRanChangeSetList in interface DatabaseDatabaseException
public Date getRanDate(ChangeSet changeSet)
throws DatabaseException,
DatabaseHistoryException
getRanDate in interface DatabaseDatabaseException
DatabaseHistoryException
public void markChangeSetExecStatus(ChangeSet changeSet,
ChangeSet.ExecType execType)
throws DatabaseException
markChangeSetExecStatus in interface DatabaseDatabaseException
public void removeRanStatus(ChangeSet changeSet)
throws DatabaseException
removeRanStatus in interface DatabaseDatabaseExceptionpublic String escapeStringForDatabase(String string)
escapeStringForDatabase in interface Database
public void commit()
throws DatabaseException
commit in interface DatabaseDatabaseException
public void rollback()
throws DatabaseException
rollback in interface DatabaseDatabaseExceptionpublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
public void close()
throws DatabaseException
close in interface DatabaseDatabaseExceptionpublic boolean supportsRestrictForeignKeys()
supportsRestrictForeignKeys in interface Database
public boolean isAutoCommit()
throws DatabaseException
isAutoCommit in interface DatabaseDatabaseException
public void setAutoCommit(boolean b)
throws DatabaseException
setAutoCommit in interface DatabaseDatabaseException
public boolean isLocalDatabase()
throws DatabaseException
isLocalDatabase in interface DatabaseDatabaseException
public void executeStatements(Change change,
DatabaseChangeLog changeLog,
List<SqlVisitor> sqlVisitors)
throws LiquibaseException,
UnsupportedChangeException
executeStatements in interface DatabaseLiquibaseException
UnsupportedChangeException
public void execute(SqlStatement[] statements,
List<SqlVisitor> sqlVisitors)
throws LiquibaseException
execute in interface DatabaseLiquibaseException
public void saveStatements(Change change,
List<SqlVisitor> sqlVisitors,
Writer writer)
throws IOException,
UnsupportedChangeException,
StatementNotSupportedOnDatabaseException,
LiquibaseException
saveStatements in interface DatabaseIOException
UnsupportedChangeException
StatementNotSupportedOnDatabaseException
LiquibaseException
public void executeRollbackStatements(Change change,
List<SqlVisitor> sqlVisitors)
throws LiquibaseException,
UnsupportedChangeException,
RollbackImpossibleException
executeRollbackStatements in interface DatabaseLiquibaseException
UnsupportedChangeException
RollbackImpossibleException
public void saveRollbackStatement(Change change,
List<SqlVisitor> sqlVisitors,
Writer writer)
throws IOException,
UnsupportedChangeException,
RollbackImpossibleException,
StatementNotSupportedOnDatabaseException,
LiquibaseException
saveRollbackStatement in interface DatabaseIOException
UnsupportedChangeException
RollbackImpossibleException
StatementNotSupportedOnDatabaseException
LiquibaseException
public int getNextChangeSetSequenceValue()
throws LiquibaseException
getNextChangeSetSequenceValue in interface DatabaseLiquibaseException
public Table getTable(String schemaName,
String tableName)
throws DatabaseException
DatabaseExceptionpublic List<DatabaseFunction> getDatabaseFunctions()
Database
getDatabaseFunctions in interface Databasepublic void reset()
reset in interface Databasepublic boolean supportsForeignKeyDisable()
supportsForeignKeyDisable in interface Database
public boolean disableForeignKeyChecks()
throws DatabaseException
disableForeignKeyChecks in interface DatabaseDatabaseException
public void enableForeignKeyChecks()
throws DatabaseException
enableForeignKeyChecks in interface DatabaseDatabaseException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||