org.apache.derby.iapi.sql.compile
Interface CompilerContext

All Superinterfaces:
Context
All Known Implementing Classes:
CompilerContextImpl

public interface CompilerContext
extends Context

CompilerContext stores the parser and type id factory to be used by the compiler. Stack compiler contexts when a new, local parser is needed (if calling the compiler recursively from within the compiler, for example).

Author:
ames History: 5/22/97 Moved getExternalInterfaceFactory() to LanguageConnectionContext because it had to be used at execution. - Jeff

Field Summary
static int CHECK_CONSTRAINT
           
static int COLUMN_REFERENCE_ILLEGAL
           
static java.lang.String CONTEXT_ID
          this is the ID we expect compiler contexts to be stored into a context manager under.
static int CURRENT_CONNECTION_ILLEGAL
           
static int DATETIME_ILLEGAL
           
static int DEFAULT_RESTRICTION
           
static int DIAGNOSTICS_ILLEGAL
           
static int FUNCTION_CALL_ILLEGAL
           
static int IGNORE_MISSING_CLASSES
           
static int INTERNAL_SQL_ILLEGAL
           
static int INTERNAL_SQL_LEGAL
          Any SQL we support is legal
static int SCHEMA_ILLEGAL
           
static int SQL_LEGAL
          Standard SQL is legal
static int SUBQUERY_ILLEGAL
           
static int UNNAMED_PARAMETER_ILLEGAL
           
static int USER_ILLEGAL
           
 
Method Summary
 int addSavedObject(java.lang.Object o)
          Add an object to the pool that is created at compile time and used at execution time.
 void addWarning(java.sql.SQLWarning warning)
          Add a compile time warning.
 void createDependency(Dependent d, Provider p)
          Add a dependency between two objects.
 void createDependency(Provider p)
          Add a dependency for the current dependent.
 void firstOnStack()
          Mark this CompilerContext as the first on the stack, so we can avoid continually popping and pushing a CompilerContext.
 ClassFactory getClassFactory()
          Return the class factory to use in this compilation.
 SchemaDescriptor getCompilationSchema()
          Get the compilation schema descriptor for this compilation context.
 ProviderList getCurrentAuxiliaryProviderList()
          Get the current auxiliary provider list from this CompilerContext.
 Dependent getCurrentDependent()
          Get the current dependent from this CompilerContext.
 java.lang.Object getCursorInfo()
          Get the cursor info stored in the context.
 int getEntryIsolationLevel()
          Get the entry isolation level from this CC.
 boolean getInUse()
          Return the in use state for the compiler context.
 JavaFactory getJavaFactory()
          Get the JavaFactory from this CompilerContext.
 int getNextColumnNumber()
          Get the current next column number (for generated column names) from this CompilerContext.
 int getNextEquivalenceClass()
          Get the next equivalence class for equijoin clauses.
 int getNextParameterNumber()
          Get the next parameter number.
 int getNextResultSetNumber()
          Get the current next ResultSet number from this CompilerContext.
 int getNextSubqueryNumber()
          Get the current next subquery number from this CompilerContext.
 int getNextTableNumber()
          Get the current next table number from this CompilerContext.
 NodeFactory getNodeFactory()
          Get the NodeFactory from this CompilerContext.
 int getNumResultSets()
          Get the number of Results in the current statement from this CompilerContext.
 int getNumSubquerys()
          Get the number of subquerys in the current statement from this CompilerContext.
 int getNumTables()
          Get the number of tables in the current statement from this CompilerContext.
 java.util.Vector getParameterList()
          Get the parameter list.
 DataTypeDescriptor[] getParameterTypes()
          Get the array of DataTypeDescriptor representing the types of the ?
 ParameterValueSet getParams()
          Get the params stored vai setParams.
 Parser getParser()
          Get the Parser from this CompilerContext
 int getReliability()
          Return the reliability requirements of this clause.
 boolean getReturnParameterFlag()
          Is the callable statement uses ?
 java.lang.Object[] getSavedObjects()
          Get the saved object pool (for putting into the prepared statement).
 int getScanIsolationLevel()
          Get the isolation level for the scans in this query.
 SortCostController getSortCostController()
          Get a SortCostController.
 StoreCostController getStoreCostController(long conglomerateNumber, LanguageConnectionContext lcc)
          Get a StoreCostController for the given conglomerate.
 TypeCompilerFactory getTypeCompilerFactory()
          Get the TypeCompilerFactory from this CompilerContext.
 java.lang.String getUniqueClassName()
          Get a unique Class name from this CompilerContext.
 java.sql.SQLWarning getWarnings()
          Get the chain of compile time warnings.
 boolean isFirstOnStack()
          Is this the first CompilerContext on the stack?
 void resetContext()
          Reset compiler context (as for instance, when we recycle a context for use by another compilation.
 void resetNextResultSetNumber()
          Reset the next ResultSet number from this CompilerContext.
 SchemaDescriptor setCompilationSchema(SchemaDescriptor newDefault)
          Set the compilation schema descriptor for this compilation context.
 void setCurrentAuxiliaryProviderList(ProviderList apl)
          Set the current auxiliary provider list for this CompilerContext.
 void setCurrentDependent(Dependent d)
          Set the current dependent from this CompilerContext.
 void setCursorInfo(java.lang.Object cursorInfo)
          Set params
 void setEntryIsolationLevel(int isolationLevel)
          Set the isolation level on entry to this CC so that it can be restored on exit.
 void setInUse(boolean inUse)
          Set the in use state for the compiler context.
 void setParameterList(java.util.Vector parameterList)
          Set the parameter list.
 void setParams(ParameterValueSet params)
          Set params
 void setReliability(int reliability)
          Sets which kind of query fragments are NOT allowed.
 void setReturnParameterFlag()
          If callable statement uses ?
 void setSavedObjects(java.lang.Object[] objs)
          Set the saved object pool (for putting into the prepared statement).
 void setScanIsolationLevel(int isolationLevel)
          Set the isolation level for the scans in this query.
 
Methods inherited from interface org.apache.derby.iapi.services.context.Context
cleanupOnError, getContextManager, getIdName, isLastHandler, popMe, pushMe
 

Field Detail

CONTEXT_ID

public static final java.lang.String CONTEXT_ID
this is the ID we expect compiler contexts to be stored into a context manager under.

See Also:
Constant Field Values

DATETIME_ILLEGAL

public static final int DATETIME_ILLEGAL
See Also:
Constant Field Values

CURRENT_CONNECTION_ILLEGAL

public static final int CURRENT_CONNECTION_ILLEGAL
See Also:
Constant Field Values

FUNCTION_CALL_ILLEGAL

public static final int FUNCTION_CALL_ILLEGAL
See Also:
Constant Field Values

UNNAMED_PARAMETER_ILLEGAL

public static final int UNNAMED_PARAMETER_ILLEGAL
See Also:
Constant Field Values

DIAGNOSTICS_ILLEGAL

public static final int DIAGNOSTICS_ILLEGAL
See Also:
Constant Field Values

SUBQUERY_ILLEGAL

public static final int SUBQUERY_ILLEGAL
See Also:
Constant Field Values

USER_ILLEGAL

public static final int USER_ILLEGAL
See Also:
Constant Field Values

COLUMN_REFERENCE_ILLEGAL

public static final int COLUMN_REFERENCE_ILLEGAL
See Also:
Constant Field Values

IGNORE_MISSING_CLASSES

public static final int IGNORE_MISSING_CLASSES
See Also:
Constant Field Values

SCHEMA_ILLEGAL

public static final int SCHEMA_ILLEGAL
See Also:
Constant Field Values

INTERNAL_SQL_ILLEGAL

public static final int INTERNAL_SQL_ILLEGAL
See Also:
Constant Field Values

SQL_LEGAL

public static final int SQL_LEGAL
Standard SQL is legal

See Also:
Constant Field Values

INTERNAL_SQL_LEGAL

public static final int INTERNAL_SQL_LEGAL
Any SQL we support is legal

See Also:
Constant Field Values

CHECK_CONSTRAINT

public static final int CHECK_CONSTRAINT
See Also:
Constant Field Values

DEFAULT_RESTRICTION

public static final int DEFAULT_RESTRICTION
See Also:
Constant Field Values
Method Detail

getParser

public Parser getParser()
Get the Parser from this CompilerContext. *

Returns:
The parser associated with this CompilerContext

getNodeFactory

public NodeFactory getNodeFactory()
Get the NodeFactory from this CompilerContext.

Returns:
The NodeFactory associated with this CompilerContext

getTypeCompilerFactory

public TypeCompilerFactory getTypeCompilerFactory()
Get the TypeCompilerFactory from this CompilerContext.

Returns:
The TypeCompilerFactory associated with this CompilerContext

getClassFactory

public ClassFactory getClassFactory()
Return the class factory to use in this compilation.


getJavaFactory

public JavaFactory getJavaFactory()
Get the JavaFactory from this CompilerContext.

Returns:
The JavaFactory associated with this CompilerContext

getNextColumnNumber

public int getNextColumnNumber()
Get the current next column number (for generated column names) from this CompilerContext.

Returns:
int The next column number for the current statement.

resetContext

public void resetContext()
Reset compiler context (as for instance, when we recycle a context for use by another compilation.


getNextTableNumber

public int getNextTableNumber()
Get the current next table number from this CompilerContext.

Returns:
int The next table number for the current statement.

getNumTables

public int getNumTables()
Get the number of tables in the current statement from this CompilerContext.

Returns:
int The number of tables in the current statement.

getNextSubqueryNumber

public int getNextSubqueryNumber()
Get the current next subquery number from this CompilerContext.

Returns:
int The next subquery number for the current statement.

getNumSubquerys

public int getNumSubquerys()
Get the number of subquerys in the current statement from this CompilerContext.

Returns:
int The number of subquerys in the current statement.

getNextResultSetNumber

public int getNextResultSetNumber()
Get the current next ResultSet number from this CompilerContext.

Returns:
int The next ResultSet number for the current statement.

resetNextResultSetNumber

public void resetNextResultSetNumber()
Reset the next ResultSet number from this CompilerContext.

Returns:
None.

getNumResultSets

public int getNumResultSets()
Get the number of Results in the current statement from this CompilerContext.

Returns:
int The number of ResultSets in the current statement.

getUniqueClassName

public java.lang.String getUniqueClassName()
Get a unique Class name from this CompilerContext. Ensures it is globally unique for this JVM.

Returns:
String A unique-enough class name.

getCurrentDependent

public Dependent getCurrentDependent()
Get the current dependent from this CompilerContext.

Returns:
The Dependent currently being compiled.

setCurrentDependent

public void setCurrentDependent(Dependent d)
Set the current dependent from this CompilerContext. This should be called at the start of a compile to register who has the dependencies needed for the compilation.

Parameters:
d - The Dependent currently being compiled.

getCurrentAuxiliaryProviderList

public ProviderList getCurrentAuxiliaryProviderList()
Get the current auxiliary provider list from this CompilerContext.

Returns:
The current AuxiliaryProviderList.

setCurrentAuxiliaryProviderList

public void setCurrentAuxiliaryProviderList(ProviderList apl)
Set the current auxiliary provider list for this CompilerContext.

Parameters:
apl - The new current AuxiliaryProviderList.

createDependency

public void createDependency(Provider p)
                      throws StandardException
Add a dependency for the current dependent.

Parameters:
p - The Provider of the dependency.
Throws:
StandardException - thrown on failure.

createDependency

public void createDependency(Dependent d,
                             Provider p)
                      throws StandardException
Add a dependency between two objects.

Parameters:
d - The Dependent object.
p - The Provider of the dependency.
Throws:
StandardException - thrown on failure.

addSavedObject

public int addSavedObject(java.lang.Object o)
Add an object to the pool that is created at compile time and used at execution time. Use the integer to reference it in execution constructs. Execution code will have to generate:
	(#objectType) (this.getPreparedStatement().getSavedObject(#int))
  <\pre>

Returns:
the entry # for the object

getSavedObjects

public java.lang.Object[] getSavedObjects()
Get the saved object pool (for putting into the prepared statement). This turns it into its storable form, an array of objects.

Returns:
the saved object pool.

setSavedObjects

public void setSavedObjects(java.lang.Object[] objs)
Set the saved object pool (for putting into the prepared statement).

Parameters:
objs - The new saved objects

setInUse

public void setInUse(boolean inUse)
Set the in use state for the compiler context.

Parameters:
inUse - The new inUse state for the compiler context.
Returns:
Nothing.

getInUse

public boolean getInUse()
Return the in use state for the compiler context.

Returns:
boolean The in use state for the compiler context.

firstOnStack

public void firstOnStack()
Mark this CompilerContext as the first on the stack, so we can avoid continually popping and pushing a CompilerContext.


isFirstOnStack

public boolean isFirstOnStack()
Is this the first CompilerContext on the stack?


setReliability

public void setReliability(int reliability)
Sets which kind of query fragments are NOT allowed. Basically, these are fragments which return unstable results. CHECK CONSTRAINTS and CREATE PUBLICATION want to forbid certain kinds of fragments.

Parameters:
reliability - bitmask of types of query fragments to be forbidden see the reliability bitmasks above

getReliability

public int getReliability()
Return the reliability requirements of this clause. See setReliability() for a definition of clause reliability.

Returns:
a bitmask of which types of query fragments are to be forbidden

getCompilationSchema

public SchemaDescriptor getCompilationSchema()
Get the compilation schema descriptor for this compilation context. Will be null if no default schema lookups have occured. Ie. the statement is independent of the current schema.

Returns:
the compilation schema descirptor

setCompilationSchema

public SchemaDescriptor setCompilationSchema(SchemaDescriptor newDefault)
Set the compilation schema descriptor for this compilation context.

Returns:
the previous compilation schema descirptor

getStoreCostController

public StoreCostController getStoreCostController(long conglomerateNumber,
                                                  LanguageConnectionContext lcc)
                                           throws StandardException
Get a StoreCostController for the given conglomerate.

Parameters:
conglomerateNumber - The conglomerate for which to get a StoreCostController.
lcc - Current LanguageConnectionContext.
Returns:
The appropriate StoreCostController.
Throws:
StandardException - Thrown on error

getSortCostController

public SortCostController getSortCostController()
                                         throws StandardException
Get a SortCostController.

Throws:
StandardException - Thrown on error

setParameterList

public void setParameterList(java.util.Vector parameterList)
Set the parameter list.

Parameters:
parameterList - The parameter list.
Returns:
Nothing.

getParameterList

public java.util.Vector getParameterList()
Get the parameter list.

Returns:
The parameter list.

setReturnParameterFlag

public void setReturnParameterFlag()
If callable statement uses ? = form

Returns:
Nothing.

getReturnParameterFlag

public boolean getReturnParameterFlag()
Is the callable statement uses ? for return parameter.

Returns:
true if ? = call else false

getParameterTypes

public DataTypeDescriptor[] getParameterTypes()
Get the array of DataTypeDescriptor representing the types of the ? parameters.

Returns:
The parameter descriptors

getNextParameterNumber

public int getNextParameterNumber()
Get the next parameter number. Useful when generating "associated" parameters.

Returns:
The next parameter number for the statement.

getParams

public ParameterValueSet getParams()
Get the params stored vai setParams. WARNING: nulls out the params value before returning it, so a subsequent get will get a null.

Returns:
the parameters

setParams

public void setParams(ParameterValueSet params)
Set params

Parameters:
params - the params

getCursorInfo

public java.lang.Object getCursorInfo()
Get the cursor info stored in the context.

Returns:
the cursor info

setCursorInfo

public void setCursorInfo(java.lang.Object cursorInfo)
Set params

Parameters:
cursorInfo - the cursor info

setScanIsolationLevel

public void setScanIsolationLevel(int isolationLevel)
Set the isolation level for the scans in this query.

Parameters:
isolationLevel - The isolation level to use.
Returns:
Nothing.

getScanIsolationLevel

public int getScanIsolationLevel()
Get the isolation level for the scans in this query.

Returns:
The isolation level for the scans in this query.

setEntryIsolationLevel

public void setEntryIsolationLevel(int isolationLevel)
Set the isolation level on entry to this CC so that it can be restored on exit.

Parameters:
isolationLevel - The isolation level on entry.
Returns:
Nothing.

getEntryIsolationLevel

public int getEntryIsolationLevel()
Get the entry isolation level from this CC.

Returns:
The entry isolation level.

getNextEquivalenceClass

public int getNextEquivalenceClass()
Get the next equivalence class for equijoin clauses.

Returns:
The next equivalence class for equijoin clauses.

addWarning

public void addWarning(java.sql.SQLWarning warning)
Add a compile time warning.


getWarnings

public java.sql.SQLWarning getWarnings()
Get the chain of compile time warnings.



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