org.skife.jdbi
Interface IDBI

All Known Implementing Classes:
DBI

public interface IDBI

Provides an interface based system to access all of the DBI instance methods. Much nicer for proxies.


Method Summary
 java.util.Map getGlobalParameters()
          Obtain a map containing globally set named parameter values.
 java.util.Map getNamedStatements()
          Obtain an unmodifiable map of all the named statements known to this DBI instance.
 void load(java.lang.String name)
          Eagerly load a named query from the filesystem.
 void name(java.lang.String name, java.lang.String statement)
          Prepared a named sql statement
 Handle open()
          Obtain a new Handle instance
 void open(HandleCallback callback)
          Execute the callback with an open handle, closing, and cleaning up resources, after the callback exits or excepts
 void setStatementLocator(StatementLocator locator)
          Specify a non-standard statement locator.
 void setTransactionHandler(TransactionHandler handler)
          Specify a non-standard TransactionHandler which should be used for all Handle instances created from this dbi.
 

Method Detail

open

Handle open()
            throws DBIException
Obtain a new Handle instance

Returns:
an open Handle
Throws:
DBIException

open

void open(HandleCallback callback)
          throws DBIException
Execute the callback with an open handle, closing, and cleaning up resources, after the callback exits or excepts

Throws:
DBIException - if exception is thrown from the callback, or an exception occurs with the database
DBIError - if an Error is thrown from the callback

getNamedStatements

java.util.Map getNamedStatements()
Obtain an unmodifiable map of all the named statements known to this DBI instance.


name

void name(java.lang.String name,
          java.lang.String statement)
          throws DBIException
Prepared a named sql statement

Parameters:
name - name to issue query under
statement - sql string to use as query
Throws:
DBIException - if there is a problem preparing the statement

load

void load(java.lang.String name)
          throws DBIException,
                 java.io.IOException
Eagerly load a named query from the filesystem. The name will be name and it will look for a file named [name].sql in the classpath which contains a single sql statement.

Parameters:
name - name of query to load, such as "foo" which will be store din foo.sql
Throws:
java.io.IOException
DBIException

setTransactionHandler

void setTransactionHandler(TransactionHandler handler)
Specify a non-standard TransactionHandler which should be used for all Handle instances created from this dbi.

The default handler, if you specify none, will explicitely manage transactions on the underlying JDBC connection.

See Also:
ConnectionTransactionHandler, CMTConnectionTransactionHandler

setStatementLocator

void setStatementLocator(StatementLocator locator)
Specify a non-standard statement locator.

Parameters:
locator - used to find externalized sql

getGlobalParameters

java.util.Map getGlobalParameters()
Obtain a map containing globally set named parameter values. All handles obtained from this DBI instance will use these named parameters.

Named parameters added to a handle will not be added to the DBI globals, and DBI globals added after a handle is opened will not be added to the already open handles.