The primary representation of a result set (of tuples) or a temporary table in VoltDB. VoltTable has arbitrary schema, is serializable, and is used from within Stored Procedures and from the client library.
Given a VoltTable, individual rows can be accessed via the {@link #fetchRow(int)}method. This method returns a {@link VoltTableRow} instance with position set tothe specified row. See VoltTableRow for further information on accessing individual column data within a row.
Like a {@link VoltTableRow}, a VoltTable has a current position within its rows. This is because VoltTable is a subclass of VoltTableRow. This allows for easy sequential access of data. Example:
while (table.advanceRow()) {
System.out.println(table.getLong(7));
}
VoltTables can be constructed on the fly. This can help generate cleaner result sets from stored procedures, or more manageable parameters to them. Example:
VoltTable t = new VoltTable(
new VoltTable.ColumnInfo("col1", VoltType.BIGINT),
new VoltTable.ColumnInfo("col2", VoltType.STRING));
t.addRow(15, "sampleString");
t.addRow(-9, "moreData");
|
|