|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectch.agent.crnickl.impl.DatabaseMethodsImpl
ch.agent.crnickl.jdbc.JDBCDatabaseMethods
public class JDBCDatabaseMethods
A JDBCDatabaseMethods object provides support for prepared statements. It is
meant as base class for actual access methods. All database accesses should
be bracketed between one of the open and the close
method.
| Constructor Summary | |
|---|---|
JDBCDatabaseMethods()
|
|
| Method Summary | |
|---|---|
PreparedStatement |
close(PreparedStatement stmt)
Close the prepared statement. |
ch.agent.crnickl.api.DBObjectId |
executeAndGetNewId(PreparedStatement stmt)
Execute a prepared statement of the "insertion" type and return the generated id. |
protected int |
getId(ch.agent.crnickl.api.DBObject dBObject)
Return the internal ID of a database object. |
int |
getId(ch.agent.crnickl.api.Surrogate surrogate)
Extract the internal ID of a database object from its surrogate. |
int |
getIdOrZero(ch.agent.crnickl.api.DBObject dBObject)
Return the internal ID of a database object or 0 if the object is null or is in construction. |
ch.agent.crnickl.api.Surrogate |
makeSurrogate(ch.agent.crnickl.api.Database db,
ch.agent.crnickl.api.DBObjectType dot,
int id)
Create a surrogate for a database object. |
PreparedStatement |
open(String sql,
ch.agent.crnickl.api.Database database,
PreparedStatement stmt)
Return a valid prepared statement for the SQL code specified. |
PreparedStatement |
open(String sql,
ch.agent.crnickl.api.DBObject dBObject,
PreparedStatement stmt)
Return a valid prepared statement for the SQL code specified. |
PreparedStatement |
open(String sql,
ch.agent.crnickl.api.Surrogate surrogate,
PreparedStatement stmt)
Return a valid prepared statement for the SQL code specified. |
| Methods inherited from class ch.agent.crnickl.impl.DatabaseMethodsImpl |
|---|
check, check, check, check, checkIntegrity, makeSurrogate, makeSurrogate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JDBCDatabaseMethods()
| Method Detail |
|---|
public int getIdOrZero(ch.agent.crnickl.api.DBObject dBObject)
This method is for use inside the JDBC implementation
and its argument must have a DBObjectId implemented
by JDBCObjectId.
dBObject - a database object or null
protected int getId(ch.agent.crnickl.api.DBObject dBObject)
This method is for use inside the JDBC implementation
and its argument must have a DBObjectId implemented
by JDBCObjectId.
dBObject - a database object
public int getId(ch.agent.crnickl.api.Surrogate surrogate)
This method is for use inside the JDBC implementation
and its argument must have a DBObjectId implemented
by JDBCObjectId.
surrogate - the surrogate of a database object
public ch.agent.crnickl.api.Surrogate makeSurrogate(ch.agent.crnickl.api.Database db,
ch.agent.crnickl.api.DBObjectType dot,
int id)
db - the database of the objectdot - the type of the objectid - the internal ID of the database object
public ch.agent.crnickl.api.DBObjectId executeAndGetNewId(PreparedStatement stmt)
throws ch.agent.crnickl.T2DBException,
SQLException
stmt - a prepared statement
ch.agent.crnickl.T2DBException
SQLException
public PreparedStatement open(String sql,
ch.agent.crnickl.api.Database database,
PreparedStatement stmt)
throws ch.agent.crnickl.T2DBException
sql - a string in SQL syntaxdatabase - a databasestmt - a prepared statement
ch.agent.crnickl.T2DBException
public PreparedStatement open(String sql,
ch.agent.crnickl.api.DBObject dBObject,
PreparedStatement stmt)
throws ch.agent.crnickl.T2DBException
dBObject parameter. To avoid preparing a new statement again
and again a statement can be passed as an argument. This statement will
be returned if it is not null and if its connection is equal to
connection embedded in the mentioned parameter.
sql - a string in SQL syntaxdBObject - a database objectstmt - a prepared statement
ch.agent.crnickl.T2DBException
public PreparedStatement open(String sql,
ch.agent.crnickl.api.Surrogate surrogate,
PreparedStatement stmt)
throws ch.agent.crnickl.T2DBException
surrogate parameter. To avoid preparing a new statement again
and again a statement can be passed as an argument. This statement will
be returned if it is not null and if its connection is equal to
connection embedded in the mentioned parameter.
sql - a string in SQL syntaxsurrogate - a surrogatestmt - a prepared statement
ch.agent.crnickl.T2DBException
public PreparedStatement close(PreparedStatement stmt)
throws ch.agent.crnickl.T2DBException
stmt - a prepared statement
ch.agent.crnickl.T2DBException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||