" WHERE custid = ?"
);
public VoltTable run(long acctId) {
voltQueueSQL(GetAccount, acctId);
VoltTable results[] = voltExecuteSQL();
if (results[0].getRowCount() != 1) {
String msg = "Invalid account '" + acctId + "'";
throw new VoltAbortException(msg);
}
// long acctId = results[0].asScalarLong();
voltQueueSQL(GetSavingsBalance, acctId);
voltQueueSQL(GetCheckingBalance, acctId);
results = voltExecuteSQL(true);
if (results[0].getRowCount() != 1) {
String msg = String.format("No %s for customer #%d",
SmallBankConstants.TABLENAME_SAVINGS,
acctId);
throw new VoltAbortException(msg);
}
if (results[1].getRowCount() != 1) {
String msg = String.format("No %s for customer #%d",
SmallBankConstants.TABLENAME_CHECKING,
acctId);
throw new VoltAbortException(msg);
}
results[0].advanceRow();
results[1].advanceRow();
double total = results[0].getDouble(0) + results[1].getDouble(0);
final VoltTable finalResult = new VoltTable(RESULT_COLS);
finalResult.addRow(total);
return (finalResult);
}