Package com.atlassian.bamboo.utils.db
Class MsSqlDbmsBean
java.lang.Object
com.atlassian.bamboo.utils.db.AbstractDbmsBean
com.atlassian.bamboo.utils.db.MsSqlDbmsBean
- All Implemented Interfaces:
BambooDatabaseTypeProvider,DbmsBean
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.bamboo.utils.db.DbmsBean
DbmsBean.ColumnDefinition, DbmsBean.ConstraintDefinition, DbmsBean.IndexDefinition -
Field Summary
Fields inherited from class com.atlassian.bamboo.utils.db.AbstractDbmsBean
LARGE_STRING_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactuallyChangeColumnToNotNull(Connection c, String tableName, String columnName) protected voidchangeColumnDefinition(Connection c, String table, String column, String sqlType, boolean isNullable) voidchangeTableNameToUpperCase(Connection connection, String oldName) Rename table from lower case to upper case.@NotNull StringclobEquals(@NotNull String columnName) Comparison string for CLOB column.protected voiddropConstraints(Connection connection, String tableName, String columnName) voiddropIndex(Connection c, String table, String index) voiddropPrimaryKey(Connection connection, String tableName) Drops the primary key on a table.@NotNull StringProvide a different SQL concatenation operator depending on SQL engine used.@NotNull Collection<DbmsBean.ConstraintDefinition> getConstraints(Connection connection, @NotNull String table, @Nullable String column) Fetch information about constraintsDetect used database type@NotNull StringgetQuery(@NotNull SqlQueryProvider sqlQueryProvider) Provide a different SQL query depending on SQL engine used.protected @NotNull StringgetSqlTypeName(int type) booleanisColumnPresent(@NotNull Statement statement, @NotNull String tableName, @NotNull String columnName) Checks whether given table contains the specified column.booleanprotected DbmsBean.ColumnDefinitionnewColumnDefinition(String columnName, int dataType, String dataTypeName, OptionalInt columnSize, Optional<Boolean> isNullable) voidrenameColumn(Connection c, String tableName, String oldName, String newName) Rename columns.voidresizeVarcharColumn(@NotNull Connection connection, String tableName, String columnName, int newSize, boolean isNullable, @Nullable String defaultValue) Methods inherited from class com.atlassian.bamboo.utils.db.AbstractDbmsBean
addColumn, changeColumnToNotNull, changeColumnType, createColumn, createIndex, createPrimaryKey, createUniqueConstraint, dropColumn, dropConstraint, dropForeignKeyConstraint, dropIndexIfExists, dropTable, getColumnDefinition, getColumnDefinitionString, getColumns, getConstraintDefinitions, getConstraintType, getIndexNames, getIndices, getLargeTextTypeName, getSchema, getSchemaUncached, getTables, hasIndexOnColumns, isColumnPresent, isColumnPresent, isH2, isMySql, isOracle, isPostgreSql, isTable, isTablePresent, migrateColumnType, quote, quoteIfNeeded, toLowerCase, unquoteIfNeededMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.bamboo.utils.db.DbmsBean
getCatalog
-
Constructor Details
-
MsSqlDbmsBean
public MsSqlDbmsBean()
-
-
Method Details
-
getQuery
Description copied from interface:DbmsBeanProvide a different SQL query depending on SQL engine used.- Parameters:
sqlQueryProvider-- Returns:
-
getConcat
Description copied from interface:DbmsBeanProvide a different SQL concatenation operator depending on SQL engine used.- Parameters:
values- the values to concatenate.- Returns:
- the concatenation SQL to append to a query.
-
resizeVarcharColumn
public void resizeVarcharColumn(@NotNull @NotNull Connection connection, String tableName, String columnName, int newSize, boolean isNullable, @Nullable @Nullable String defaultValue) throws SQLException - Throws:
SQLException
-
isMsSqlServer
public boolean isMsSqlServer()- Specified by:
isMsSqlServerin interfaceDbmsBean- Overrides:
isMsSqlServerin classAbstractDbmsBean- Returns:
- true if db configured in Hibernate is Microsoft SQL Server
-
getDatabaseType
Description copied from interface:BambooDatabaseTypeProviderDetect used database type- Returns:
- database type
-
dropIndex
- Specified by:
dropIndexin interfaceDbmsBean- Overrides:
dropIndexin classAbstractDbmsBean- Throws:
SQLException
-
dropConstraints
- Overrides:
dropConstraintsin classAbstractDbmsBean
-
isColumnPresent
public boolean isColumnPresent(@NotNull @NotNull Statement statement, @NotNull @NotNull String tableName, @NotNull @NotNull String columnName) throws SQLException Description copied from interface:DbmsBeanChecks whether given table contains the specified column.- Specified by:
isColumnPresentin interfaceDbmsBean- Overrides:
isColumnPresentin classAbstractDbmsBean- Returns:
- true if given table contains the specified column or false when either column or table doesn't exist
- Throws:
SQLException
-
dropPrimaryKey
Description copied from interface:DbmsBeanDrops the primary key on a table.- Throws:
SQLException
-
getConstraints
@NotNull public @NotNull Collection<DbmsBean.ConstraintDefinition> getConstraints(Connection connection, @NotNull @NotNull String table, @Nullable @Nullable String column) throws SQLException Description copied from interface:DbmsBeanFetch information about constraints- Throws:
SQLException
-
changeTableNameToUpperCase
Description copied from interface:DbmsBeanRename table from lower case to upper case. No-op if database is table names are case insensitive.- Specified by:
changeTableNameToUpperCasein interfaceDbmsBean- Overrides:
changeTableNameToUpperCasein classAbstractDbmsBean- Throws:
SQLException
-
renameColumn
public void renameColumn(Connection c, String tableName, String oldName, String newName) throws SQLException Description copied from interface:DbmsBeanRename columns.- Specified by:
renameColumnin interfaceDbmsBean- Specified by:
renameColumnin classAbstractDbmsBean- Throws:
SQLException
-
clobEquals
Description copied from interface:DbmsBeanComparison string for CLOB column.- Specified by:
clobEqualsin interfaceDbmsBean- Overrides:
clobEqualsin classAbstractDbmsBean- Parameters:
columnName- column name- Returns:
- string for prepared statement
-
newColumnDefinition
protected DbmsBean.ColumnDefinition newColumnDefinition(String columnName, int dataType, String dataTypeName, OptionalInt columnSize, Optional<Boolean> isNullable) - Overrides:
newColumnDefinitionin classAbstractDbmsBean
-
actuallyChangeColumnToNotNull
public void actuallyChangeColumnToNotNull(Connection c, String tableName, String columnName) throws SQLException - Overrides:
actuallyChangeColumnToNotNullin classAbstractDbmsBean- Throws:
SQLException
-
changeColumnDefinition
protected void changeColumnDefinition(Connection c, String table, String column, String sqlType, boolean isNullable) throws SQLException - Overrides:
changeColumnDefinitionin classAbstractDbmsBean- Throws:
SQLException
-
getSqlTypeName
- Overrides:
getSqlTypeNamein classAbstractDbmsBean
-