Forum: Building VoltDB Applications

Post: Is this possible?

Is this possible?
francis
Jul 26, 2012
I'm having a hard time finding ways to make this code work as expected, forgive me as this is incomplete.
At this point, I am trying to get content from one table (locks) that links to another table (lock_conditions) with a one to many relationship. I need to return this to the application.
When calling the procedure, we sometimes don't have the lockID, but have the ID of the content that we want to retrieve a lock from. We need to get the lockID (and that lock info) which is easily doable, but I need to append the lock conditions to that
Here is the code I have so far:

public VoltTable[] run( String contentType, long contentID ) throws VoltAbortException { voltQueueSQL(mainStmt, contentType, contentID); VoltTable[] lockInfo = voltExecuteSQL(); long lockID = lockInfo[0].fetchRow(0).getLong(0); voltQueueSQL(propertiesStmt, lockID); lockInfo = voltExecuteSQL(true); return lockInfo; } Clearly that doesn't work. But how do I append the VoltTable results to an existing VoltTable? I can't find documentation on ways to add to an existing VoltTable variable or even adding a column to that existing lockInfo.
It would be nice to have some documentation on these kinds of types, I couldn't really find it and have found myself struggling to figure out the methods available for the various types in VoltDB, including TimestampType, which I had to get the source code to figure it out.
Hi Francis, Let me try to
jpiekos
Jul 30, 2012
Hi Francis,
Let me try to re-phrase what I think you want to do: you'd like to either create your own VoltTable object, or perhaps augment an existing VoltTable object (one that VoltDB created)?
If so, check out the javadoc for VoltTable, found in the doc directory of your VoltDB installation. In particular, see page voltdb-2.8/doc/javadoc/procedure-api/org/voltdb/VoltTable.html That page shows how you can create your own VoltTable object.
I suspect you might want to have your stored procedure 1) return multiple tables to the caller, or 2) merge the results of two SQL satements (two VoltTables) together in some manner?
If I have it wrong, please clarify.
Thanks,
John
Thanks John. That was exactly
francis
Aug 8, 2012
Thanks John. That was exactly it, I'll have a look at that. In the above example I'd like to manually merge two results together.