added test for date and time, sql read and write functionality

This commit is contained in:
2026-01-06 22:23:50 +01:00
parent 0c6b5a0a93
commit c48bd4f9d6
17 changed files with 516 additions and 360 deletions
+23 -25
View File
@@ -3,49 +3,47 @@
#include "matador/sql/interface/query_result_reader.hpp"
namespace matador::sql {
detail::pk_reader::pk_reader(query_result_reader &reader)
: reader_(reader) {}
: reader_(reader) {
}
query_result_impl::query_result_impl(std::unique_ptr<query_result_reader> &&reader, std::vector<object::attribute> &&prototype, const size_t column_index)
query_result_impl::query_result_impl(std::unique_ptr<query_result_reader> &&reader,
std::vector<object::attribute> &&prototype,
const size_t column_index)
: column_index_(column_index)
, prototype_(std::move(prototype))
, reader_(std::move(reader))
, pk_reader_(*reader_)
{}
, prototype_(std::move(prototype))
, reader_(std::move(reader))
, pk_reader_(*reader_) {
}
query_result_impl::query_result_impl(std::unique_ptr<query_result_reader> &&reader, const std::vector<object::attribute> &prototype, const size_t column_index)
query_result_impl::query_result_impl(std::unique_ptr<query_result_reader> &&reader,
const std::vector<object::attribute> &prototype,
const size_t column_index)
: column_index_(column_index)
, prototype_(prototype)
, reader_(std::move(reader))
, pk_reader_(*reader_)
{}
, prototype_(prototype)
, reader_(std::move(reader))
, pk_reader_(*reader_) {
}
void query_result_impl::on_revision(const char *id, uint64_t &rev)
{
void query_result_impl::on_revision(const char *id, uint64_t &rev) {
utils::data_type_traits<uint64_t>::read_value(*reader_, id, column_index_++, rev);
reader_->read_value(id, column_index_++, rev);
}
void query_result_impl::on_attribute(const char *id, char *value, const utils::field_attributes &attr)
{
utils::data_type_traits<char*>::read_value(*reader_, id, column_index_++, value, attr.size());
void query_result_impl::on_attribute(const char *id, char *value, const utils::field_attributes &attr) {
utils::data_type_traits<char *>::read_value(*reader_, id, column_index_++, value, attr.size());
}
void query_result_impl::on_attribute(const char *id, std::string &value, const utils::field_attributes &attr)
{
void query_result_impl::on_attribute(const char *id, std::string &value, const utils::field_attributes &attr) {
utils::data_type_traits<std::string>::read_value(*reader_, id, column_index_++, value, attr.size());
}
void
query_result_impl::on_attribute(const char *id, utils::value &val, const utils::field_attributes &attr)
{
query_result_impl::on_attribute(const char *id, utils::value &val, const utils::field_attributes &attr) {
reader_->read_value(id, column_index_++, val, attr.size());
}
const std::vector<object::attribute>& query_result_impl::prototype() const
{
const std::vector<object::attribute> &query_result_impl::prototype() const {
return prototype_;
}
}
}