com.bristle.javalib.sql.oracle
Class OracleUtil

java.lang.Object
  extended by com.bristle.javalib.sql.oracle.OracleUtil

public class OracleUtil
extends Object

This class contains utility routines for use with an Oracle database.

Usage:
   - The typical scenario for using this class is:
       String s = OracleUtil.oracleBoolean(bln);

   - See the source code of the inner Tester class for more examples.
  
Assumptions:
Effects:
       - None.
Anticipated Changes:
Notes:
Implementation Notes:
Portability Issues:
Revision History:
   $Log$


Nested Class Summary
static class OracleUtil.Tester
          Each class contains a Tester inner class with a main() for easier unit testing.
 
Constructor Summary
OracleUtil()
           
 
Method Summary
static boolean databaseConnectionIsValid(Connection conn)
          Test the specified Oracle database connection.
static String oracleBoolean(boolean blnIn)
          Returns a string containing the Oracle keyword TRUE if the specified boolean is null.
static String oracleIntegerOrNull(Integer intIn)
          Returns a string containing the Oracle keyword NULL if the specified Integer is null.
static String oracleStringOrNull(String strIn)
          Returns a string containing the Oracle keyword NULL if the specified string is null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OracleUtil

public OracleUtil()
Method Detail

oracleStringOrNull

public static String oracleStringOrNull(String strIn)
Returns a string containing the Oracle keyword NULL if the specified string is null. Otherwise, returns the specified string with Oracle quotes (') around it

Parameters:
strIn - The input string.
Returns:
The string "NULL" or the value of strIn enclosed in quotes as an Oracle string literal.

oracleIntegerOrNull

public static String oracleIntegerOrNull(Integer intIn)
Returns a string containing the Oracle keyword NULL if the specified Integer is null. Otherwise, returns the specified Integer as a string (to be used as an Oracle numeric literal value).

Parameters:
intIn - The input Integer.
Returns:
The string "NULL" or the string value of intIn.

oracleBoolean

public static String oracleBoolean(boolean blnIn)
Returns a string containing the Oracle keyword TRUE if the specified boolean is null. Otherwise, returns the Oracle keyword FALSE.

Parameters:
blnIn - The input boolean.
Returns:
The stringized value "TRUE" or"FALSE".

databaseConnectionIsValid

public static boolean databaseConnectionIsValid(Connection conn)
Test the specified Oracle database connection.

Parameters:
conn - Oracle database connection
Returns:
True if valid; False if invalid.