|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--il.co.iter.dbdom.StoredProcedure
Represents a stored procedure with a known result set signature in the underlying databas. This class is not currently used. Some of the comments in the class are still highly relevant.
DBDOM makes extensive use of stored procedures. This class exists for two reasons:
PreparedStatement
and
CallableStatement
. The choice depends on whether or
not support is available in a particular JDBC driver.
SQLException
s in DBDOMSqlException
s,
because DOM methods can't raise exceptions other than
DOMException
;
Statement
s on demand;
ResultSet
s.
Statement
s (or their subclasses) that represent the stored
procedures are kept as private members of DBDOMImplementation
.
They are not initialized in DBDOMImplementation
's constructor, but
rather on first access.
Keeping Statement
s in DBDOMImplementation
optimizes for size, since individual
DBNode
s don't need to cary their own statements. This may become
a performance bottleneck: only one Node
at a time is able to
execute a particular DOM method. If this in fact bocomes an issue, move
StoredProcedure
declarations to DBNode
and it's subclasses.
Statement
s cannot be static members, because different
instances of DBDOMImplementation
may hold connections to different
databases - with different Connection
objects and possibly
different versions of DBDOM and possibly different RDBMSs altogether.
All DBDOM stored procedures
have a known type of result set. If a stored procedure returns a different
type of result set than expected, it means that the database is
incompatible with DBDOM or that there is a version missmatch between the
database and the Java wrappers. See DBDOMSpException
StoredProcedure
may be subclassed to emulate stored procedures
in an RDMS that doesn't provide a native PS mechanism.
Field Summary | |
static int |
UNLIMITED
Specifies that a stored procedure may return an unlimited number of results per invocation. |
Constructor Summary | |
protected |
StoredProcedure(DBDOMImplementation dbDomImplementation,
java.lang.String spName,
int nOfParams,
int nOfResults)
|
Method Summary | |
protected java.sql.ResultSet |
executeQuery()
|
java.lang.String |
getSpName()
Returns the name of the SQL stored procedure |
protected void |
initStatementIfNull()
This simple operation is implemented as a protected method to allow overriding by subclases. |
protected void |
setInt(int parameterIndex,
int x)
|
protected void |
setNull(int parameterIndex,
int sqlType)
|
protected void |
setNull(int paramIndex,
int sqlType,
java.lang.String typeName)
|
protected void |
setString(int parameterIndex,
java.lang.String x)
|
java.lang.String |
toString()
Returns the SQL string that would be used to run this SP against the databse. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int UNLIMITED
Constructor Detail |
protected StoredProcedure(DBDOMImplementation dbDomImplementation, java.lang.String spName, int nOfParams, int nOfResults)
Method Detail |
protected void initStatementIfNull() throws java.sql.SQLException
In particular, a subclass that uses a
CallableStatement
as opposed to
PreparedStatement
should override this method.
protected java.sql.ResultSet executeQuery()
protected void setInt(int parameterIndex, int x)
protected void setString(int parameterIndex, java.lang.String x)
protected void setNull(int parameterIndex, int sqlType)
protected void setNull(int paramIndex, int sqlType, java.lang.String typeName)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getSpName()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |