|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1) E13403-04 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.javatools.db.execute.StatementWrapper
public class StatementWrapper
Wrapper for executing statements against a database. It provides:
AbstractDatabase.cancelStatement()
.final Database db = ... final String stmt = ... final StatementWrapper wrap = new StatementWrapper( db, stmt ); boolean success = false; try { success = wrap.execute(); } catch( DBException dbe ) { // process exception }
Nested Class Summary | |
---|---|
static class |
StatementWrapper.ExecutionProxy
Allows a proxy to be registered against all queries to wrap the execution of any sql against the database. |
class |
StatementWrapper.ExecutionRunnable<T>
Runnable implementation that wraps the execution of a statement or query. |
static interface |
StatementWrapper.Listener
Listner interface to be implemented by anything interested in knowing when the API is talking to a database. |
Constructor Summary | |
---|---|
StatementWrapper(Database db,
java.lang.String... statements)
|
|
StatementWrapper(java.lang.String connName,
java.sql.Connection connection,
java.lang.String... statements)
|
Method Summary | ||
---|---|---|
static void |
addListener(StatementWrapper.Listener l)
Adds a query listener to be notified whenever the db is queried. |
|
void |
close()
Closes the statement and result set if we got that far. |
|
protected java.sql.Statement |
createStatment()
Creates the Statement object to use. |
|
protected
|
doExecute(StatementWrapper.ExecutionRunnable<T> r)
|
|
boolean |
execute()
Executes the statment against the database. |
|
protected boolean |
executeImpl(java.lang.String stmt)
|
|
protected java.sql.Connection |
getConnection()
|
|
protected java.lang.String |
getConnectionName()
|
|
protected Database |
getDatabase()
Returns the Database that this wrapper is executing on. |
|
static StatementWrapper.ExecutionProxy |
getExecutionProxy()
Gets the execution proxy for statement execution (if one is set). |
|
java.lang.String |
getIdentifier()
Gets the identifier for this statement wrapper. |
|
protected java.sql.Statement |
getStatement()
Gets the Statement object for this wrapper. |
|
protected java.lang.String[] |
getStatementStrings()
Returns all the statement strings to be executed. |
|
protected java.lang.String |
getStatementTextForLog()
For logging and exception handling. |
|
protected boolean |
hasCancelled(java.sql.SQLException sqe)
|
|
protected boolean |
isIgnoreErrors()
|
|
protected void |
queryFinished()
|
|
protected void |
queryStarted()
|
|
static boolean |
removeListener(StatementWrapper.Listener l)
Removes a query listener. |
|
void |
setBypassExecutionProxy(boolean doNotThread)
Explicitly disables the threading of this query using an execution proxy. |
|
protected void |
setDatabase(Database db)
Sets the wrappers database. |
|
protected void |
setExecuting(boolean executing)
Indicates that this wrapper is in the process of executing. |
|
static void |
setExecutionProxy(StatementWrapper.ExecutionProxy ep)
Sets the execution proxy for all queries in the API. |
|
void |
setIdentifier(java.lang.String i)
Sets the identifier for this query wrapper. |
|
void |
setIgnoreErrors(boolean ignore)
|
|
void |
setStatement(java.lang.String... statements)
Only works after construction for simple statements, not queries (i.e. |
|
protected void |
sqlTrace(java.lang.String dbName,
java.lang.String query,
java.lang.Object... params)
Sets up the query log which will be output when the query has finished (complete with timing information). |
|
void |
throwDBException(DBObject obj,
java.sql.SQLException sqe)
If a SQLException is caught during the processing of this query, or its Difference then it can be wrapped in a DBException which can then be displayed to the user. |
|
protected void |
throwDBException(DBObject obj,
java.lang.String text,
java.sql.SQLException sqe)
|
|
void |
throwDBException(java.sql.SQLException sqe)
If a SQLException is caught during the processing of this query, or its Difference then it can be wrapped in a DBException which can then be displayed to the user. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StatementWrapper(java.lang.String connName, java.sql.Connection connection, java.lang.String... statements)
public StatementWrapper(Database db, java.lang.String... statements)
Method Detail |
---|
public void setStatement(java.lang.String... statements)
protected final java.lang.String[] getStatementStrings()
protected java.lang.String getStatementTextForLog()
protected final java.sql.Statement getStatement() throws java.sql.SQLException
java.sql.SQLException
protected java.sql.Statement createStatment() throws java.sql.SQLException
java.sql.SQLException
public void setBypassExecutionProxy(boolean doNotThread)
doNotThread
- don't use an execution proxy for this wrapper, even if
one exists.protected final void setExecuting(boolean executing)
public boolean execute() throws DBException
DBException
Statement.execute(java.lang.String)
protected boolean executeImpl(java.lang.String stmt) throws java.sql.SQLException
java.sql.SQLException
protected final <T> T doExecute(StatementWrapper.ExecutionRunnable<T> r) throws DBException
DBException
public void close()
finally{ ... }
block. When finished the timing is traced
for the query time.
public final java.lang.String getIdentifier()
public final void setIdentifier(java.lang.String i)
protected final Database getDatabase()
protected final void setDatabase(Database db)
protected final java.lang.String getConnectionName()
protected final java.sql.Connection getConnection()
protected boolean isIgnoreErrors()
public void setIgnoreErrors(boolean ignore)
protected final void throwDBException(DBObject obj, java.lang.String text, java.sql.SQLException sqe) throws DBException
DBException
public final void throwDBException(java.sql.SQLException sqe) throws DBException
DBException
public final void throwDBException(DBObject obj, java.sql.SQLException sqe) throws DBException
DBException
protected boolean hasCancelled(java.sql.SQLException sqe)
protected final void sqlTrace(java.lang.String dbName, java.lang.String query, java.lang.Object... params)
protected final void queryStarted()
protected final void queryFinished()
public static final void addListener(StatementWrapper.Listener l)
public static final boolean removeListener(StatementWrapper.Listener l)
addListener(oracle.javatools.db.execute.StatementWrapper.Listener)
public static void setExecutionProxy(StatementWrapper.ExecutionProxy ep)
public static StatementWrapper.ExecutionProxy getExecutionProxy()
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1) E13403-04 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |