|
|||||||||
| 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.OperatorNode
org.apache.derby.impl.sql.compile.UnaryOperatorNode
public class UnaryOperatorNode
A UnaryOperatorNode represents a built-in unary operator as defined by the ANSI/ISO SQL standard. This covers operators like +, -, NOT, and IS NULL. Java operators are not represented here: the JSQL language allows Java methods to be called from expressions, but not Java operators.
| Field Summary | |
|---|---|
private java.lang.Object[] |
additionalArgs
|
(package private) java.lang.String |
methodName
|
(package private) ValueNode |
operand
WARNING: operand may be NULL for COUNT(*). |
(package private) java.lang.String |
operator
|
private int |
operatorType
Operator type, only valid for XMLPARSE and XMLSERIALIZE. |
(package private) java.lang.String |
receiverInterfaceType
|
(package private) java.lang.String |
resultInterfaceType
|
(package private) static java.lang.String[] |
UnaryArgTypes
|
(package private) static java.lang.String[] |
UnaryMethodNames
|
(package private) static java.lang.String[] |
UnaryOperators
|
(package private) static java.lang.String[] |
UnaryResultTypes
|
static int |
XMLPARSE_OP
|
static int |
XMLSERIALIZE_OP
|
| 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 | |
|---|---|
UnaryOperatorNode()
|
|
| Method Summary | |
|---|---|
(package private) void |
acceptChildren(Visitor v)
Accept the visitor for all visitable children of this node. |
protected int |
addXmlOpMethodParams(ExpressionClassBuilder acb,
MethodBuilder mb,
LocalField resultField)
Add some additional arguments to our method call for XML related operations like XMLPARSE and XMLSERIALIZE. |
ValueNode |
bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.List aggregateVector)
Bind this expression. |
protected void |
bindOperand(FromList fromList,
SubqueryList subqueryList,
java.util.List aggregateVector)
Bind the operand for this unary operator. |
(package private) void |
bindParameter()
By default unary operators don't accept ? |
private void |
bindXMLParse()
Bind an XMLPARSE operator. |
private void |
bindXMLSerialize()
Bind an XMLSERIALIZE operator. |
boolean |
categorize(JBitSet referencedTabs,
boolean simplePredsOnly)
Categorize this predicate. |
boolean |
constantExpression(PredicateList whereClause)
Return whether or not this expression tree represents a constant value. |
void |
generateExpression(ExpressionClassBuilder acb,
MethodBuilder mb)
Do code generation for this unary operator. |
ValueNode |
getOperand()
Get the operand of this unary operator. |
(package private) java.lang.String |
getOperatorString()
Get the operator of this unary operator. |
protected int |
getOrderableVariantType()
Return the variant type for the underlying expression. |
ParameterNode |
getParameterOperand()
Get the parameter operand of this unary operator. |
java.lang.String |
getReceiverInterfaceName()
Determine the type the binary method is called on. |
void |
init(java.lang.Object operand)
Initializer for a UnaryOperatorNode |
void |
init(java.lang.Object operand,
java.lang.Object operatorOrOpType,
java.lang.Object methodNameOrAddedArgs)
Initializer for a UnaryOperatorNode. |
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. |
ValueNode |
preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
Preprocess an expression tree. |
void |
printSubNodes(int depth)
Prints the sub-nodes of this object. |
ValueNode |
remapColumnReferencesToExpressions()
Remap all ColumnReferences in this tree to be clones of the underlying expression. |
(package private) void |
setMethodName(java.lang.String methodName)
Set the methodName. |
(package private) void |
setOperator(java.lang.String operator)
Set the operator. |
java.lang.String |
toString()
Convert this object to a String. |
| Methods inherited from class org.apache.derby.impl.sql.compile.OperatorNode |
|---|
pushSqlXmlUtil |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
java.lang.String operator
java.lang.String methodName
private int operatorType
java.lang.String resultInterfaceType
java.lang.String receiverInterfaceType
ValueNode operand
public static final int XMLPARSE_OP
public static final int XMLSERIALIZE_OP
static final java.lang.String[] UnaryOperators
static final java.lang.String[] UnaryMethodNames
static final java.lang.String[] UnaryResultTypes
static final java.lang.String[] UnaryArgTypes
private java.lang.Object[] additionalArgs
| Constructor Detail |
|---|
public UnaryOperatorNode()
| Method Detail |
|---|
public void init(java.lang.Object operand,
java.lang.Object operatorOrOpType,
java.lang.Object methodNameOrAddedArgs)
init in interface Nodeinit in class QueryTreeNodeoperand - The operand of the nodeoperatorOrOpType - Either 1) the name of the operator,
OR 2) an Integer holding the operatorType for this operator.methodNameOrAddedArgs - Either 1) name of the method
to call for this operator, or 2) an array of Objects
from which primitive method parameters can be
retrieved.public void init(java.lang.Object operand)
init in interface Nodeinit in class QueryTreeNodeoperand - The operand of the nodevoid setOperator(java.lang.String operator)
operator - The operator.java.lang.String getOperatorString()
void setMethodName(java.lang.String methodName)
methodName - The methodName.public java.lang.String toString()
toString in class ValueNodepublic void printSubNodes(int depth)
printSubNodes in class QueryTreeNodedepth - The depth of this node in the treepublic ValueNode getOperand()
public ParameterNode getParameterOperand()
throws StandardException
StandardException
public ValueNode bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.List aggregateVector)
throws StandardException
bindExpression in class ValueNodefromList - 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 error
protected void bindOperand(FromList fromList,
SubqueryList subqueryList,
java.util.List aggregateVector)
throws StandardException
StandardException
private void bindXMLParse()
throws StandardException
StandardException - Thrown on error
private void bindXMLSerialize()
throws StandardException
StandardException - Thrown on error
public ValueNode preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
throws StandardException
preprocess in class ValueNodenumTables - Number of tables in the DML StatementouterFromList - FromList from outer query blockouterSubqueryList - SubqueryList from outer query blockouterPredicateList - PredicateList from outer query block
StandardException - Thrown on error
public boolean categorize(JBitSet referencedTabs,
boolean simplePredsOnly)
throws StandardException
categorize in class ValueNodereferencedTabs - JBitSet with bit map of referenced FromTablessimplePredsOnly - Whether or not to consider method
calls, field references and conditional nodes
when building bit map
StandardException - Thrown on error
public ValueNode remapColumnReferencesToExpressions()
throws StandardException
remapColumnReferencesToExpressions in class ValueNodeStandardException - Thrown on errorpublic boolean isConstantExpression()
isConstantExpression in class ValueNodepublic boolean constantExpression(PredicateList whereClause)
ValueNode
constantExpression in class ValueNodeValueNode.constantExpression(org.apache.derby.impl.sql.compile.PredicateList)
void bindParameter()
throws StandardException
StandardException - Thrown if ? parameter doesn't
have a type bound to it yet.
? parameter where it isn't allowed.
public void generateExpression(ExpressionClassBuilder acb,
MethodBuilder mb)
throws StandardException
generateExpression in class ValueNodeacb - The ExpressionClassBuilder for the class we're generatingmb - The method the expression will go into
StandardException - Thrown on error
public java.lang.String getReceiverInterfaceName()
throws StandardException
StandardException - Thrown on error
protected int getOrderableVariantType()
throws StandardException
getOrderableVariantType in class ValueNodeStandardException - thrown on error
void acceptChildren(Visitor v)
throws StandardException
acceptChildren in class QueryTreeNodev - the visitor
StandardException - on error
protected int addXmlOpMethodParams(ExpressionClassBuilder acb,
MethodBuilder mb,
LocalField resultField)
throws StandardException
acb - the builder for the class in which the method livesmb - The MethodBuilder that will make the call.resultField - the field that contains the previous result
StandardException
protected boolean isEquivalent(ValueNode o)
throws StandardException
ValueNodeThis 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 ValueNodeo - the node to compare this ValueNode against.
true if the two nodes are equivalent,
false otherwise.
StandardException
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||