Forum: Building VoltDB Applications

Post: Call Stored with Array

Call Stored with Array
faster2b
May 16, 2011
Hello,
i have write a stored for insert data,
i will insert multiple row on one call, this is possible?
i have write this:
public VoltTable[] run(String[][] idPoolsArray) throws VoltAbortException
but when i compile the project i obtain this error:
904 [main] ERROR COMPILER - Failed to compile XML
904 [main] ERROR COMPILER - Procedure: insertIdPools has a parameter with invalid type: String[]
904 [main] ERROR COMPILER - Catalog compilation failed.
i will insert 1000 row on 1 call.
Many thanks!
Yes, this is possible.
jhugg
May 16, 2011
The Java classes that represent VoltDB stored procedures must be a bit special. Since the invocations and results are type-checked and marshaled by VoltDB, there are certain restrictions on the types that can be passed as parameters or returned from a procedure's run(..) method. The parameters have to be generic enough that VoltDB procedures can be called from many languages with minimal serialization expense.
Currently, we support byte, Byte, short, Short, int, Integer, long, Long, double, Double, Date, String, BigDecimal and VoltTable. You can pass in scalars or single-dimensional arrays of these types.
In your case, where you want to insert many rows, creating a VoltTable instance on the client and passing it to a procedure may be the best option.
This information is available in our Wire Protocol document, but I couldn't find it in the Using VoltDB document. We've added a todo to improve the Using VoltDB document with more specifics on this limitation.
I have implode de values in a
faster2b
May 17, 2011
The Java classes that represent VoltDB stored procedures must be a bit special. Since the invocations and results are type-checked and marshaled by VoltDB, there are certain restrictions on the types that can be passed as parameters or returned from a procedure's run(..) method. The parameters have to be generic enough that VoltDB procedures can be called from many languages with minimal serialization expense.
Currently, we support byte, Byte, short, Short, int, Integer, long, Long, double, Double, Date, String, BigDecimal and VoltTable. You can pass in scalars or single-dimensional arrays of these types.
In your case, where you want to insert many rows, creating a VoltTable instance on the client and passing it to a procedure may be the best option.
This information is available in our http://www.voltdb.com/community/documentation.php

[TD="class: xl67, width: 658"]


but I couldn't find it in the Using VoltDB document. We've added a todo to improve the Using VoltDB document with more specifics on this limitation.


I have implode de values in a string (csv format 1,2,3;4,5,6; etc..) and send with a string format, in the stored procedure with a split
i have recreated the array.
This work fine.
Now i test with create a VoltTable.
Thank you for your support.