|
|||||||||
| Home >> All >> org >> apache >> derby >> iapi >> [ jdbc overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.iapi.jdbc
Class BrokeredStatement

java.lang.Objectorg.apache.derby.iapi.jdbc.BrokeredStatement
- All Implemented Interfaces:
- java.sql.Statement
- Direct Known Subclasses:
- BrokeredPreparedStatement
- public class BrokeredStatement
- extends java.lang.Object
- implements java.sql.Statement
- extends java.lang.Object
A Statement implementation that forwards all of its requests to an underlying Statement.
| Field Summary | |
protected BrokeredStatementControl |
control
My control. |
private java.lang.String |
cursorName
My state |
private java.lang.Boolean |
escapeProcessing
|
protected int |
jdbcLevel
|
protected int |
resultSetConcurrency
|
protected int |
resultSetHoldability
|
protected int |
resultSetType
|
| Fields inherited from interface java.sql.Statement |
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO |
| Constructor Summary | |
protected |
BrokeredStatement(BrokeredStatementControl control,
int jdbcLevel)
|
| Method Summary | |
void |
addBatch(java.lang.String sql)
This method adds a SQL statement to a SQL batch. |
void |
cancel()
This method cancels an outstanding statement, if the database supports that operation. |
void |
clearBatch()
This method clears out any SQL statements that have been populated in the current batch. |
void |
clearWarnings()
After this call getWarnings returns null until a new warning is reported for this Statement. |
void |
close()
In many cases, it is desirable to immediately release a Statements's database and JDBC resources instead of waiting for this to happen when it is automatically closed; the close method provides this immediate release. |
protected BrokeredStatementControl |
controlCheck()
Get the BrokeredStatementControl in order to perform a check. |
java.sql.Statement |
createDuplicateStatement(java.sql.Connection conn,
java.sql.Statement oldStatement)
|
boolean |
execute(java.lang.String sql)
This method executes an arbitrary SQL statement of any time. |
boolean |
execute(java.lang.String sql,
int autoGeneratedKeys)
|
boolean |
execute(java.lang.String sql,
int[] columnIndexes)
|
boolean |
execute(java.lang.String sql,
java.lang.String[] columnNames)
|
int[] |
executeBatch()
This method executes the SQL batch and returns an array of update counts - one for each SQL statement in the batch - ordered in the same order the statements were added to the batch. |
java.sql.ResultSet |
executeQuery(java.lang.String sql)
This method executes the specified SQL SELECT statement and returns a (possibly empty) ResultSet with the results of the query. |
int |
executeUpdate(java.lang.String sql)
This method executes the specified SQL INSERT, UPDATE, or DELETE statement and returns the number of rows affected, which may be 0. |
int |
executeUpdate(java.lang.String sql,
int autoGeneratedKeys)
|
int |
executeUpdate(java.lang.String sql,
int[] columnIndexes)
|
int |
executeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
|
java.sql.Connection |
getConnection()
This method returns the Connection instance that was
used to create this object. |
int |
getFetchDirection()
This method returns the current direction that the driver thinks the result set will be accessed int. |
int |
getFetchSize()
This method returns the number of rows the driver believes should be fetched from the database at a time. |
java.sql.ResultSet |
getGeneratedKeys()
JDBC 3.0 Retrieves any auto-generated keys created as a result of executing this Statement object. |
int |
getMaxFieldSize()
This method returns the maximum length of any column value in bytes. |
int |
getMaxRows()
This method returns the maximum possible number of rows in a result set. |
boolean |
getMoreResults()
getMoreResults moves to a Statement's next result. |
boolean |
getMoreResults(int current)
JDBC 3.0 Moves to this Statement obect's next result, deals with any current ResultSet object(s) according to the instructions specified by the given flag, and returns true if the next result is a ResultSet object |
int |
getQueryTimeout()
The method returns the number of seconds a statement may be in process before timing out. |
java.sql.ResultSet |
getResultSet()
getResultSet returns the current result as a ResultSet. |
int |
getResultSetConcurrency()
This method returns the concurrency type of the result set for this statement. |
int |
getResultSetHoldability()
|
int |
getResultSetType()
JDBC 2.0 Determine the result set type. |
java.sql.Statement |
getStatement()
|
int |
getUpdateCount()
getUpdateCount returns the current result as an update count; if the result is a ResultSet or there are no more results -1 is returned. |
java.sql.SQLWarning |
getWarnings()
The first warning reported by calls on this Statement is returned. |
void |
setCursorName(java.lang.String name)
setCursorName defines the SQL cursor name that will be used by subsequent Statement execute methods. |
void |
setEscapeProcessing(boolean enable)
If escape scanning is on (the default) the driver will do escape substitution before sending the SQL to the database. |
void |
setFetchDirection(int direction)
JDBC 2.0 Give a hint as to the direction in which the rows in a result set will be processed. |
void |
setFetchSize(int rows)
JDBC 2.0 Give the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. |
void |
setMaxFieldSize(int max)
The maxFieldSize limit (in bytes) is set to limit the size of data that can be returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields. |
void |
setMaxRows(int max)
The maxRows limit is set to limit the number of rows that any ResultSet can contain. |
void |
setQueryTimeout(int seconds)
This method sets the number of seconds a statement may be in process before timing out. |
protected void |
setStatementState(java.sql.Statement oldStatement,
java.sql.Statement newStatement)
|
protected java.sql.ResultSet |
wrapResultSet(java.sql.ResultSet rs)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
control
protected final BrokeredStatementControl control
- My control. Use the controlCheck() method to obtain the control
when calling a check method. This will result in the correct exception
being thrown if the statement is already closed.
jdbcLevel
protected final int jdbcLevel
resultSetType
protected final int resultSetType
resultSetConcurrency
protected final int resultSetConcurrency
resultSetHoldability
protected final int resultSetHoldability
cursorName
private java.lang.String cursorName
- My state
escapeProcessing
private java.lang.Boolean escapeProcessing
| Constructor Detail |
BrokeredStatement
protected BrokeredStatement(BrokeredStatementControl control, int jdbcLevel) throws java.sql.SQLException
| Method Detail |
addBatch
public final void addBatch(java.lang.String sql) throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method adds a SQL statement to a SQL batch. A driver is not
required to implement this method.
- Specified by:
addBatchin interfacejava.sql.Statement
clearBatch
public final void clearBatch()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method clears out any SQL statements that have been populated in
the current batch. A driver is not required to implement this method.
- Specified by:
clearBatchin interfacejava.sql.Statement
executeBatch
public final int[] executeBatch()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method executes the SQL batch and returns an array of update
counts - one for each SQL statement in the batch - ordered in the same
order the statements were added to the batch. A driver is not required
to implement this method.
- Specified by:
executeBatchin interfacejava.sql.Statement
cancel
public final void cancel()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method cancels an outstanding statement, if the database supports
that operation.
- Specified by:
cancelin interfacejava.sql.Statement
execute
public final boolean execute(java.lang.String sql) throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method executes an arbitrary SQL statement of any time. The
methods
getResultSet,getMoreResultsandgetUpdateCountretrieve the results.- Specified by:
executein interfacejava.sql.Statement
executeQuery
public final java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method executes the specified SQL SELECT statement and returns a
(possibly empty)
ResultSetwith the results of the query.- Specified by:
executeQueryin interfacejava.sql.Statement
executeUpdate
public final int executeUpdate(java.lang.String sql) throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method executes the specified SQL INSERT, UPDATE, or DELETE statement
and returns the number of rows affected, which may be 0.
- Specified by:
executeUpdatein interfacejava.sql.Statement
close
public final void close()
throws java.sql.SQLException
- In many cases, it is desirable to immediately release a
Statements's database and JDBC resources instead of waiting for
this to happen when it is automatically closed; the close
method provides this immediate release.
Note: A Statement is automatically closed when it is garbage collected. When a Statement is closed its current ResultSet, if one exists, is also closed.
- Specified by:
closein interfacejava.sql.Statement
getConnection
public final java.sql.Connection getConnection() throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the
Connectioninstance that was used to create this object.- Specified by:
getConnectionin interfacejava.sql.Statement
getFetchDirection
public final int getFetchDirection()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the current direction that the driver thinks the
result set will be accessed int.
- Specified by:
getFetchDirectionin interfacejava.sql.Statement
getFetchSize
public final int getFetchSize()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the number of rows the driver believes should be
fetched from the database at a time.
- Specified by:
getFetchSizein interfacejava.sql.Statement
getMaxFieldSize
public final int getMaxFieldSize()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the maximum length of any column value in bytes.
- Specified by:
getMaxFieldSizein interfacejava.sql.Statement
getMaxRows
public final int getMaxRows()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the maximum possible number of rows in a result set.
- Specified by:
getMaxRowsin interfacejava.sql.Statement
getResultSetConcurrency
public final int getResultSetConcurrency()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method returns the concurrency type of the result set for this
statement. This will be one of the concurrency types defined in
ResultSet.- Specified by:
getResultSetConcurrencyin interfacejava.sql.Statement
setMaxFieldSize
public final void setMaxFieldSize(int max)
throws java.sql.SQLException
- The maxFieldSize limit (in bytes) is set to limit the size of
data that can be returned for any column value; it only applies
to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and
LONGVARCHAR fields. If the limit is exceeded, the excess data
is silently discarded.
- Specified by:
setMaxFieldSizein interfacejava.sql.Statement
setMaxRows
public final void setMaxRows(int max)
throws java.sql.SQLException
- The maxRows limit is set to limit the number of rows that any
ResultSet can contain. If the limit is exceeded, the excess
rows are silently dropped.
- Specified by:
setMaxRowsin interfacejava.sql.Statement
setEscapeProcessing
public final void setEscapeProcessing(boolean enable)
throws java.sql.SQLException
- If escape scanning is on (the default) the driver will do
escape substitution before sending the SQL to the database.
- Specified by:
setEscapeProcessingin interfacejava.sql.Statement
getWarnings
public final java.sql.SQLWarning getWarnings() throws java.sql.SQLException
- The first warning reported by calls on this Statement is
returned. A Statment's execute methods clear its SQLWarning
chain. Subsequent Statement warnings will be chained to this
SQLWarning.
The warning chain is automatically cleared each time a statement is (re)executed.
Note: If you are processing a ResultSet then any warnings associated with ResultSet reads will be chained on the ResultSet object.
- Specified by:
getWarningsin interfacejava.sql.Statement
clearWarnings
public final void clearWarnings()
throws java.sql.SQLException
- After this call getWarnings returns null until a new warning is
reported for this Statement.
- Specified by:
clearWarningsin interfacejava.sql.Statement
setCursorName
public final void setCursorName(java.lang.String name) throws java.sql.SQLException
- setCursorName defines the SQL cursor name that will be used by
subsequent Statement execute methods. This name can then be
used in SQL positioned update/delete statements to identify the
current row in the ResultSet generated by this getStatement(). If
the database doesn't support positioned update/delete, this
method is a noop.
Note: By definition, positioned update/delete execution must be done by a different Statement than the one which generated the ResultSet being used for positioning. Also, cursor names must be unique within a Connection.
- Specified by:
setCursorNamein interfacejava.sql.Statement
getResultSet
public final java.sql.ResultSet getResultSet() throws java.sql.SQLException
- getResultSet returns the current result as a ResultSet. It
should only be called once per result.
- Specified by:
getResultSetin interfacejava.sql.Statement
getUpdateCount
public final int getUpdateCount()
throws java.sql.SQLException
- getUpdateCount returns the current result as an update count;
if the result is a ResultSet or there are no more results -1
is returned. It should only be called once per result.
The only way to tell for sure that the result is an update count is to first test to see if it is a ResultSet. If it is not a ResultSet it is either an update count or there are no more results.
- Specified by:
getUpdateCountin interfacejava.sql.Statement
getMoreResults
public final boolean getMoreResults()
throws java.sql.SQLException
- getMoreResults moves to a Statement's next result. It returns true if
this result is a ResultSet. getMoreResults also implicitly
closes any current ResultSet obtained with getResultSet.
There are no more results when (!getMoreResults() &&
(getUpdateCount() == -1)
- Specified by:
getMoreResultsin interfacejava.sql.Statement
getResultSetType
public final int getResultSetType()
throws java.sql.SQLException
- JDBC 2.0
Determine the result set type.
- Specified by:
getResultSetTypein interfacejava.sql.Statement
setFetchDirection
public final void setFetchDirection(int direction)
throws java.sql.SQLException
- JDBC 2.0
Give a hint as to the direction in which the rows in a result set
will be processed. The hint applies only to result sets created
using this Statement object. The default value is
ResultSet.FETCH_FORWARD.
- Specified by:
setFetchDirectionin interfacejava.sql.Statement
setFetchSize
public final void setFetchSize(int rows)
throws java.sql.SQLException
- JDBC 2.0
Give the JDBC driver a hint as to the number of rows that should
be fetched from the database when more rows are needed. The number
of rows specified only affects result sets created using this
getStatement(). If the value specified is zero, then the hint is ignored.
The default value is zero.
- Specified by:
setFetchSizein interfacejava.sql.Statement
getQueryTimeout
public final int getQueryTimeout()
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - The method returns the number of seconds a statement may be in process
before timing out. A value of 0 means there is no timeout.
- Specified by:
getQueryTimeoutin interfacejava.sql.Statement
setQueryTimeout
public final void setQueryTimeout(int seconds)
throws java.sql.SQLException
- Description copied from interface:
java.sql.Statement - This method sets the number of seconds a statement may be in process
before timing out. A value of 0 means there is no timeout.
- Specified by:
setQueryTimeoutin interfacejava.sql.Statement
execute
public final boolean execute(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
- Specified by:
executein interfacejava.sql.Statement
execute
public final boolean execute(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
- Specified by:
executein interfacejava.sql.Statement
execute
public final boolean execute(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
- Specified by:
executein interfacejava.sql.Statement
executeUpdate
public final int executeUpdate(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
- Specified by:
executeUpdatein interfacejava.sql.Statement
executeUpdate
public final int executeUpdate(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
- Specified by:
executeUpdatein interfacejava.sql.Statement
executeUpdate
public final int executeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
- Specified by:
executeUpdatein interfacejava.sql.Statement
getMoreResults
public final boolean getMoreResults(int current)
throws java.sql.SQLException
- JDBC 3.0
Moves to this Statement obect's next result, deals with any current ResultSet
object(s) according to the instructions specified by the given flag, and
returns true if the next result is a ResultSet object
- Specified by:
getMoreResultsin interfacejava.sql.Statement
getGeneratedKeys
public final java.sql.ResultSet getGeneratedKeys() throws java.sql.SQLException
- JDBC 3.0
Retrieves any auto-generated keys created as a result of executing this
Statement object. If this Statement object did not generate any keys, an empty
ResultSet object is returned. If this Statement is a non-insert statement,
an exception will be thrown.
- Specified by:
getGeneratedKeysin interfacejava.sql.Statement
getResultSetHoldability
public final int getResultSetHoldability()
throws java.sql.SQLException
- Specified by:
getResultSetHoldabilityin interfacejava.sql.Statement
createDuplicateStatement
public java.sql.Statement createDuplicateStatement(java.sql.Connection conn, java.sql.Statement oldStatement) throws java.sql.SQLException
setStatementState
protected void setStatementState(java.sql.Statement oldStatement, java.sql.Statement newStatement) throws java.sql.SQLException
getStatement
public java.sql.Statement getStatement() throws java.sql.SQLException
wrapResultSet
protected final java.sql.ResultSet wrapResultSet(java.sql.ResultSet rs)
controlCheck
protected final BrokeredStatementControl controlCheck() throws java.sql.SQLException
- Get the BrokeredStatementControl in order to perform a check.
Obtained indirectly to ensure that the correct exception is
thrown if the Statement has been closed.
|
|||||||||
| Home >> All >> org >> apache >> derby >> iapi >> [ jdbc overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.derby.iapi.jdbc.BrokeredStatement