本文整理汇总了Java中org.voltdb.VoltTable.getActiveRowIndex方法的典型用法代码示例。如果您正苦于以下问题:Java VoltTable.getActiveRowIndex方法的具体用法?Java VoltTable.getActiveRowIndex怎么用?Java VoltTable.getActiveRowIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.voltdb.VoltTable
的用法示例。
在下文中一共展示了VoltTable.getActiveRowIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: storeTableInMap
import org.voltdb.VoltTable; //导入方法依赖的package包/类
/**
* Store
*
* @param map
* @param vt
*/
public static void storeTableInMap(final Map<String, Object[]> map, final VoltTable vt) {
assert (vt != null);
assert (map != null);
int num_rows = vt.getRowCount();
while (vt.advanceRow()) {
int row_idx = vt.getActiveRowIndex();
for (int i = 0, cnt = vt.getColumnCount(); i < cnt; i++) {
String col_name = vt.getColumnName(i);
VoltType vtype = vt.getColumnType(i);
if (row_idx == 0) {
map.put(col_name, new Object[num_rows]);
}
map.get(col_name)[row_idx] = vt.get(col_name, vtype);
} // FOR
} // WHILE
}
示例2: checkConstraints
import org.voltdb.VoltTable; //导入方法依赖的package包/类
private boolean checkConstraints(String procName, ClientResponse response) {
boolean isSatisfied = true;
int orig_position = -1;
// Check if all the tables in the result set satisfy the constraints.
for (int i = 0; isSatisfied && i < response.getResults().length; i++) {
Pair<String, Integer> key = Pair.of(procName, i);
if (!m_constraints.containsKey(key))
continue;
VoltTable table = response.getResults()[i];
orig_position = table.getActiveRowIndex();
table.resetRowPosition();
// Iterate through all rows and check if they satisfy the
// constraints.
while (isSatisfied && table.advanceRow()) {
isSatisfied = Verification.checkRow(m_constraints.get(key), table);
}
// Have to reset the position to its original position.
if (orig_position < 0)
table.resetRowPosition();
else
table.advanceToRow(orig_position);
}
if (!isSatisfied)
LOG.error("Transaction " + procName + " failed check");
return isSatisfied;
}