/**
   * Some prepared statements return multiple results; the execute method handles these complex
   * statements as well as the simpler form of statements handled by executeQuery and executeUpdate.
   *
   * @exception SQLException if a database-access error occurs.
   * @see Statement#execute
   */
  public boolean execute(Tds tds) throws SQLException {
    //
    // TDS can handle prepared statements by creating a temporary
    // procedure.  Since procedure must have the datatype specified
    // in the procedure declaration we will have to defer creating
    // the actual procedure until the statement is executed.  By
    // that time we know all the types of all of the parameters.
    //

    Procedure procedure = null;
    boolean result = false;

    // SAfe No need for this either. We'll have to consume all input, nut
    //      just the last ResultSet (if one exists).
    //        closeResults(false);
    // SAfe No need for this. getMoreResults sets it to -1 at start, anyway
    //        updateCount = -2;

    // First make sure the caller has filled in all the parameters.
    ParameterUtils.verifyThatParametersAreSet(parameterList);

    // Find a stored procedure that is compatible with this set of parameters if one exists.
    procedure = findCompatibleStoredProcedure(tds, rawQueryString);
    // now look in tds

    // if we don't have a suitable match then create a new temporary stored procedure
    if (procedure == null) {
      // Create the stored procedure
      procedure = new Procedure(rawQueryString, tds.getUniqueProcedureName(), parameterList, tds);

      // SAfe Submit it to the SQL Server before adding it to the cache or procedures of transaction
      // list.
      //      Otherwise, if submitProcedure fails (e.g. because of a syntax error) it will be in our
      // procedure
      //      cache, but not on the server.
      submitProcedure(tds, procedure);

      // store it in the procedureCache
      tds.procedureCache.put(rawQueryString, procedure);

      // MJH Only record the proc name in proceduresOfTra if in manual commit mode
      if (!getConnection().getAutoCommit()) // MJH
      tds.proceduresOfTra.add(procedure);
    }

    result =
        internalExecuteCall(
            procedure.getProcedureName(),
            procedure.getParameterList(),
            parameterList,
            tds,
            warningChain);

    return result;
  }
  /**
   * Some prepared statements return multiple results; the execute method handles these complex
   * statements as well as the simpler form of statements handled by executeQuery and executeUpdate.
   *
   * @exception SQLException if a database-access error occurs.
   * @see Statement#execute
   */
  public boolean execute(Tds tds) throws SQLException {
    //
    // TDS can handle prepared statements by creating a temporary
    // procedure.  Since procedure must have the datatype specified
    // in the procedure declaration we will have to defer creating
    // the actual procedure until the statement is executed.  By
    // that time we know all the types of all of the parameters.
    //

    Procedure procedure = null;
    boolean result = false;

    closeResults();
    updateCount = -2;

    // First make sure the caller has filled in all the parameters.
    ParameterUtils.verifyThatParametersAreSet(parameterList);

    // Find a stored procedure that is compatible with this set of
    // parameters if one exists.
    procedure = findCompatibleStoredProcedure(tds, rawQueryString);
    // now look in tds

    // if we don't have a suitable match then create a new
    // temporary stored procedure
    if (procedure == null) {
      // create the stored procedure
      procedure = new Procedure(rawQueryString, tds.getUniqueProcedureName(), parameterList, tds);

      // store it in the procedureCache
      // procedureCache.addElement(procedure);
      // store it in the procedureCache
      tds.procedureCache.put(rawQueryString, procedure);
      tds.proceduresOfTra.add(procedure);

      // create it on the SQLServer.
      submitProcedure(tds, procedure);
    }
    result =
        executeCall(
            tds,
            procedure.getProcedureName(),
            procedure.getParameterList(),
            // formal params
            parameterList);
    // actual params

    return result;
  }
 private void submitProcedure(Tds tds, Procedure proc) throws SQLException {
   String sql = proc.getPreparedSqlString();
   tds.submitProcedure(sql, warningChain);
 }