adjust types in requested columns
This commit is contained in:
+6
-1
@@ -50,9 +50,14 @@ query_result<record> session::fetch(const query &q) const
|
||||
if (it == prototypes_.end()) {
|
||||
it = prototypes_.emplace(q.table_name, c->describe(q.table_name)).first;
|
||||
}
|
||||
// adjust columns from given query
|
||||
for (auto &col : q.prototype) {
|
||||
if (const auto rit = it->second.find(col.name()); col.type() == data_type_t::type_unknown && rit != it->second.end()) {
|
||||
const_cast<column&>(col).type(rit->type());
|
||||
}
|
||||
}
|
||||
auto res = c->call_fetch(q.sql);
|
||||
return query_result<record>{std::move(res), q.prototype};
|
||||
// return query_result<record>{std::move(res), [it]() { return new record(it->second); }};
|
||||
}
|
||||
|
||||
//query_result<record> session::fetch(const std::string &sql) const
|
||||
|
||||
Reference in New Issue
Block a user