transport: send back only the requested columns

result_set may contain more columns than user requested (for instance if
some of them were needed to properly sort output). The additional columns
are always the last ones and are not included in metadata::column_count().

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
This commit is contained in:
Paweł Dziepak
2015-07-14 13:50:30 +02:00
parent f829cf373e
commit 01b2f76fee

View File

@@ -9,6 +9,7 @@
#include <boost/bimap.hpp>
#include <boost/assign.hpp>
#include <boost/locale/encoding_utf.hpp>
#include <boost/range/adaptor/sliced.hpp>
#include "db/consistency_level.hh"
#include "core/future-util.hh"
@@ -575,7 +576,7 @@ public:
_response->write(rs.get_metadata());
_response->write_int(rs.size());
for (auto&& row : rs.rows()) {
for (auto&& cell : row) {
for (auto&& cell : row | boost::adaptors::sliced(0, rs.get_metadata().column_count())) {
_response->write_value(cell);
}
}