Forum: Building VoltDB Applications

Post: Issue: Voltjs Stored Proc returning multiple tables

Issue: Voltjs Stored Proc returning multiple tables
theschmitzer
Feb 12, 2013
The voltjs NPM package appears to have an issue. When a stored procedure returns multiple tables, the result.tables contains only one.

Souce code from NPM package:

QueryMessage = function(buffer) {
  Message.call(this, buffer);
// cut out some
  if(this.fieldsPresent & PRESENT.EXCEPTION) {
    this.exception = this.readException(1);
    // seems size doesn't matter, always 1
  } else {
    // don't parse the rest if there was an exception. Bad material there.
    var resultCount = this.readShort();
    if(resultCount != 0)
      resultCount = 1;
    // there can be more than one table with rows
    this.table = new Array(resultCount);
    for(var i = 0; i < resultCount; i++) {
      this.table = this.readVoltTable();
    }
  }


line 125-126 (resetting result count) appears to be the offenders. Not sure what purpose they serve, but commenting them out fixes this issue.

Note, I didn't open a github issue, because the source there is dramatically different than from NPM.