org.skife.jdbi.v2
Interface StatementContext

All Known Implementing Classes:
ConcreteStatementContext

public interface StatementContext

The statement context provides a means for passing client specific information through the evaluation of a statement. The context is not used by jDBI internally, but will be passed to all statement customizers. This makes it possible to parameterize the processing of the tweakable parts of the statement processing cycle.


Method Summary
 Object getAttribute(String key)
          Obtain the value of an attribute
 Map<String,Object> getAttributes()
          Obtain all the attributes associated with this context as a map.
 Binding getBinding()
           
 Connection getConnection()
          Obtain the JDBC connection being used for this statement
 String getLocatedSql()
          Obtain the located sql

Not available until until statement execution time

 String getRawSql()
          Obtain the initial sql for the statement used to create the statement
 String getRewrittenSql()
          Obtain the located and rewritten sql

Not available until until statement execution time

 Method getSqlObjectMethod()
           
 Class<?> getSqlObjectType()
           
 PreparedStatement getStatement()
          Obtain the actual prepared statement being used.
 Object setAttribute(String key, Object value)
          Specify an attribute on the statement context
 

Method Detail

getAttribute

Object getAttribute(String key)
Obtain the value of an attribute

Parameters:
key - The name of the attribute
Returns:
the value of the attribute

getAttributes

Map<String,Object> getAttributes()
Obtain all the attributes associated with this context as a map. Changes to the map or to the attributes on the context will be reflected across both

Returns:
a map f attributes

getBinding

Binding getBinding()

getConnection

Connection getConnection()
Obtain the JDBC connection being used for this statement

Returns:
the JDBC connection

getLocatedSql

String getLocatedSql()
Obtain the located sql

Not available until until statement execution time

Returns:
the sql which will be passed to the statement rewriter

getRawSql

String getRawSql()
Obtain the initial sql for the statement used to create the statement

Returns:
the initial sql

getRewrittenSql

String getRewrittenSql()
Obtain the located and rewritten sql

Not available until until statement execution time

Returns:
the sql as it will be executed against the database

getSqlObjectMethod

Method getSqlObjectMethod()

getSqlObjectType

Class<?> getSqlObjectType()

getStatement

PreparedStatement getStatement()
Obtain the actual prepared statement being used.

Not available until execution time

Returns:
Obtain the actual prepared statement being used.

setAttribute

Object setAttribute(String key,
                    Object value)
Specify an attribute on the statement context

Parameters:
key - name of the attribute
value - value for the attribute
Returns:
previous value of this attribute


Copyright © 2011. All Rights Reserved.