Package org.apache.empire.db.context
Class DBContextStatic
java.lang.Object
org.apache.empire.db.context.DBContextBase
org.apache.empire.db.context.DBContextStatic
- All Implemented Interfaces:
DBContext
-
Constructor Summary
ConstructorsConstructorDescriptionDBContextStatic(DBMSHandler dbmsHandler, Connection conn) Creates a static DBContext with default optionsDBContextStatic(DBMSHandler dbmsHandler, Connection conn, boolean closeOnDiscard) Creates a static DBContext with custom options -
Method Summary
Modifier and TypeMethodDescriptionvoiddiscard()Discard connection releated ressources WARING: No gurarantee it will be calledprotected ConnectiongetConnection(boolean create) getDbms()protected DBRollbackManagergetRollbackManager(boolean create) booleanreturns whether DBCommmand should automatically create a prepared statement with command params (?)booleansetPreparedStatementsEnabled(boolean enabled) Enables or disables the use of prepared statements for update and insert commands as well as for read operations on a DBRecord.setRollbackHandlingEnabled(boolean enabled) Enables or disables rollback handlingMethods inherited from class org.apache.empire.db.context.DBContextBase
appendRollbackHandler, closeConnection, commit, createCommand, createUtils, executeDelete, executeInsert, executeInsertInto, executeSQL, executeUpdate, getConnection, getUtils, removeRollbackHandler, rollback, setUtils
-
Constructor Details
-
DBContextStatic
Creates a static DBContext with default options- Parameters:
dbmsHandler- the database handlerconn- a database connection
-
DBContextStatic
Creates a static DBContext with custom options- Parameters:
dbmsHandler- the database handlerconn- a database connectioncloseOnDiscard- flag whether to close the connection when calling discard()
-
-
Method Details
-
getDbms
-
isPreparedStatementsEnabled
public boolean isPreparedStatementsEnabled()Description copied from class:DBContextBasereturns whether DBCommmand should automatically create a prepared statement with command params (?) Event if this is false, is still possible to manually add command params using cmd.addCmdParam();- Specified by:
isPreparedStatementsEnabledin classDBContextBase- Returns:
- true if automatic prepared Statements are enabled or false if not
-
setPreparedStatementsEnabled
Enables or disables the use of prepared statements for update and insert commands as well as for read operations on a DBRecord. Note: For custom SQL commands parameters must be explicitly declared using cmd.addCmdParam();- Parameters:
enabled- flag whether to enable prepared statements- Returns:
- the context (this)
-
isRollbackHandlingEnabled
public boolean isRollbackHandlingEnabled() -
setRollbackHandlingEnabled
Enables or disables rollback handling- Parameters:
enabled- flag whether to enable rollback handling- Returns:
- the context (this)
-
discard
public void discard()Description copied from class:DBContextBaseDiscard connection releated ressources WARING: No gurarantee it will be called- Specified by:
discardin interfaceDBContext- Overrides:
discardin classDBContextBase
-
getConnection
- Specified by:
getConnectionin classDBContextBase
-
getRollbackManager
- Specified by:
getRollbackManagerin classDBContextBase
-