Json::Value generateRowsJsonT(const T& table, const size_t transmitLimit) {
  hyrise::storage::type_switch<hyrise_basic_types> ts;
  json_functor<T> fun(table);
  Json::Value rows(Json::arrayValue);
  for (size_t row = 0; row < table->size(); ++row) {

    fun.row = row;
    Json::Value json_row(Json::arrayValue);
    for (size_t col = 0; col < table->columnCount(); ++col) {
      fun.column = col;
      json_row.append(ts(table->typeOfColumn(col), fun));
    }
    rows.append(json_row);

    if (transmitLimit > 0 && row == transmitLimit)
      break;
  }
  return rows;
}
Beispiel #2
0
Json::Value generateRowsJsonT(const T& table, const size_t transmitLimit, const size_t transmitOffset) {
  storage::type_switch<hyrise_basic_types> ts;
  json_functor<T> fun(table);
  Json::Value rows(Json::arrayValue);
  for (size_t row = 0; row < table->size(); ++row) {

    // Align offset
    if (row < transmitOffset)
      continue;

    // Break if limit reached
    if (transmitLimit > 0 && row == (transmitOffset + transmitLimit))
      break;

    fun.row = row;
    Json::Value json_row(Json::arrayValue);
    for (size_t col = 0; col < table->columnCount(); ++col) {
      fun.column = col;
      json_row.append(ts(table->typeOfColumn(col), fun));
    }
    rows.append(json_row);
  }
  return rows;
}