I would like to know if it is possible to execute a store function using NpgsqlBatch having NpgsqlBatchCommand with parameter?
I am using Npgsql 8.0.4
Basically, it tried the following:
sql = $"SELECT {FunctionName}($1, $2)";
foreach (var value in values)
{
var cmd = new NpgsqlBatchCommand(sql)
{
Parameters =
{
new NpgsqlParameter {NpgsqlDbType = NpgsqlDbType.someType, Value = value.Item1},
new NpgsqlParameter {NpgsqlDbType = NpgsqlDbType.someType2, Value = value.Item2)},
}
};
batch.BatchCommands.Add(cmd);
}
batch.Prepare();
var reader = batch.ExecuteReader();
but the reader is empty.
I made it worked for function inserting but not on function selecting
Any ideas?