|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.aris.hldb.CS
public class CS
The main class which provides the pooled CallableStatements. This class is THREAD SAFE. Note: when using transactions, the pool can't be used. Call CS.allocTransactionalCS() instead.
Constructor Summary | |
---|---|
CS(ConnectionProviderI hl_con)
Creates a new instance of hlCS |
Method Summary | |
---|---|
void |
addSqlCall(java.lang.String key,
java.lang.String sql,
int maxInPool)
Creates a new pooled CS which will be searchable by the "key" key. |
void |
addSqlCall(java.lang.String key,
java.lang.String sql,
int resultSetType,
int resultSetConcurency,
int maxInPool)
Creates a new pooled CS which will be searchable by the "key" key. |
java.sql.CallableStatement |
allocCS(java.lang.String key)
Allocates an unused CS. |
java.sql.CallableStatement |
allocTransactionalCS(java.sql.Connection con,
java.lang.String key)
Gets a CallableStatement for the key. |
void |
dumpAllocated(java.io.PrintStream out)
This function is used for debugging reasons. |
void |
execCS(java.lang.String key)
Executes a simple sql which doesn't have parameters. |
java.lang.String |
execCS(java.lang.String key,
int parameter)
Executes a query with 1 int parameter and returns the 1 single string result, or null if there are no results. |
int |
execCSID(java.sql.CallableStatement cs)
Executes a CallableStatement that returns 1 row with an integer. |
boolean |
exists(java.lang.String key)
Checks to see if a key (which links to a CS pool) exists in the CS pool tree. |
java.sql.CallableStatement |
freeCS(java.sql.CallableStatement cs)
Returns an allocated CS back to it's CS pool. |
ConnectionProviderI |
gethlCon()
Get the hlCon that this hlCS uses. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CS(ConnectionProviderI hl_con)
hl_con
- The hlCon database Connection pool. The hlCS will use that
pool for new CS's.Method Detail |
---|
public ConnectionProviderI gethlCon()
public boolean exists(java.lang.String key)
key
- The CS pool key.
public void addSqlCall(java.lang.String key, java.lang.String sql, int resultSetType, int resultSetConcurency, int maxInPool) throws KeyAlreadyExistsException
key
- The key assigned to this CS pool. It mustn't already exist in
the CS pool tree.sql
- The sql command of this pool, i.e. "{call mySP(...)}".resultSetType
- The type of the ResultSets returned by this CS.resultSetConcurency
- The Concurency kind of the resultSets returned by this CS.maxInPool
- The pool tries to keep maximum CallableStatements below this
figure, but if more CallableStatements are needed, they will
be allocated
KeyAlreadyExistsException
public void addSqlCall(java.lang.String key, java.lang.String sql, int maxInPool) throws KeyAlreadyExistsException
key
- The key assigned to this CS pool. It mustn't already exist in
the CS pool tree.sql
- The sql command of this pool, i.e. "{call mySP(...)}".maxInPool
- The pool tries to keep maximum CallableStatements below this
figure, but if more CallableStatements are needed, they will
be allocated.
KeyAlreadyExistsException
public java.sql.CallableStatement allocCS(java.lang.String key) throws java.sql.SQLException
CallableStatement cs;
try
{
cs=hlcs.allocCS("mysqlKey");
} catch {...}
{ ... }
finally
{
hlcs.freeCS(cs)
}
key
- The key by which a CS pool is found.
java.sql.SQLException
- -public java.sql.CallableStatement allocTransactionalCS(java.sql.Connection con, java.lang.String key) throws java.sql.SQLException
con
- The connectionkey
- The key of the sql
java.sql.SQLException
- -public java.sql.CallableStatement freeCS(java.sql.CallableStatement cs)
cs
- The CS which was allocated with hlCS.allocCS(). If null, the call has
no effect.public void execCS(java.lang.String key) throws java.sql.SQLException
key
- The key by which a CS pool is found.
java.sql.SQLException
- -public int execCSID(java.sql.CallableStatement cs) throws java.sql.SQLException
cs
- The callable statement to execute.
java.sql.SQLException
- -public java.lang.String execCS(java.lang.String key, int parameter) throws java.sql.SQLException
key
- The query keyparameter
- the one and only query parameter. Typically an table ID.
java.sql.SQLException
- -public void dumpAllocated(java.io.PrintStream out)
out
- The output PrintWriter.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |