Examples of TypeId


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

     * Standard.
     */
    private boolean unionCompatible( ValueNode left, ValueNode right )
        throws StandardException
    {
        TypeId leftTypeId = left.getTypeId();
        TypeId rightTypeId = right.getTypeId();
        ClassFactory cf = getClassFactory();

        if (
            !left.getTypeCompiler().storable(rightTypeId, cf) &&
            !right.getTypeCompiler().storable(leftTypeId, cf)
            )
        { return false; }

        if ( leftTypeId.isBooleanTypeId() != rightTypeId.isBooleanTypeId() ) { return false; }

        return true;
    }
View Full Code Here

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

      for (int index = 1; index <= numColumns; index++)
      {
        boolean nullableResult =
          (rsmd.isNullable(index) != ResultSetMetaData.columnNoNulls);

        TypeId cti;

        int jdbcColumnType = rsmd.getColumnType(index);

        switch (jdbcColumnType) {
        case Types.JAVA_OBJECT:
        case Types.OTHER:
        {
          cti = TypeId.getUserDefinedTypeId(rsmd.getColumnTypeName(index), false);
          break;
        }
        default:
        {
          cti = TypeId.getBuiltInTypeId(jdbcColumnType);
          break;
        }
        }

        // Handle the case where a VTI returns a bad column type
        if (cti == null)
        {
          throw StandardException.newException(SQLState.LANG_BAD_J_D_B_C_TYPE_INFO, Integer.toString(index));
        }

        // Get the maximum byte storage for this column
        int maxWidth;

        /* Get maximum byte storage from rsmd for variable
         * width types, set it to MAXINT for the long types,
         * otherwise get it from the TypeId
         */
        if (cti.variableLength())
        {
          maxWidth = rsmd.getColumnDisplaySize(index);
        }
        else if (jdbcColumnType == Types.LONGVARCHAR ||
             jdbcColumnType == Types.LONGVARBINARY)
        {
          maxWidth = Integer.MAX_VALUE;
        }
        else
        {
          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);
View Full Code Here

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

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

    */

    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

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

    **    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

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

    // 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

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

        // 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

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

                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

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

    {
      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

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

              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
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.