Package org.apache.derby.iapi.types

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


    int          position = 1;

    for (int index = 0; index < columnCount; index++)
    {
        ResultColumn rc = (ResultColumn) elementAt(index);
      DataTypeDescriptor dataType = rc.getTypeServices();
      DataValueDescriptor dataValue = dataType.getNull();

      row.setColumn( position++, dataValue );
    }

    return  row;
View Full Code Here


    ExecRow row = getExecutionFactory().getValueRow(baseCols.length + 1);

    for (int i = 0; i < baseCols.length; i++)
    {
      ColumnDescriptor coldes = td.getColumnDescriptor(baseCols[i]);
      DataTypeDescriptor dataType = coldes.getType();

      // rc = getResultColumn(baseCols[i]);
        // rc = (ResultColumn) at(baseCols[i] - 1);
      // dataType = rc.getTypeServices();
      DataValueDescriptor dataValue = dataType.getNull();

      row.setColumn(i + 1, dataValue );
    }

    RowLocation rlTemplate = scc.newRowLocationTemplate();
View Full Code Here

    for (int index = 0; index < size; index++)
    {
      ResultColumn resultColumn = (ResultColumn) elementAt(index);

      /* dts = resultColumn.getExpression().getTypeServices(); */
      DataTypeDescriptor dts = resultColumn.getTypeServices();

      /* Vectors are 0-based, VirtualColumnIds are 1-based */
      resultColumn.expression = (ValueNode) getNodeFactory().getNode(
              C_NodeTypes.VIRTUAL_COLUMN_NODE,
              sourceResultSet,
View Full Code Here

                                                     thisTypeId.getSQLTypeName(),
                                                     otherTypeId.getSQLTypeName(),
                                                     operatorName);
      }

      DataTypeDescriptor resultType = thisExpr.getTypeServices().getDominantType(
                        otherExpr.getTypeServices(),
                        cf);

      newCR = (ColumnReference) getNodeFactory().getNode(
                    C_NodeTypes.COLUMN_REFERENCE,
View Full Code Here

    int size = size();
    for (int index = 0; index < size; index++)
      {
        ResultColumn  rc = (ResultColumn) elementAt(index);
        ValueNode     expr = rc.getExpression();
        DataTypeDescriptor rcDTS = rc.getTypeServices();
        DataTypeDescriptor exDTS = expr.getTypeServices();

        if (rcDTS == null || exDTS == null)
        {
          isConsistent = false;
          break;
        }

        if (rcDTS.getClass().getName() !=
          exDTS.getClass().getName())
        {
          isConsistent = false;
          break;
        }
      }
View Full Code Here

          maxWidth = 0;
        }

        int precision = cti.isDecimalTypeId() ? rsmd.getPrecision(index) : 0;
        int scale = cti.isDecimalTypeId() ? rsmd.getScale(index) : 0;
        DataTypeDescriptor dts = new DataTypeDescriptor(cti,
                      precision,
                      scale,
                      nullableResult,
                      maxWidth);
        addColumn( tableName, rsmd.getColumnName(index), dts );
View Full Code Here

    }
  }


    private static boolean streamableType(ResultColumn rc) {
        DataTypeDescriptor dtd = rc.getType();
        TypeId s = TypeId.getBuiltInTypeId(dtd.getTypeName());

        if (s != null) {
            return s.streamStorable();
        } else {
            return false;
View Full Code Here

        *  the left, since it won't match if it is any longer than it.
        */
        if (receiver.requiresTypeFromContext())
        {
            receiver.setType(
                new DataTypeDescriptor(
                    TypeId.getBuiltInTypeId(Types.VARCHAR), true));
            //check if this parameter can pick up it's collation from pattern
            //or escape clauses in that order. If not, then it will take it's
            //collation from the compilation schema.
            if (!leftOperand.requiresTypeFromContext()) {
                receiver.setCollationInfo(leftOperand.getTypeServices());

            } else if (rightOperand != null && !rightOperand.requiresTypeFromContext()) {
                receiver.setCollationInfo(rightOperand.getTypeServices());           
            } else {
          receiver.setCollationUsingCompilationSchema();             
            }
        }

        /*
         *  Is there a ? parameter for the PATTERN of LIKE? ie. "column like ?"
         * 
         *  Copy from the receiver -- legal if both are parameters,
         *  both will be max length.
         *  REMIND: should nullability be copied, or set to true?
         */
        if (leftOperand.requiresTypeFromContext())
        {
            /*
            * Set the pattern to the type of the left parameter, if
            * the left is a string, otherwise set it to be VARCHAR.
            */
            if (receiver.getTypeId().isStringTypeId())
            {
                leftOperand.setType(receiver.getTypeServices());
            }
            else
            {
                leftOperand.setType(
                    new DataTypeDescriptor(
                        TypeId.getBuiltInTypeId(Types.VARCHAR), true));
            }
      //collation of ? operand should be picked up from the context.
            //By the time we come here, receiver will have correct collation
            //set on it and hence we can rely on it to get correct collation
            //for the other ? in LIKE clause
            leftOperand.setCollationInfo(receiver.getTypeServices());           
        }

        /*
         *  Is there a ? parameter for the ESCAPE of LIKE?
         *  Copy from the receiver -- legal if both are parameters,
         *  both will be max length.  nullability is set to true.
         */

        if (rightOperand != null && rightOperand.requiresTypeFromContext())
        {
            /*
             * Set the pattern to the type of the left parameter, if
             * the left is a string, otherwise set it to be VARCHAR.
             */
            if (receiver.getTypeId().isStringTypeId())
            {
                rightOperand.setType(receiver.getTypeServices());
            }
            else
            {
                rightOperand.setType(
                    new DataTypeDescriptor(
                        TypeId.getBuiltInTypeId(Types.VARCHAR), true));
            }
      //collation of ? operand should be picked up from the context.
            //By the time we come here, receiver will have correct collation
            //set on it and hence we can rely on it to get correct collation
View Full Code Here

        if (rightOperand != null)
        {
            nullableResult |= rightOperand.getTypeServices().isNullable();
        }

        setType(new DataTypeDescriptor(TypeId.BOOLEAN_ID, nullableResult));
    }
View Full Code Here

    **
    **    CREATE TRIGGER ... INSERT INTO T length(Column), ...
      **
      */

    DataTypeDescriptor  dts     = colDesc.getType();
    TypeId              typeId  = dts.getTypeId();

      if (!typeId.isXMLTypeId())
      {

          StringBuffer methodCall = new StringBuffer();
          methodCall.append(
              "CAST (org.apache.derby.iapi.db.Factory::getTriggerExecutionContext().");
          methodCall.append(isOldTable ? "getOldRow()" : "getNewRow()");
          methodCall.append(".getObject(");
          methodCall.append(colPositionInRuntimeResultSet);
          methodCall.append(") AS ");

          /*
          ** getSQLString() returns <typeName>
          ** for user types, so call getSQLTypeName in that
          ** case.
          */
          methodCall.append(
              (typeId.userType() ?
                   typeId.getSQLTypeName() : dts.getSQLstring()));
         
          methodCall.append(") ");

          return methodCall.toString();
      }
View Full Code Here

TOP

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

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.