|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.spy.SpyObject
net.spy.db.SpyDB
net.spy.db.SpyCacheDB
net.spy.db.DBSP
public abstract class DBSP
Super class for all stored procedure calls.
| Nested Class Summary | |
|---|---|
class |
DBSP.Argument
Arguments for DBSPs. |
class |
DBSP.NamedObject
Objects with names. |
class |
DBSP.Parameter
Parameters for DBSPs. |
| Field Summary |
|---|
| Fields inherited from class net.spy.db.SpyDB |
|---|
INIT_FROM_CONFIG, INIT_FROM_CONN |
| Constructor Summary | |
|---|---|
DBSP(Connection conn)
Get a new DBSP object using the given Connection |
|
DBSP(SpyConfig conf)
Get a new DBSP object with a given config. |
|
| Method Summary | |
|---|---|
protected void |
addParameter(DBSP.Parameter p)
Define a parameter. |
protected void |
applyArgs(Collection<DBSP.Argument> v)
Fill in the arguments (with types) for the given list of parameters. |
protected void |
checkArgs()
Verify that the arguments, as given, are acceptable. |
void |
close()
Close this statement and whatever the superclass wants to do. |
ResultSet |
executeQuery()
Execute the query. |
int |
executeUpdate()
Execute a query for update only. |
Collection<DBSP.Argument> |
getArguments()
Get the arguments in parameter order. |
long |
getCacheTime()
Get the cache time configured for this SP. |
Collection<DBSP.Parameter> |
getParameters()
Get a Collection containing all parameters. |
Collection<DBSP.Parameter> |
getParameters(int type)
Get a Collection of parameters of a specific type. |
int |
getParameterType(String var)
Get the DBSP.Parameter type. |
protected Collection<DBSP.Parameter> |
getParams()
Get a Collection of all of the parameters in the order in which they were defined. |
protected PreparedStatement |
getPreparedStatement()
Get the prepared statement on which this DBSP will operate. |
protected String |
getQuery()
Get the query this DBSP will be calling. |
int |
getQueryTimeout()
Get the timeout for this query |
protected String |
getSPName()
Get the SP name. |
int |
getType(String var)
Get the Types type of the given parameter. |
SQLWarning |
getWarnings()
Get the warnings. |
protected boolean |
isDebugEnabled()
Find out if debug is enabled. |
ResultSet |
nextResults()
Get the next result set. |
protected void |
prepare()
Prepare the statement for execution. |
protected void |
resetArgs()
Reset all arguments. |
void |
set(String which,
BigDecimal a1)
Set field which to the value a1 of the type java.math.BigDecimal |
void |
set(String which,
boolean a1)
Set field which to the value a1 of the type boolean |
void |
set(String which,
Boolean b)
Set field which to the value of b. |
void |
set(String which,
byte b)
Set a parameter to the tinyint value b of the type byte. |
void |
set(String which,
Byte b)
Set a parameter to a tinyint value. |
void |
set(String which,
Date a1)
Set field which to the value a1 of the type java.sql.Date |
void |
set(String which,
double a1)
Set field which to the value a1 of the type double |
void |
set(String which,
float a1)
Set field which to the value a1 of the type float |
void |
set(String which,
Float a1)
Set field which to the value a1 of the type float |
void |
set(String which,
int a1)
Set field which to the value a1 of the type int |
void |
set(String which,
Integer a1)
Set field which to the value a1 of the type java.lang.Integer |
void |
set(String which,
long a1)
Set field which to the value a1 of the type long |
void |
set(String which,
Object obj)
|
void |
set(String which,
short a1)
Set field which to the value a1 of the type short |
void |
set(String which,
Short s)
Set the field which to the value s of the type short. |
void |
set(String which,
String a1)
Set field which to the value a1 of the type java.lang.String |
void |
set(String which,
Time a1)
Set field which to the value a1 of the type Time |
void |
set(String which,
Timestamp a1)
Set field which to the value a1 of the type Timestamp |
protected void |
setArg(String which,
Object what,
int type)
Set the named argument to the value contained in the given object for the given type. |
void |
setCacheTime(long time)
Set the number of seconds the results of this SP will be valid. |
void |
setCoerced(String var,
String value)
Set a field in the DBSP after coercing the String value to the required value for the given field. |
void |
setCursorName(String name)
Set the cursor name to be handed to the underlying Statement. |
protected void |
setDebug(boolean db)
Set the value of debug for this instance. |
void |
setMaxRows(int to)
Set the maximum number of rows that should be returned from this query. |
protected void |
setNull(String which,
int a1)
Set field which to a null of the given type. |
protected void |
setOptional(String name,
int type)
Define a field to be optional. |
protected void |
setOutput(String name,
int type)
Define a field to be output. |
protected void |
setPreparedStatement(PreparedStatement to)
Set the prepared statement on which this DBSP will operate. |
protected void |
setQuery(String to)
Set the SQL query to call |
void |
setQueryTimeout(int to)
Set the timeout for this query. |
protected void |
setRequired(String name,
int type)
Define a field to be required. |
protected void |
setSPName(String to)
Set the stored procedure to the given value. |
void |
setTinyInt(String which,
short a1)
Set field which to the value a1 of the type short |
| Methods inherited from class net.spy.db.SpyCacheDB |
|---|
executeQuery, prepareStatement |
| Methods inherited from class net.spy.db.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 |
|---|
public DBSP(SpyConfig conf)
throws SQLException
SQLException
public DBSP(Connection conn)
throws SQLException
SQLException| Method Detail |
|---|
public ResultSet executeQuery()
throws SQLException
executeQuery in interface DBSPLikeSQLException - if there's a problem executing the query
public int executeUpdate()
throws SQLException
executeUpdate in interface DBSPLikeSQLException - if there's a problem executing the query
public ResultSet nextResults()
throws SQLException
SQLException
public SQLWarning getWarnings()
throws SQLException
SQLException
public void setCursorName(String name)
throws SQLException
name - cursor name (or null to disable cursor handling)
SQLExceptionpublic void setCacheTime(long time)
SpyCacheDB.prepareStatement(String,long)
instead of the native driver's version.
setCacheTime in interface DBSPLiketime - time (in seconds) to keep the results aroundpublic long getCacheTime()
getCacheTime in interface DBSPLike
protected void setPreparedStatement(PreparedStatement to)
throws SQLException
to - the prepared statement
SQLExceptionprotected PreparedStatement getPreparedStatement()
protected void addParameter(DBSP.Parameter p)
throws SQLException
p - the parameter
SQLException - if the parameter has already been added
protected void setRequired(String name,
int type)
throws SQLException
name - the name of the fieldtype - the type
SQLException - if the type has already been addedTypes
protected void setOptional(String name,
int type)
throws SQLException
name - the name of the fieldtype - the type
SQLException - if the type has already been addedTypes
protected void setOutput(String name,
int type)
throws SQLException
name - the name of the fieldtype - the type
SQLException - if the type has already been addedTypes
protected void setArg(String which,
Object what,
int type)
throws SQLException
which - which variable to setwhat - what value to set it totype - type of variable this is
SQLExceptionpublic Collection<DBSP.Argument> getArguments()
DBSP.Argument objectsprotected Collection<DBSP.Parameter> getParams()
DBSP.Parameter objects.protected void resetArgs()
public void setQueryTimeout(int to)
setQueryTimeout in interface DBSPLikeStatement.setQueryTimeout(int)public void setMaxRows(int to)
public int getQueryTimeout()
getQueryTimeout in interface DBSPLikeStatement.getQueryTimeout()protected void setSPName(String to)
protected String getSPName()
protected void checkArgs()
throws SQLException
SQLException
protected void prepare()
throws SQLException
SQLExceptionprotected void setDebug(boolean db)
db - the debug value to setprotected boolean isDebugEnabled()
protected void setQuery(String to)
throws SQLException
SQLExceptionprotected String getQuery()
protected void applyArgs(Collection<DBSP.Argument> v)
throws SQLException
v - the list of Parameters we need to add, in order
SQLException
public void set(String which,
BigDecimal a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
boolean a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
Boolean b)
throws SQLException
which - the field to setb - the value to set
SQLException - if there's an error setting this argument
public void set(String which,
Date a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
double a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
float a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
Float a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
Integer a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
int a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
long a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
protected void setNull(String which,
int a1)
throws SQLException
set("mycol", (String)null);
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void setTinyInt(String which,
short a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
byte b)
throws SQLException
SQLException
public void set(String which,
Byte b)
throws SQLException
SQLException
public void set(String which,
short a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
Short s)
throws SQLException
which - the field to set (by name)s - the new value
SQLException - if there's a problem setting this value
public void set(String which,
String a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
Time a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
Timestamp a1)
throws SQLException
which - which field to seta1 - the value to set
SQLException - if there's an error setting this argument.
public void set(String which,
Object obj)
throws SQLException
SQLExceptionpublic Collection<DBSP.Parameter> getParameters()
DBSP.Parameter objects.public Collection<DBSP.Parameter> getParameters(int type)
type - the Parameter type.
DBSP.Parameters of the specified type.public int getType(String var)
Types type of the given parameter.
public int getParameterType(String var)
DBSP.Parameter type.
var - the name of the parameter
DBSP.Parameter type, or -1 if there's no such
parameterpublic void close()
close in interface Closeableclose in interface DBSPLikeclose in class SpyDB
public void setCoerced(String var,
String value)
throws SQLException
var - the field to setvalue - the String representation of the value to set
SQLException - if there's a problem with coersion
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||