Top Description Methods
org.apache.derby.iapi.sql

public Interface Statement

Known Direct Implementers
org.apache.derby.impl.sql.GenericStatement
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.sql.dictionary.SchemaDescriptor, org.apache.derby.iapi.sql.conn.LanguageConnectionContext

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.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the SQL string this statement is for.
getSource
()

Return the SQL string that this statement is for.

public PreparedStatement

Returns:

A PreparedStatement that allows execution of the execution plan.
prepare
(LanguageConnectionContext
The language connection context
lcc
)

Generates an execution plan without executing it.

public PreparedStatement

Returns:

A PreparedStatement that allows execution of the execution plan.
prepare
(LanguageConnectionContext
the language connection context
lcc
,
boolean
If this statement is for a metadata call then we will allow internal sql syntax on such statement. This internal sql syntax is not available to a user sql statement.
allowInternalSyntax
)

Generates an execution plan without executing it.

public PreparedStatement

Returns:

A Storable PreparedStatement that allows execution of the execution plan.
prepareStorable
(LanguageConnectionContext
Compiler state variable.
lcc
,
PreparedStatement
Prepared statement
ps
,
Object[]
Default parameter values to use for optimization
paramDefaults
,
SchemaDescriptor
schema of the stored prepared statement
spsSchema
,
boolean
True if this is for Derby-internal SQL
internalSQL
)

Generates an execution plan given a set of named parameters.

Method Detail

getSourceback to summary
public String getSource()

Return the SQL string that this statement is for.

Returns:String

the SQL string this statement is for.

prepareback to summary
public PreparedStatement prepare(LanguageConnectionContext lcc) throws StandardException

Generates an execution plan without executing it.

Parameters
lcc:LanguageConnectionContext

The language connection context

Returns:PreparedStatement

A PreparedStatement that allows execution of the execution plan.

Exceptions
StandardException:
Thrown if this is an execution-only version of the module (the prepare() method relies on compilation).
prepareback to summary
public PreparedStatement prepare(LanguageConnectionContext lcc, boolean allowInternalSyntax) throws StandardException

Generates an execution plan without executing it.

Parameters
lcc:LanguageConnectionContext

the language connection context

allowInternalSyntax:boolean

If this statement is for a metadata call then we will allow internal sql syntax on such statement. This internal sql syntax is not available to a user sql statement.

Returns:PreparedStatement

A PreparedStatement that allows execution of the execution plan.

Exceptions
StandardException:
Thrown if this is an execution-only version of the module (the prepare() method relies on compilation).
prepareStorableback to summary
public PreparedStatement prepareStorable(LanguageConnectionContext lcc, PreparedStatement ps, 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
lcc:LanguageConnectionContext

Compiler state variable.

ps:PreparedStatement

Prepared statement

paramDefaults:Object[]

Default parameter values to use for optimization

spsSchema:SchemaDescriptor

schema of the stored prepared statement

internalSQL:boolean

True if this is for Derby-internal SQL

Returns:PreparedStatement

A Storable PreparedStatement that allows execution of the execution plan.

Exceptions
StandardException:
Thrown if this is an execution-only version of the module (the prepare() method relies on compilation).