has many fetch with join
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "matador/sql/internal/query_result_pk_resolver.hpp"
|
||||
|
||||
#include "matador/utils/value.hpp"
|
||||
|
||||
namespace matador::sql::internal {
|
||||
void query_result_pk_resolver::on_primary_key(const char* id, std::string& /*value*/, const size_t size) {
|
||||
if (!type_stack_.empty()) {
|
||||
return;
|
||||
}
|
||||
std::string value;
|
||||
utils::data_type_traits<std::string>::read_value(reader_, id, column_index_++, value, size);
|
||||
pk_ = value;
|
||||
}
|
||||
|
||||
void query_result_pk_resolver::on_attribute(const char *id, const utils::value &x, const utils::field_attributes &attr) {
|
||||
if (is_constraint_set(attr.options(), utils::constraints::PRIMARY_KEY)) {
|
||||
if (x.is_integer()) {
|
||||
uint64_t val;
|
||||
utils::data_type_traits<uint64_t>::read_value(reader_, id, column_index_++, val);
|
||||
pk_ = val;
|
||||
} else if (x.is_varchar()) {
|
||||
std::string value;
|
||||
utils::data_type_traits<std::string>::read_value(reader_, id, column_index_++, value, attr.size());
|
||||
pk_ = value;
|
||||
}
|
||||
}
|
||||
++column_index_;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user