Top Description Fields Constructors Methods
org.apache.derby.impl.jdbc

public Class EmbedStatement

extends ConnectionChild
implements EngineStatement
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.jdbc.EngineStatement, java.sql.Statement, java.lang.AutoCloseable, java.sql.Wrapper
Known Direct Subclasses
org.apache.derby.impl.jdbc.EmbedPreparedStatement
Imports
org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.Activation, .PreparedStatement, .ResultSet, .ParameterValueSet, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.jdbc.EngineStatement, java.sql.BatchUpdateException, .SQLException, .SQLWarning, .Statement, java.util.Arrays, .Vector, org.apache.derby.iapi.util.InterruptStatus

EmbedStatement is a local JDBC statement. It supports JDBC 4.1.

Field Summary

Modifier and TypeField and Description
private boolean
private final Connection
protected EngineStatement
applicationStatement

Statement reference the application is using to execute this Statement.

private ResultSet
pack-priv Vector<Object>
private boolean
private boolean
private int
private String
private EmbedResultSet[]
private int
private int
private final boolean
protected boolean
pack-priv final LanguageConnectionContext
pack-priv int
pack-priv long
private ParameterValueSet
pack-priv EmbedResultSet
pack-priv final int
private final int
pack-priv final int
pack-priv String
pack-priv long
timeoutMillis

Query timeout in milliseconds.

pack-priv long
private SQLWarning
Inherited from org.apache.derby.impl.jdbc.ConnectionChild:
factorylocalConn

Constructor Summary

AccessConstructor and Description
public
EmbedStatement(EmbedConnection connection, boolean forMetaData, int resultSetType, int resultSetConcurrency, int resultSetHoldability)

Method Summary

Modifier and TypeMethod and Description
public void
addBatch(String
typically this is a static SQL INSERT or UPDATE statement
sql
)

Implements java.sql.Statement.addBatch.

JDBC 2.0 Adds a SQL command to the current batch of commmands for the statement.

pack-priv final void
addWarning(SQLWarning sw)

Add a SQLWarning to this Statement object.

public void
cancel()

Implements java.sql.Statement.cancel.

Cancel can be used by one thread to cancel a statement that is being executed by another thread.

pack-priv final void
checkExecStatus()

A heavier weight version of checkStatus() that ensures the application's Connection object is still open.

pack-priv final void
pack-priv void
checkRequiresCallableStatement(Activation activation)

Check to see if a statement requires to be executed via a callable statement.

pack-priv final void
checkStatus()

Throw an exception if this Statement has been closed explictly or it has noticed it has been closed implicitly.

public final void
clearBatch()

Implements java.sql.Statement.clearBatch.

JDBC 2.0 Make the set of commands in the current batch empty.

pack-priv void
clearResultSets()

Close and clear all result sets associated with this statement from the last execution.

private void
public void
clearWarnings()

Implements java.sql.Statement.clearWarnings.

After this call getWarnings returns null until a new warning is reported for this Statement.

public final void
close()

Implements java.sql.Statement.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.

pack-priv void
pack-priv void
public void
closeOnCompletion()

Implements org.apache.derby.iapi.jdbc.EngineStatement.closeOnCompletion.

Specifies that this Statement will be closed when all its dependent result sets are closed.

public boolean

Returns:

true if the first result is a ResultSet; false if it is an integer
execute
(String
any SQL statement
sql
)

Implements java.sql.Statement.execute.

Execute a SQL statement that may return multiple results.

private boolean

Returns:

true if the first result is a ResultSet; false if it is an integer
execute
(String
any SQL statement
sql
,
boolean
caller is executeQuery()
executeQuery
,
boolean
caller is executeUpdate()
executeUpdate
,
int autoGeneratedKeys, int[] columnIndexes, String[] columnNames)

Execute a SQL statement that may return multiple results.

public boolean

Returns:

rue if the first result is a ResultSet object; false if it is an update count or there are no results
execute
(String
any SQL statement
sql
,
int
- a constant indicating whether auto-generated keys should be made available for retrieval using the method getGeneratedKeys; one of the following constants: Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
autoGeneratedKeys
)

Implements java.sql.Statement.execute.

JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval.

public boolean

Returns:

rue if the first result is a ResultSet object; false if it is an update count or there are no results
execute
(String
any SQL statement
sql
,
int[]
- an array of the indexes of the columns in the inserted/updated row that should be made available for retrieval by a call to the method getGeneratedKeys
columnIndexes
)

Implements java.sql.Statement.execute.

JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.

public boolean

Returns:

rue if the first result is a ResultSet object; false if it is an update count or there are no results
execute
(String
any SQL statement
sql
,
String[]
- an array of the names of the columns in the inserted/updated row that should be made available for retrieval by a call to the method getGeneratedKeys
columnNames
)

Implements java.sql.Statement.execute.

JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.

public int[]

Returns:

an array of update counts containing one element for each command in the batch. The array is ordered according to the order in which commands were inserted into the batch
executeBatch
()

Implements java.sql.Statement.executeBatch.

JDBC 2.0 Submit a batch of commands to the database for execution.

pack-priv boolean
executeBatchElement(Object batchElement)

Execute a single element of the batch.

public long[]
executeLargeBatch()

Implements org.apache.derby.iapi.jdbc.EngineStatement.executeLargeBatch.

JDBC 4.2 Submit a batch of commands to the database for execution.

public long
executeLargeUpdate(String
an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.
sql
)

Implements org.apache.derby.iapi.jdbc.EngineStatement.executeLargeUpdate.

JDBC 4.2 Execute a SQL INSERT, UPDATE or DELETE statement.

public long
executeLargeUpdate(String
an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.
sql
,
int
a flag indicating whether auto-generated keys should be made available for retrieval; one of the following constants: Statement.RETURN_GENERATED_KEYS Statement.NO_GENERATED_KEYS
autoGeneratedKeys
)

Implements org.apache.derby.iapi.jdbc.EngineStatement.executeLargeUpdate.

JDBC 4.2 Execute the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.

public long
executeLargeUpdate(String
an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.
sql
,
int[]
an array of column indexes indicating the columns that should be returned from the inserted row
columnIndexes
)

Implements org.apache.derby.iapi.jdbc.EngineStatement.executeLargeUpdate.

JDBC 4.2 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.

public long
executeLargeUpdate(String
an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.
sql
,
String[]
an array of the names of the columns that should be returned from the inserted row
columnNames
)

Implements org.apache.derby.iapi.jdbc.EngineStatement.executeLargeUpdate.

JDBC 4.2 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.

public ResultSet

Returns:

a ResultSet that contains the data produced by the query; never null
executeQuery
(String
typically this is a static SQL SELECT statement
sql
)

Implements java.sql.Statement.executeQuery.

Execute a SQL statement that returns a single ResultSet.

pack-priv boolean
executeStatement(Activation a, boolean executeQuery, boolean executeUpdate)

Execute the current statement.

public int

Returns:

either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
executeUpdate
(String
a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
sql
)

Implements java.sql.Statement.executeUpdate.

Execute a SQL INSERT, UPDATE or DELETE statement.

public int

Returns:

either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
executeUpdate
(String
a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
sql
,
int
- a flag indicating whether auto-generated keys should be made available for retrieval; one of the following constants: Statement.RETURN_GENERATED_KEYS Statement.NO_GENERATED_KEYS
autoGeneratedKeys
)

Implements java.sql.Statement.executeUpdate.

JDBC 3.0 Execute the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.

public int

Returns:

either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
executeUpdate
(String
a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
sql
,
int[]
- an array of column indexes indicating the columns that should be returned from the inserted row
columnIndexes
)

Implements java.sql.Statement.executeUpdate.

JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.

public int

Returns:

either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
executeUpdate
(String
a SQL INSERT, UPDATE or DELETE statement or a SQL statement that returns nothing
sql
,
String[]
- an array of the names of the columns that should be returned from the inserted row
columnNames
)

Implements java.sql.Statement.executeUpdate.

JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.

protected void
finalize()

Overrides java.lang.Object.finalize.

Mark the statement and its single-use activation as unused.

public final Connection
getConnection()

Implements java.sql.Statement.getConnection.

JDBC 2.0 Return the Connection that produced the Statement.

private boolean
getExecuteHoldable()

Get the execute time holdability for the Statement.

public int

Returns:

the default fetch direction
getFetchDirection
()

Implements java.sql.Statement.getFetchDirection.

JDBC 2.0 Determine the fetch direction.

public int
getFetchSize()

Implements java.sql.Statement.getFetchSize.

JDBC 2.0 Determine the default fetch size.

public final ResultSet

Returns:

a ResultSet object containing the auto-generated key(s) generated by the execution of this Statement object
getGeneratedKeys
()

Implements java.sql.Statement.getGeneratedKeys.

JDBC 3.0 Retrieves any auto-generated keys created as a result of executing this Statement object.

public long

Returns:

the current max row limit; zero means unlimited
getLargeMaxRows
()

Implements org.apache.derby.iapi.jdbc.EngineStatement.getLargeMaxRows.

JDBC 4.2 The maxRows limit is the maximum number of rows that a ResultSet can contain.

public final long
getLargeUpdateCount()

Implements org.apache.derby.iapi.jdbc.EngineStatement.getLargeUpdateCount.

JDBC 4.2 getLargeUpdateCount returns the current result as an update count; if the result is a ResultSet or there are no more results -1 is returned.

public int

Returns:

the current max column size limit; zero means unlimited
getMaxFieldSize
()

Implements java.sql.Statement.getMaxFieldSize.

The maxFieldSize limit (in bytes) is the maximum amount of data returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns.

public int

Returns:

the current max row limit; zero means unlimited
getMaxRows
()

Implements java.sql.Statement.getMaxRows.

The maxRows limit is the maximum number of rows that a ResultSet can contain.

public final boolean

Returns:

true if the next result is a ResultSet; false if it is an update count or there are no more results
getMoreResults
()

Implements java.sql.Statement.getMoreResults.

getMoreResults moves to a Statement's next result.

public final boolean

Returns:

true if the next result is a ResultSet; false if it is an update count or there are no more results
getMoreResults
(int
- one of the following Statement constants indicating what should happen to current ResultSet objects obtained using the method getResultSetCLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT, or CLOSE_ALL_RESULTS
current
)

Implements java.sql.Statement.getMoreResults.

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

public ParameterValueSet
public final int

Returns:

the current query timeout limit in seconds; zero means unlimited
getQueryTimeout
()

Implements java.sql.Statement.getQueryTimeout.

The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.

public final ResultSet

Returns:

the current result as a ResultSet; null if the result is an update count or there are no more results or the statement was closed.
getResultSet
()

Implements java.sql.Statement.getResultSet.

getResultSet returns the current result as a ResultSet.

public int
getResultSetConcurrency()

Implements java.sql.Statement.getResultSetConcurrency.

JDBC 2.0 Determine the result set concurrency.

public final int

Returns:

either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
getResultSetHoldability
()

Implements java.sql.Statement.getResultSetHoldability.

JDBC 3.0 Retrieves the result set holdability for ResultSet objects generated by this Statement object.

public final int
getResultSetType()

Implements java.sql.Statement.getResultSetType.

JDBC 2.0 Determine the result set type.

public String
public final int

Returns:

the current result as an update count; -1 if it is a ResultSet or there are no more results
getUpdateCount
()

Implements java.sql.Statement.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.

public SQLWarning

Returns:

the first SQLWarning or null
getWarnings
()

Implements java.sql.Statement.getWarnings.

The first warning reported by calls on this Statement is returned.

public boolean

Returns:

true is closed, false otherwise.
isClosed
()

Implements java.sql.Statement.isClosed.

Tell whether this statment has been closed or not.

public boolean
isCloseOnCompletion()

Implements org.apache.derby.iapi.jdbc.EngineStatement.isCloseOnCompletion.

Returns a value indicating whether this Statement will be closed when all its dependent result sets are closed.

private boolean
public boolean

Returns:

The value of the poolable hint.
isPoolable
()

Implements java.sql.Statement.isPoolable.

Returns the value of the EmbedStatement's poolable hint, indicating whether pooling is requested.

public final boolean

Returns:

true if this implements the interface or directly or indirectly wraps an object that does.
isWrapperFor
(Class<?>
a Class defining an interface.
interfaces
)

Implements java.sql.Wrapper.isWrapperFor.

Returns false unless interfaces is implemented.

pack-priv static EmbedResultSet

Returns:

The result set cast down to EmbedResultSet, null if not a valid dynamic result.
processDynamicResult
(EmbedConnection
Connection ResultSet needs to belong to
conn
,
ResultSet
ResultSet to be tested
resultSet
,
EmbedStatement
Statement that executed the CALL, null if
callStatement
)

Process a ResultSet created in a Java procedure as a dynamic result.

private int

Returns:

the actual number of result sets
processDynamicResults
(ResultSet[][]
a holder of dynamic result sets
holder
,
int
the maximum number of result sets to be returned
maxDynamicResultSets
)

Go through a holder of dynamic result sets, remove those that should not be returned, and sort the result sets according to their creation.

pack-priv void
resultSetClosing(EmbedResultSet closingLRS)

Callback on the statement when one of its result sets is closed.

public final void
setApplicationStatement(EngineStatement s)

Set the application statement for this Statement.

public void
setCursorName(String
the new cursor name.
name
)

Implements java.sql.Statement.setCursorName.

setCursorName defines the SQL cursor name that will be used by subsequent Statement execute methods.

public void
setEscapeProcessing(boolean
true to enable; false to disable
enable
)

Implements java.sql.Statement.setEscapeProcessing.

If escape scanning is on (the default) the driver will do escape substitution before sending the SQL to the database.

public void
setFetchDirection(int
the initial direction for processing rows
direction
)

Implements java.sql.Statement.setFetchDirection.

JDBC 2.0 Give a hint as to the direction in which the rows in a result set will be processed.

public void
setFetchSize(int
the number of rows to fetch
rows
)

Implements java.sql.Statement.setFetchSize.

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.

public void
setLargeMaxRows(long
the new max rows limit; zero means unlimited
max
)

Implements org.apache.derby.iapi.jdbc.EngineStatement.setLargeMaxRows.

The maxRows limit is set to limit the number of rows that any ResultSet can contain.

public void
setMaxFieldSize(int
the new max column size limit; zero means unlimited
max
)

Implements java.sql.Statement.setMaxFieldSize.

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.

public void
setMaxRows(int
the new max rows limit; zero means unlimited
max
)

Implements java.sql.Statement.setMaxRows.

The maxRows limit is set to limit the number of rows that any ResultSet can contain.

public void
setPoolable(boolean
requests that the EmbedStatement be pooled if true and not be pooled if false.
poolable
)

Implements java.sql.Statement.setPoolable.

Requests that an EmbedStatement be pooled or not.

public final void
setQueryTimeout(int
the new query timeout limit in seconds; zero means unlimited
seconds
)

Implements java.sql.Statement.setQueryTimeout.

The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.

public void
transferBatch(EmbedStatement other)

Transfer my batch of Statements to a newly created Statement.

public final <T> T

Returns:

an object that implements the interface
unwrap
(Class<T>
a Class defining an interface
interfaces
)

Implements java.sql.Wrapper.unwrap.

Returns this if this class implements the interface.

Inherited from org.apache.derby.impl.jdbc.ConnectionChild:
commitIfAutoCommitcommitIfNeededgetCalgetConnectionSynchronizationgetEmbedConnectiongetLanguageConnectionContextgetLCChandleExceptionneedCommitnewSQLExceptionrestoreContextStackrestoreIntrFlagIfSeensetupContextStack