public class JDBCDatabaseMethods
extends ch.agent.crnickl.impl.DatabaseMethodsImpl
open and the close
method.| Constructor and Description |
|---|
JDBCDatabaseMethods() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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 nullprotected 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 objectpublic 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 objectpublic 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 objectpublic ch.agent.crnickl.api.DBObjectId executeAndGetNewId(PreparedStatement stmt) throws ch.agent.crnickl.T2DBException, SQLException
stmt - a prepared statementch.agent.crnickl.T2DBExceptionSQLExceptionpublic 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 statementch.agent.crnickl.T2DBExceptionpublic 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 statementch.agent.crnickl.T2DBExceptionpublic 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 statementch.agent.crnickl.T2DBExceptionpublic PreparedStatement close(PreparedStatement stmt) throws ch.agent.crnickl.T2DBException
stmt - a prepared statementch.agent.crnickl.T2DBExceptionCopyright © 2017. All rights reserved.