net.spy.db
Class DBCP

java.lang.Object
  extended bynet.spy.SpyObject
      extended bynet.spy.SpyDB
          extended bynet.spy.db.SpyCacheDB
              extended bynet.spy.db.DBSP
                  extended bynet.spy.db.DBCP
All Implemented Interfaces:
DBSPLike

public abstract class DBCP
extends DBSP

Superclass for dynamic SQL calls.


Nested Class Summary
 
Nested classes inherited from class net.spy.db.DBSP
DBSP.Argument, DBSP.NamedObject, DBSP.Parameter
 
Field Summary
 
Fields inherited from class net.spy.SpyDB
INIT_FROM_CONFIG, INIT_FROM_CONN
 
Constructor Summary
DBCP(Connection conn)
          Get a DBCP object with the given Connection.
DBCP(SpyConfig conf)
          Get a DBCP object with the given DBConfig.
 
Method Summary
protected  void applyArgs(Collection v)
          Fill in the arguments (with types) for the given list of parameters.
 boolean execute()
          Execute a query for update only.
 CallableStatement getCallableStatement()
          Get the CallableStatement for fetching output args.
protected  void prepare()
          Prepare the statement for execution.
protected  void setOptional(String name, int type)
          Optional parameters are not currently supported for DBCP objects.
 
Methods inherited from class net.spy.db.DBSP
addParameter, checkArgs, close, executeQuery, executeUpdate, getArguments, getCacheTime, getOptionalArgs, getOutputArgs, getParameters, getParameters, getParameterType, getParams, getPreparedStatement, getQuery, getQueryTimeout, getRequiredArgs, getSPName, getType, getWarnings, isDebugEnabled, main, nextResults, resetArgs, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, setArg, setCacheTime, setCoerced, setCursorName, setDebug, setMaxRows, setNull, setOutput, setPreparedStatement, setQuery, setQueryTimeout, setRequired, setSmallInt, setSPName
 
Methods inherited from class net.spy.db.SpyCacheDB
executeQuery, prepareStatement
 
Methods inherited from class net.spy.SpyDB
dbquoteStr, executeQuery, executeUpdate, freeDBConn, getConfig, getConn, getInitType, getSource, init, isClosed, prepareCall, prepareStatement
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBCP

public DBCP(SpyConfig conf)
     throws SQLException
Get a DBCP object with the given DBConfig.


DBCP

public DBCP(Connection conn)
     throws SQLException
Get a DBCP object with the given Connection.

Method Detail

execute

public boolean execute()
                throws SQLException
Execute a query for update only.

Throws:
SQLException

setOptional

protected void setOptional(String name,
                           int type)
                    throws SQLException
Optional parameters are not currently supported for DBCP objects. This method will always throw a SQLException when called.

Overrides:
setOptional in class DBSP
Parameters:
name - name of the parameter
type - type of the parameter
Throws:
SQLException - Optional Parameters are not supported
See Also:
Types

getCallableStatement

public CallableStatement getCallableStatement()
Get the CallableStatement for fetching output args. TODO get the get* methods implemented

Returns:
The CallableStatement for getting the RC's from.

applyArgs

protected void applyArgs(Collection v)
                  throws SQLException
Fill in the arguments (with types) for the given list of parameters.

Overrides:
applyArgs in class DBSP
Parameters:
v - the list of Argument objects we need to add, in order
Throws:
SQLException

prepare

protected void prepare()
                throws SQLException
Prepare the statement for execution.

Overrides:
prepare in class DBSP
Throws:
SQLException