Package org.apache.derby.impl.sql
Class GenericStatement
- java.lang.Object
-
- org.apache.derby.impl.sql.GenericStatement
-
-
Field Summary
Fields Modifier and Type Field Description private SchemaDescriptorcompilationSchemaprivate booleanisForReadOnlyprivate GenericPreparedStatementpreparedStmtprivate intprepareIsolationLevelprivate java.lang.StringstatementText
-
Constructor Summary
Constructors Constructor Description GenericStatement(SchemaDescriptor compilationSchema, java.lang.String statementText, boolean isForReadOnly)Constructor for a Statement given the text of the statement in a String
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)java.lang.StringgetCompilationSchema()private static longgetCurrentTimeMillis(LanguageConnectionContext lcc)PreparedStatementgetPreparedStatement()Return thePreparedStatementcurrently associated with this statement.java.lang.StringgetSource()Return the SQL string that this statement is for.inthashCode()PreparedStatementprepare(LanguageConnectionContext lcc)Generates an execution plan without executing it.PreparedStatementprepare(LanguageConnectionContext lcc, boolean forMetaData)Generates an execution plan without executing it.PreparedStatementprepareStorable(LanguageConnectionContext lcc, PreparedStatement ps, java.lang.Object[] paramDefaults, SchemaDescriptor spsSchema, boolean internalSQL)Generates an execution plan given a set of named parameters.private PreparedStatementprepMinion(LanguageConnectionContext lcc, boolean cacheMe, java.lang.Object[] paramDefaults, SchemaDescriptor spsSchema, boolean internalSQL)private voidwalkAST(LanguageConnectionContext lcc, Visitable queryTree, int phase)Walk the AST, using a (user-supplied) Visitor
-
-
-
Field Detail
-
compilationSchema
private final SchemaDescriptor compilationSchema
-
statementText
private final java.lang.String statementText
-
isForReadOnly
private final boolean isForReadOnly
-
prepareIsolationLevel
private int prepareIsolationLevel
-
preparedStmt
private GenericPreparedStatement preparedStmt
-
-
Constructor Detail
-
GenericStatement
public GenericStatement(SchemaDescriptor compilationSchema, java.lang.String statementText, boolean isForReadOnly)
Constructor for a Statement given the text of the statement in a String- Parameters:
compilationSchema- schemastatementText- The text of the statementisForReadOnly- if the statement is opened with level CONCUR_READ_ONLY
-
-
Method Detail
-
prepare
public PreparedStatement prepare(LanguageConnectionContext lcc) throws StandardException
Description copied from interface:StatementGenerates an execution plan without executing it.- Specified by:
preparein interfaceStatement- 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).
-
prepare
public PreparedStatement prepare(LanguageConnectionContext lcc, boolean forMetaData) throws StandardException
Description copied from interface:StatementGenerates an execution plan without executing it.- Specified by:
preparein interfaceStatement- Parameters:
lcc- the language connection contextforMetaData- 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:
- 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).
-
prepMinion
private PreparedStatement prepMinion(LanguageConnectionContext lcc, boolean cacheMe, java.lang.Object[] paramDefaults, SchemaDescriptor spsSchema, boolean internalSQL) throws StandardException
- Throws:
StandardException
-
walkAST
private void walkAST(LanguageConnectionContext lcc, Visitable queryTree, int phase) throws StandardException
Walk the AST, using a (user-supplied) Visitor- Throws:
StandardException
-
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. Does so for a storable prepared statement.- Specified by:
prepareStorablein interfaceStatement- Parameters:
paramDefaults- Parameter defaultslcc- Compiler state variable.ps- Prepared statementspsSchema- schema of the stored prepared statement- 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).
-
getSource
public java.lang.String getSource()
Description copied from interface:StatementReturn the SQL string that this statement is for.
-
getCompilationSchema
public java.lang.String getCompilationSchema()
-
getCurrentTimeMillis
private static long getCurrentTimeMillis(LanguageConnectionContext lcc)
-
getPreparedStatement
public PreparedStatement getPreparedStatement()
Return thePreparedStatementcurrently associated with this statement.- Returns:
- the prepared statement that is associated with this statement
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-