Package org.apache.derby.iapi.types

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


  }


    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


    */

    public void bindComparisonOperator()
        throws StandardException
    {
        TypeId receiverType = receiver.getTypeId();
        TypeId leftType     = leftOperand.getTypeId();

        /*
        ** Check the type of the operands - this function is allowed only on
        ** string types.
        */

        if (!receiverType.isStringTypeId())
        {
            throw StandardException.newException(
                SQLState.LANG_LIKE_BAD_TYPE, receiverType.getSQLTypeName());
        }

        if (!leftType.isStringTypeId())
        {
            throw StandardException.newException(
                SQLState.LANG_LIKE_BAD_TYPE, leftType.getSQLTypeName());
        }

        if (rightOperand != null && ! rightOperand.getTypeId().isStringTypeId())
        {
            throw StandardException.newException(
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

    // String sqlTypeName = typeId == null ? "OTHER" : typeId.getSQLTypeName();


    String jdbcTypesName = org.apache.derby.impl.jdbc.Util.typeName(sqlType);

    TypeId typeId = TypeId.getBuiltInTypeId(jdbcTypeId);
    String thisTypeName = typeId == null ? declaredClassName : typeId.getSQLTypeName();
       
    StandardException e = StandardException.newException(SQLState.LANG_INVALID_OUT_PARAM_MAP,
          getJDBCParameterNumberStr(),
          jdbcTypesName, thisTypeName);
View Full Code Here

        // must have a void method for a procedure call.
        requiredType = "void";
      }
      else
      {
        TypeId returnTypeId = TypeId.getBuiltInTypeId(returnType.getJDBCTypeId());

        if (
            returnType.isRowMultiSet() &&
            ( routineInfo.getParameterStyle() == RoutineAliasInfo.PS_DERBY_JDBC_RESULT_SET )
        )
        {
            requiredType = ResultSet.class.getName();
        }
                else if ( returnType.getTypeId().userType() )
                {
                    requiredType = ((UserDefinedTypeIdImpl) returnType.getTypeId()).getClassName();
                }
        else
        {
           requiredType = returnTypeId.getCorrespondingJavaTypeName();

          if (!requiredType.equals(typeName)) {
            switch (returnType.getJDBCTypeId()) {
            case java.sql.Types.BOOLEAN:
            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:
              TypeCompiler tc = getTypeCompiler(returnTypeId);
              requiredType = tc.getCorrespondingPrimitiveTypeName();
              if (!routineInfo.calledOnNullInput() && routineInfo.getParameterCount() != 0)
              {
                promoteName = returnTypeId.getCorrespondingJavaTypeName();
              }
              break;
            }
          }
        }
View Full Code Here

                Integer.toString(count),
                Integer.toString(signature.length)); // too many types
          }

                  
          TypeId  paramTypeId = signature[count - 1].getSQLType().getTypeId();
                   
          // Does it match the object name
          if (type.equals(paramTypeId.getCorrespondingJavaTypeName()))
          {
            signatureTypes[count - 1] = type;
            continue;
          }
       
          // how about the primitive name
      if ((paramTypeId.isNumericTypeId() && !paramTypeId.isDecimalTypeId())
          || paramTypeId.isBooleanTypeId())
      {
        TypeCompiler tc = getTypeCompiler(paramTypeId);
        if (type.equals(tc.getCorrespondingPrimitiveTypeName()))
        {
               signatureTypes[count - 1] = type;
              continue;         
        }
      }
          throw StandardException.newException(SQLState.LANG_DATA_TYPE_GET_MISMATCH,
                type, paramTypeId.getSQLTypeName()); // type conversion error
        }
       
        // Did signature end with trailing comma?
        if (count != 0 && !seenClass)
          throw StandardException.newException(SQLState.SQLJ_SIGNATURE_INVALID); // invalid
View Full Code Here

    {
      switch( jsqlType.getCategory() )
      {
          case JSQLType.SQLTYPE:

          TypeId  ctid = mapToTypeID( jsqlType );

          if ( ctid == null ) { return null; }
          else {
            // DB2 LUW does not support Java object types for SMALLINT, INTEGER, BIGINT, REAL, DOUBLE
            // and these are the only types that can map to a primitive or an object type according
            // to SQL part 13. So always map to the primitive type. We can not use the getPrimitiveSignature()
            // as it (incorrectly but historically always has) maps a DECIMAL to a double.

            switch (ctid.getJDBCTypeId()) {
            case java.sql.Types.BOOLEAN:
            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:
              if (routineInfo != null) {
                TypeCompiler tc = getTypeCompiler(ctid);
                return tc.getCorrespondingPrimitiveTypeName();
              }
              // fall through
            default:
              return ctid.getCorrespondingJavaTypeName();
            }
          }

            case JSQLType.JAVA_CLASS: return jsqlType.getJavaClassName();
View Full Code Here

              primParmTypeNames[i] = procedurePrimitiveArrayType[i];

            } else {


              TypeId  ctid = mapToTypeID( jsqlType );

              if ((ctid.isNumericTypeId() && !ctid.isDecimalTypeId()) || ctid.isBooleanTypeId())
              {
                TypeCompiler tc = getTypeCompiler(ctid);
                primParmTypeNames[i] = tc.getCorrespondingPrimitiveTypeName();
                if ( castToPrimitiveAsNecessary) { methodParms[i].castToPrimitive(true); }
              }
              else { primParmTypeNames[i] = ctid.getCorrespondingJavaTypeName(); }
            }

            break;

                case JSQLType.JAVA_CLASS:
View Full Code Here

                getNodeFactory().doJoinOrderOptimization(),
                getContextManager()),
              (SubqueryList) null,
              (Vector) null);

      TypeId columnTypeId = getType().getTypeId();
      TypeId defaultTypeId = defaultTree.getTypeId();

      // Check for 'invalid default' errors (42894)
      // before checking for 'not storable' errors (42821).
      if (!defaultTypeIsValid(columnTypeId, getType(),
          defaultTypeId, defaultTree, defaultNode.getDefaultText()))
      {
          throw StandardException.newException(
            SQLState.LANG_DB2_INVALID_DEFAULT_VALUE,
            this.name);
      }

      // Now check 'not storable' errors.
      if (! getTypeCompiler(columnTypeId).
                storable(defaultTypeId, getClassFactory()))
      {
        throw StandardException.newException(SQLState.LANG_NOT_STORABLE,
          columnTypeId.getSQLTypeName(),
          defaultTypeId.getSQLTypeName() );
      }

      // Save off the default text
      // RESOLVEDEFAULT - Convert to constant if possible
      defaultInfo = new DefaultInfoImpl(false,
View Full Code Here

      ** 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.  We want to make sure that
      ** the types are assignable in either direction
      ** and they are comparable.
      */
      ClassFactory cf = getClassFactory();
      if (
        !thisExpr.getTypeCompiler().storable(otherTypeId, cf) &&
        !otherExpr.getTypeCompiler().storable(thisTypeId, cf))
      {
        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

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.