File indexing completed on 2025-01-18 09:42:42
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_MYSQL_IMPL_FIELD_IPP
0009 #define BOOST_MYSQL_IMPL_FIELD_IPP
0010
0011 #pragma once
0012
0013 #include <boost/mysql/field.hpp>
0014
0015 #include <ostream>
0016
0017 namespace boost {
0018 namespace mysql {
0019 namespace detail {
0020
0021 inline blob to_blob(blob_view v) { return blob(v.data(), v.data() + v.size()); }
0022
0023 }
0024 }
0025 }
0026
0027 void boost::mysql::field::from_view(const field_view& fv)
0028 {
0029 switch (fv.kind())
0030 {
0031 case field_kind::null: repr_.data.emplace<detail::field_impl::null_t>(); break;
0032 case field_kind::int64: repr_.data.emplace<std::int64_t>(fv.get_int64()); break;
0033 case field_kind::uint64: repr_.data.emplace<std::uint64_t>(fv.get_uint64()); break;
0034 case field_kind::string: repr_.data.emplace<std::string>(fv.get_string()); break;
0035 case field_kind::blob: repr_.data.emplace<blob>(detail::to_blob(fv.get_blob())); break;
0036 case field_kind::float_: repr_.data.emplace<float>(fv.get_float()); break;
0037 case field_kind::double_: repr_.data.emplace<double>(fv.get_double()); break;
0038 case field_kind::date: repr_.data.emplace<date>(fv.get_date()); break;
0039 case field_kind::datetime: repr_.data.emplace<datetime>(fv.get_datetime()); break;
0040 case field_kind::time: repr_.data.emplace<time>(fv.get_time()); break;
0041 }
0042 }
0043
0044 std::ostream& boost::mysql::operator<<(std::ostream& os, const field& value)
0045 {
0046 return os << field_view(value);
0047 }
0048
0049 #endif