org.apache.derby.iapi.sql
Interface Statement

All Known Implementing Classes:
GenericStatement

public interface Statement

The Statement interface provides a way of giving a statement to the language module, preparing the statement, and executing it. It also provides some support for stored statements. Simple, non-stored, non-parameterized statements can be executed with the execute() method. Parameterized statements must use prepare(). To get the stored query plan for a statement, use get().

This interface will have different implementations for the execution-only and compile-and-execute versions of the product. In the execution-only version, some of the methods will do nothing but raise exceptions to indicate that they are not implemented.

There is a Statement factory in the Connection interface in the Database module, which uses the one provided in LanguageFactory.

Author:
Jeff Lichtman

Method Summary
 java.lang.String getSource()
          Return the SQL string that this statement is for.
 boolean getUnicode()
           
 PreparedStatement prepare(LanguageConnectionContext lcc)
          Generates an execution plan without executing it.
 PreparedStatement prepareStorable(LanguageConnectionContext lcc, PreparedStatement ps, java.lang.Object[] paramDefaults, SchemaDescriptor spsSchema, boolean internalSQL)
          Generates an execution plan given a set of named parameters.
 

Method Detail

prepare

public PreparedStatement prepare(LanguageConnectionContext lcc)
                          throws StandardException
Generates an execution plan without executing it.

Returns:
A PreparedStatement that allows execution of the execution plan.
Throws:
StandardException - Thrown if this is an execution-only version of the module (the prepare() method relies on compilation).

prepareStorable

public PreparedStatement prepareStorable(LanguageConnectionContext lcc,
                                         PreparedStatement ps,
                                         java.lang.Object[] paramDefaults,
                                         SchemaDescriptor spsSchema,
                                         boolean internalSQL)
                                  throws StandardException
Generates an execution plan given a set of named parameters. For generating a storable prepared statement (which has some extensions over a standard prepared statement).

Parameters:
paramDefaults - Default parameter values to use for optimization
spsSchema - schema of the stored prepared statement
Returns:
A Storable PreparedStatement that allows execution of the execution plan.
Throws:
StandardException - Thrown if this is an execution-only version of the module (the prepare() method relies on compilation).

getSource

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

Returns:
the SQL string this statement is for.

getUnicode

public boolean getUnicode()

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.