Top Fields Constructors Methods
org.apache.derby.impl.sql

public Class GenericStatement

extends Object
implements Statement
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.sql.Statement
Imports
java.sql.Timestamp, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.daemon.IndexStatisticsDaemon, org.apache.derby.iapi.services.loader.GeneratedClass, org.apache.derby.iapi.services.monitor.Monitor, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.stream.HeaderPrintWriter, org.apache.derby.iapi.sql.PreparedStatement, .Statement, org.apache.derby.iapi.sql.compile.CompilerContext, .Parser, .Visitable, .ASTVisitor, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, .StatementContext, org.apache.derby.iapi.sql.dictionary.DataDictionary, .SchemaDescriptor, .TableDescriptor, org.apache.derby.impl.sql.compile.StatementNode, org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext, org.apache.derby.iapi.transaction.TransactionControl, org.apache.derby.iapi.util.InterruptStatus

Field Summary

Modifier and TypeField and Description
private final SchemaDescriptor
private final boolean
private GenericPreparedStatement
private int
private final String

Constructor Summary

AccessConstructor and Description
public
GenericStatement(SchemaDescriptor
schema
compilationSchema
,
String
The text of the statement
statementText
,
boolean
if the statement is opened with level CONCUR_READ_ONLY
isForReadOnly
)

Constructor for a Statement given the text of the statement in a String

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public String
private static long
public PreparedStatement

Returns:

the prepared statement that is associated with this statement
getPreparedStatement
()

Return the PreparedStatement currently associated with this statement.

public String
getSource()

Implements org.apache.derby.iapi.sql.Statement.getSource.

Return the SQL string that this statement is for.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public PreparedStatement
prepare(LanguageConnectionContext
The language connection context
lcc
)

Implements org.apache.derby.iapi.sql.Statement.prepare.

Generates an execution plan without executing it.

public PreparedStatement
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.
forMetaData
)

Implements org.apache.derby.iapi.sql.Statement.prepare.

Generates an execution plan without executing it.

public PreparedStatement

Returns:

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

Implements org.apache.derby.iapi.sql.Statement.prepareStorable.

Generates an execution plan given a set of named parameters.

private PreparedStatement
prepMinion(LanguageConnectionContext lcc, boolean cacheMe, Object[] paramDefaults, SchemaDescriptor spsSchema, boolean internalSQL)

private void
walkAST(LanguageConnectionContext lcc, Visitable queryTree, int phase)

Walk the AST, using a (user-supplied) Visitor

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

compilationSchemaback to summary
private final SchemaDescriptor compilationSchema
isForReadOnlyback to summary
private final boolean isForReadOnly
preparedStmtback to summary
private GenericPreparedStatement preparedStmt
prepareIsolationLevelback to summary
private int prepareIsolationLevel
statementTextback to summary
private final String statementText

Constructor Detail

GenericStatementback to summary
public GenericStatement(SchemaDescriptor compilationSchema, String statementText, boolean isForReadOnly)

Constructor for a Statement given the text of the statement in a String

Parameters
compilationSchema:SchemaDescriptor

schema

statementText:String

The text of the statement

isForReadOnly:boolean

if the statement is opened with level CONCUR_READ_ONLY

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getCompilationSchemaback to summary
public String getCompilationSchema()
getCurrentTimeMillisback to summary
private static long getCurrentTimeMillis(LanguageConnectionContext lcc)
getPreparedStatementback to summary
public PreparedStatement getPreparedStatement()

Return the PreparedStatement currently associated with this statement.

Returns:PreparedStatement

the prepared statement that is associated with this statement

getSourceback to summary
public String getSource()

Implements org.apache.derby.iapi.sql.Statement.getSource.

Doc from org.apache.derby.iapi.sql.Statement.getSource.

Return the SQL string that this statement is for.

Returns:String

the SQL string this statement is for.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

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

Implements org.apache.derby.iapi.sql.Statement.prepare.

Doc from org.apache.derby.iapi.sql.Statement.prepare.

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 forMetaData) throws StandardException

Implements org.apache.derby.iapi.sql.Statement.prepare.

Doc from org.apache.derby.iapi.sql.Statement.prepare.

Generates an execution plan without executing it.

Parameters
lcc:LanguageConnectionContext

the language connection context

forMetaData: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

Implements org.apache.derby.iapi.sql.Statement.prepareStorable.

Generates an execution plan given a set of named parameters. Does so for a storable prepared statement.

Parameters
lcc:LanguageConnectionContext

Doc from org.apache.derby.iapi.sql.Statement.prepareStorable.

Compiler state variable.

ps:PreparedStatement

Doc from org.apache.derby.iapi.sql.Statement.prepareStorable.

Prepared statement

paramDefaults:Object[]

Parameter defaults

spsSchema:SchemaDescriptor

Doc from org.apache.derby.iapi.sql.Statement.prepareStorable.

schema of the stored prepared statement

internalSQL:boolean

Doc from org.apache.derby.iapi.sql.Statement.prepareStorable.

True if this is for Derby-internal SQL

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).
prepMinionback to summary
private PreparedStatement prepMinion(LanguageConnectionContext lcc, boolean cacheMe, Object[] paramDefaults, SchemaDescriptor spsSchema, boolean internalSQL) throws StandardException
walkASTback to summary
private void walkAST(LanguageConnectionContext lcc, Visitable queryTree, int phase) throws StandardException

Walk the AST, using a (user-supplied) Visitor