Package org.apache.derby.iapi.types

Examples of org.apache.derby.iapi.types.TypeId


    super.bindExpression(fromList, subqueryList, aggregateVector);

//RESOLVELOCALIZE - convert constants to national constants
    TypeCompiler leftTC = leftOperand.getTypeCompiler();
    TypeCompiler rightTC = rightOperand.getTypeCompiler();
    TypeId leftTypeId = leftOperand.getTypeId();
    TypeId rightTypeId = rightOperand.getTypeId();

    /*
     * If we are comparing a non-string with a string type, then we
     * must prevent the non-string value from being used to probe into
     * an index on a string column. This is because the string types
     * are all of low precedence, so the comparison rules of the non-string
     * value are used, so it may not find values in a string index because
     * it will be in the wrong order. So, cast the string value to its
     * own type. This is easier than casting it to the non-string type,
     * because we would have to figure out the right length to cast it to.
     */
    if (! leftTypeId.isStringTypeId() && rightTypeId.isStringTypeId())
    {
      DataTypeDescriptor rightTypeServices = rightOperand.getTypeServices();

      rightOperand =  (ValueNode)
        getNodeFactory().getNode(
          C_NodeTypes.CAST_NODE,
          rightOperand,
          new DataTypeDescriptor(
              rightTypeId,
              true,
              rightTypeServices.getMaximumWidth()),
          getContextManager());
      ((CastNode) rightOperand).bindCastNodeOnly();
    }
    else if (! rightTypeId.isStringTypeId() && leftTypeId.isStringTypeId())
    {
      DataTypeDescriptor leftTypeServices = leftOperand.getTypeServices();

      leftOperand =  (ValueNode)
        getNodeFactory().getNode(
          C_NodeTypes.CAST_NODE,
          leftOperand,
          new DataTypeDescriptor(
              leftTypeId,
              true,
              leftTypeServices.getMaximumWidth()),
          getContextManager());
      ((CastNode) leftOperand).bindCastNodeOnly();
    }
    /* If we are comparing a char with a national char then
     * we need to generate a cast to the appropriate national
     * char above the char operand.
     */
    else if (! leftTypeId.isNationalStringTypeId() &&
      rightTypeId.isNationalStringTypeId())
    {
      leftOperand =  (ValueNode)
        getNodeFactory().getNode(
          C_NodeTypes.CAST_NODE,
          leftOperand,
          DataTypeDescriptor.getBuiltInDataTypeDescriptor(leftTC.getMatchingNationalCharTypeName(),
                    leftTC.getCastToCharWidth(
                      leftOperand.getTypeServices())),
          getContextManager());
      ((CastNode) leftOperand).bindCastNodeOnly();
    }
    else if (! rightTypeId.isNationalStringTypeId() &&
        leftTypeId.isNationalStringTypeId())
    {
      rightOperand =  (ValueNode)
        getNodeFactory().getNode(
          C_NodeTypes.CAST_NODE,
View Full Code Here


   * @exception StandardException    Thrown on error
   */
  public void bindComparisonOperator()
      throws StandardException
  {
    TypeId  leftType;
    TypeId  rightType;
    boolean        nullableResult;

    leftType = leftOperand.getTypeId();
    rightType = rightOperand.getTypeId();


    /*
    ** Can the types be compared to each other?  If not, throw an
    ** exception.
    */
    boolean forEquals = operator.equals("=") || operator.equals("<>");

        boolean cmp = leftOperand.getTypeServices().comparable(
            rightOperand.getTypeServices(),
        forEquals,
        getClassFactory());
    // Bypass the comparable check if this is a rewrite from the
    // optimizer.  We will assume Mr. Optimizer knows what he is doing.
          if (!cmp && !forQueryRewrite) {
      throw StandardException.newException(SQLState.LANG_NOT_COMPARABLE,
          leftType.getSQLTypeName(),
          rightType.getSQLTypeName()
        );
      }

   
    /*
 
View Full Code Here

  }
 
  /** @see BinaryOperatorNode#genSQLJavaSQLTree */
  public ValueNode genSQLJavaSQLTree() throws StandardException
  {
    TypeId leftTypeId = leftOperand.getTypeId();

    /* If I have Java types, I need only add java->sql->java if the types
     * are not comparable
     */
    if (leftTypeId.userType())
    {
      if (leftOperand.getTypeServices().comparable(leftOperand.getTypeServices(),
          false, getClassFactory()))
        return this;

      leftOperand = leftOperand.genSQLJavaSQLTree();
    }

    TypeId rightTypeId = rightOperand.getTypeId();

    if (rightTypeId.userType())
    {
      if (rightOperand.getTypeServices().comparable(rightOperand.getTypeServices(),
          false, getClassFactory()))
        return this;

View Full Code Here

  public void generateExpression(ExpressionClassBuilder acb,
                      MethodBuilder mb)
                  throws StandardException
  {
    TypeId      resultType;
    String            resultTypeName;

    /*
    ** Tell the Java node that it's value is being returned to the
    ** SQL domain.  This way, it knows whether the checking for a null
View Full Code Here

        optimizeDomainValueConversion();
     
      TypeDescriptor returnType = routineInfo.getReturnType();
      if (returnType != null)
      {
        TypeId returnTypeId = TypeId.getBuiltInTypeId(returnType.getJDBCTypeId());

        if (returnTypeId.variableLength()) {
          // Cast the return using a cast node, but have to go
          // into the SQL domain, and back to the Java domain.

          DataTypeDescriptor returnValueDtd = new DataTypeDescriptor(
                returnTypeId,
View Full Code Here

        // find the declared type.

        TypeDescriptor td = parameterTypes[p];

        TypeId typeId = TypeId.getBuiltInTypeId(td.getJDBCTypeId());

        TypeId parameterTypeId = typeId;


        // if it's an OUT or INOUT parameter we need an array.
        int parameterMode = routineInfo.getParameterModes()[p];

        if (parameterMode != JDBC30Translation.PARAMETER_MODE_IN) {

          String arrayType;
          switch (typeId.getJDBCTypeId()) {
            case java.sql.Types.SMALLINT:
            case java.sql.Types.INTEGER:
            case java.sql.Types.BIGINT:
            case java.sql.Types.REAL:
            case java.sql.Types.DOUBLE:
              arrayType = getTypeCompiler(typeId).getCorrespondingPrimitiveTypeName().concat("[]");
              break;
            default:
              arrayType = typeId.getCorrespondingJavaTypeName().concat("[]");
              break;
          }

          typeId = TypeId.getUserDefinedTypeId(arrayType, false);
        }

        // this is the type descriptor of the require method parameter
        DataTypeDescriptor methoddtd = new DataTypeDescriptor(
            typeId,
            td.getPrecision(),
            td.getScale(),
            td.isNullable(),
            td.getMaximumWidth()
          );

        signature[p] = new JSQLType(methoddtd);

        // check parameter is a ? node for INOUT and OUT parameters.

        ValueNode sqlParamNode = null;

        if (methodParms[p] instanceof SQLToJavaValueNode) {
          SQLToJavaValueNode sql2j = (SQLToJavaValueNode) methodParms[p];
          sqlParamNode = sql2j.getSQLValueNode();
        }
        else
        {
        }

        boolean isParameterMarker = true;
        if ((sqlParamNode == null) || !sqlParamNode.requiresTypeFromContext())
        {
          if (parameterMode != JDBC30Translation.PARAMETER_MODE_IN) {
          
            throw StandardException.newException(SQLState.LANG_DB2_PARAMETER_NEEDS_MARKER,
              RoutineAliasInfo.parameterMode(parameterMode),
              routineInfo.getParameterNames()[p]);
          }
          isParameterMarker = false;
        }
        else
        {
          if (applicationParameterNumbers == null)
            applicationParameterNumbers = new int[parameterCount];
            if (sqlParamNode instanceof UnaryOperatorNode) {
              ParameterNode pn = ((UnaryOperatorNode)sqlParamNode).getParameterOperand();
              applicationParameterNumbers[p] = pn.getParameterNumber();
            } else
            applicationParameterNumbers[p] = ((ParameterNode) sqlParamNode).getParameterNumber();
        }

        // this is the SQL type of the procedure parameter.
        DataTypeDescriptor paramdtd = new DataTypeDescriptor(
          parameterTypeId,
          td.getPrecision(),
          td.getScale(),
          td.isNullable(),
          td.getMaximumWidth()
        );

        boolean needCast = false;
        if (!isParameterMarker)
        {

          // can only be an IN parameter.
          // check that the value can be assigned to the
          // type of the procedure parameter.
          if (sqlParamNode instanceof UntypedNullConstantNode)
          {
            sqlParamNode.setType(paramdtd);
          }
          else
          {


            DataTypeDescriptor dts;
            TypeId argumentTypeId;

            if (sqlParamNode != null)
            {
              // a node from the SQL world
              argumentTypeId = sqlParamNode.getTypeId();
              dts = sqlParamNode.getTypeServices();
            }
            else
            {
              // a node from the Java world
              dts = DataTypeDescriptor.getSQLDataTypeDescriptor(methodParms[p].getJavaTypeName());
              if (dts == null)
              {
                throw StandardException.newException(SQLState.LANG_NO_CORRESPONDING_S_Q_L_TYPE,
                  methodParms[p].getJavaTypeName());
              }

              argumentTypeId = dts.getTypeId();
            }

            if (! getTypeCompiler(parameterTypeId).storable(argumentTypeId, getClassFactory()))
                throw StandardException.newException(SQLState.LANG_NOT_STORABLE,
                  parameterTypeId.getSQLTypeName(),
                  argumentTypeId.getSQLTypeName() );

            // if it's not an exact length match then some cast will be needed.
            if (!paramdtd.isExactTypeAndLengthMatch(dts))
              needCast = true;
          }
        }
        else
        {
          // any variable length type will need a cast from the
          // Java world (the ? parameter) to the SQL type. This
          // ensures values like CHAR(10) are passed into the procedure
          // correctly as 10 characters long.
          if (parameterTypeId.variableLength()) {

            if (parameterMode != JDBC30Translation.PARAMETER_MODE_OUT)
              needCast = true;
          }
        }
       

        if (needCast)
        {
          // push a cast node to ensure the
          // correct type is passed to the method
          // this gets tacky because before we knew
          // it was a procedure call we ensured all the
          // parameter are JavaNodeTypes. Now we need to
          // push them back to the SQL domain, cast them
          // and then push them back to the Java domain.

          if (sqlParamNode == null) {

            sqlParamNode = (ValueNode) getNodeFactory().getNode(
              C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
              methodParms[p],
              getContextManager());
          }

          ValueNode castNode = (ValueNode) getNodeFactory().getNode(
            C_NodeTypes.CAST_NODE,
            sqlParamNode,
            paramdtd,
            getContextManager());


          methodParms[p] = (JavaValueNode) getNodeFactory().getNode(
              C_NodeTypes.SQL_TO_JAVA_VALUE_NODE,
              castNode,
              getContextManager());

          methodParms[p] = methodParms[p].bindExpression(fromList, subqueryList, aggregateVector);
        }

        // only force the type for a ? so that the correct type shows up
        // in parameter meta data
        if (isParameterMarker)
          sqlParamNode.setType(paramdtd);
      }

      if (sigParameterCount != parameterCount) {

        TypeId typeId = TypeId.getUserDefinedTypeId("java.sql.ResultSet[]", false);

        DataTypeDescriptor dtd = new DataTypeDescriptor(
            typeId,
            0,
            0,
View Full Code Here

    /*
    ** Generate a CastNode if necessary and
    ** stick it over the original expression
    */
    TypeId condTypeId = getTypeId();
    TypeId thenTypeId = ((ValueNode) thenElseList.elementAt(0)).getTypeId();
    TypeId elseTypeId = ((ValueNode) thenElseList.elementAt(1)).getTypeId();

    /* Need to generate conversion if thenExpr or elseExpr is not of
     * dominant type.  (At least 1 of them must be of the dominant type.)
     */
    if (thenTypeId.typePrecedence() != condTypeId.typePrecedence())
    {
      ValueNode cast = (ValueNode) getNodeFactory().getNode(
                C_NodeTypes.CAST_NODE,
                thenElseList.elementAt(0),
                                getTypeServices()// cast to dominant type
                getContextManager());
      cast = cast.bindExpression(fromList,
                      subqueryList,
                      aggregateVector);
     
      thenElseList.setElementAt(cast, 0);
    }

    else if (elseTypeId.typePrecedence() != condTypeId.typePrecedence())
    {
      ValueNode cast = (ValueNode) getNodeFactory().getNode(
                C_NodeTypes.CAST_NODE,
                thenElseList.elementAt(1),
                                getTypeServices()// cast to dominant type
View Full Code Here

    /*
    ** Generate a CastNode if necessary and
    ** stick it over the original expression
    */
    TypeId condTypeId = getTypeId();
    TypeId thenTypeId = ((ValueNode) thenElseList.elementAt(0)).getTypeId();
    TypeId elseTypeId = ((ValueNode) thenElseList.elementAt(1)).getTypeId();

    /* Need to generate conversion if thenExpr or elseExpr is not of
     * dominant type.  (At least 1 of them must be of the dominant type.)
     */
    if (thenTypeId.typePrecedence() != condTypeId.typePrecedence())
    {
      ValueNode cast = (ValueNode) getNodeFactory().getNode(
                C_NodeTypes.CAST_NODE,
                thenElseList.elementAt(0),
                                getTypeServices()// cast to dominant type
                getContextManager());
      cast = cast.bindExpression(fromList,
                      subqueryList,
                      aggregateVector);
     
      thenElseList.setElementAt(cast, 0);
    }

    else if (elseTypeId.typePrecedence() != condTypeId.typePrecedence())
    {
      ValueNode cast = (ValueNode) getNodeFactory().getNode(
                C_NodeTypes.CAST_NODE,
                thenElseList.elementAt(1),
                                getTypeServices()// cast to dominant type
View Full Code Here

      if (rightOperand.requiresTypeFromContext()) {
        throw StandardException.newException(
            SQLState.LANG_BINARY_OPERANDS_BOTH_PARMS, operator);
      }

      TypeId leftType;

      /*
       * * A ? on the left gets its type from the right. There are eight *
       * legal types for the concatenation operator: CHAR, VARCHAR, * LONG
       * VARCHAR, CLOB, BIT, BIT VARYING, LONG BIT VARYING, and BLOB. * If
       * the right type is BLOB, set the parameter type to BLOB with max
       * length. * If the right type is one of the other bit types, set
       * the parameter type to * BIT VARYING with maximum length. * * If
       * the right type is CLOB, set parameter type to CLOB with max
       * length. * If the right type is anything else, set it to VARCHAR
       * with * maximum length. We count on the resolveConcatOperation
       * method to * catch an illegal type. * * NOTE: When I added the
       * long types, I could have changed the * resulting parameter types
       * to LONG VARCHAR and LONG BIT VARYING, * but they were already
       * VARCHAR and BIT VARYING, and it wasn't * clear to me what effect
       * it would have to change it. - Jeff
       */
      if (rightOperand.getTypeId().isBitTypeId()) {
        if (rightOperand.getTypeId().isBlobTypeId())
          leftType = TypeId.getBuiltInTypeId(Types.BLOB);
        else
          leftType = TypeId.getBuiltInTypeId(Types.VARBINARY);
      } else {
        if (rightOperand.getTypeId().isClobTypeId())
          leftType = TypeId.getBuiltInTypeId(Types.CLOB);
        else
          leftType = TypeId.getBuiltInTypeId(Types.VARCHAR);
      }

      leftOperand.setType(new DataTypeDescriptor(leftType, true));
      if (rightOperand.getTypeId().isStringTypeId()) {
        //collation of ? operand should be picked from the context
        leftOperand.getTypeServices().setCollationDerivation(
            rightOperand.getTypeServices().getCollationDerivation());
        leftOperand.getTypeServices().setCollationType(
            rightOperand.getTypeServices().getCollationType());
      }
    }

    /*
     * Is there a ? parameter on the right?
     */
    if (rightOperand.requiresTypeFromContext()) {
      TypeId rightType;

      /*
       * * A ? on the right gets its type from the left. There are eight *
       * legal types for the concatenation operator: CHAR, VARCHAR, * LONG
       * VARCHAR, CLOB, BIT, BIT VARYING, LONG BIT VARYING, and BLOB. * If
 
View Full Code Here

   *                not supported on the operand types.
   */
  private DataTypeDescriptor resolveConcatOperation(
      DataTypeDescriptor leftType, DataTypeDescriptor rightType)
      throws StandardException {
    TypeId leftTypeId;
    TypeId rightTypeId;
    String higherType;
    int resultLength;
    boolean nullable;

    leftTypeId = leftType.getTypeId();
    rightTypeId = rightType.getTypeId();

    /*
     * * Check the right type to be sure it's a concatable. By convention, *
     * we call this method off the TypeId of the left operand, so if * we
     * get here, we know the left operand is a concatable.
     */
    /*
     * * Make sure we haven't been given a char and a * bit to concatenate.
     */

    if (!leftTypeId.isConcatableTypeId()
        || !rightTypeId.isConcatableTypeId()
        || (rightTypeId.isBitTypeId() && leftTypeId.isStringTypeId())
        || (leftTypeId.isBitTypeId() && rightTypeId.isStringTypeId()))
      throw StandardException.newException(
          SQLState.LANG_DB2_FUNCTION_INCOMPATIBLE, "||", "FUNCTION");

    /*
     * * The types aren't the same. The result of the operation is the *
     * type of higher precedence.
     */

    higherType = (leftTypeId.typePrecedence() >= rightTypeId
        .typePrecedence()) ? leftType.getTypeName() : rightType
        .getTypeName();

    /* Get the length of the result */
    resultLength = leftType.getMaximumWidth() + rightType.getMaximumWidth();

    /*
     * * Use following chart to handle overflow * operands CHAR(A) CHAR(B)
     * and A+B <255 then result is CHAR(A+B) * operands CHAR FOR BIT DATA(A)
     * CHAR FOR BIT DATA(B) and A+B <255 then result is CHAR FOR BIT
     * DATA(A+B) * * operands CHAR(A) CHAR(B) and A+B>254 then result is
     * VARCHAR(A+B) * operands CHAR FOR BIT DATA(A) CHAR FOR BIT DATA(B) and
     * A+B>254 then result is VARCHAR FOR BIT DATA(A+B) * * operands CHAR(A)
     * VARCHAR(B) and A+B <4001 then result is VARCHAR(A+B) * operands CHAR
     * FOR BIT DATA(A) VARCHAR FOR BIT DATA(B) and A+B <4001 then result is
     * VARCHAR FOR BIT DATA(A+B) * * operands CHAR(A) VARCHAR(B) and
     * A+B>4000 then result is LONG VARCHAR * operands CHAR FOR BIT DATA(A)
     * VARCHAR FOR BIT DATA(B) and A+B>4000 then result is LONG VARCHAR FOR
     * BIT DATA * * operands CHAR(A) LONG VARCHAR then result is LONG
     * VARCHAR * operands CHAR FOR BIT DATA(A) LONG VARCHAR FOR BIT DATA
     * then result is LONG VARCHAR FOR BIT DATA * * operands VARCHAR(A)
     * VARCHAR(B) and A+B <4001 then result is VARCHAR(A+B) * operands
     * VARCHAR FOR BIT DATA(A) VARCHAR FOR BIT DATA(B) and A+B <4001 then
     * result is VARCHAR FOR BIT DATA(A+B) * * operands VARCHAR(A)
     * VARCHAR(B) and A+B>4000 then result is LONG VARCHAR * operands
     * VARCHAR FOR BIT DATA(A) VARCHAR FOR BIT DATA(B) and A+B>4000 then
     * result is LONG VARCHAR FOR BIT DATA * * operands VARCHAR(A) LONG
     * VARCHAR then result is LONG VARCHAR * operands VARCHAR FOR BIT
     * DATA(A) LONG VARCHAR FOR BIT DATA then result is LONG VARCHAR FOR BIT
     * DATA * * operands LONG VARCHAR, LONG VARCHAR then result is LONG
     * VARCHAR * operands LONG VARCHAR FOR BIT DATA, LONG VARCHAR FOR BIT
     * DATA then result is LONG VARCHAR FOR BIT DATA * * operands CLOB(A),
     * CHAR(B) then result is CLOB(MIN(A+B,2G)) * operands CLOB(A),
     * VARCHAR(B) then result is CLOB(MIN(A+B,2G)) * operands CLOB(A), LONG
     * VARCHAR then result is CLOB(MIN(A+32K,2G)) * operands CLOB(A),
     * CLOB(B) then result is CLOB(MIN(A+B,2G)) * * operands BLOB(A), CHAR
     * FOR BIT DATA(B) then result is BLOB(MIN(A+B,2G)) * operands BLOB(A),
     * VARCHAR FOR BIT DATA(B) then result is BLOB(MIN(A+B,2G)) * operands
     * BLOB(A), LONG VARCHAR FOR BIT DATA then result is BLOB(MIN(A+32K,2G)) *
     * operands BLOB(A), BLOB(B) then result is BLOB(MIN(A+B,2G)) * *
     * operands CHAR(A)/VARCHAR(A)/LONGVARCHAR, LONGVARCHAR and
     * "concatenated string length">32700 does not cause automatic
     * escalation * to LOB for compatibility with previous releases. Any
     * such cases would result in an error at runtime *
     */
    //in the following code, I can assume that left and right operands both
    // will be either char kind
    //of datatypes or they will be both binary kind of datatypes. That's
    // because operand datatypes
    //mismatch has already been handled earlier
    if (leftTypeId.getJDBCTypeId() == Types.CHAR
        || leftTypeId.getJDBCTypeId() == Types.BINARY) {
      switch (rightTypeId.getJDBCTypeId()) {
      case Types.CHAR:
      case Types.BINARY:
        if (resultLength > Limits.DB2_CHAR_MAXWIDTH) {
          if (rightTypeId.getJDBCTypeId() == Types.CHAR)
            //operands CHAR(A) CHAR(B) and A+B>254 then result is
            // VARCHAR(A+B)
            higherType = TypeId.VARCHAR_NAME;
          else
            //operands CHAR FOR BIT DATA(A) CHAR FOR BIT DATA(B)
            // and A+B>254 then result is VARCHAR FOR BIT DATA(A+B)
            higherType = TypeId.VARBIT_NAME;
        }
        break;

      case Types.VARCHAR:
      case Types.VARBINARY:
        if (resultLength > Limits.DB2_CONCAT_VARCHAR_LENGTH) {
          if (rightTypeId.getJDBCTypeId() == Types.VARCHAR)
            //operands CHAR(A) VARCHAR(B) and A+B>4000 then result
            // is LONG VARCHAR
            higherType = TypeId.LONGVARCHAR_NAME;
          else
            //operands CHAR FOR BIT DATA(A) VARCHAR FOR BIT DATA(B)
            // and A+B>4000 then result is LONG VARCHAR FOR BIT DATA
            higherType = TypeId.LONGVARBIT_NAME;
        }
        break;

      case Types.CLOB:
      case Types.BLOB:
        //operands CHAR(A), CLOB(B) then result is CLOB(MIN(A+B,2G))
        //operands CHAR FOR BIT DATA(A), BLOB(B) then result is
        // BLOB(MIN(A+B,2G))
        resultLength = clobBlobHandling(rightType, leftType);
        break;
      }
    } else if (leftTypeId.getJDBCTypeId() == Types.VARCHAR) {
      switch (rightTypeId.getJDBCTypeId()) {
      case Types.CHAR: //operands CHAR(A) VARCHAR(B) and A+B>4000 then
               // result is LONG VARCHAR
      case Types.VARCHAR: //operands VARCHAR(A) VARCHAR(B) and A+B>4000
                // then result is LONG VARCHAR
        if (resultLength > Limits.DB2_CONCAT_VARCHAR_LENGTH)
          higherType = TypeId.LONGVARCHAR_NAME;
        break;

      case Types.CLOB:
        //operands VARCHAR(A), CLOB(B) then result is CLOB(MIN(A+B,2G))
        resultLength = clobBlobHandling(rightType, leftType);
        break;
      }
    } else if (leftTypeId.getJDBCTypeId() == Types.VARBINARY) {
      switch (rightTypeId.getJDBCTypeId()) {
      case Types.BINARY: //operands CHAR FOR BIT DATA(A) VARCHAR FOR BIT
                 // DATA(B) and A+B>4000 then result is LONG
                 // VARCHAR FOR BIT DATA
      case Types.VARBINARY://operands VARCHAR FOR BIT DATA(A) VARCHAR FOR
                 // BIT DATA(B) and A+B>4000 then result is LONG
                 // VARCHAR FOR BIT DATA
        if (resultLength > Limits.DB2_CONCAT_VARCHAR_LENGTH)
          higherType = TypeId.LONGVARBIT_NAME;
        break;

      case Types.BLOB:
        //operands VARCHAR FOR BIT DATA(A), BLOB(B) then result is
        // BLOB(MIN(A+B,2G))
        resultLength = clobBlobHandling(rightType, leftType);
        break;
      }
    } else if (leftTypeId.getJDBCTypeId() == Types.CLOB
        || leftTypeId.getJDBCTypeId() == Types.BLOB) {
      //operands CLOB(A), CHAR(B) then result is CLOB(MIN(A+B,2G))
      //operands CLOB(A), VARCHAR(B) then result is CLOB(MIN(A+B,2G))
      //operands CLOB(A), LONG VARCHAR then result is CLOB(MIN(A+32K,2G))
      //operands CLOB(A), CLOB(B) then result is CLOB(MIN(A+B,2G))
      //operands BLOB(A), CHAR FOR BIT DATA(B) then result is
      // BLOB(MIN(A+B,2G))
      //operands BLOB(A), VARCHAR FOR BIT DATA(B) then result is
      // BLOB(MIN(A+B,2G))
      //operands BLOB(A), LONG VARCHAR FOR BIT DATA then result is
      // BLOB(MIN(A+32K,2G))
      //operands BLOB(A), BLOB(B) then result is BLOB(MIN(A+B,2G))
      resultLength = clobBlobHandling(leftType, rightType);
    } else if (rightTypeId.getJDBCTypeId() == Types.CLOB
        || rightTypeId.getJDBCTypeId() == Types.BLOB) {
      //operands LONG VARCHAR, CLOB(A) then result is CLOB(MIN(A+32K,2G))
      //operands LONG VARCHAR FOR BIT DATA, BLOB(A) then result is
      // BLOB(MIN(A+32K,2G))
      resultLength = clobBlobHandling(rightType, leftType);
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.types.TypeId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.