org.sape.sqlutils
Class ResultSetHelper

java.lang.Object
  extended byorg.sape.sqlutils.ResultSetHelper

public class ResultSetHelper
extends Object

Translates database values to application values. Also contains other ResultSet utilities, such as getting column names.


Field Summary
private static int BUF_LEN
           
private static org.apache.commons.logging.Log log
           
 
Constructor Summary
ResultSetHelper()
           
 
Method Summary
static boolean getBooleanFromChar(ResultSet rs, String column)
          Converts a 'Y' or 'N' character stored in the database to a boolean.
static String getColumnNames(ResultSet rs)
          Returns the column names in the supplied ResultSet.
static Date getDate(ResultSet rs, String column)
          Converts a java.sql.Date object stored in the database to a java.util.Date object.
static Date getTimestamp(ResultSet rs, String column)
          Converts a java.sql.Timestamp object stored in the database to a java.util.Date object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

BUF_LEN

private static final int BUF_LEN
See Also:
Constant Field Values
Constructor Detail

ResultSetHelper

public ResultSetHelper()
Method Detail

getDate

public static Date getDate(ResultSet rs,
                           String column)
                    throws SQLException
Converts a java.sql.Date object stored in the database to a java.util.Date object. The date retrieved from the database is interpretted as GMT.

Parameters:
rs - ResultSet from which value is to be extracted
column - from which value is to be extracted
Returns:
java.util.Date object representing the column value. If the column value is SQL NULL, returns a null in the Java programming language.
Throws:
SQLException

getTimestamp

public static Date getTimestamp(ResultSet rs,
                                String column)
                         throws SQLException
Converts a java.sql.Timestamp object stored in the database to a java.util.Date object. The timestamp retrieved from the database is interpretted as GMT.

Parameters:
rs - ResultSet from which value is to be extracted
column - from which value is to be extracted
Returns:
java.util.Date object representing the column value. If the column value is SQL NULL, returns a null in the Java programming language.
Throws:
SQLException

getBooleanFromChar

public static boolean getBooleanFromChar(ResultSet rs,
                                         String column)
                                  throws SQLException
Converts a 'Y' or 'N' character stored in the database to a boolean.

Parameters:
rs - ResultSet from which value is to be extracted
column - from which boolean conversion to be performed
Returns:
boolean true for 'Y', otherwise false
Throws:
SQLException

getColumnNames

public static String getColumnNames(ResultSet rs)
Returns the column names in the supplied ResultSet.

Parameters:
rs - ResultSet whose column names are needed
Returns:
String containing column names


Copyright 2003 Sapient Corporation. All Rights Reserved.