|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.ValueNode
org.apache.derby.impl.sql.compile.ParameterNode
public class ParameterNode
This node type represents a ? parameter.
Field Summary | |
---|---|
private DataValueDescriptor |
defaultValue
|
private JSQLType |
jsqlType
This ParameterNode may turn up as an argument to a replicated Work Unit. |
private int |
orderableVariantType
|
private int |
parameterNumber
|
private ValueNode |
returnOutputParameter
By default, we assume we are just a normal, harmless little ole parameter. |
private DataTypeDescriptor[] |
userParameterTypes
Pointer to the array in the CompilerContext that holds array of types for all the user-visible paramerers.. |
private ValueNode |
valToGenerate
If this parameter node was created as part of a "probe predicate" for an InListOperatorNode then it does not actually correspond to a specific value--we just created it as a start-key place-holder for IN-list values at execution time. |
Fields inherited from class org.apache.derby.impl.sql.compile.ValueNode |
---|
transformed |
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
---|
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired |
Constructor Summary | |
---|---|
ParameterNode()
Constructor for use by the NodeFactory |
Method Summary | |
---|---|
ValueNode |
bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.Vector aggregateVector)
Bind this expression. |
boolean |
constantExpression(PredicateList whereClause)
Return whether or not this expression tree represents a constant value. |
void |
generateExpression(ExpressionClassBuilder acb,
MethodBuilder mb)
For a ParameterNode, we generate for the return value: ( |
static void |
generateParameterValueSet(ExpressionClassBuilder acb,
int numberOfParameters,
java.util.Vector parameterList)
Generate the code to create the ParameterValueSet, if necessary, when constructing the activation. |
(package private) DataValueDescriptor |
getDefaultValue()
Get the default value for the parameter. |
JSQLType |
getJSQLType()
Get the JSQLType associated with this parameter. |
protected int |
getOrderableVariantType()
Return the variant type for the underlying expression. |
(package private) int |
getParameterNumber()
Get the parameter number |
TypeId |
getTypeId()
Get the TypeId from this ValueNode. |
void |
init(java.lang.Object parameterNumber,
java.lang.Object defaultValue)
Initializer for a ParameterNode. |
boolean |
isConstantExpression()
Return whether or not this expression tree represents a constant expression. |
protected boolean |
isEquivalent(ValueNode o)
Tests if this node is equivalent to the specified ValueNode. |
boolean |
isParameterNode()
Returns TRUE if this is a parameter node. |
boolean |
isReturnOutputParam()
Is this as a return output parameter (e.g. ? |
boolean |
requiresTypeFromContext()
Returns TRUE if the type of this node will be determined from the context in which it is getting used. |
(package private) void |
setDescriptors(DataTypeDescriptor[] descriptors)
Set the descriptor array |
void |
setJSQLType(JSQLType type)
Set the JSQLType of this parameter. |
(package private) void |
setOrderableVariantType(int type)
In a special circumstance, we want to consider parameters as constants. |
void |
setReturnOutputParam(ValueNode valueNode)
Mark this as a return output parameter (e.g. ? |
void |
setType(DataTypeDescriptor descriptor)
Set the DataTypeServices for this parameter |
protected void |
setValueToGenerate(ValueNode vn)
Save the received ValueNode locally so that we can generate it (in place of "this") at generation time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private int parameterNumber
private DataTypeDescriptor[] userParameterTypes
private DataValueDescriptor defaultValue
private JSQLType jsqlType
private int orderableVariantType
private ValueNode returnOutputParameter
private ValueNode valToGenerate
Constructor Detail |
---|
public ParameterNode()
Method Detail |
---|
public void init(java.lang.Object parameterNumber, java.lang.Object defaultValue)
init
in class QueryTreeNode
parameterNumber
- The number of this parameter,
(unique per query starting at 0)defaultValue
- The default value for this parameterint getParameterNumber()
void setDescriptors(DataTypeDescriptor[] descriptors)
descriptors
- The array of DataTypeServices to fill in when the parameters
are bound.public void setType(DataTypeDescriptor descriptor) throws StandardException
setType
in class ValueNode
descriptor
- The DataTypeServices to set for this parameter
StandardException
public void setReturnOutputParam(ValueNode valueNode)
public boolean isReturnOutputParam()
public ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.Vector aggregateVector) throws StandardException
bindExpression
in class ValueNode
fromList
- The FROM list for the query this
expression is in, for binding columns.subqueryList
- The subquery list being built as we find SubqueryNodesaggregateVector
- The aggregate vector being built as we find AggregateNodes
StandardException
- Thrown on errorpublic boolean isConstantExpression()
isConstantExpression
in class ValueNode
public boolean constantExpression(PredicateList whereClause)
ValueNode
constantExpression
in class ValueNode
ValueNode.constantExpression(org.apache.derby.impl.sql.compile.PredicateList)
protected int getOrderableVariantType()
getOrderableVariantType
in class ValueNode
void setOrderableVariantType(int type)
public void setJSQLType(JSQLType type)
type
- the JSQLType associated with this parameterpublic JSQLType getJSQLType()
public void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
generateExpression
in class ValueNode
acb
- The ExpressionClassBuilder for the class being builtmb
- The method the expression will go into
StandardException
- Thrown on errorpublic TypeId getTypeId() throws StandardException
ValueNode
getTypeId
in class ValueNode
StandardException
public static void generateParameterValueSet(ExpressionClassBuilder acb, int numberOfParameters, java.util.Vector parameterList) throws StandardException
acb
- The ExpressionClassBuilder for the class we're buildingnumberOfParameters
- number of parameters for this statementparameterList
- The parameter list for the statement.
StandardException
- on errorDataValueDescriptor getDefaultValue()
public boolean requiresTypeFromContext()
ValueNode
requiresTypeFromContext
in class ValueNode
ValueNode.requiresTypeFromContext()
public boolean isParameterNode()
ValueNode
isParameterNode
in class ValueNode
ValueNode.isParameterNode()
protected boolean isEquivalent(ValueNode o)
ValueNode
This method provides basic expression matching facility for the derived class of ValueNode and it is used by the language layer to compare the node structural form of the two expressions for equivalence at bind phase.
Note that it is not comparing the actual row values at runtime to produce a result; hence, when comparing SQL NULLs, they are considered to be equivalent and not unknown.
One usage case of this method in this context is to compare the select column expression against the group by expression to check if they are equivalent. e.g.:
SELECT c1+c2 FROM t1 GROUP BY c1+c2
In general, node equivalence is determined by the derived class of ValueNode. But they generally abide to the rules below:
isEquivalent
in class ValueNode
o
- the node to compare this ValueNode against.
true
if the two nodes are equivalent,
false
otherwise.protected void setValueToGenerate(ValueNode vn)
vn
- The ValueNode to generate in place of this ParameterNode.
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |