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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
actuallyChangeColumnToNotNull
(Connection c, String tableName, String columnName) protected void
changeColumnDefinition
(Connection c, String table, String column, String sqlType, boolean isNullable) void
changeTableNameToUpperCase
(Connection connection, String oldName) Rename table from lower case to upper case.void
dropConstraint
(Connection c, String tableName, String constraint) Drop constraintprotected void
dropConstraints
(Connection connection, String tableName, String columnName) void
dropForeignKeyConstraint
(Connection c, String tableName, String foreignKey) void
dropPrimaryKey
(Connection connection, String tableName) Drops the primary key on a table.@NotNull String
Provide 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 String
getQuery
(@NotNull SqlQueryProvider sqlQueryProvider) Provide a different SQL query depending on SQL engine used.boolean
isMySql()
protected DbmsBean.ColumnDefinition
newColumnDefinition
(String columnName, int dataType, String dataTypeName, OptionalInt columnSize, Optional<Boolean> isNullable) Quotes the supplied name according to the quoting rules of the underlying DBMS.void
renameColumn
(Connection c, String tableName, String oldName, String newName) Rename columns.void
resizeVarcharColumn
(@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, isColumnPresent, isColumnPresent, isColumnPresent, isH2, isHsqldb, isMsSqlServer, isOracle, isPostgreSql, isTable, isTablePresent, migrateColumnType, quoteIfNeeded, toLowerCase
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.bamboo.utils.db.DbmsBean
getCatalog
-
Constructor Details
-
MySqlDbmsBean
public MySqlDbmsBean()
-
-
Method Details
-
getQuery
Description copied from interface:DbmsBean
Provide a different SQL query depending on SQL engine used.- 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:DbmsBean
Fetch information about constraints- Throws:
SQLException
-
getConcat
Description copied from interface:DbmsBean
Provide 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:
isMySql
in interfaceDbmsBean
- Overrides:
isMySql
in classAbstractDbmsBean
- Returns:
- true if db configured in Hibernate is MySQL
-
getDatabaseType
Description copied from interface:BambooDatabaseTypeProvider
Detect used database type- Returns:
- database type
-
changeColumnDefinition
protected void changeColumnDefinition(Connection c, String table, String column, String sqlType, boolean isNullable) throws SQLException - Overrides:
changeColumnDefinition
in classAbstractDbmsBean
- Throws:
SQLException
-
dropConstraints
- Overrides:
dropConstraints
in classAbstractDbmsBean
-
dropConstraint
Description copied from interface:DbmsBean
Drop constraint- Specified by:
dropConstraint
in interfaceDbmsBean
- Overrides:
dropConstraint
in classAbstractDbmsBean
- Throws:
SQLException
- if constraint does not exist
-
dropForeignKeyConstraint
public void dropForeignKeyConstraint(Connection c, String tableName, String foreignKey) throws SQLException - Specified by:
dropForeignKeyConstraint
in interfaceDbmsBean
- Overrides:
dropForeignKeyConstraint
in classAbstractDbmsBean
- Throws:
SQLException
-
actuallyChangeColumnToNotNull
public void actuallyChangeColumnToNotNull(Connection c, String tableName, String columnName) throws SQLException - Overrides:
actuallyChangeColumnToNotNull
in classAbstractDbmsBean
- Throws:
SQLException
-
quote
Description copied from interface:DbmsBean
Quotes the supplied name according to the quoting rules of the underlying DBMS.- Specified by:
quote
in interfaceDbmsBean
- Overrides:
quote
in classAbstractDbmsBean
-
changeTableNameToUpperCase
Description copied from interface:DbmsBean
Rename table from lower case to upper case. No-op if database is table names are case insensitive.- Specified by:
changeTableNameToUpperCase
in interfaceDbmsBean
- Overrides:
changeTableNameToUpperCase
in classAbstractDbmsBean
- Throws:
SQLException
-
dropPrimaryKey
Description copied from interface:DbmsBean
Drops 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:DbmsBean
Rename columns.- Specified by:
renameColumn
in interfaceDbmsBean
- Specified by:
renameColumn
in classAbstractDbmsBean
- Throws:
SQLException
-
newColumnDefinition
protected DbmsBean.ColumnDefinition newColumnDefinition(String columnName, int dataType, String dataTypeName, OptionalInt columnSize, Optional<Boolean> isNullable) - Overrides:
newColumnDefinition
in classAbstractDbmsBean
-