renamed foreign class to entity, introduced interface class query_result_reader
This commit is contained in:
+3
-2
@@ -44,10 +44,11 @@ set(SQL_HEADER
|
||||
../include/matador/sql/value_extractor.hpp
|
||||
../include/matador/sql/any_type.hpp
|
||||
../include/matador/sql/key_value_generator.hpp
|
||||
../include/matador/sql/foreign.hpp
|
||||
../include/matador/sql/entity.hpp
|
||||
../include/matador/sql/fk_value_extractor.hpp
|
||||
"../include/matador/sql/table_repository.hpp"
|
||||
../include/matador/sql/any_type_to_visitor.hpp)
|
||||
../include/matador/sql/any_type_to_visitor.hpp
|
||||
../include/matador/sql/query_result_reader.hpp)
|
||||
|
||||
set(UTILS_HEADER
|
||||
../include/matador/utils/field_attributes.hpp
|
||||
|
||||
@@ -1,31 +1,45 @@
|
||||
#include "matador/sql/query_result_impl.hpp"
|
||||
#include "matador/sql/query_result_reader.hpp"
|
||||
|
||||
namespace matador::sql {
|
||||
|
||||
detail::pk_reader::pk_reader(query_result_reader &reader)
|
||||
: reader_(reader) {}
|
||||
|
||||
void detail::pk_reader::on_primary_key(const char *id, std::string &value, size_t size) {
|
||||
reader_.read_value(id, column_index_, value, size);
|
||||
}
|
||||
|
||||
query_result_impl::query_result_impl(std::unique_ptr<query_result_reader> &&reader, record prototype)
|
||||
: prototype_(std::move(prototype))
|
||||
, reader_(std::move(reader))
|
||||
, pk_reader_(*reader_)
|
||||
{}
|
||||
|
||||
void query_result_impl::on_primary_key(const char *id, std::string &value, size_t size)
|
||||
{
|
||||
read_value(id, column_index_++, value, size);
|
||||
reader_->read_value(id, column_index_++, value, size);
|
||||
}
|
||||
|
||||
void query_result_impl::on_revision(const char *id, unsigned long long int &rev)
|
||||
{
|
||||
read_value(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)
|
||||
{
|
||||
read_value(id, column_index_++, value, attr.size());
|
||||
reader_->read_value(id, column_index_++, value, attr.size());
|
||||
}
|
||||
|
||||
void query_result_impl::on_attribute(const char *id, std::string &value, const utils::field_attributes &attr)
|
||||
{
|
||||
read_value(id, column_index_++, value, attr.size());
|
||||
reader_->read_value(id, column_index_++, value, attr.size());
|
||||
}
|
||||
|
||||
void
|
||||
query_result_impl::on_attribute(const char *id, any_type &value, data_type_t type, const utils::field_attributes &attr)
|
||||
{
|
||||
read_value(id, column_index_++, value, type, attr.size());
|
||||
reader_->read_value(id, column_index_++, value, type, attr.size());
|
||||
}
|
||||
|
||||
const record& query_result_impl::prototype() const
|
||||
@@ -33,8 +47,4 @@ const record& query_result_impl::prototype() const
|
||||
return prototype_;
|
||||
}
|
||||
|
||||
query_result_impl::query_result_impl(record prototype)
|
||||
: prototype_(std::move(prototype))
|
||||
{}
|
||||
|
||||
}
|
||||
@@ -107,7 +107,7 @@ void logger::log(log_level lvl, const char *message) const
|
||||
std::snprintf(timestamp_buffer + std::strftime(timestamp_buffer,
|
||||
sizeof timestamp_buffer - 3,
|
||||
"%F %T.",
|
||||
std::localtime(&coarse)), 4, "%03ld", fine.time_since_epoch().count() % 1000);
|
||||
std::localtime(&coarse)), 4, "%03lld", fine.time_since_epoch().count() % 1000);
|
||||
char buffer[1024];
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
Reference in New Issue
Block a user