liquibase.database
Class AbstractJdbcDatabase

java.lang.Object
  extended by liquibase.database.AbstractJdbcDatabase
All Implemented Interfaces:
Database, PrioritizedService
Direct Known Subclasses:
DB2Database, DerbyDatabase, FirebirdDatabase, H2Database, HsqlDatabase, InformixDatabase, MSSQLDatabase, MySQLDatabase, OracleDatabase, PostgresDatabase, SQLiteDatabase, SybaseASADatabase, SybaseDatabase, UnsupportedDatabase

public abstract class AbstractJdbcDatabase
extends Object
implements Database

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
protected  Boolean caseSensitive
           
protected  String currentDateTimeFunction
           
protected  List<DatabaseFunction> dateFunctions
           
protected  BigInteger defaultAutoIncrementBy
           
protected  BigInteger defaultAutoIncrementStartWith
           
protected  String defaultCatalogName
           
protected  String defaultSchemaName
           
protected  String quotingEndCharacter
           
protected  String quotingEndReplacement
           
protected  String quotingStartCharacter
           
protected  ObjectQuotingStrategy quotingStrategy
           
protected  String sequenceCurrentValueFunction
           
protected  String sequenceNextValueFunction
          The sequence name will be substituted into the string e.g.
protected  List<String> unmodifiableDataTypes
           
protected  Boolean unquotedObjectsAreUppercased
           
 
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
 
Constructor Summary
AbstractJdbcDatabase()
           
 
Method Summary
 void addReservedWords(Collection<String> words)
           
protected  boolean canCreateChangeLogTable()
           
 void close()
           
 void commit()
           
 String correctObjectName(String objectName, Class<? extends DatabaseObject> objectType)
          Fix the object name to the format the database expects, handling changes in case, etc.
 CatalogAndSchema correctSchema(CatalogAndSchema schema)
          Returns a new CatalogAndSchema adjusted for this database.
 CatalogAndSchema correctSchema(String catalog, String schema)
          Deprecated. use CatalogAndSchema.standardize(Database)
 boolean createsIndexesForForeignKeys()
           
 boolean dataTypeIsNotModifiable(String typeName)
          Types like int4 in postgres cannot have a modifier.
 boolean disableForeignKeyChecks()
           
 boolean doesTagExist(String tag)
           
 void dropDatabaseObjects(CatalogAndSchema schemaToDrop)
          Drops all objects owned by the connected user.
 void enableForeignKeyChecks()
           
 boolean equals(Object o)
           
 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)
           
protected  List<SqlVisitor> filterRollbackVisitors(List<SqlVisitor> visitors)
          Takes a list of SqlVisitors and returns a new list with only the SqlVisitors set to apply to rollbacks
protected  boolean generateAutoIncrementBy(BigInteger incrementBy)
           
protected  boolean generateAutoIncrementStartWith(BigInteger startWith)
           
 String generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
          Some function names are placeholders that need to be replaced with the specific database value.
 String generatePrimaryKeyName(String tableName)
           
 Object get(String key)
           
 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()
           
protected  String getConnectionCatalogName()
           
protected  String getConnectionSchemaName()
          Overwrite this method to get the default schema name for the connection.
protected  String getConnectionSchemaNameCallStatement()
          Used to obtain the connection schema name through a statement Override this method to change the statement.
 DatabaseObject[] getContainingObjects()
           
 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 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 abstract  String getDefaultDatabaseProductName()
           
 CatalogAndSchema getDefaultSchema()
           
 String getDefaultSchemaName()
           
 Integer getFetchSize()
           
 String getJdbcCatalogName(CatalogAndSchema schema)
           
 String getJdbcCatalogName(Schema schema)
           
 String getJdbcSchemaName(CatalogAndSchema schema)
           
 String getJdbcSchemaName(Schema schema)
           
 String getLineComment()
          Returns database-specific line comment string.
 String getLiquibaseCatalogName()
           
 String getLiquibaseSchemaName()
           
 String getLiquibaseTablespaceName()
           
 String getName()
           
 ObjectQuotingStrategy getObjectQuotingStrategy()
           
 boolean getOutputDefaultCatalog()
           
 boolean getOutputDefaultSchema()
           
 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 getSchemaFromJdbcInfo(String rawCatalogName, String rawSchemaName)
           
 String getSystemSchema()
           
protected  Set<String> getSystemTables()
          Returns system (undroppable) views.
protected  Set<String> getSystemViews()
          Returns system (undroppable) views.
 String getTimeLiteral(Time date)
           
 String getViewDefinition(CatalogAndSchema schema, String viewName)
           
 int hashCode()
           
 boolean isAutoCommit()
           
 boolean isCaseSensitive()
           
protected  boolean isDateOnly(String isoDate)
           
protected  boolean isDateTime(String isoDate)
           
 boolean isDefaultCatalog(String catalog)
           
 boolean isDefaultSchema(String catalog, String schema)
           
 boolean isFunction(String string)
           
 boolean isLiquibaseObject(DatabaseObject object)
           
 boolean isReservedWord(String string)
           
 boolean isSafeToRunUpdate()
          Default implementation, just look for "local" IPs.
 boolean isSystemObject(DatabaseObject example)
           
 boolean isSystemView(CatalogAndSchema schema, String viewName)
           
protected  boolean isTimeOnly(String isoDate)
           
protected  boolean isTimestamp(String isoDate)
           
 boolean jdbcCallsCatalogsSchemas()
           
 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.
protected  boolean mustQuoteObjectName(String objectName, Class<? extends DatabaseObject> objectType)
           
 Date parseDate(String dateAsString)
           
 String quoteObject(String objectName, Class<? extends DatabaseObject> objectType)
           
 void removeRanStatus(ChangeSet changeSet)
           
 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)
           
 AbstractJdbcDatabase set(String key, Object value)
           
 void setAutoCommit(boolean b)
           
 void setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo)
           
 void setCaseSensitive(Boolean caseSensitive)
           
 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 defaultCatalogName)
           
 void setDefaultSchemaName(String schemaName)
           
 void setLiquibaseCatalogName(String catalogName)
           
 void setLiquibaseSchemaName(String schemaName)
           
 void setLiquibaseTablespaceName(String tablespace)
           
 void setObjectQuotingStrategy(ObjectQuotingStrategy quotingStrategy)
           
 void setOutputDefaultCatalog(boolean outputDefaultCatalog)
           
 void setOutputDefaultSchema(boolean outputDefaultSchema)
          Whether the default schema should be included in generated SQL
protected  boolean startsWithNumeric(String objectName)
           
 boolean supportsAutoIncrement()
           
 boolean supportsCatalogInObjectName(Class<? extends DatabaseObject> type)
           
 boolean supportsCatalogs()
           
 boolean supportsDDLInTransaction()
          By default databases should support DDL within a transaction.
 boolean supportsDropTableCascadeConstraints()
           
 boolean supportsForeignKeyDisable()
           
 boolean supportsPrimaryKeyNames()
           
 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()
           
 String unescapeDataTypeName(String dataTypeName)
           
 String unescapeDataTypeString(String dataTypeString)
           
 ValidationErrors validate()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface liquibase.database.Database
getDefaultDriver, getDefaultPort, getShortName, isCorrectDatabaseImplementation, supportsInitiallyDeferrableColumns, supportsTablespaces
 
Methods inherited from interface liquibase.servicelocator.PrioritizedService
getPriority
 

Field Detail

defaultCatalogName

protected String defaultCatalogName

defaultSchemaName

protected String defaultSchemaName

currentDateTimeFunction

protected String currentDateTimeFunction

sequenceNextValueFunction

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


sequenceCurrentValueFunction

protected String sequenceCurrentValueFunction

quotingStartCharacter

protected String quotingStartCharacter

quotingEndCharacter

protected String quotingEndCharacter

quotingEndReplacement

protected String quotingEndReplacement

dateFunctions

protected List<DatabaseFunction> dateFunctions

unmodifiableDataTypes

protected List<String> unmodifiableDataTypes

defaultAutoIncrementStartWith

protected BigInteger defaultAutoIncrementStartWith

defaultAutoIncrementBy

protected BigInteger defaultAutoIncrementBy

unquotedObjectsAreUppercased

protected Boolean unquotedObjectsAreUppercased

quotingStrategy

protected ObjectQuotingStrategy quotingStrategy

caseSensitive

protected Boolean caseSensitive
Constructor Detail

AbstractJdbcDatabase

public AbstractJdbcDatabase()
Method Detail

getName

public String getName()

requiresPassword

public boolean requiresPassword()
Specified by:
requiresPassword in interface Database

requiresUsername

public boolean requiresUsername()
Specified by:
requiresUsername in interface Database

getContainingObjects

public DatabaseObject[] getContainingObjects()

getConnection

public DatabaseConnection getConnection()
Specified by:
getConnection in interface Database

setConnection

public void setConnection(DatabaseConnection conn)
Specified by:
setConnection in interface Database

getAutoCommitMode

public boolean getAutoCommitMode()
Auto-commit mode to run in

Specified by:
getAutoCommitMode in interface Database

addReservedWords

public void addReservedWords(Collection<String> words)
Specified by:
addReservedWords in interface Database

supportsDDLInTransaction

public boolean supportsDDLInTransaction()
By default databases should support DDL within a transaction.

Specified by:
supportsDDLInTransaction in interface Database
Returns:
True if the database supports DDL within a transaction, otherwise false.

getDatabaseProductName

public String getDatabaseProductName()
Returns the name of the database product according to the underlying database.

Specified by:
getDatabaseProductName in interface Database

getDefaultDatabaseProductName

protected abstract String getDefaultDatabaseProductName()

getDatabaseProductVersion

public String getDatabaseProductVersion()
                                 throws DatabaseException
Specified by:
getDatabaseProductVersion in interface Database
Throws:
DatabaseException

getDatabaseMajorVersion

public int getDatabaseMajorVersion()
                            throws DatabaseException
Specified by:
getDatabaseMajorVersion in interface Database
Throws:
DatabaseException

getDatabaseMinorVersion

public int getDatabaseMinorVersion()
                            throws DatabaseException
Specified by:
getDatabaseMinorVersion in interface Database
Throws:
DatabaseException

getDefaultCatalogName

public String getDefaultCatalogName()
Specified by:
getDefaultCatalogName in interface Database

getConnectionCatalogName

protected String getConnectionCatalogName()
                                   throws DatabaseException
Throws:
DatabaseException

correctSchema

public CatalogAndSchema correctSchema(String catalog,
                                      String schema)
Deprecated. use CatalogAndSchema.standardize(Database)


correctSchema

public CatalogAndSchema correctSchema(CatalogAndSchema schema)
Description copied from interface: Database
Returns a new CatalogAndSchema adjusted for this database. Examples of adjustments include: fixes for case issues, replacing null schema or catalog names with the default values removing set schema or catalog names if they are not supported

Specified by:
correctSchema in interface Database

correctObjectName

public String correctObjectName(String objectName,
                                Class<? extends DatabaseObject> objectType)
Description copied from interface: Database
Fix the object name to the format the database expects, handling changes in case, etc.

Specified by:
correctObjectName in interface Database

getDefaultSchema

public CatalogAndSchema getDefaultSchema()
Specified by:
getDefaultSchema in interface Database

getDefaultSchemaName

public String getDefaultSchemaName()
Specified by:
getDefaultSchemaName in interface Database

getConnectionSchemaName

protected String getConnectionSchemaName()
Overwrite this method to get the default schema name for the connection. If you only need to change the statement that obtains the current schema then override

Returns:
See Also:
getConnectionSchemaNameCallStatement()

getConnectionSchemaNameCallStatement

protected String getConnectionSchemaNameCallStatement()
Used to obtain the connection schema name through a statement Override this method to change the statement. Only override this if getConnectionSchemaName is left unchanges or is using this method.

Returns:
See Also:
getConnectionSchemaName()

setDefaultCatalogName

public void setDefaultCatalogName(String defaultCatalogName)
Specified by:
setDefaultCatalogName in interface Database

setDefaultSchemaName

public void setDefaultSchemaName(String schemaName)
Specified by:
setDefaultSchemaName in interface Database

getFetchSize

public Integer getFetchSize()
Specified by:
getFetchSize in interface Database

getSystemTables

protected Set<String> getSystemTables()
Returns system (undroppable) views.


getSystemViews

protected Set<String> getSystemViews()
Returns system (undroppable) views.


supportsSequences

public boolean supportsSequences()
Does the database type support sequence.

Specified by:
supportsSequences in interface Database

supportsAutoIncrement

public boolean supportsAutoIncrement()
Specified by:
supportsAutoIncrement in interface Database

setCurrentDateTimeFunction

public void setCurrentDateTimeFunction(String function)
Specified by:
setCurrentDateTimeFunction in interface Database

getDateLiteral

public String getDateLiteral(String isoDate)
Return a date literal with the same value as a string formatted using ISO 8601.

Note: many databases accept date literals in ISO8601 format with the 'T' replaced with a space. Only databases which do not accept these strings should need to override this method.

Implementation restriction: Currently, only the following subsets of ISO8601 are supported: yyyy-MM-dd hh:mm:ss yyyy-MM-ddThh:mm:ss

Specified by:
getDateLiteral in interface Database

getDateTimeLiteral

public String getDateTimeLiteral(Timestamp date)
Specified by:
getDateTimeLiteral in interface Database

getDateLiteral

public String getDateLiteral(Date date)
Specified by:
getDateLiteral in interface Database

getTimeLiteral

public String getTimeLiteral(Time date)
Specified by:
getTimeLiteral in interface Database

getDateLiteral

public String getDateLiteral(Date date)
Specified by:
getDateLiteral in interface Database

parseDate

public Date parseDate(String dateAsString)
               throws DateParseException
Specified by:
parseDate in interface Database
Throws:
DateParseException

isDateOnly

protected boolean isDateOnly(String isoDate)

isDateTime

protected boolean isDateTime(String isoDate)

isTimestamp

protected boolean isTimestamp(String isoDate)

isTimeOnly

protected boolean isTimeOnly(String isoDate)

getLineComment

public String getLineComment()
Returns database-specific line comment string.

Specified by:
getLineComment in interface Database

getAutoIncrementClause

public String getAutoIncrementClause(BigInteger startWith,
                                     BigInteger incrementBy)
Returns database-specific auto-increment DDL clause.

Specified by:
getAutoIncrementClause in interface Database

getAutoIncrementClause

protected String getAutoIncrementClause()

generateAutoIncrementStartWith

protected boolean generateAutoIncrementStartWith(BigInteger startWith)

generateAutoIncrementBy

protected boolean generateAutoIncrementBy(BigInteger incrementBy)

getAutoIncrementOpening

protected String getAutoIncrementOpening()

getAutoIncrementClosing

protected String getAutoIncrementClosing()

getAutoIncrementStartWithClause

protected String getAutoIncrementStartWithClause()

getAutoIncrementByClause

protected String getAutoIncrementByClause()

getConcatSql

public String getConcatSql(String... values)
Description copied from interface: Database
Returns SQL to concat the passed values.

Specified by:
getConcatSql in interface Database

getDatabaseChangeLogTableName

public String getDatabaseChangeLogTableName()
Specified by:
getDatabaseChangeLogTableName in interface Database
See Also:
Database.getDatabaseChangeLogTableName()

getDatabaseChangeLogLockTableName

public String getDatabaseChangeLogLockTableName()
Specified by:
getDatabaseChangeLogLockTableName in interface Database
See Also:
Database.getDatabaseChangeLogLockTableName()

getLiquibaseTablespaceName

public String getLiquibaseTablespaceName()
Specified by:
getLiquibaseTablespaceName in interface Database
See Also:
Database.getLiquibaseTablespaceName()

setDatabaseChangeLogTableName

public void setDatabaseChangeLogTableName(String tableName)
Description copied from interface: Database
Set the table name of the change log to the given table name

Specified by:
setDatabaseChangeLogTableName in interface Database
See Also:
Database.setDatabaseChangeLogTableName(java.lang.String)

setDatabaseChangeLogLockTableName

public void setDatabaseChangeLogLockTableName(String tableName)
Description copied from interface: Database
Set the table name of the change log lock to the given table name

Specified by:
setDatabaseChangeLogLockTableName in interface Database
See Also:
Database.setDatabaseChangeLogLockTableName(java.lang.String)

setLiquibaseTablespaceName

public void setLiquibaseTablespaceName(String tablespace)
Specified by:
setLiquibaseTablespaceName in interface Database
See Also:
Database.setLiquibaseTablespaceName(java.lang.String)

canCreateChangeLogTable

protected boolean canCreateChangeLogTable()
                                   throws DatabaseException
Throws:
DatabaseException

setCanCacheLiquibaseTableInfo

public void setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo)
Specified by:
setCanCacheLiquibaseTableInfo in interface Database

getLiquibaseCatalogName

public String getLiquibaseCatalogName()
Specified by:
getLiquibaseCatalogName in interface Database

setLiquibaseCatalogName

public void setLiquibaseCatalogName(String catalogName)
Specified by:
setLiquibaseCatalogName in interface Database

getLiquibaseSchemaName

public String getLiquibaseSchemaName()
Specified by:
getLiquibaseSchemaName in interface Database

setLiquibaseSchemaName

public void setLiquibaseSchemaName(String schemaName)
Specified by:
setLiquibaseSchemaName in interface Database

isCaseSensitive

public boolean isCaseSensitive()
Specified by:
isCaseSensitive in interface Database

setCaseSensitive

public void setCaseSensitive(Boolean caseSensitive)

isReservedWord

public boolean isReservedWord(String string)
Specified by:
isReservedWord in interface Database

startsWithNumeric

protected boolean startsWithNumeric(String objectName)

dropDatabaseObjects

public void dropDatabaseObjects(CatalogAndSchema schemaToDrop)
                         throws LiquibaseException
Drops all objects owned by the connected user.

Specified by:
dropDatabaseObjects in interface Database
Throws:
LiquibaseException

supportsDropTableCascadeConstraints

public boolean supportsDropTableCascadeConstraints()
Specified by:
supportsDropTableCascadeConstraints in interface Database

isSystemObject

public boolean isSystemObject(DatabaseObject example)
Specified by:
isSystemObject in interface Database

isSystemView

public boolean isSystemView(CatalogAndSchema schema,
                            String viewName)

isLiquibaseObject

public boolean isLiquibaseObject(DatabaseObject object)
Specified by:
isLiquibaseObject in interface Database

tag

public void tag(String tagString)
         throws DatabaseException
Tags the database changelog with the given string.

Specified by:
tag in interface Database
Throws:
DatabaseException

doesTagExist

public boolean doesTagExist(String tag)
                     throws DatabaseException
Specified by:
doesTagExist in interface Database
Throws:
DatabaseException

toString

public String toString()
Overrides:
toString in class Object

getViewDefinition

public String getViewDefinition(CatalogAndSchema schema,
                                String viewName)
                         throws DatabaseException
Specified by:
getViewDefinition in interface Database
Throws:
DatabaseException

escapeTableName

public String escapeTableName(String catalogName,
                              String schemaName,
                              String tableName)
Specified by:
escapeTableName in interface Database

escapeObjectName

public String escapeObjectName(String catalogName,
                               String schemaName,
                               String objectName,
                               Class<? extends DatabaseObject> objectType)
Specified by:
escapeObjectName in interface Database

escapeObjectName

public String escapeObjectName(String objectName,
                               Class<? extends DatabaseObject> objectType)
Specified by:
escapeObjectName in interface Database

mustQuoteObjectName

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

quoteObject

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

escapeIndexName

public String escapeIndexName(String catalogName,
                              String schemaName,
                              String indexName)
Specified by:
escapeIndexName in interface Database

escapeSequenceName

public String escapeSequenceName(String catalogName,
                                 String schemaName,
                                 String sequenceName)
Specified by:
escapeSequenceName in interface Database

escapeConstraintName

public String escapeConstraintName(String constraintName)
Specified by:
escapeConstraintName in interface Database

escapeColumnName

public String escapeColumnName(String catalogName,
                               String schemaName,
                               String tableName,
                               String columnName)
Description copied from interface: Database
Escapes a single column name in a database-dependent manner so reserved words can be used as a column name (i.e. "return").

Specified by:
escapeColumnName in interface Database
columnName - column name
Returns:
escaped column name

escapeColumnName

public 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.

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

Specified by:
escapeColumnName in interface Database

escapeColumnNameList

public String escapeColumnNameList(String columnNames)
Description copied from interface: Database
Escapes a list of column names in a database-dependent manner so reserved words can be used as a column name (i.e. "return").

Specified by:
escapeColumnNameList in interface Database
Parameters:
columnNames - list of column names
Returns:
escaped column name list

supportsSchemas

public boolean supportsSchemas()
Specified by:
supportsSchemas in interface Database

supportsCatalogs

public boolean supportsCatalogs()
Specified by:
supportsCatalogs in interface Database

jdbcCallsCatalogsSchemas

public boolean jdbcCallsCatalogsSchemas()

supportsCatalogInObjectName

public boolean supportsCatalogInObjectName(Class<? extends DatabaseObject> type)
Specified by:
supportsCatalogInObjectName in interface Database

generatePrimaryKeyName

public String generatePrimaryKeyName(String tableName)
Specified by:
generatePrimaryKeyName in interface Database

escapeViewName

public String escapeViewName(String catalogName,
                             String schemaName,
                             String viewName)
Specified by:
escapeViewName in interface Database

getRunStatus

public ChangeSet.RunStatus getRunStatus(ChangeSet changeSet)
                                 throws DatabaseException,
                                        DatabaseHistoryException
Returns the run status for the given ChangeSet

Specified by:
getRunStatus in interface Database
Throws:
DatabaseException
DatabaseHistoryException

getRanChangeSet

public RanChangeSet getRanChangeSet(ChangeSet changeSet)
                             throws DatabaseException,
                                    DatabaseHistoryException
Specified by:
getRanChangeSet in interface Database
Throws:
DatabaseException
DatabaseHistoryException

getRanChangeSetList

public List<RanChangeSet> getRanChangeSetList()
                                       throws DatabaseException
Returns the ChangeSets that have been run against the current database.

Specified by:
getRanChangeSetList in interface Database
Throws:
DatabaseException

getRanDate

public Date getRanDate(ChangeSet changeSet)
                throws DatabaseException,
                       DatabaseHistoryException
Specified by:
getRanDate in interface Database
Throws:
DatabaseException
DatabaseHistoryException

markChangeSetExecStatus

public void markChangeSetExecStatus(ChangeSet changeSet,
                                    ChangeSet.ExecType execType)
                             throws DatabaseException
After the change set has been ran against the database this method will update the change log table with the information.

Specified by:
markChangeSetExecStatus in interface Database
Throws:
DatabaseException

removeRanStatus

public void removeRanStatus(ChangeSet changeSet)
                     throws DatabaseException
Specified by:
removeRanStatus in interface Database
Throws:
DatabaseException

escapeStringForDatabase

public String escapeStringForDatabase(String string)
Specified by:
escapeStringForDatabase in interface Database

commit

public void commit()
            throws DatabaseException
Specified by:
commit in interface Database
Throws:
DatabaseException

rollback

public void rollback()
              throws DatabaseException
Specified by:
rollback in interface Database
Throws:
DatabaseException

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

close

public void close()
           throws DatabaseException
Specified by:
close in interface Database
Throws:
DatabaseException

supportsRestrictForeignKeys

public boolean supportsRestrictForeignKeys()
Specified by:
supportsRestrictForeignKeys in interface Database

isAutoCommit

public boolean isAutoCommit()
                     throws DatabaseException
Specified by:
isAutoCommit in interface Database
Throws:
DatabaseException

setAutoCommit

public void setAutoCommit(boolean b)
                   throws DatabaseException
Specified by:
setAutoCommit in interface Database
Throws:
DatabaseException

isSafeToRunUpdate

public boolean isSafeToRunUpdate()
                          throws DatabaseException
Default implementation, just look for "local" IPs. If the database returns a null URL we return false since we don't know it's safe to run the update.

Specified by:
isSafeToRunUpdate in interface Database
Throws:
DatabaseException

executeStatements

public void executeStatements(Change change,
                              DatabaseChangeLog changeLog,
                              List<SqlVisitor> sqlVisitors)
                       throws LiquibaseException
Specified by:
executeStatements in interface Database
Throws:
LiquibaseException

execute

public void execute(SqlStatement[] statements,
                    List<SqlVisitor> sqlVisitors)
             throws LiquibaseException
Specified by:
execute in interface Database
Throws:
LiquibaseException

saveStatements

public void saveStatements(Change change,
                           List<SqlVisitor> sqlVisitors,
                           Writer writer)
                    throws IOException,
                           StatementNotSupportedOnDatabaseException,
                           LiquibaseException
Specified by:
saveStatements in interface Database
Throws:
IOException
StatementNotSupportedOnDatabaseException
LiquibaseException

executeRollbackStatements

public void executeRollbackStatements(SqlStatement[] statements,
                                      List<SqlVisitor> sqlVisitors)
                               throws LiquibaseException,
                                      RollbackImpossibleException
Specified by:
executeRollbackStatements in interface Database
Throws:
LiquibaseException
RollbackImpossibleException

executeRollbackStatements

public void executeRollbackStatements(Change change,
                                      List<SqlVisitor> sqlVisitors)
                               throws LiquibaseException,
                                      RollbackImpossibleException
Specified by:
executeRollbackStatements in interface Database
Throws:
LiquibaseException
RollbackImpossibleException

saveRollbackStatement

public void saveRollbackStatement(Change change,
                                  List<SqlVisitor> sqlVisitors,
                                  Writer writer)
                           throws IOException,
                                  RollbackImpossibleException,
                                  StatementNotSupportedOnDatabaseException,
                                  LiquibaseException
Specified by:
saveRollbackStatement in interface Database
Throws:
IOException
RollbackImpossibleException
StatementNotSupportedOnDatabaseException
LiquibaseException

filterRollbackVisitors

protected List<SqlVisitor> filterRollbackVisitors(List<SqlVisitor> visitors)
Takes a list of SqlVisitors and returns a new list with only the SqlVisitors set to apply to rollbacks


getDateFunctions

public List<DatabaseFunction> getDateFunctions()
Description copied from interface: Database
Returns list of database native date functions

Specified by:
getDateFunctions in interface Database

isFunction

public boolean isFunction(String string)
Specified by:
isFunction in interface Database

resetInternalState

public void resetInternalState()
Specified by:
resetInternalState in interface Database

supportsForeignKeyDisable

public boolean supportsForeignKeyDisable()
Specified by:
supportsForeignKeyDisable in interface Database

disableForeignKeyChecks

public boolean disableForeignKeyChecks()
                                throws DatabaseException
Specified by:
disableForeignKeyChecks in interface Database
Throws:
DatabaseException

enableForeignKeyChecks

public void enableForeignKeyChecks()
                            throws DatabaseException
Specified by:
enableForeignKeyChecks in interface Database
Throws:
DatabaseException

createsIndexesForForeignKeys

public boolean createsIndexesForForeignKeys()
Specified by:
createsIndexesForForeignKeys in interface Database

getDataTypeMaxParameters

public int getDataTypeMaxParameters(String dataTypeName)
Specified by:
getDataTypeMaxParameters in interface Database

getSchemaFromJdbcInfo

public CatalogAndSchema getSchemaFromJdbcInfo(String rawCatalogName,
                                              String rawSchemaName)

getJdbcCatalogName

public String getJdbcCatalogName(CatalogAndSchema schema)

getJdbcSchemaName

public String getJdbcSchemaName(CatalogAndSchema schema)

getJdbcCatalogName

public final String getJdbcCatalogName(Schema schema)

getJdbcSchemaName

public final String getJdbcSchemaName(Schema schema)

dataTypeIsNotModifiable

public boolean dataTypeIsNotModifiable(String typeName)
Description copied from interface: Database
Types like int4 in postgres cannot have a modifier. e.g. int4(10) Checks whether the type is allowed to have a modifier

Specified by:
dataTypeIsNotModifiable in interface Database
Parameters:
typeName - type name
Returns:
Whether data type can have a modifier

setObjectQuotingStrategy

public void setObjectQuotingStrategy(ObjectQuotingStrategy quotingStrategy)
Specified by:
setObjectQuotingStrategy in interface Database

getObjectQuotingStrategy

public ObjectQuotingStrategy getObjectQuotingStrategy()
Specified by:
getObjectQuotingStrategy in interface Database

generateDatabaseFunctionValue

public String generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
Description copied from interface: Database
Some function names are placeholders that need to be replaced with the specific database value. e.g. nextSequenceValue(sequenceName) should be replaced with NEXT_VAL('sequenceName') for Postgresql

Specified by:
generateDatabaseFunctionValue in interface Database
Parameters:
databaseFunction - database function to check.
Returns:
the string value to use for an update or generate

getCurrentDateTimeFunction

public String getCurrentDateTimeFunction()
Description copied from interface: Database
Returns database-specific function for generating the current date/time.

Specified by:
getCurrentDateTimeFunction in interface Database

setOutputDefaultSchema

public void setOutputDefaultSchema(boolean outputDefaultSchema)
Description copied from interface: Database
Whether the default schema should be included in generated SQL

Specified by:
setOutputDefaultSchema in interface Database

isDefaultSchema

public boolean isDefaultSchema(String catalog,
                               String schema)
Specified by:
isDefaultSchema in interface Database

isDefaultCatalog

public boolean isDefaultCatalog(String catalog)
Specified by:
isDefaultCatalog in interface Database

getOutputDefaultSchema

public boolean getOutputDefaultSchema()
Specified by:
getOutputDefaultSchema in interface Database

getOutputDefaultCatalog

public boolean getOutputDefaultCatalog()
Specified by:
getOutputDefaultCatalog in interface Database

setOutputDefaultCatalog

public void setOutputDefaultCatalog(boolean outputDefaultCatalog)
Specified by:
setOutputDefaultCatalog in interface Database

supportsPrimaryKeyNames

public boolean supportsPrimaryKeyNames()
Specified by:
supportsPrimaryKeyNames in interface Database

getSystemSchema

public String getSystemSchema()
Specified by:
getSystemSchema in interface Database

escapeDataTypeName

public String escapeDataTypeName(String dataTypeName)
Specified by:
escapeDataTypeName in interface Database

unescapeDataTypeName

public String unescapeDataTypeName(String dataTypeName)
Specified by:
unescapeDataTypeName in interface Database

unescapeDataTypeString

public String unescapeDataTypeString(String dataTypeString)
Specified by:
unescapeDataTypeString in interface Database

get

public Object get(String key)

set

public AbstractJdbcDatabase set(String key,
                                Object value)

validate

public ValidationErrors validate()
Specified by:
validate in interface Database


Copyright © 2016 Liquibase.org. All rights reserved.