Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.iapi.sql
Interface PreparedStatement  view PreparedStatement download PreparedStatement.java

All Superinterfaces:
org.apache.derby.catalog.Dependable, org.apache.derby.iapi.sql.depend.Dependent, org.apache.derby.iapi.sql.depend.Provider
All Known Subinterfaces:
org.apache.derby.iapi.sql.execute.ExecPreparedStatement, StorablePreparedStatement

public interface PreparedStatement
extends org.apache.derby.iapi.sql.depend.Dependent, org.apache.derby.iapi.sql.depend.Provider

The PreparedStatement interface provides methods to execute prepared statements, store them, and get metadata about them.


Field Summary
 
Fields inherited from interface org.apache.derby.catalog.Dependable
ALIAS, COLUMNS_IN_TABLE, CONGLOMERATE, CONSTRAINT, DEFAULT, FILE, HEAP, INDEX, PREPARED_STATEMENT, SCHEMA, STORED_PREPARED_STATEMENT, TABLE, TRIGGER, VIEW
 
Method Summary
 ResultSet execute(Activation activation, boolean executeQuery, boolean executeUpdate, boolean rollbackParentContext)
          Execute the PreparedStatement and return results.
 ResultSet execute(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc, boolean rollbackParentContext)
          Simple form of execute().
 Activation getActivation(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc, boolean scrollable)
          PreparedStatements are re-entrant - that is, more than one execution can be active at a time for a single prepared statement.
 java.sql.Timestamp getBeginCompileTimestamp()
          Get the timestamp for the beginning of compilation
 long getBindTimeInMillis()
          Get the bind time for the associated query in milliseconds.
 long getCompileTimeInMillis()
          Get the total compile time for the associated query in milliseconds.
 java.sql.SQLWarning getCompileTimeWarnings()
          Return any compile time warnings.
 java.sql.Timestamp getEndCompileTimestamp()
          Get the timestamp for the end of compilation
 long getGenerateTimeInMillis()
          Get the generate time for the associated query in milliseconds.
 long getOptimizeTimeInMillis()
          Get the optimize time for the associated query in milliseconds.
 org.apache.derby.iapi.types.DataTypeDescriptor[] getParameterTypes()
          Get an array of DataTypeDescriptors describing the types of the parameters of this PreparedStatement.
 long getParseTimeInMillis()
          Get the parse time for the associated query in milliseconds.
 ResultDescription getResultDescription()
          Get the ResultDescription for the statement.
 java.lang.String getSource()
          Return the SQL string that this statement is for.
 java.lang.String getSPSName()
          Return the SPS Name for this statement.
 boolean isAtomic()
          Returns whether or not this Statement requires should behave atomically -- i.e.
 boolean referencesSessionSchema()
          Return true if the query node for this statement references SESSION schema tables.
 void rePrepare(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
          Re-prepare the statement if it is not up to date or, if requested, simply not optimal.
 boolean upToDate()
          Checks whether this PreparedStatement is up to date.
 
Methods inherited from interface org.apache.derby.iapi.sql.depend.Dependent
isValid, makeInvalid, makeValid, prepareToInvalidate
 
Methods inherited from interface org.apache.derby.catalog.Dependable
getClassType, getDependableFinder, getObjectID, getObjectName, isPersistent
 

Method Detail

upToDate

public boolean upToDate()
                 throws org.apache.derby.iapi.error.StandardException
Checks whether this PreparedStatement is up to date. A PreparedStatement can become out of date if any of several things happen: A schema used by the statement is dropped A table used by the statement is dropped A table used by the statement, or a column in such a table, is altered in one of several ways: a column is dropped, a privilege is dropped, a constraint is added or dropped, an index is dropped. A view used by the statement is dropped. In general, anything that happened since the plan was generated that might cause the plan to fail, or to generate incorrect results, will cause this method to return FALSE.


rePrepare

public void rePrepare(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
               throws org.apache.derby.iapi.error.StandardException
Re-prepare the statement if it is not up to date or, if requested, simply not optimal. If there are open cursors using this prepared statement, then we will not be able to recompile the statement.


getActivation

public Activation getActivation(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc,
                                boolean scrollable)
                         throws org.apache.derby.iapi.error.StandardException
PreparedStatements are re-entrant - that is, more than one execution can be active at a time for a single prepared statement. An Activation contains all the local state information to execute a prepared statement (as opposed to the constant information, such as literal values and code). Each Activation class contains the code specific to the prepared statement represented by an instance of this class (PreparedStatement).


execute

public ResultSet execute(Activation activation,
                         boolean executeQuery,
                         boolean executeUpdate,
                         boolean rollbackParentContext)
                  throws org.apache.derby.iapi.error.StandardException
Execute the PreparedStatement and return results.

There is no executeQuery() or executeUpdate(); a method is provided in ResultSet to tell whether to expect rows to be returned.


execute

public ResultSet execute(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc,
                         boolean rollbackParentContext)
                  throws org.apache.derby.iapi.error.StandardException
Simple form of execute(). Creates a new single use activation and executes it, but also passes rollbackParentContext parameter (see above).


getResultDescription

public ResultDescription getResultDescription()
Get the ResultDescription for the statement. The ResultDescription describes what the results look like: what are the rows and columns?

This is available here and on the ResultSet so that users can see the shape of the result before they execute.


referencesSessionSchema

public boolean referencesSessionSchema()
Return true if the query node for this statement references SESSION schema tables.


getParameterTypes

public org.apache.derby.iapi.types.DataTypeDescriptor[] getParameterTypes()
Get an array of DataTypeDescriptors describing the types of the parameters of this PreparedStatement. The Nth element of the array describes the Nth parameter.


getSource

public java.lang.String getSource()
Return the SQL string that this statement is for.


getSPSName

public java.lang.String getSPSName()
Return the SPS Name for this statement.


getCompileTimeInMillis

public long getCompileTimeInMillis()
Get the total compile time for the associated query in milliseconds. Compile time can be divided into parse, bind, optimize and generate times.


getParseTimeInMillis

public long getParseTimeInMillis()
Get the parse time for the associated query in milliseconds.


getBindTimeInMillis

public long getBindTimeInMillis()
Get the bind time for the associated query in milliseconds.


getOptimizeTimeInMillis

public long getOptimizeTimeInMillis()
Get the optimize time for the associated query in milliseconds.


getGenerateTimeInMillis

public long getGenerateTimeInMillis()
Get the generate time for the associated query in milliseconds.


getBeginCompileTimestamp

public java.sql.Timestamp getBeginCompileTimestamp()
Get the timestamp for the beginning of compilation


getEndCompileTimestamp

public java.sql.Timestamp getEndCompileTimestamp()
Get the timestamp for the end of compilation


isAtomic

public boolean isAtomic()
Returns whether or not this Statement requires should behave atomically -- i.e. whether a user is permitted to do a commit/rollback during the execution of this statement.


getCompileTimeWarnings

public java.sql.SQLWarning getCompileTimeWarnings()
Return any compile time warnings. Null if no warnings exist.