Description
Hi,
I am trying to call a function on tarantool which inserts given list into a space. Function looks like below, it gets list, loop over records and inserts into tester space.
When I call the function within tarantool like the following, it works as expected and inserts records into the space.
tarantool> lst = {{1,'Test',1}, {2, 'Test2', 2}}
tarantool> batch_insert_tester(lst)
When I try to call the function through the library, it fails with the following error.
System.AggregateException: 'One or more errors occurred. (Tarantool returns an error for request with id: 31, code: 0x00008020 and message: [string "function batch_insert_tester(list)..."]:4: attempt to index local 'record' (a number value). )'
ArgumentException: Tarantool returns an error for request with id: 31, code: 0x00008020 and message: [string "function batch_insert_tester(list)..."]:4: attempt to index local 'record' (a number value).
This is the code I have been using, as an input I am sending list of value tuples (tester space has 3 fields). How can I call a function with a list input like this?
using var tarantoolClient = await Box.Connect("...");
ValueTuple<int, string, int>[] test = new ValueTuple<int, string, int>[]
{
new ValueTuple<int, string, int>(4, "TEST4", 4),
new ValueTuple<int, string, int>(5, "TEST5", 5)
};
await tarantoolClient.Call("batch_insert_tester", test);
Here is the function defined on tarantool:
function batch_insert_tester(list)
box.begin()
for _, record in ipairs(list) do
box.space.tester:replace{record[1], record[2], record[3]}
end
box.commit()
end