collection_resolver progress
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
#include "matador/utils/os.hpp"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <ctime>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
@@ -357,4 +359,16 @@ char* strerror(int err, char* errbuf, size_t bufsize)
|
||||
#endif
|
||||
}
|
||||
|
||||
void localtime(const time_t &in, struct tm &out) {
|
||||
#if defined(__unix__)
|
||||
localtime_r(&in, &out);
|
||||
#elif defined(_MSC_VER)
|
||||
errno_t err = localtime_s(&out, &in);
|
||||
#else
|
||||
static std::mutex mtx;
|
||||
std::lock_guard<std::mutex> lock(mtx);
|
||||
out = *std::localtime(&in);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ sql::record *create_prototype(const std::vector<object::attribute> &prototype) {
|
||||
}
|
||||
utils::result<sql::query_result<sql::record>, utils::error> fetchable_query::fetch_all(const sql::executor &exec) const {
|
||||
query_builder compiler;
|
||||
const auto ctx = compiler.compile(*context_, exec.dialect(), std::nullopt);
|
||||
auto ctx = compiler.compile(*context_, exec.dialect(), std::nullopt);
|
||||
ctx.resolver = exec.resolver();
|
||||
return exec.fetch(ctx)
|
||||
.and_then([](auto &&res) {
|
||||
const auto prototype = res->prototype();
|
||||
@@ -67,9 +68,10 @@ sql::query_context fetchable_query::compile(const sql::dialect &d) const {
|
||||
return compiler.compile(*context_, d, std::nullopt);
|
||||
}
|
||||
|
||||
utils::result<std::unique_ptr<sql::query_result_impl>, utils::error> fetchable_query::fetch(const sql::executor &exec) const {
|
||||
utils::result<std::unique_ptr<sql::query_result_impl>, utils::error> fetchable_query::fetch(const sql::executor &exec, const std::type_index& index) const {
|
||||
auto ctx = compile(exec.dialect());
|
||||
ctx.resolver = exec.resolver();
|
||||
ctx.result_type = index;
|
||||
return exec.fetch(ctx);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,14 @@ detail::pk_reader::pk_reader(query_result_reader &reader)
|
||||
|
||||
query_result_impl::query_result_impl(std::unique_ptr<query_result_reader> &&reader,
|
||||
std::vector<object::attribute> prototype,
|
||||
const std::shared_ptr<sql::resolver_service>& resolver,
|
||||
const std::shared_ptr<resolver_service>& resolver,
|
||||
const std::type_index& result_type,
|
||||
const size_t column_index)
|
||||
: column_index_(column_index)
|
||||
, prototype_(std::move(prototype))
|
||||
, reader_(std::move(reader))
|
||||
, resolver_(resolver)
|
||||
, result_type_(result_type)
|
||||
, id_reader_(*reader_)
|
||||
, pk_reader_(*reader_) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user