0

I have something like this in postgre:

create type "test_complex_rec" as (
                           num$ numeric,
                           str$ character varying
                           )

create or replace function "test_complex_fun"(INOUT params "test_complex_rec") as
                  $BODY$
                  begin
                    params.num$ := params.num$ + 1;
                    params.str$ := 'some result';
                  end;
                  $BODY$ LANGUAGE plpgsql

and c# code:

using (var q1 = new PgSqlCommand("test_complex_fun", connection) { CommandType = CommandType.StoredProcedure  })
{
      var rowType = PgSqlRowType.GetRowType("test_complex_rec", connection);

      var complexValue = new PgSqlRow(rowType);
      complexValue[0] = 3;
      complexValue[1] = "lala";

      var compositeParam = new PgSqlParameter("params", complexValue)
      {
         Direction = ParameterDirection.InputOutput
      };

      // add it manually
      //q1.Parameters.Add(compositeParam);

      // lets try describe from metadata
      q1.ParameterCheck = true;
      q1.Prepare();
      q1.Parameters[0].Value = complexValue;

     q1.ExecuteNonQuery(); // Anyway, we will get ArgumentOutOfRange
}

Executing last line will raise ArgumentOutOfRange.

An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in Devart.Data.dll
Additional information: The value for the output parameter 'params' is absent in the command execution result.

What is correct way to work with composite arguments? According to DBMonitor it will pass correct parameter (3, 'lala') to function, but how to retrieve 'out' value in c# code?

M.Y.Mnu
  • 718
  • 8
  • 22
garry
  • 25
  • 5
  • Thank you for your report. We have reproduced the issue and are investigating it. We will notify you about the result. – Devart Dec 12 '17 at 14:30

1 Answers1

0

The bug with using composite type INOUT parameter is fixed: http://forums.devart.com/viewtopic.php?f=3&t=36447.

Devart
  • 119,203
  • 23
  • 166
  • 186