org.apache.derby.impl.sql.compile
Class UnaryDateTimestampOperatorNode

java.lang.Object
  extended byorg.apache.derby.impl.sql.compile.QueryTreeNode
      extended byorg.apache.derby.impl.sql.compile.ValueNode
          extended byorg.apache.derby.impl.sql.compile.UnaryOperatorNode
              extended byorg.apache.derby.impl.sql.compile.UnaryDateTimestampOperatorNode
All Implemented Interfaces:
Visitable

public class UnaryDateTimestampOperatorNode
extends UnaryOperatorNode

This class implements the timestamp( x) and date(x) functions. These two functions implement a few special cases of string conversions beyond the normal string to date/timestamp casts.


Field Summary
private static java.lang.String DATE_METHOD_NAME
           
private static java.lang.String TIMESTAMP_METHOD_NAME
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.UnaryOperatorNode
IS_NULL, methodName, NOT, operand, operator, operatorType, receiverInterfaceType, resultInterfaceType, UNARY_MINUS, UNARY_PLUS, UnaryArgTypes, UnaryMethodNames, UnaryOperators, UnaryResultTypes, XMLPARSE_OP, XMLSERIALIZE_OP
 
Fields inherited from class org.apache.derby.impl.sql.compile.ValueNode
clause, dataTypeServices, IN_HAVING_CLAUSE, IN_SELECT_LIST, IN_UNKNOWN_CLAUSE, IN_WHERE_CLAUSE, transformed
 
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset
 
Constructor Summary
UnaryDateTimestampOperatorNode()
           
 
Method Summary
protected  ValueNode bindUnaryOperator(FromList fromList, SubqueryList subqueryList, java.util.Vector aggregateVector)
          Called by UnaryOperatorNode.bindExpression.
 void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
          Do code generation for this unary operator.
 void init(java.lang.Object operand, java.lang.Object targetType)
          Initialize a query tree node.
private  void invalidOperandType()
           
 
Methods inherited from class org.apache.derby.impl.sql.compile.UnaryOperatorNode
accept, addMethodParams, bindExpression, bindParameter, bindXMLParse, bindXMLSerialize, categorize, constantExpression, getOperand, getOperatorString, getOrderableVariantType, getReceiverInterfaceName, init, init, isConstantExpression, preprocess, printSubNodes, remapColumnReferencesToExpressions, setClause, setMethodName, setOperator, toString
 
Methods inherited from class org.apache.derby.impl.sql.compile.ValueNode
bindExpression, changeToCNF, checkIsBoolean, checkReliability, checkReliability, checkTopPredicatesForEqualsConditions, copyFields, eliminateNots, genEqualsFalseTree, generate, generateFilter, genIsNullTree, genSQLJavaSQLTree, getClause, getClone, getColumnName, getConstantValueAsObject, getDataValueFactory, getSchemaName, getSourceResultColumn, getTableName, getTablesReferenced, getTransformed, getTypeCompiler, getTypeId, getTypeServices, init, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isCloneable, isParameterNode, isRelationalOperator, optimizableEqualityNode, putAndsOnTop, selectivity, setDescriptor, setTransformed, setType, updatableByCursor, verifyChangeToCNF, verifyEliminateNots, verifyPutAndsOnTop
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
bind, convertDefaultNode, debugFlush, debugPrint, executeSchemaName, executeStatementName, formatNodeString, foundString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getSPSName, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isSessionSchema, isSessionSchema, makeConstantAction, makeResultDescription, makeTableName, needsSavepoint, nodeHeader, optimize, parseQueryText, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TIMESTAMP_METHOD_NAME

private static final java.lang.String TIMESTAMP_METHOD_NAME
See Also:
Constant Field Values

DATE_METHOD_NAME

private static final java.lang.String DATE_METHOD_NAME
See Also:
Constant Field Values
Constructor Detail

UnaryDateTimestampOperatorNode

public UnaryDateTimestampOperatorNode()
Method Detail

init

public void init(java.lang.Object operand,
                 java.lang.Object targetType)
          throws StandardException
Description copied from class: QueryTreeNode
Initialize a query tree node.

Overrides:
init in class QueryTreeNode
Parameters:
operand - The operand of the function
targetType - The type of the result. Timestamp or Date.
Throws:
StandardException - Thrown on error

bindUnaryOperator

protected ValueNode bindUnaryOperator(FromList fromList,
                                      SubqueryList subqueryList,
                                      java.util.Vector aggregateVector)
                               throws StandardException
Called by UnaryOperatorNode.bindExpression. If the operand is a constant then evaluate the function at compile time. Otherwise, if the operand input type is the same as the output type then discard this node altogether. If the function is "date" and the input is a timestamp then change this node to a cast.

Overrides:
bindUnaryOperator in class UnaryOperatorNode
Parameters:
fromList - The FROM list for the query this expression is in, for binding columns.
subqueryList - The subquery list being built as we find SubqueryNodes
aggregateVector - The aggregate vector being built as we find AggregateNodes
Returns:
The new top of the expression tree.
Throws:
StandardException - Thrown on error

invalidOperandType

private void invalidOperandType()
                         throws StandardException
Throws:
StandardException

generateExpression

public void generateExpression(ExpressionClassBuilder acb,
                               MethodBuilder mb)
                        throws StandardException
Do code generation for this unary operator.

Overrides:
generateExpression in class UnaryOperatorNode
Parameters:
acb - The ExpressionClassBuilder for the class we're generating
mb - The method the expression will go into
Throws:
StandardException - Thrown on error

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

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