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?
使用复合类型INOUT参数的错误已修复: http : //forums.devart.com/viewtopic.php ?f=3&t= 36447 。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.