public abstract class DBContextBase extends Object implements DBContext
Constructor and Description |
---|
DBContextBase() |
Modifier and Type | Method and Description |
---|---|
void |
appendRollbackHandler(DBRollbackHandler handler) |
protected void |
closeConnection()
helper to close a connection on discard
|
void |
commit() |
DBCommand |
createCommand()
Creates a new Command object for the given database
|
protected DBUtils |
createUtils()
Factory function for Utils creation
|
void |
discard()
Discard connection releated ressources
WARING: No gurarantee it will be called
|
int |
executeDelete(DBTable from,
DBCommand cmd)
Executes a Delete statement from a command object
|
int |
executeInsert(DBCommand cmd)
Executes an Insert statement from a command object
|
int |
executeInsertInto(DBTable table,
DBCommand cmd)
Executes an InsertInfo statement from a command object
|
int |
executeSQL(String sqlCmd,
Object[] sqlParams)
Executes an SQLStatment
|
int |
executeUpdate(DBCommand cmd)
Executes an Update statement from a command object
|
Connection |
getConnection() |
protected abstract Connection |
getConnection(boolean required) |
protected abstract DBRollbackManager |
getRollbackManager(boolean required) |
DBUtils |
getUtils() |
abstract boolean |
isPreparedStatementsEnabled()
returns whether DBCommmand should automatically create a prepared statement with command params (?)
|
void |
removeRollbackHandler(DBObject object) |
void |
rollback()
Discards all changes made since the previous commit/rollback
and releases any database locks currently held by this
Connection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDbms, isRollbackHandlingEnabled
protected DBUtils createUtils()
protected abstract Connection getConnection(boolean required)
protected abstract DBRollbackManager getRollbackManager(boolean required)
public Connection getConnection()
getConnection
in interface DBContext
public abstract boolean isPreparedStatementsEnabled()
public final DBCommand createCommand()
createCommand
in interface DBContext
public final int executeSQL(String sqlCmd, Object[] sqlParams)
executeSQL
in interface DBContext
sqlCmd
- the SQL-CommandsqlParams
- a list of objects to replace sql parameterspublic final int executeInsert(DBCommand cmd)
executeInsert
in interface DBContext
cmd
- the command object containing the insert commandpublic final int executeInsertInto(DBTable table, DBCommand cmd)
executeInsertInto
in interface DBContext
table
- the table into which to insert the selected datacmd
- the command object containing the selection commandpublic final int executeUpdate(DBCommand cmd)
executeUpdate
in interface DBContext
cmd
- the command object containing the update commandpublic final int executeDelete(DBTable from, DBCommand cmd)
executeDelete
in interface DBContext
from
- the database table from which to delete recordscmd
- the command object containing the delete constraintspublic void rollback()
public void appendRollbackHandler(DBRollbackHandler handler)
appendRollbackHandler
in interface DBContext
public void removeRollbackHandler(DBObject object)
removeRollbackHandler
in interface DBContext
public void discard()
protected void closeConnection()
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.