示例#1
0
  private boolean shouldIncludeParameter(
      final Routine sp, final RoutineColumn<? extends Routine> parameter) {
    boolean should = true;

    if (m_options.m_ignoreReturnParameterOnProcedure) {
      final boolean isFunction = sp.getRoutineType() == RoutineType.function;

      if (!isFunction) {
        final RoutineColumnType columnType = parameter.getColumnType();
        if (columnType instanceof ProcedureColumnType
            && (ProcedureColumnType) columnType == ProcedureColumnType.returnValue) {
          should = false;
        }
      }
    }

    return should;
  }
示例#2
0
  private Element createParameterElement(
      final Document dom, final RoutineColumn<? extends Routine> parameter) {
    final Element eParameter = dom.createElement("parameter");

    final String parameterName = getPhysicalName(parameter.getName());
    eParameter.setAttribute("name", getLogicalName(parameterName));
    eParameter.setAttribute("physicalname", parameterName);

    setColumnTypeAttributes(eParameter, parameter, "stored procedure");

    String direction = null;

    final RoutineColumnType columnType = parameter.getColumnType();
    if (columnType instanceof FunctionColumnType) {
      switch ((FunctionColumnType) columnType) {
        case unknown: // default to in
        case in:
          {
            direction = "in";
            break;
          }

        case inOut:
          {
            direction = "inout";
            break;
          }

        case out:
          {
            direction = "out";
            break;
          }

        case returnValue:
          {
            direction = "return";
            break;
          }

        case result:
          {
            direction = "result";
            break;
          }
      }
    } else if (columnType instanceof ProcedureColumnType) {
      switch ((ProcedureColumnType) columnType) {
        case unknown: // default to in
        case in:
          {
            direction = "in";
            break;
          }

        case inOut:
          {
            direction = "inout";
            break;
          }

        case out:
          {
            direction = "out";
            break;
          }

        case returnValue:
          {
            direction = "return";
            break;
          }

        case result:
          {
            direction = "result";
            break;
          }
      }
    } else {
      ThreadContext.assertFault(
          false,
          "Unknown proc columnType [%s] [%s] [%s]",
          parameterName,
          columnType,
          columnType.getClass());
    }

    if (direction != null) {
      eParameter.setAttribute("direction", direction);
    }

    return eParameter;
  }