mappingmicroarrayprobestotheratgenomeviaapersistentindex
Class DatabaseFunctions

java.lang.Object
  extended by mappingmicroarrayprobestotheratgenomeviaapersistentindex.DatabaseFunctions

public class DatabaseFunctions
extends java.lang.Object

This class provides database functions required by the software.


Constructor Summary
DatabaseFunctions()
           
 
Method Summary
static java.sql.Connection connect(java.lang.String url, java.lang.String username, java.lang.String password)
          Connects to database dbName
static java.sql.CallableStatement createStoredQuery(java.sql.Connection conn, java.lang.String query)
          Creates a stored query
static java.lang.Boolean doesIndexExist(java.sql.Connection conn, java.lang.String tableName)
          Checks to see if an index exists
static java.lang.Boolean doesTableExist(java.sql.Connection conn, java.lang.String tableName)
          Checks to see if a table exists
static java.lang.Boolean doesTablespaceExist(java.sql.Connection conn, java.lang.String tablespaceName)
          Checks to see if a tablespace exists
static java.lang.Boolean isTableEmpty(java.sql.Connection conn, java.lang.String tableName)
          Checks to see if a table is empty
static java.sql.ResultSet query(java.sql.Connection conn, java.lang.String query)
          Executes a query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseFunctions

public DatabaseFunctions()
Method Detail

connect

public static java.sql.Connection connect(java.lang.String url,
                                          java.lang.String username,
                                          java.lang.String password)
Connects to database dbName

Parameters:
url - the url of the database to connect to
dbName - the name of the database to connect to
username - the username to use when connecting to the database
password - the password for this user
Returns:
the connection

query

public static java.sql.ResultSet query(java.sql.Connection conn,
                                       java.lang.String query)
Executes a query

Parameters:
conn - the connection to the database
query - the query to execute
Returns:
the query result

createStoredQuery

public static java.sql.CallableStatement createStoredQuery(java.sql.Connection conn,
                                                           java.lang.String query)
Creates a stored query

Parameters:
conn - the connection to the database
query - the query used to create the stored query
Returns:
the CallableStatement used to call the stored query

doesTableExist

public static java.lang.Boolean doesTableExist(java.sql.Connection conn,
                                               java.lang.String tableName)
Checks to see if a table exists

Parameters:
conn - the connection to the database
tableName - the name of the table to check for existence
Returns:
true if the table exists, otherwise false

isTableEmpty

public static java.lang.Boolean isTableEmpty(java.sql.Connection conn,
                                             java.lang.String tableName)
Checks to see if a table is empty

Parameters:
conn - the connection to the database
tableName - the name of the table to be checked to see if it is empty
Returns:
true if the table is empty, otherwise false

doesTablespaceExist

public static java.lang.Boolean doesTablespaceExist(java.sql.Connection conn,
                                                    java.lang.String tablespaceName)
Checks to see if a tablespace exists

Parameters:
conn - the connection to the database
tableName - the name of the tablespace to be checked for existence
Returns:
true if the tablespace exists, otherwise false

doesIndexExist

public static java.lang.Boolean doesIndexExist(java.sql.Connection conn,
                                               java.lang.String tableName)
Checks to see if an index exists

Parameters:
conn - the connection to the database
tableName - the name of the table to be checked for index existence
Returns:
true if the index exists, otherwise false