Package com.atlassian.bamboo.utils.db
Class MySqlDbmsBean
java.lang.Object
com.atlassian.bamboo.utils.db.AbstractDbmsBean
com.atlassian.bamboo.utils.db.MySqlDbmsBean
- 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.voiddropConstraint(Connection c, String tableName, String constraint) Drop constraintprotected voiddropConstraints(Connection connection, String tableName, String columnName) voiddropForeignKeyConstraint(Connection c, String tableName, String foreignKey) 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.booleanisMySql()protected DbmsBean.ColumnDefinitionnewColumnDefinition(String columnName, int dataType, String dataTypeName, OptionalInt columnSize, Optional<Boolean> isNullable) Quotes the supplied name according to the quoting rules of the underlying DBMS.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, clobEquals, createColumn, createIndex, createPrimaryKey, createUniqueConstraint, dropColumn, dropIndex, dropIndexIfExists, dropTable, getColumnDefinition, getColumnDefinitionString, getColumns, getConstraintDefinitions, getConstraintType, getIndexNames, getIndices, getLargeTextTypeName, getSchema, getSchemaUncached, getSqlTypeName, getTables, hasIndexOnColumns, isColumnPresent, isColumnPresent, isColumnPresent, isH2, isMsSqlServer, isOracle, isPostgreSql, isTable, isTablePresent, migrateColumnType, 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
-
MySqlDbmsBean
public MySqlDbmsBean()
-
-
Method Details
-
getQuery
Description copied from interface:DbmsBeanProvide a different SQL query depending on SQL engine used.- Parameters:
sqlQueryProvider-- Returns:
-
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
-
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
-
isMySql
public boolean isMySql()- Specified by:
isMySqlin interfaceDbmsBean- Overrides:
isMySqlin classAbstractDbmsBean- Returns:
- true if db configured in Hibernate is MySQL
-
getDatabaseType
Description copied from interface:BambooDatabaseTypeProviderDetect used database type- Returns:
- database type
-
changeColumnDefinition
protected void changeColumnDefinition(Connection c, String table, String column, String sqlType, boolean isNullable) throws SQLException - Overrides:
changeColumnDefinitionin classAbstractDbmsBean- Throws:
SQLException
-
dropConstraints
- Overrides:
dropConstraintsin classAbstractDbmsBean
-
dropConstraint
Description copied from interface:DbmsBeanDrop constraint- Specified by:
dropConstraintin interfaceDbmsBean- Overrides:
dropConstraintin classAbstractDbmsBean- Throws:
SQLException- if constraint does not exist
-
dropForeignKeyConstraint
public void dropForeignKeyConstraint(Connection c, String tableName, String foreignKey) throws SQLException - Specified by:
dropForeignKeyConstraintin interfaceDbmsBean- Overrides:
dropForeignKeyConstraintin classAbstractDbmsBean- Throws:
SQLException
-
actuallyChangeColumnToNotNull
public void actuallyChangeColumnToNotNull(Connection c, String tableName, String columnName) throws SQLException - Overrides:
actuallyChangeColumnToNotNullin classAbstractDbmsBean- Throws:
SQLException
-
quote
Description copied from interface:DbmsBeanQuotes the supplied name according to the quoting rules of the underlying DBMS.- Specified by:
quotein interfaceDbmsBean- Overrides:
quotein classAbstractDbmsBean
-
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
-
dropPrimaryKey
Description copied from interface:DbmsBeanDrops the primary key on a table.- 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
-
newColumnDefinition
protected DbmsBean.ColumnDefinition newColumnDefinition(String columnName, int dataType, String dataTypeName, OptionalInt columnSize, Optional<Boolean> isNullable) - Overrides:
newColumnDefinitionin classAbstractDbmsBean
-