Examples of TypeId


Examples of com.akiban.sql.types.TypeId

     */
    public void init(Object arg1) throws StandardException {
        int precision = 0, scal = 0, maxwidth = 0;
        Boolean isNullable;
        boolean valueInP; // value in Predicate-- if TRUE a value was passed in
        TypeId typeId = null;
        int typeid = 0;

        if (arg1 instanceof TypeId) {
            typeId = (TypeId)arg1;
            isNullable = Boolean.TRUE;
View Full Code Here

Examples of com.foundationdb.sql.types.TypeId

                       Boolean.TRUE,
                       DataTypeDescriptor.MAXIMUM_WIDTH_UNKNOWN);
        }
        else {
            Integer maxWidth = null;
            TypeId typeId = null;

            if (arg1 instanceof Date) {
                maxWidth = TypeId.DATE_MAXWIDTH;
                typeId = TypeId.getBuiltInTypeId(Types.DATE);
            }
View Full Code Here

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

                        int judgeUserJDBCTypeId)
                    throws StandardException
  {
    DataValueDescriptor judge;
    if (judgeUserJDBCTypeId == -1)
      judge = (DataValueDescriptor) new TypeId(judgeTypeFormatId, null).getNull();
    else
      judge = (DataValueDescriptor) new TypeId(judgeTypeFormatId, new UserDefinedTypeIdImpl()).getNull();
     
    DataValueDescriptor minVal = v1;
    if (v2 != null && judge.lessThan(v2, minVal).equals(true))
      minVal = v2;
    if (v3 != null && judge.lessThan(v3, minVal).equals(true))
View Full Code Here

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

                        int judgeUserJDBCTypeId)
                    throws StandardException
  {
    DataValueDescriptor judge;
    if (judgeUserJDBCTypeId == -1)
      judge =  new TypeId(judgeTypeFormatId, null).getNull();
    else
      judge =  new TypeId(judgeTypeFormatId, new UserDefinedTypeIdImpl()).getNull();

    DataValueDescriptor maxVal = v1;
    if (v2 != null && judge.greaterThan(v2, maxVal).equals(true))
      maxVal = v2;
    if (v3 != null && judge.greaterThan(v3, maxVal).equals(true))
View Full Code Here

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

   */

  private ValueNode trimBind()
      throws StandardException
  {
    TypeId  receiverType;
    TypeId  resultType = TypeId.getBuiltInTypeId(Types.VARCHAR);

    // handle parameters here

    /* Is there a ? parameter for the receiver? */
    if (receiver.requiresTypeFromContext())
    {
      /*
      ** According to the SQL standard, if trim has a ? receiver,
      ** its type is varchar with the implementation-defined maximum length
      ** for a varchar.
      */
 
      receiver.setType(getVarcharDescriptor());
            //check if this parameter can pick up it's collation from the
      //character that will be used for trimming. If not(meaning the
      //character to be trimmed is also a parameter), then it will take
      //it's collation from the compilation schema.
            if (!leftOperand.requiresTypeFromContext()) {
              receiver.getTypeServices().setCollationDerivation(
                  leftOperand.getTypeServices().getCollationDerivation());
              receiver.getTypeServices().setCollationType(
                  leftOperand.getTypeServices().getCollationType());
            } else {
          receiver.setCollationUsingCompilationSchema(
              StringDataValue.COLLATION_DERIVATION_IMPLICIT);             
            }
    }

    /* Is there a ? parameter on the left? */
    if (leftOperand.requiresTypeFromContext())
    {
      /* Set the left operand type to varchar. */
      leftOperand.setType(getVarcharDescriptor());
      //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 ? for the character that needs to be used for trimming.
      leftOperand.getTypeServices().setCollationDerivation(
          receiver.getTypeServices().getCollationDerivation());
      leftOperand.getTypeServices().setCollationType(
              receiver.getTypeServices().getCollationType());             
    }

    bindToBuiltIn();

    /*
    ** Check the type of the receiver - this function is allowed only on
    ** string value types. 
    */
    receiverType = receiver.getTypeId();
    if (receiverType.userType())
      throwBadType("trim", receiverType.getSQLTypeName());

    receiver = castArgToString(receiver);

    if (receiverType.getTypeFormatId() == StoredFormatIds.CLOB_TYPE_ID) {
    // special case for CLOBs: if we start with a CLOB, we have to get
    // a CLOB as a result (as opposed to a VARCHAR), because we can have a
    // CLOB that is beyond the max length of VARCHAR (ex. "clob(100k)").
    // This is okay because CLOBs, like VARCHARs, allow variable-length
    // values (which is a must for the trim to actually work).
      resultType = receiverType;
    }

    /*
    ** Check the type of the leftOperand (trimSet).
    ** The leftOperand should be a string value type. 
    */
    TypeId  leftCTI;
    leftCTI = leftOperand.getTypeId();
    if (leftCTI.userType())
      throwBadType("trim", leftCTI.getSQLTypeName());

    leftOperand = castArgToString(leftOperand);

    /*
    ** The result type of trim is varchar.
View Full Code Here

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

   * @exception StandardException    Thrown on error
   */

  public ValueNode locateBind() throws StandardException
  {
    TypeId  firstOperandType, secondOperandType, offsetType;

    /*
     * Is there a ? parameter for the first arg.  Copy the
     * left/firstOperand's.  If the left/firstOperand are both parameters,
     * both will be max length.
     */
    if( receiver.requiresTypeFromContext())
    {
      if( leftOperand.requiresTypeFromContext())
      {
        receiver.setType(getVarcharDescriptor());
              //Since both receiver and leftOperands are parameters, use the
        //collation of compilation schema for receiver.
        receiver.setCollationUsingCompilationSchema(
            StringDataValue.COLLATION_DERIVATION_IMPLICIT);             
      }
      else
      {
        if( leftOperand.getTypeId().isStringTypeId() )
        {
          //Since the leftOperand is not a parameter, receiver will
          //get it's collation from leftOperand through following
          //setType method
          receiver.setType(
                       leftOperand.getTypeServices());
        }
      }
    }
                                         
    /*
     * Is there a ? parameter for the second arg.  Copy the receiver's.
     * If the receiver are both parameters, both will be max length.
     */
    if(leftOperand.requiresTypeFromContext())
    {
      if(receiver.requiresTypeFromContext())
      {
        leftOperand.setType(getVarcharDescriptor());
      }
      else
      {
        if( receiver.getTypeId().isStringTypeId() )
        {
          leftOperand.setType(
                       receiver.getTypeServices());
        }
      }
      //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 this ?
      leftOperand.getTypeServices().setCollationDerivation(
          receiver.getTypeServices().getCollationDerivation());
      leftOperand.getTypeServices().setCollationType(
              receiver.getTypeServices().getCollationType());             
    }

    /*
     * Is there a ? paramter for the third arg.  It will be an int.
     */
    if( rightOperand.requiresTypeFromContext())
    {
      rightOperand.setType(
        new DataTypeDescriptor(TypeId.INTEGER_ID, true));
    }

    bindToBuiltIn();

    /*
    ** Check the type of the operand - this function is allowed only
    ** for: receiver = CHAR
    **      firstOperand = CHAR
    **      secondOperand = INT
    */
    secondOperandType = leftOperand.getTypeId();
    offsetType = rightOperand.getTypeId();
    firstOperandType = receiver.getTypeId();

    if (!firstOperandType.isStringTypeId() ||
      !secondOperandType.isStringTypeId() ||
      offsetType.getJDBCTypeId() != Types.INTEGER)
      throw StandardException.newException(SQLState.LANG_DB2_FUNCTION_INCOMPATIBLE,
          "LOCATE", "FUNCTION");

View Full Code Here

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

   */

   public ValueNode substrBind()
      throws StandardException
  {
    TypeId  receiverType;
    TypeId  resultType = TypeId.getBuiltInTypeId(Types.VARCHAR);

    // handle parameters here

    /* Is there a ? parameter for the receiver? */
    if (receiver.requiresTypeFromContext())
View Full Code Here

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

        throw StandardException.newException(SQLState.LANG_COLUMN_NOT_FOUND_IN_TABLE,
                              columnNames[i],
                              tableName);
      }

      TypeId typeId = columnDescriptor.getType().getTypeId();

      // Don't allow a column to be created on a non-orderable type
      ClassFactory cf = lcc.getLanguageConnectionFactory().getClassFactory();
      boolean isIndexable = typeId.orderable(cf);

      if (isIndexable && typeId.userType()) {
        String userClass = typeId.getCorrespondingJavaTypeName();

        // Don't allow indexes to be created on classes that
        // are loaded from the database. This is because recovery
        // won't be able to see the class and it will need it to
        // run the compare method.
        try {
          if (cf.isApplicationClass(cf.loadApplicationClass(userClass)))
            isIndexable = false;
        } catch (ClassNotFoundException cnfe) {
          // shouldn't happen as we just check the class is orderable
          isIndexable = false;
        }
      }

      if (!isIndexable) {
        throw StandardException.newException(SQLState.LANG_COLUMN_NOT_ORDERABLE_DURING_EXECUTION,
          typeId.getSQLTypeName());
      }

      // Remember the position in the base table of each column
      baseColumnPositions[i] = columnDescriptor.getPosition();
View Full Code Here

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

     * @return Object representing the column.
     */
    static SystemColumn getJavaColumn(String name, String javaClassName,
            boolean nullability) {

        TypeId typeId = TypeId.getUserDefinedTypeId(javaClassName, false);

        DataTypeDescriptor dtd = new DataTypeDescriptor(typeId, nullability);
        return new SystemColumnImpl(name, dtd);
    }
View Full Code Here

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

      ** get the type of the first non-? in its column, so it can't
      ** affect the final dominant type.  It's possible that all the
      ** rows for a particular column will have ? parameters - this is
      ** an error condition that will be caught later.
      */
      TypeId thisTypeId = thisExpr.getTypeId();
      if (thisTypeId == null)
        continue;

      TypeId otherTypeId = otherExpr.getTypeId();
      if (otherTypeId == null)
        continue;

      /*
      ** Check type compatability.
      */
      ClassFactory cf = getClassFactory();
      if ( !unionCompatible( thisExpr, otherExpr ) )
      {
        throw StandardException.newException(SQLState.LANG_NOT_UNION_COMPATIBLE,
                                                     thisTypeId.getSQLTypeName(),
                                                     otherTypeId.getSQLTypeName(),
                                                     operatorName);
      }

      DataTypeDescriptor resultType = thisExpr.getTypeServices().getDominantType(
                        otherExpr.getTypeServices(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.