/** * Bind this expression. This means binding the sub-expressions, * as well as figuring out what the return type is for this expression. * This method is the implementation for XMLPARSE and XMLSERIALIZE. * Sub-classes need to implement their own bindExpression() method * for their own specific rules. * * @param fromList The FROM list for the query this * expression is in, for binding columns. * @param subqueryList The subquery list being built as we find SubqueryNodes * @param aggregateVector The aggregate vector being built as we find AggregateNodes * * @return The new top of the expression tree. * * @exception StandardException Thrown on error */ public ValueNode bindExpression( FromList fromList, SubqueryList subqueryList, Vector aggregateVector) throws StandardException { bindOperand(fromList, subqueryList, aggregateVector); if (operatorType == XMLPARSE_OP) bindXMLParse(); else if (operatorType == XMLSERIALIZE_OP) bindXMLSerialize(); return this; }
/** * Do code generation for this unary plus operator * * @param acb The ExpressionClassBuilder for the class we're generating * @param mb The method the expression will go into * * @exception StandardException Thrown on error */ public void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException { /* Unary + doesn't do anything. Just return the operand */ if (operatorType == UNARY_PLUS) operand.generateExpression(acb, mb); else super.generateExpression(acb, mb); } /**
/** * Get the parameter operand of this unary operator. * For the example below, for abs unary operator node, we want to get ? * select * from t1 where -? = max_cni(abs(-?), sqrt(+?)) * * This gets called when ParameterNode is needed to get parameter * specific information like getDefaultValue(), getParameterNumber() etc * * @return The parameter operand of this unary operator else null. */ public ValueNode getParameterOperand() throws StandardException { if (requiresTypeFromContext() == false) return null; else { UnaryOperatorNode tempUON = this; ValueNode operand = tempUON.getOperand(); Class<?> opclass; while ((opclass = (operand = tempUON.getOperand()).getClass()) != ParameterNode.class && opclass != ParameterizedConstantNode.class) { tempUON = (UnaryOperatorNode)operand; } return tempUON.getOperand(); } }
mb.pushNewComplete(addXmlOpMethodParams(acb, mb)); ? getTypeCompiler().interfaceName() : resultInterfaceType; boolean needField = !getTypeId().isBooleanTypeId(); String receiverType = getReceiverInterfaceName(); operand.generateExpression(acb, mb); mb.cast(receiverType);
pn = ((UnaryOperatorNode)value).getParameterOperand(); else pn = value;
mb.push(targetType.getJDBCTypeId()); mb.push(targetType.getMaximumWidth()); mb.push(getSchemaDescriptor(null, false).getCollationType()); return 3; mb.push(getCompilerContext().addSavedObject(sqlxUtil));
/** * For SQRT and ABS the parameter becomes a DOUBLE. * For unary + and - no change is made to the * underlying node. Once this node's type is set * using setType, then the underlying node will have * its type set. * * @exception StandardException Thrown if ? parameter doesn't * have a type bound to it yet. * ? parameter where it isn't allowed. */ void bindParameter() throws StandardException { if (operatorType == SQRT || operatorType == ABSOLUTE) { operand.setType( new DataTypeDescriptor(TypeId.getBuiltInTypeId(Types.DOUBLE), true)); return; } //Derby-582 add support for dynamic parameter for unary plus and minus if (operatorType == UNARY_MINUS || operatorType == UNARY_PLUS) return; // Not expected to get here since only the above types are supported // but the super-class method will throw an exception super.bindParameter(); }
if (uon.getOperand() instanceof ColumnReference) cr1 = (ColumnReference) uon.getOperand();
this.canonicalizedExpression.append(opNode.getOperatorString()); acceptChildVisitor(opNode);
mb.pushNewComplete(addXmlOpMethodParams(acb, mb)); ? getTypeCompiler().interfaceName() : resultInterfaceType; boolean needField = !getTypeId().isBooleanTypeId(); String receiverType = getReceiverInterfaceName(); operand.generateExpression(acb, mb); mb.cast(receiverType);
pn = ((UnaryOperatorNode)value).getParameterOperand(); else pn = value;
mb.push(targetType.getJDBCTypeId()); mb.push(targetType.getMaximumWidth()); mb.push(getSchemaDescriptor(null, false).getCollationType()); return 3; mb.push(getCompilerContext().addSavedObject(sqlxUtil));
/** * For SQRT and ABS the parameter becomes a DOUBLE. * For unary + and - no change is made to the * underlying node. Once this node's type is set * using setType, then the underlying node will have * its type set. * * @exception StandardException Thrown if ? parameter doesn't * have a type bound to it yet. * ? parameter where it isn't allowed. */ void bindParameter() throws StandardException { if (operatorType == SQRT || operatorType == ABSOLUTE) { operand.setType( new DataTypeDescriptor(TypeId.getBuiltInTypeId(Types.DOUBLE), true)); return; } //Derby-582 add support for dynamic parameter for unary plus and minus if (operatorType == UNARY_MINUS || operatorType == UNARY_PLUS) return; // Not expected to get here since only the above types are supported // but the super-class method will throw an exception super.bindParameter(); }
if (uon.getOperand() instanceof ColumnReference) cr1 = (ColumnReference) uon.getOperand();
this.canonicalizedExpression.append(opNode.getOperatorString()); acceptChildVisitor(opNode);
mb.pushNewComplete(addXmlOpMethodParams(acb, mb)); ? getTypeCompiler().interfaceName() : resultInterfaceType; boolean needField = !getTypeId().isBooleanTypeId(); String receiverType = getReceiverInterfaceName(); operand.generateExpression(acb, mb); mb.cast(receiverType);
/** * Bind this expression. This means binding the sub-expressions, * as well as figuring out what the return type is for this expression. * This method is the implementation for XMLPARSE and XMLSERIALIZE. * Sub-classes need to implement their own bindExpression() method * for their own specific rules. * * @param fromList The FROM list for the query this * expression is in, for binding columns. * @param subqueryList The subquery list being built as we find SubqueryNodes * @param aggregateVector The aggregate vector being built as we find AggregateNodes * * @return The new top of the expression tree. * * @exception StandardException Thrown on error */ public ValueNode bindExpression( FromList fromList, SubqueryList subqueryList, Vector aggregateVector) throws StandardException { bindOperand(fromList, subqueryList, aggregateVector); if (operatorType == XMLPARSE_OP) bindXMLParse(); else if (operatorType == XMLSERIALIZE_OP) bindXMLSerialize(); return this; }
/** * Get the parameter operand of this unary operator. * For the example below, for abs unary operator node, we want to get ? * select * from t1 where -? = max_cni(abs(-?), sqrt(+?)) * * This gets called when ParameterNode is needed to get parameter * specific information like getDefaultValue(), getParameterNumber() etc * * @return The parameter operand of this unary operator else null. */ public ValueNode getParameterOperand() throws StandardException { if (requiresTypeFromContext() == false) return null; else { UnaryOperatorNode tempUON = this; ValueNode operand = tempUON.getOperand(); Class<?> opclass; while ((opclass = (operand = tempUON.getOperand()).getClass()) != ParameterNode.class && opclass != ParameterizedConstantNode.class) { tempUON = (UnaryOperatorNode)operand; } return tempUON.getOperand(); } }
pn = ((UnaryOperatorNode)value).getParameterOperand(); else pn = value;
mb.push(targetType.getJDBCTypeId()); mb.push(targetType.getMaximumWidth()); mb.push(getSchemaDescriptor(null, false).getCollationType()); return 3; mb.push(getCompilerContext().addSavedObject(sqlxUtil));