liquibase.database.core
Class MSSQLDatabase

java.lang.Object
  extended by liquibase.database.AbstractJdbcDatabase
      extended by liquibase.database.core.MSSQLDatabase
All Implemented Interfaces:
Database, PrioritizedService

public class MSSQLDatabase
extends AbstractJdbcDatabase

Encapsulates MS-SQL database support.


Field Summary
static String PRODUCT_NAME
           
protected  Set<String> systemTablesAndViews
           
 
Fields inherited from class liquibase.database.AbstractJdbcDatabase
caseSensitive, currentDateTimeFunction, dateFunctions, defaultAutoIncrementBy, defaultAutoIncrementStartWith, defaultCatalogName, defaultSchemaName, quotingEndCharacter, quotingEndReplacement, quotingStartCharacter, quotingStrategy, sequenceCurrentValueFunction, sequenceNextValueFunction, unmodifiableDataTypes, unquotedObjectsAreUppercased
 
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
 
Constructor Summary
MSSQLDatabase()
           
 
Method Summary
 String escapeDataTypeName(String dataTypeName)
           
 String escapeObjectName(String objectName, Class<? extends DatabaseObject> objectType)
           
 String escapeObjectName(String catalogName, String schemaName, String objectName, Class<? extends DatabaseObject> objectType)
           
 String escapeTableName(String catalogName, String schemaName, String tableName)
           
protected  boolean generateAutoIncrementBy(BigInteger incrementBy)
           
protected  boolean generateAutoIncrementStartWith(BigInteger startWith)
           
 String generateDefaultConstraintName(String tableName, String columnName)
           
protected  String getAutoIncrementByClause()
           
protected  String getAutoIncrementClause()
           
protected  String getAutoIncrementStartWithClause()
           
 String getConcatSql(String... values)
          Returns SQL to concat the passed values.
protected  SqlStatement getConnectionSchemaNameCallStatement()
          Used to obtain the connection schema name through a statement Override this method to change the statement.
 int getDataTypeMaxParameters(String dataTypeName)
           
 String getDateLiteral(String isoDate)
          Return a date literal with the same value as a string formatted using ISO 8601.
 String getDefaultCatalogName()
           
protected  String getDefaultDatabaseProductName()
           
 String getDefaultDriver(String url)
          If this database understands the given url, return the default driver class name.
 Integer getDefaultPort()
           
 String getEngineEdition()
           
 String getJdbcSchemaName(CatalogAndSchema schema)
           
 int getPriority()
           
 String getShortName()
          Returns an all-lower-case short name of the product.
protected  Set<String> getSystemTables()
          Returns system (undroppable) views.
 Set<String> getSystemViews()
          Returns system (undroppable) views.
 String getViewDefinition(CatalogAndSchema schema, String viewName)
           
 boolean isAzureDb()
           
 boolean isCaseSensitive()
           
 boolean isCorrectDatabaseImplementation(DatabaseConnection conn)
          Is this AbstractDatabase subclass the correct one to use for the given connection.
 boolean isSystemObject(DatabaseObject example)
           
 boolean sendsStringParametersAsUnicode()
           
 boolean supportsCatalogInObjectName(Class<? extends DatabaseObject> type)
           
 boolean supportsDropTableCascadeConstraints()
           
 boolean supportsInitiallyDeferrableColumns()
          Returns whether this database support initially deferrable columns.
 boolean supportsRestrictForeignKeys()
           
 boolean supportsSequences()
          Does the database type support sequence.
 boolean supportsTablespaces()
           
 String unescapeDataTypeName(String dataTypeName)
           
 String unescapeDataTypeString(String dataTypeString)
           
 
Methods inherited from class liquibase.database.AbstractJdbcDatabase
addReservedWords, canCreateChangeLogTable, close, commit, correctObjectName, correctSchema, correctSchema, createsIndexesForForeignKeys, dataTypeIsNotModifiable, disableForeignKeyChecks, doesTagExist, dropDatabaseObjects, enableForeignKeyChecks, equals, escapeColumnName, escapeColumnName, escapeColumnNameList, escapeConstraintName, escapeIndexName, escapeSequenceName, escapeStringForDatabase, escapeViewName, execute, executeRollbackStatements, executeRollbackStatements, executeStatements, filterRollbackVisitors, generateDatabaseFunctionValue, generatePrimaryKeyName, get, getAutoCommitMode, getAutoIncrementClause, getAutoIncrementClosing, getAutoIncrementOpening, getConnection, getConnectionCatalogName, getConnectionSchemaName, getContainingObjects, getCurrentDateTimeFunction, getDatabaseChangeLogLockTableName, getDatabaseChangeLogTableName, getDatabaseMajorVersion, getDatabaseMinorVersion, getDatabaseProductName, getDatabaseProductVersion, getDateFunctions, getDateLiteral, getDateLiteral, getDateTimeLiteral, getDefaultSchema, getDefaultSchemaName, getFetchSize, getJdbcCatalogName, getJdbcCatalogName, getJdbcSchemaName, getLineComment, getLiquibaseCatalogName, getLiquibaseSchemaName, getLiquibaseTablespaceName, getName, getObjectQuotingStrategy, getOutputDefaultCatalog, getOutputDefaultSchema, getRanChangeSet, getRanChangeSetList, getRanDate, getRunStatus, getSchemaFromJdbcInfo, getSystemSchema, getTimeLiteral, hashCode, isAutoCommit, isDateOnly, isDateTime, isDefaultCatalog, isDefaultSchema, isFunction, isLiquibaseObject, isReservedWord, isSafeToRunUpdate, isSystemView, isTimeOnly, isTimestamp, jdbcCallsCatalogsSchemas, markChangeSetExecStatus, mustQuoteObjectName, parseDate, quoteObject, removeRanStatus, requiresPassword, requiresUsername, resetInternalState, rollback, saveRollbackStatement, saveStatements, set, setAutoCommit, setCanCacheLiquibaseTableInfo, setCaseSensitive, setConnection, setCurrentDateTimeFunction, setDatabaseChangeLogLockTableName, setDatabaseChangeLogTableName, setDefaultCatalogName, setDefaultSchemaName, setLiquibaseCatalogName, setLiquibaseSchemaName, setLiquibaseTablespaceName, setObjectQuotingStrategy, setOutputDefaultCatalog, setOutputDefaultSchema, startsWithNumeric, supportsAutoIncrement, supportsCatalogs, supportsDDLInTransaction, supportsForeignKeyDisable, supportsPrimaryKeyNames, supportsSchemas, tag, toString, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PRODUCT_NAME

public static final String PRODUCT_NAME
See Also:
Constant Field Values

systemTablesAndViews

protected Set<String> systemTablesAndViews
Constructor Detail

MSSQLDatabase

public MSSQLDatabase()
Method Detail

getShortName

public String getShortName()
Description copied from interface: Database
Returns an all-lower-case short name of the product. Used for end-user selecting of database type such as the DBMS precondition.


getPriority

public int getPriority()

getDefaultDatabaseProductName

protected String getDefaultDatabaseProductName()
Specified by:
getDefaultDatabaseProductName in class AbstractJdbcDatabase

getDefaultPort

public Integer getDefaultPort()

getSystemViews

public Set<String> getSystemViews()
Description copied from class: AbstractJdbcDatabase
Returns system (undroppable) views.

Overrides:
getSystemViews in class AbstractJdbcDatabase

getSystemTables

protected Set<String> getSystemTables()
Description copied from class: AbstractJdbcDatabase
Returns system (undroppable) views.

Overrides:
getSystemTables in class AbstractJdbcDatabase

supportsInitiallyDeferrableColumns

public boolean supportsInitiallyDeferrableColumns()
Description copied from interface: Database
Returns whether this database support initially deferrable columns.


supportsSequences

public boolean supportsSequences()
Description copied from class: AbstractJdbcDatabase
Does the database type support sequence.

Specified by:
supportsSequences in interface Database
Overrides:
supportsSequences in class AbstractJdbcDatabase

isCorrectDatabaseImplementation

public boolean isCorrectDatabaseImplementation(DatabaseConnection conn)
                                        throws DatabaseException
Description copied from interface: Database
Is this AbstractDatabase subclass the correct one to use for the given connection.

Throws:
DatabaseException

getDefaultDriver

public String getDefaultDriver(String url)
Description copied from interface: Database
If this database understands the given url, return the default driver class name. Otherwise return null.


getAutoIncrementClause

protected String getAutoIncrementClause()
Overrides:
getAutoIncrementClause in class AbstractJdbcDatabase

generateAutoIncrementStartWith

protected boolean generateAutoIncrementStartWith(BigInteger startWith)
Overrides:
generateAutoIncrementStartWith in class AbstractJdbcDatabase

generateAutoIncrementBy

protected boolean generateAutoIncrementBy(BigInteger incrementBy)
Overrides:
generateAutoIncrementBy in class AbstractJdbcDatabase

getAutoIncrementStartWithClause

protected String getAutoIncrementStartWithClause()
Overrides:
getAutoIncrementStartWithClause in class AbstractJdbcDatabase

getAutoIncrementByClause

protected String getAutoIncrementByClause()
Overrides:
getAutoIncrementByClause in class AbstractJdbcDatabase

getDefaultCatalogName

public String getDefaultCatalogName()
Specified by:
getDefaultCatalogName in interface Database
Overrides:
getDefaultCatalogName in class AbstractJdbcDatabase

getConnectionSchemaNameCallStatement

protected SqlStatement getConnectionSchemaNameCallStatement()
Description copied from class: AbstractJdbcDatabase
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.

Overrides:
getConnectionSchemaNameCallStatement in class AbstractJdbcDatabase
Returns:
See Also:
AbstractJdbcDatabase.getConnectionSchemaName()

getConcatSql

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

Specified by:
getConcatSql in interface Database
Overrides:
getConcatSql in class AbstractJdbcDatabase

escapeTableName

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

supportsTablespaces

public boolean supportsTablespaces()

isSystemObject

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

generateDefaultConstraintName

public String generateDefaultConstraintName(String tableName,
                                            String columnName)

escapeObjectName

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

getDateLiteral

public String getDateLiteral(String isoDate)
Description copied from class: AbstractJdbcDatabase
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
Overrides:
getDateLiteral in class AbstractJdbcDatabase

supportsRestrictForeignKeys

public boolean supportsRestrictForeignKeys()
Specified by:
supportsRestrictForeignKeys in interface Database
Overrides:
supportsRestrictForeignKeys in class AbstractJdbcDatabase

supportsDropTableCascadeConstraints

public boolean supportsDropTableCascadeConstraints()
Specified by:
supportsDropTableCascadeConstraints in interface Database
Overrides:
supportsDropTableCascadeConstraints in class AbstractJdbcDatabase

supportsCatalogInObjectName

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

getViewDefinition

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

escapeObjectName

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

getJdbcSchemaName

public String getJdbcSchemaName(CatalogAndSchema schema)
Overrides:
getJdbcSchemaName in class AbstractJdbcDatabase

isCaseSensitive

public boolean isCaseSensitive()
Specified by:
isCaseSensitive in interface Database
Overrides:
isCaseSensitive in class AbstractJdbcDatabase

getDataTypeMaxParameters

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

escapeDataTypeName

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

unescapeDataTypeName

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

unescapeDataTypeString

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

sendsStringParametersAsUnicode

public boolean sendsStringParametersAsUnicode()

isAzureDb

public boolean isAzureDb()

getEngineEdition

public String getEngineEdition()


Copyright © 2016 Liquibase.org. All rights reserved.