Ejemplo n.º 1
0
  boolean resolvesDuplicateColumnReference(RangeVariable rangeVar) {

    if (tableName == null) {
      Expression e = rangeVar.getColumnExpression(columnName);

      if (e != null) {
        return false;
      }

      switch (rangeVar.rangeType) {
        case RangeVariable.PARAMETER_RANGE:
        case RangeVariable.VARIALBE_RANGE:
        case RangeVariable.TRANSITION_RANGE:
          return false;

        default:
          int colIndex = rangeVar.findColumn(schema, tableName, columnName);

          return colIndex != -1;
      }
    }

    return false;
  }
Ejemplo n.º 2
0
  private boolean resolveColumnReference(RangeVariable rangeVar) {

    Expression e = rangeVar.getColumnExpression(columnName);

    if (e != null) {
      opType = e.opType;
      nodes = e.nodes;
      dataType = e.dataType;

      return true;
    }

    int colIndex = rangeVar.findColumn(schema, tableName, columnName);

    if (colIndex == -1) {
      return false;
    }

    switch (rangeVar.rangeType) {
      case RangeVariable.PARAMETER_RANGE:
      case RangeVariable.VARIALBE_RANGE:
        {
          if (tableName != null) {
            return false;
          }

          ColumnSchema column = rangeVar.getColumn(colIndex);

          if (column.getParameterMode() == SchemaObject.ParameterModes.PARAM_OUT) {
            return false;
          } else {
            opType =
                rangeVar.rangeType == RangeVariable.VARIALBE_RANGE
                    ? OpTypes.VARIABLE
                    : OpTypes.PARAMETER;
          }

          break;
        }
      case RangeVariable.TRANSITION_RANGE:
        {
          if (tableName == null) {
            return false;
          }

          if (schema != null) {
            return false;
          }

          opType = OpTypes.TRANSITION_VARIABLE;

          break;
        }
      default:
        {
          break;
        }
    }

    setAttributesAsColumn(rangeVar, colIndex);

    return true;
  }