com.atlassian.bamboo.setup
Class DbmsSpecificUtils

java.lang.Object
  extended by com.atlassian.bamboo.setup.DbmsSpecificUtils

public class DbmsSpecificUtils
extends java.lang.Object

This class holds utility methods used when DBMS has to be accessed without Hibernate.


Field Summary
static java.lang.String PROPERTY_HIBERNATE_DIALECT
           
 
Constructor Summary
DbmsSpecificUtils(com.atlassian.config.db.HibernateConfig hibernateConfig)
           
 
Method Summary
static void dropMsSqlForeignKeyConstraints(java.sql.Statement statement, java.lang.String tableName)
          Drops foreign key constraints defined for a table
static java.sql.ResultSet getMsSqlForeignKeyConstraintsForTable(java.sql.Statement statement, java.lang.String tableName)
          Retrieves foreign key constraints defined for a table
 boolean isHsqldb()
          Checks whether the db configured in Hibernate is HSQL
 boolean isMsSqlServer()
          Checks whether the db configured in Hibernate is MS SQL Server (international/standard)
 boolean isMySql()
          Checks whether the db configured in Hibernate is MySQL
 boolean isOracle()
          Checks whether the db configured in Hibernate is Oracle (8/9 dialect)
 boolean isPostgreSQL()
          Checks whether the db configured in Hibernate is PostgreSQL
static boolean isTablePresent(java.sql.Connection connection, java.lang.String tableName)
          Checks whether given table is present in the database
static boolean isTablePresent(java.sql.Statement statement, java.lang.String tableName)
          Checks whether given table is present in the database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_HIBERNATE_DIALECT

public static final java.lang.String PROPERTY_HIBERNATE_DIALECT
See Also:
Constant Field Values
Constructor Detail

DbmsSpecificUtils

public DbmsSpecificUtils(@NotNull
                         com.atlassian.config.db.HibernateConfig hibernateConfig)
Method Detail

isMySql

public boolean isMySql()
Checks whether the db configured in Hibernate is MySQL

Returns:

isOracle

public boolean isOracle()
Checks whether the db configured in Hibernate is Oracle (8/9 dialect)

Returns:

isHsqldb

public boolean isHsqldb()
Checks whether the db configured in Hibernate is HSQL

Returns:

isPostgreSQL

public boolean isPostgreSQL()
Checks whether the db configured in Hibernate is PostgreSQL

Returns:

isMsSqlServer

public boolean isMsSqlServer()
Checks whether the db configured in Hibernate is MS SQL Server (international/standard)

Returns:

getMsSqlForeignKeyConstraintsForTable

public static java.sql.ResultSet getMsSqlForeignKeyConstraintsForTable(java.sql.Statement statement,
                                                                       java.lang.String tableName)
                                                                throws java.sql.SQLException
Retrieves foreign key constraints defined for a table

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

dropMsSqlForeignKeyConstraints

public static void dropMsSqlForeignKeyConstraints(java.sql.Statement statement,
                                                  java.lang.String tableName)
                                           throws java.sql.SQLException
Drops foreign key constraints defined for a table

Throws:
java.sql.SQLException

isTablePresent

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

Parameters:
statement -
tableName -
Returns:

isTablePresent

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

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


Copyright © 2010 Atlassian. All Rights Reserved.