Modifier and Type | Method and Description |
---|---|
void |
close(Object sqlObject)
Used to close a sql object which lacks a close() method.
|
void |
define(String key,
Object value)
Define an attribute on every
StatementContext for every statement created
from a handle obtained from this DBI instance. |
<ReturnType> |
inTransaction(TransactionCallback<ReturnType> callback)
A convenience function which manages the lifecycle of a handle and yields it to a callback
for use by clients.
|
<ReturnType> |
inTransaction(TransactionIsolationLevel isolation,
TransactionCallback<ReturnType> callback)
A convenience function which manages the lifecycle of a handle and yields it to a callback
for use by clients.
|
<SqlObjectType> |
onDemand(Class<SqlObjectType> sqlObjectType)
Create a new sql object which will obtain and release connections from this dbi instance, as it needs to,
and can, respectively.
|
Handle |
open()
Obtain a Handle to the data source wrapped by this DBI instance
|
<SqlObjectType> |
open(Class<SqlObjectType> sqlObjectType)
Open a handle and attach a new sql object of the specified type to that handle.
|
void |
useHandle(HandleConsumer callback)
A convenience function which manages the lifecycle of a handle and yields it to a callback
for use by clients.
|
void |
useTransaction(TransactionConsumer callback)
A convenience function which manages the lifecycle of a handle and yields it to a callback
for use by clients.
|
void |
useTransaction(TransactionIsolationLevel isolation,
TransactionConsumer callback)
A convenience function which manages the lifecycle of a handle and yields it to a callback
for use by clients.
|
<ReturnType> |
withHandle(HandleCallback<ReturnType> callback)
A convenience function which manages the lifecycle of a handle and yields it to a callback
for use by clients.
|
void close(Object sqlObject)
sqlObject
- the sql object to closevoid define(String key, Object value)
StatementContext
for every statement created
from a handle obtained from this DBI instance.key
- The key for the attributevalue
- the value for the attribute<ReturnType> ReturnType inTransaction(TransactionCallback<ReturnType> callback) throws CallbackFailedException
callback
- A callback which will receive an open Handle, in a transactionCallbackFailedException
- Will be thrown if callback raises an exception. This exception will
wrap the exception thrown by the callback.<ReturnType> ReturnType inTransaction(TransactionIsolationLevel isolation, TransactionCallback<ReturnType> callback) throws CallbackFailedException
isolation
- The transaction isolation level to setcallback
- A callback which will receive an open Handle, in a transactionCallbackFailedException
- Will be thrown if callback raises an exception. This exception will
wrap the exception thrown by the callback.<SqlObjectType> SqlObjectType onDemand(Class<SqlObjectType> sqlObjectType)
SqlObjectType
- sqlObjectType
- an interface with annotations declaring desired behaviorHandle open()
DBI.open()
<SqlObjectType> SqlObjectType open(Class<SqlObjectType> sqlObjectType)
close(Object)
SqlObjectType
- sqlObjectType
- an interface with annotations declaring desired behaviorvoid useHandle(HandleConsumer callback) throws CallbackFailedException
callback
- A callback which will receive an open HandleCallbackFailedException
- Will be thrown if callback raises an exception. This exception will
wrap the exception thrown by the callback.void useTransaction(TransactionConsumer callback) throws CallbackFailedException
callback
- A callback which will receive an open Handle, in a transactionCallbackFailedException
- Will be thrown if callback raises an exception. This exception will
wrap the exception thrown by the callback.void useTransaction(TransactionIsolationLevel isolation, TransactionConsumer callback) throws CallbackFailedException
isolation
- The transaction isolation level to setcallback
- A callback which will receive an open Handle, in a transactionCallbackFailedException
- Will be thrown if callback raises an exception. This exception will
wrap the exception thrown by the callback.<ReturnType> ReturnType withHandle(HandleCallback<ReturnType> callback) throws CallbackFailedException
callback
- A callback which will receive an open HandleCallbackFailedException
- Will be thrown if callback raises an exception. This exception will
wrap the exception thrown by the callback.Copyright © 2018. All rights reserved.