com.atlassian.bamboo.utils.db
Interface DbmsBean

All Known Implementing Classes:
AbstractDbmsBean, HsqlDbmsBean, MsSqlDbmsBean, MySqlDbmsBean, OracleDbmsBean, PostgreSqlDbmsBean

public interface DbmsBean


Method Summary
 boolean dropColumn(java.sql.Connection connection, java.lang.String tableName, java.lang.String columnName)
          Checks whether given table contains the specified column and drops it
 boolean dropColumn(java.sql.Connection connection, java.lang.String tableName, java.lang.String columnName, java.util.List<java.lang.String> defaultConstraintNames, java.lang.String indexName)
          Checks whether given table contains the specified column and drops it, as well as foreign key constraints and index on the column.
 java.lang.String getQuery(SqlQueryProvider sqlQueryProvider)
          Provide a different SQL query depending on SQL engine used.
 boolean isColumnPresent(java.sql.Connection connection, java.lang.String tableName, java.lang.String columnName)
          Checks whether given table contains the specified column.
 boolean isColumnPresent(java.sql.Statement statement, java.lang.String tableName, java.lang.String columnName)
          Checks whether given table contains the specified column.
 boolean isHsqldb()
           
 boolean isMsSqlServer()
           
 boolean isMySql()
           
 boolean isOracle()
           
 boolean isPostgreSql()
           
 boolean isTablePresent(java.sql.Connection connection, java.lang.String tableName)
          Checks whether given table is present in the database
 boolean isTablePresent(java.sql.Statement statement, java.lang.String tableName)
          Checks whether given table is present in the database
 java.sql.PreparedStatement prepareStatement(java.sql.Connection connection, PreparedStatementProvider preparedStatementProvider)
          Provide a different PreparedStatement depending on SQL engine used.
 

Method Detail

getQuery

@NotNull
java.lang.String getQuery(@NotNull
                                  SqlQueryProvider sqlQueryProvider)
Provide a different SQL query depending on SQL engine used.

Parameters:
sqlQueryProvider -
Returns:

prepareStatement

@NotNull
java.sql.PreparedStatement prepareStatement(@NotNull
                                                    java.sql.Connection connection,
                                                    @NotNull
                                                    PreparedStatementProvider preparedStatementProvider)
                                            throws java.sql.SQLException
Provide a different PreparedStatement depending on SQL engine used.

Parameters:
connection -
preparedStatementProvider -
Returns:
Throws:
java.sql.SQLException

isColumnPresent

boolean isColumnPresent(@NotNull
                        java.sql.Connection connection,
                        @NotNull
                        java.lang.String tableName,
                        @NotNull
                        java.lang.String columnName)
                        throws java.sql.SQLException
Checks whether given table contains the specified column.

Parameters:
connection -
tableName -
columnName -
Returns:
Throws:
java.sql.SQLException

isColumnPresent

boolean isColumnPresent(@NotNull
                        java.sql.Statement statement,
                        @NotNull
                        java.lang.String tableName,
                        @NotNull
                        java.lang.String columnName)
                        throws java.sql.SQLException
Checks whether given table contains the specified column.

Parameters:
statement -
tableName -
columnName -
Returns:
Throws:
java.sql.SQLException

dropColumn

boolean dropColumn(@NotNull
                   java.sql.Connection connection,
                   @NotNull
                   java.lang.String tableName,
                   @NotNull
                   java.lang.String columnName)
                   throws java.sql.SQLException
Checks whether given table contains the specified column and drops it

Parameters:
connection -
tableName -
columnName -
Returns:
Throws:
java.sql.SQLException

dropColumn

boolean dropColumn(@NotNull
                   java.sql.Connection connection,
                   @NotNull
                   java.lang.String tableName,
                   @NotNull
                   java.lang.String columnName,
                   @NotNull
                   java.util.List<java.lang.String> defaultConstraintNames,
                   @Nullable
                   java.lang.String indexName)
                   throws java.sql.SQLException
Checks whether given table contains the specified column and drops it, as well as foreign key constraints and index on the column. The method will automatically detect constraint names on DBMS that supports it or use provided names on DBMS that don't.

Parameters:
connection -
tableName -
columnName -
defaultConstraintNames -
indexName -
Returns:
Throws:
java.sql.SQLException

isTablePresent

boolean isTablePresent(@NotNull
                       java.sql.Statement statement,
                       @NotNull
                       java.lang.String tableName)
Checks whether given table is present in the database

Parameters:
statement - statement used to verify DB table existence
tableName - name of DB table
Returns:
true if database is accessible and table exists, false otherwise

isTablePresent

boolean isTablePresent(@NotNull
                       java.sql.Connection connection,
                       @NotNull
                       java.lang.String tableName)
                       throws java.sql.SQLException
Checks whether given table is present in the database

Parameters:
connection - connection used to verify DB table existence
tableName - name of DB table
Returns:
true if database is accessible and table exists, false otherwise
Throws:
java.sql.SQLException - if a database error occurs or connection is closed

isMySql

boolean isMySql()
Returns:
true if db configured in Hibernate is MySQL

isOracle

boolean isOracle()
Returns:
true if db configured in Hibernate is Oracle

isHsqldb

boolean isHsqldb()
Returns:
true if db configured in Hibernate is HSQL

isPostgreSql

boolean isPostgreSql()
Returns:
true if db configured in Hibernate is PostgreSQL

isMsSqlServer

boolean isMsSqlServer()
Returns:
true if db configured in Hibernate is Microsoft SQL Server


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.