com.is.util.sql
Class JDBCHelper

java.lang.Object
  |
  +--com.is.util.sql.JDBCHelper
All Implemented Interfaces:
java.lang.Cloneable

public class JDBCHelper
extends java.lang.Object
implements java.lang.Cloneable

Instances of this class execute JDBC queries and give access to data columns.

Note: **AutoCommit has been turned off**. You must explicitly call commit() or rollback(). (If you do not, the close method will commit any uncommitted transactions).

How to Use

In your class that needs to execute a query put something like this:
  Vector result = new Vector(20);
  JDBCHelper helper = null;
  try
      {
      helper = new JDBCHelper("weblogic.jdbc.pool.Driver",
                              "jdbc:weblogic:pool",
                              "myPool");
      helper.executeQuery("SELECT * FROM Status");
      while (helper.next())
          {
          StatusValue aStatusValue =
                 new StatusValue(helper.getInteger("StatusId"));
          aStatusValue.setCode(helper.getString("Code"));
          aStatusValue.setActive(helper.getboolean("Active"));
          aStatusValue.setSortOrder(helper.getint("SortOrder"));
          result.addElement(aStatusValue);
          } // while
      helper.close();
      }
  catch (SQLException e)
      {
      LOG.error(
            "***SQLException - Column name: " + helper.getColumnName());
      e.printStackTrace();
      throw e;
      }
  catch (Exception e)
      {
      LOG.error("Exception caught in Xyx.abc()", e);
      e.printStackTrace();
      throw e;
      }
  

Quick summary of the column value getter methods:
(This is here to show the naming convention)
method name return type
getint int
getInteger Integer or null
getlong long
getLong Long
getShort Short
getboolean boolean
getBoolean Boolean
getNullableBooleanBoolean or null
getfloat float
getFloat Float or null
getdouble double
getDouble Double
getString trimmed String or null
getRawString String or null
getDate java.sql.Date or null
getTime java.sql.Time or null
getTimestamp java.sql.Timestamp or null
getBigDecimalBigDecimal
Note: the i_reuseStatement field was added to account for a JDBCDriver (The FreeTDS SQLServer driver) that rolls back the connection whenever a statement is closed. (From my knowledge no other drivers work this way, but this driver does allow reuse of statements). Note that using the executeQuery(aPreparedStatement) or executeUpdated(aPreparedStatement) methods will close the statement regardless of whether i_reuseStatement is true or not.


Field Summary
static java.lang.String DOUBLE_QUOTE
          The delimiter characters - double quote.
static int s_instanceCount
           
static java.lang.String SINGLE_QUOTE
          The delimiter characters - single quote.
 
Constructor Summary
JDBCHelper(javax.sql.DataSource dataSource)
          Create a JDBC helper that will use the supplied information to get a connection from a JDBC connection pool.
JDBCHelper(java.lang.String dataSourceName)
          Create a JDBC helper that will use the supplied information to get a connection from a JDBC connection pool.
JDBCHelper(java.lang.String driverClass, java.lang.String url, java.lang.String poolName)
          Deprecated. Use J2EE DataSource instead
JDBCHelper(java.lang.String driverClass, java.lang.String url, java.lang.String user, java.lang.String password)
          Deprecated. Use J2EE DataSource instead
 
Method Summary
 void beginTransaction()
          Calling this method tells JDBCHelper to ignore commit() messages and close() messages until endTransaction() is called.
 java.lang.Object clone()
          Return a copy of myself without a database connection.
 void close()
          Close the result set, statement, and connection.
 void commit()
          Commit the transaction.
static java.lang.String delimitDoubleQuote(java.lang.String p_val)
          Formats a String for use as a String in a DB query where a double quote is the delimiter.
static java.lang.String delimitSingleQuote(java.lang.String p_val)
          Formats a String for use as a String in a DB query where a single quote is the delimiter.
static java.lang.String delimitString(java.lang.String p_val, java.lang.String p_delimiter)
          STATIC CLASS METHOD: Formats a String for use as a String in a DB query where the delimiter is as provided.
 void endTransaction()
          This method turns off the isInsideTransaction flag and commits the database changes.
 void executeQuery(java.sql.PreparedStatement stmt)
          Executes a prepared statement created by prepareStatement().
 void executeQuery(java.lang.String sqlString)
          Execute the SQL string.
 int executeUpdate(java.sql.PreparedStatement stmt)
          Execute an update/insert/delete on a PreparedStatement
 int executeUpdate(java.lang.String sqlString)
          Execute an update/insert/delete.
 java.math.BigDecimal getBigDecimal(int column)
          Calls the getBigDecimal() method on the ResultSet.
 java.math.BigDecimal getBigDecimal(java.lang.String column)
          Calls the getBigDecimal() method on the ResultSet.
 boolean getboolean(int column)
          Calls the getboolean() method on the ResultSet.
 java.lang.Boolean getBoolean(int column)
          Calls the getBoolean() method on the ResultSet and wraps the boolean in a Boolean.
 boolean getboolean(java.lang.String column)
          Calls the getBoolean() method on the ResultSet.
 java.lang.Boolean getBoolean(java.lang.String column)
          Calls the getBoolean() method on the ResultSet and wraps the boolean in a Boolean.
 byte[] getBytes(int column)
          Calls the getBytes() method on the ResultSet.
 byte[] getBytes(java.lang.String column)
          Calls the getBytes() method on the ResultSet.
 boolean getCloseButDontCommit()
          Return whether the commit() method should actually commit or not.
 java.lang.String getColumnName()
          Return the name of the column that was unsuccessfully accessed.
 boolean getCommitButDontClose()
          Return whether the close() method should actually close the connection or not.
 java.sql.Connection getConnection()
          Return the current Connection.
 java.sql.Date getDate(int column)
          Calls the getDate() method on the ResultSet.
 java.sql.Date getDate(java.lang.String column)
          Calls the getDate() method on the ResultSet.
 double getdouble(int column)
          Calls the getDouble() method on the ResultSet.
 java.lang.Double getDouble(int column)
          Calls the getDouble() method on the ResultSet and wraps the resulting double in a Double.
 double getdouble(java.lang.String column)
          Calls the getDouble() method on the ResultSet.
 java.lang.Double getDouble(java.lang.String column)
          Calls the getDouble() method on the ResultSet and wraps the resulting double in a Double.
 float getfloat(int column)
          Calls the getFloat() method on the ResultSet.
 java.lang.Float getFloat(int column)
          Calls the getFloat() method on the ResultSet and wraps the resulting float in a Float.
 float getfloat(java.lang.String column)
          Calls the getFloat() method on the ResultSet.
 java.lang.Float getFloat(java.lang.String column)
          Calls the getFloat() method on the ResultSet and wraps the resulting float in a Float.
 int getint(int column)
          Calls the getInt() method on the ResultSet.
 int getint(java.lang.String column)
          Calls the getInt() method on the ResultSet.
 java.lang.Integer getInteger(int column)
          Calls the getInt() method on the ResultSet and wraps the resulting int in an Integer.
 java.lang.Integer getInteger(java.lang.String column)
          Calls the getInt() method on the ResultSet and wraps the resulting int in an Integer.
 JDBCHelperPool getJDBCHelperPool()
           
 long getlong(int column)
          Calls the getLong() method on the ResultSet.
 java.lang.Long getLong(int column)
          Calls the getLong() method on the ResultSet and wraps the resulting long in a Long.
 long getlong(java.lang.String column)
          Calls the getLong() method on the ResultSet.
 java.lang.Long getLong(java.lang.String column)
          Calls the getLong() method on the ResultSet and wraps the resulting long in a Long.
 java.lang.Boolean getNullableBoolean(int column)
          Calls the getBoolean() method on the ResultSet and wraps the boolean in a Boolean.
 java.lang.Boolean getNullableBoolean(java.lang.String column)
          Calls the getBoolean() method on the ResultSet and wraps the boolean in a Boolean.
 java.lang.Object getObject(int column)
          Get whatever type of object is in the given column.
 java.lang.Object getObject(java.lang.String column)
          Get whatever type of object is in the given column.
 java.lang.String getRawString(int column)
          Calls the getString() method on the ResultSet.
 java.lang.String getRawString(java.lang.String column)
          Calls the getString() method on the ResultSet.
 java.sql.ResultSet getResultSet()
          Return the current ResultSet
 boolean getReuseStatement()
          Return the value of reuseStatement.
 java.lang.Short getShort(int column)
          Calls the getShort() method on the ResultSet and wraps the resulting in a Short.
 java.lang.Short getShort(java.lang.String column)
          Calls the getShort() method on the ResultSet and wraps the result in a Short.
 boolean getShouldAutoCommit()
          Return the value of shouldAutoCommit.
 boolean getShouldCommitOnClose()
          Return the value of shouldCommitOnClose.
 java.lang.String getSQLString()
          Return the SQL string that was last executed.
 java.sql.Statement getStatement()
          Return the statement last used.
 java.lang.String getString(int column)
          Calls the getString() method on the ResultSet and trims the result.
 java.lang.String getString(java.lang.String column)
          Calls the getString() method on the ResultSet and trims the result.
 java.sql.Time getTime(int column)
          Calls the getTime() method on the ResultSet.
 java.sql.Time getTime(java.lang.String column)
          Calls the getTime() method on the ResultSet.
 java.sql.Timestamp getTimestamp(int column)
          Calls the getTimestamp() method on the ResultSet.
 java.sql.Timestamp getTimestamp(java.lang.String column)
          Calls the getTimestamp() method on the ResultSet.
 boolean isConnectionClosed()
          Answer true if the connection is closed.
 boolean isInPool()
           
 boolean isInsideTransaction()
          Return boolean informing us whether we are inside a "transaction" or not.
 void markInPool()
          After this method is called, this JDBCHelper cannot be used until markOutOfPool() is called.
 void markOutOfPool()
           
 boolean next()
          Move the cursor to the next row in the result set.
 java.sql.PreparedStatement prepareStatement(java.lang.String sqlStatement)
          Gets a PreparedStatement for use with executeQuery(aPreparedStatement).
 void printColumnNames()
          Print the column names returned in the result set out to System.out.
static java.lang.String replace(java.lang.String content, java.lang.String oldString, java.lang.String newString)
          This method should really be in a StringUtil class.
 void returnToPool()
           
 void rollback()
          Rollback the transaction.
 void setCloseButDontCommit(boolean v)
          Set the value of commitButDontClose.
 void setCommitButDontClose(boolean v)
          Set the value of commitButDontClose.
 void setJDBCHelperPool(JDBCHelperPool v)
           
 void setReuseStatement(boolean v)
          Set the value of reuseStatement.
 void setShouldAutoCommit(boolean v)
          Set the value of shouldAutoCommit.
 void setShouldCommitOnClose(boolean v)
          Set the value of shouldCommitOnClose.
static java.lang.String toSQLList(java.util.List objects)
          This method should really be in a StringUtil class.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SINGLE_QUOTE

public static final java.lang.String SINGLE_QUOTE
The delimiter characters - single quote.

DOUBLE_QUOTE

public static final java.lang.String DOUBLE_QUOTE
The delimiter characters - double quote.

s_instanceCount

public static int s_instanceCount
Constructor Detail

JDBCHelper

public JDBCHelper(java.lang.String driverClass,
                  java.lang.String url,
                  java.lang.String poolName)
Deprecated. Use J2EE DataSource instead

Create a JDBCHelper that will use the supplied information to get a connection from a JDBC connection pool. (This may be specific to Weblogic).
Parameters:
poolName - a value of type 'String'

JDBCHelper

public JDBCHelper(javax.sql.DataSource dataSource)
Create a JDBC helper that will use the supplied information to get a connection from a JDBC connection pool.
Parameters:
poolName - a value of type 'String'

JDBCHelper

public JDBCHelper(java.lang.String dataSourceName)
Create a JDBC helper that will use the supplied information to get a connection from a JDBC connection pool.
Parameters:
poolName - a value of type 'String'

JDBCHelper

public JDBCHelper(java.lang.String driverClass,
                  java.lang.String url,
                  java.lang.String user,
                  java.lang.String password)
Deprecated. Use J2EE DataSource instead

Create a JDBC helper that will use the supplied information to create a JDBC connection.
Parameters:
poolName - a value of type 'String'
Method Detail

getCommitButDontClose

public boolean getCommitButDontClose()
Return whether the close() method should actually close the connection or not. This is used by the JDBCHelperPool to keep connections open.
Returns:
Value of shouldClose.

setCommitButDontClose

public void setCommitButDontClose(boolean v)
Set the value of commitButDontClose. This should be set to true when you want the connection commit, but not actually close during the close() method. This is used by the JDBCHelperPool to keep it's connections open.
Parameters:
v - Value to assign to shouldClose.

getCloseButDontCommit

public boolean getCloseButDontCommit()
Return whether the commit() method should actually commit or not. This is needed for EJB server options that don't allow commits.
Returns:
Value of shouldClose.

setCloseButDontCommit

public void setCloseButDontCommit(boolean v)
Set the value of commitButDontClose. This should be set to true when you want the connection to be closed but not manually committed. This is needed for EJB server options that don't allow commits.
Parameters:
v - Value to assign to shouldClose.

getShouldCommitOnClose

public boolean getShouldCommitOnClose()
Return the value of shouldCommitOnClose. This should be true if shouldAutoCommit is false.
Returns:
Value of shouldCommitOnClose.

setShouldCommitOnClose

public void setShouldCommitOnClose(boolean v)
Set the value of shouldCommitOnClose. This should be true if shouldAutoCommit is false.
Parameters:
v - Value to assign to shouldCommitOnClose.

getShouldAutoCommit

public boolean getShouldAutoCommit()
Return the value of shouldAutoCommit.
Returns:
Value of shouldAutoCommit.

setShouldAutoCommit

public void setShouldAutoCommit(boolean v)
Set the value of shouldAutoCommit. This value is passed to Connection#setAutoCommit(boolean) when the connection is created.
Parameters:
v - Value to assign to shouldAutoCommit.

getReuseStatement

public boolean getReuseStatement()
Return the value of reuseStatement.
Returns:
Value of reuseStatement.

setReuseStatement

public void setReuseStatement(boolean v)
Set the value of reuseStatement. This is set to true for drivers (like freeTDS) that tie transactions to the statement instead of the connection.
Parameters:
v - Value to assign to reuseStatement.

getStatement

public java.sql.Statement getStatement()
Return the statement last used.

isInsideTransaction

public boolean isInsideTransaction()
Return boolean informing us whether we are inside a "transaction" or not.
Returns:
Value of isInsideTransaction.

getJDBCHelperPool

public JDBCHelperPool getJDBCHelperPool()

setJDBCHelperPool

public void setJDBCHelperPool(JDBCHelperPool v)

returnToPool

public void returnToPool()

executeQuery

public void executeQuery(java.lang.String sqlString)
                  throws java.lang.ClassNotFoundException,
                         java.lang.InstantiationException,
                         java.lang.IllegalAccessException,
                         javax.naming.NamingException,
                         java.sql.SQLException
Execute the SQL string. The native sql of the query is logged. It is up to the user to make sure this gets closed appropriately.
Parameters:
sqlString - a value of type 'String'
Throws:
java.sql.SQLException - if a database access error occurs

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sqlStatement)
                                            throws java.lang.ClassNotFoundException,
                                                   java.lang.InstantiationException,
                                                   java.lang.IllegalAccessException,
                                                   javax.naming.NamingException,
                                                   java.sql.SQLException
Gets a PreparedStatement for use with executeQuery(aPreparedStatement).
Parameters:
sqlStatement - a SQL statement that may contain one or more '?' IN parameter placeholders

executeQuery

public void executeQuery(java.sql.PreparedStatement stmt)
                  throws java.lang.ClassNotFoundException,
                         java.lang.InstantiationException,
                         java.lang.IllegalAccessException,
                         javax.naming.NamingException,
                         java.sql.SQLException
Executes a prepared statement created by prepareStatement().
Parameters:
stmt - prepared statement to execute. All IN parameter values must have been set.
Throws:
java.sql.SQLException - if an error occurs

executeUpdate

public int executeUpdate(java.lang.String sqlString)
                  throws java.lang.ClassNotFoundException,
                         java.lang.InstantiationException,
                         java.lang.IllegalAccessException,
                         javax.naming.NamingException,
                         java.sql.SQLException
Execute an update/insert/delete.
Parameters:
sqlString - a value of type 'String'
Returns:
a value of type 'int'
Throws:
java.sql.SQLException - if an error occurs

executeUpdate

public int executeUpdate(java.sql.PreparedStatement stmt)
                  throws java.lang.ClassNotFoundException,
                         java.lang.InstantiationException,
                         java.lang.IllegalAccessException,
                         javax.naming.NamingException,
                         java.sql.SQLException
Execute an update/insert/delete on a PreparedStatement
Parameters:
sqlString - a value of type 'String'
Returns:
either the row count for INSERT, UPDATE or DELETE statements; or 0 for SQL statements that return nothing
Throws:
java.sql.SQLException - if an error occurs

isConnectionClosed

public boolean isConnectionClosed()
                           throws java.sql.SQLException
Answer true if the connection is closed.
Returns:
a value of type 'boolean'

getConnection

public java.sql.Connection getConnection()
                                  throws java.lang.ClassNotFoundException,
                                         java.lang.InstantiationException,
                                         java.lang.IllegalAccessException,
                                         javax.naming.NamingException,
                                         java.sql.SQLException
Return the current Connection. This was added to allow users to bypass the executeQuery() method. i.e. to use a PreparedStatement instead of a Statement, etc.
Returns:
a value of type 'Connection'

getResultSet

public java.sql.ResultSet getResultSet()
Return the current ResultSet
Returns:
a value of type 'ResultSet'

next

public boolean next()
             throws java.sql.SQLException
Move the cursor to the next row in the result set.
Returns:
true if the new current row is valid; false if there are no more rows.
Throws:
java.sql.SQLException - if a database access error occurs

close

public void close()
           throws java.sql.SQLException
Close the result set, statement, and connection. If the connection is from a pool driver, it is returned to the pool.
Throws:
java.sql.SQLException - if a database access error occurs

commit

public void commit()
            throws java.sql.SQLException
Commit the transaction.
Throws:
java.sql.SQLException - if a database access error occurs

rollback

public void rollback()
              throws java.sql.SQLException
Rollback the transaction.
Throws:
java.sql.SQLException - if a database access error occurs

beginTransaction

public void beginTransaction()
                      throws java.lang.ClassNotFoundException,
                             java.lang.InstantiationException,
                             java.lang.IllegalAccessException,
                             javax.naming.NamingException,
                             java.sql.SQLException
Calling this method tells JDBCHelper to ignore commit() messages and close() messages until endTransaction() is called. rollback() messages are *not* ignored.

endTransaction

public void endTransaction()
                    throws java.sql.SQLException
This method turns off the isInsideTransaction flag and commits the database changes. It is up to the user to close the JDBCHelper when done with it.
Throws:
java.sql.SQLException - if an error occurs

getColumnName

public java.lang.String getColumnName()
Return the name of the column that was unsuccessfully accessed.
Returns:
a value of type 'String'

getSQLString

public java.lang.String getSQLString()
Return the SQL string that was last executed.
Returns:
a value of type 'String'

markInPool

public void markInPool()
After this method is called, this JDBCHelper cannot be used until markOutOfPool() is called.

markOutOfPool

public void markOutOfPool()

isInPool

public boolean isInPool()

printColumnNames

public void printColumnNames()
Print the column names returned in the result set out to System.out. This is only done if the ResultSet is not null. This is a debugging method; and has no practical application in production.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Return a copy of myself without a database connection. Because there will not be a database connection, it will be considered to be outside of a transaction.
Overrides:
clone in class java.lang.Object
Returns:
a clone of this 'Object'

getObject

public java.lang.Object getObject(java.lang.String column)
                           throws java.sql.SQLException
Get whatever type of object is in the given column. If the column has a null, this will return false.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'Object'

getObject

public java.lang.Object getObject(int column)
                           throws java.sql.SQLException
Get whatever type of object is in the given column. If the column has a null, this will return false.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'Object'

getboolean

public boolean getboolean(java.lang.String column)
                   throws java.sql.SQLException
Calls the getBoolean() method on the ResultSet. If the column has a null, this will return false.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'boolean'
Throws:
java.sql.SQLException - if column is not found

getboolean

public boolean getboolean(int column)
                   throws java.sql.SQLException
Calls the getboolean() method on the ResultSet. If the column has a null, this will return false.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'boolean'
Throws:
java.sql.SQLException - if column is not found

getBoolean

public java.lang.Boolean getBoolean(java.lang.String column)
                             throws java.sql.SQLException
Calls the getBoolean() method on the ResultSet and wraps the boolean in a Boolean. If the column has a null, this will return false. (This used to return null if the JDBC driver did, but each JDBC driver behaves a little differently, so this equalizes that)
Parameters:
column - a value of type 'String'
Returns:
a value of type 'Boolean'
Throws:
java.sql.SQLException - if column is not found

getBoolean

public java.lang.Boolean getBoolean(int column)
                             throws java.sql.SQLException
Calls the getBoolean() method on the ResultSet and wraps the boolean in a Boolean. If the column has a null, this will return false. (This used to return null if the JDBC driver did, but each JDBC driver behaves a little differently, so this equalizes that)
Parameters:
column - a value of type 'int'
Returns:
a value of type 'Boolean'
Throws:
java.sql.SQLException - if column is not found

getNullableBoolean

public java.lang.Boolean getNullableBoolean(java.lang.String column)
                                     throws java.sql.SQLException
Calls the getBoolean() method on the ResultSet and wraps the boolean in a Boolean. If the column has a null, this will return a null.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'Boolean', or null.
Throws:
java.sql.SQLException - if column is not found

getNullableBoolean

public java.lang.Boolean getNullableBoolean(int column)
                                     throws java.sql.SQLException
Calls the getBoolean() method on the ResultSet and wraps the boolean in a Boolean. If the column has a null, this will return a null.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'Boolean', or null.
Throws:
java.sql.SQLException - if column is not found

getString

public java.lang.String getString(java.lang.String column)
                           throws java.sql.SQLException
Calls the getString() method on the ResultSet and trims the result. If the column has a null, this will return a null.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'String'
Throws:
java.sql.SQLException - if column is not found
See Also:
getRawString(java.lang.String)

getString

public java.lang.String getString(int column)
                           throws java.sql.SQLException
Calls the getString() method on the ResultSet and trims the result. If the column has a null, this will return a null.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'String'
Throws:
java.sql.SQLException - if column is not found
See Also:
getRawString(java.lang.String)

getRawString

public java.lang.String getRawString(java.lang.String column)
                              throws java.sql.SQLException
Calls the getString() method on the ResultSet. If the column has a null, this will return a null.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'String'
Throws:
java.sql.SQLException - if column is not found

getRawString

public java.lang.String getRawString(int column)
                              throws java.sql.SQLException
Calls the getString() method on the ResultSet. If the column has a null, this will return a null.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'String'
Throws:
java.sql.SQLException - if column is not found

getTimestamp

public java.sql.Timestamp getTimestamp(java.lang.String column)
                                throws java.sql.SQLException
Calls the getTimestamp() method on the ResultSet. If the column has a null, this will return a null.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'Date'
Throws:
java.sql.SQLException - if column is not found

getTimestamp

public java.sql.Timestamp getTimestamp(int column)
                                throws java.sql.SQLException
Calls the getTimestamp() method on the ResultSet. If the column has a null, this will return a null.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'java.sql.Date'
Throws:
java.sql.SQLException - if column is not found

getDate

public java.sql.Date getDate(java.lang.String column)
                      throws java.sql.SQLException
Calls the getDate() method on the ResultSet. If the column has a null, this will return a null.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'java.sql.Date'
Throws:
java.sql.SQLException - if column is not found

getDate

public java.sql.Date getDate(int column)
                      throws java.sql.SQLException
Calls the getDate() method on the ResultSet. If the column has a null, this will return a null.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'java.sql.Date'
Throws:
java.sql.SQLException - if column is not found

getTime

public java.sql.Time getTime(java.lang.String column)
                      throws java.sql.SQLException
Calls the getTime() method on the ResultSet. If the column has a null, this will return a null.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'java.sql.Time'
Throws:
java.sql.SQLException - if column is not found

getTime

public java.sql.Time getTime(int column)
                      throws java.sql.SQLException
Calls the getTime() method on the ResultSet. If the column has a null, this will return a null.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'java.sql.Time'
Throws:
java.sql.SQLException - if column is not found

getInteger

public java.lang.Integer getInteger(java.lang.String column)
                             throws java.sql.SQLException
Calls the getInt() method on the ResultSet and wraps the resulting int in an Integer. If database has a null, null is returned.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'Integer'
Throws:
java.sql.SQLException - if column is not found

getInteger

public java.lang.Integer getInteger(int column)
                             throws java.sql.SQLException
Calls the getInt() method on the ResultSet and wraps the resulting int in an Integer. If database has a null, null is returned.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'Integer'
Throws:
java.sql.SQLException - if column is not found

getLong

public java.lang.Long getLong(java.lang.String column)
                       throws java.sql.SQLException
Calls the getLong() method on the ResultSet and wraps the resulting long in a Long. If database has a null, null is returned.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'Long'
Throws:
java.sql.SQLException - if column is not found

getLong

public java.lang.Long getLong(int column)
                       throws java.sql.SQLException
Calls the getLong() method on the ResultSet and wraps the resulting long in a Long. If database has a null, null is returned.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'Long'
Throws:
java.sql.SQLException - if column is not found

getint

public int getint(java.lang.String column)
           throws java.sql.SQLException
Calls the getInt() method on the ResultSet. If the column has a null, this will return a zero.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'int'
Throws:
java.sql.SQLException - if column is not found

getint

public int getint(int column)
           throws java.sql.SQLException
Calls the getInt() method on the ResultSet. If the column has a null, this will return a zero.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'int'
Throws:
java.sql.SQLException - if column is not found

getlong

public long getlong(java.lang.String column)
             throws java.sql.SQLException
Calls the getLong() method on the ResultSet. If the column has a null, this will return a zero.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'long'
Throws:
java.sql.SQLException - if column is not found

getlong

public long getlong(int column)
             throws java.sql.SQLException
Calls the getLong() method on the ResultSet. If the column has a null, this will return a zero.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'long'
Throws:
java.sql.SQLException - if column is not found

getShort

public java.lang.Short getShort(java.lang.String column)
                         throws java.sql.SQLException
Calls the getShort() method on the ResultSet and wraps the result in a Short. If database has a null, null is returned.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'Short'
Throws:
java.sql.SQLException - if column is not found

getShort

public java.lang.Short getShort(int column)
                         throws java.sql.SQLException
Calls the getShort() method on the ResultSet and wraps the resulting in a Short. If database has a null, null is returned.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'Short'
Throws:
java.sql.SQLException - if column is not found

getFloat

public java.lang.Float getFloat(java.lang.String column)
                         throws java.sql.SQLException
Calls the getFloat() method on the ResultSet and wraps the resulting float in a Float. If database has a null, null is returned.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'Float'
Throws:
java.sql.SQLException - if column is not found

getFloat

public java.lang.Float getFloat(int column)
                         throws java.sql.SQLException
Calls the getFloat() method on the ResultSet and wraps the resulting float in a Float. If database has a null, null is returned.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'Float'
Throws:
java.sql.SQLException - if column is not found

getfloat

public float getfloat(java.lang.String column)
               throws java.sql.SQLException
Calls the getFloat() method on the ResultSet. If the column has a null, this will return a zero.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'float'
Throws:
java.sql.SQLException - if column is not found

getfloat

public float getfloat(int column)
               throws java.sql.SQLException
Calls the getFloat() method on the ResultSet. If the column has a null, this will return a zero.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'float'
Throws:
java.sql.SQLException - if column is not found

getDouble

public java.lang.Double getDouble(java.lang.String column)
                           throws java.sql.SQLException
Calls the getDouble() method on the ResultSet and wraps the resulting double in a Double. If database has a null, null is returned.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'Double'
Throws:
java.sql.SQLException - if column is not found

getDouble

public java.lang.Double getDouble(int column)
                           throws java.sql.SQLException
Calls the getDouble() method on the ResultSet and wraps the resulting double in a Double. If database has a null, null is returned.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'Double'
Throws:
java.sql.SQLException - if column is not found

getdouble

public double getdouble(java.lang.String column)
                 throws java.sql.SQLException
Calls the getDouble() method on the ResultSet. If the column has a null, this will return a zero.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'double'
Throws:
java.sql.SQLException - if column is not found

getdouble

public double getdouble(int column)
                 throws java.sql.SQLException
Calls the getDouble() method on the ResultSet. If the column has a null, this will return a zero.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'double'
Throws:
java.sql.SQLException - if column is not found

getBigDecimal

public java.math.BigDecimal getBigDecimal(java.lang.String column)
                                   throws java.sql.SQLException
Calls the getBigDecimal() method on the ResultSet. If the column has a null, this will return null.
Parameters:
column - a value of type String
Returns:
a value of type BigDecimal
Throws:
java.sql.SQLException - if column is not found

getBigDecimal

public java.math.BigDecimal getBigDecimal(int column)
                                   throws java.sql.SQLException
Calls the getBigDecimal() method on the ResultSet. If the column has a null, this will return null.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'BigDecimal'
Throws:
java.sql.SQLException - if column is not found

getBytes

public byte[] getBytes(int column)
                throws java.sql.SQLException
Calls the getBytes() method on the ResultSet. If the column has a null, this will return a null.
Parameters:
column - a value of type 'int'
Returns:
a value of type 'byte[]'
Throws:
java.sql.SQLException - if column is not found

getBytes

public byte[] getBytes(java.lang.String column)
                throws java.sql.SQLException
Calls the getBytes() method on the ResultSet. If the column has a null, this will return a null.
Parameters:
column - a value of type 'String'
Returns:
a value of type 'byte[]'
Throws:
java.sql.SQLException - if column is not found

delimitSingleQuote

public static java.lang.String delimitSingleQuote(java.lang.String p_val)
Formats a String for use as a String in a DB query where a single quote is the delimiter.
Parameters:
p_val - the String to format
Returns:
String with quotes escaped, and enclosing.
See Also:
delimitString(java.lang.String, java.lang.String)

delimitDoubleQuote

public static java.lang.String delimitDoubleQuote(java.lang.String p_val)
Formats a String for use as a String in a DB query where a double quote is the delimiter.
Parameters:
p_val - the String to format
Returns:
String with quotes escaped, and enclosing.
See Also:
delimitString(java.lang.String, java.lang.String)

delimitString

public static java.lang.String delimitString(java.lang.String p_val,
                                             java.lang.String p_delimiter)
STATIC CLASS METHOD: Formats a String for use as a String in a DB query where the delimiter is as provided.
Parameters:
p_val - the String to format
p_delimiter - the delimiter for formatting
Returns:
String with quotes escaped, and enclosing.

replace

public static java.lang.String replace(java.lang.String content,
                                       java.lang.String oldString,
                                       java.lang.String newString)
This method should really be in a StringUtil class. Replace occurrences of oldString with newString within the content text.
Parameters:
content - The text String that will be acted upon (strings replaced).
oldString - The string that will be replaced.
newString - The string that will replace oldString.
Returns:
returns the content string with the replaced values, as a String, or original content if bad parms.

toSQLList

public static java.lang.String toSQLList(java.util.List objects)
This method should really be in a StringUtil class. For a given List, this method creates a comma-separated string list and surrounds it with parenthesis. It is suitable for use in any SQL clauses where that formatting is required.
e.g. WHERE IN (foo,bar,blah) e.g. VALUES (tom,dick,harry)
This calls the String.valueOf() method on each List element to produce the values.
Parameters:
objects - a value of type 'List'
Returns:
a value of type 'String'

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object