20export import :database_object_binding;
21export import :database_result_storage;
37template <
typename Owner,
typename Target,
typename SchemaType,
bool JoinedValues>
40 static_assert(SchemaType::template contains<Owner> && SchemaType::template contains<Target>,
41 "Collection binding endpoints must belong to the selected Schema");
55template <
typename ResultField>
58 static auto get(ResultField* ,
const std::string& fieldName,
const auto& ) ->
void
60 throw ConversionError{
"Unsupported projection result field type: " + fieldName};
64template <
typename ResultField>
70template <
typename ResultField,
typename StoredField>
83 catch (
const std::exception&)
89template <
typename ResultField>
95template <
typename ResultField>
111 canonical_type canonical{};
120 catch (
const std::invalid_argument&)
122 throw ConversionError{
"A database value was rejected by its converter"};
133template <ValueConvertible ResultField>
137 static auto get(ResultField* field,
const std::string& fieldName,
const auto& values) ->
void
143template <SociEncodedValue ResultField>
144struct ObjectFieldFromProjectionValues<ResultField>
146 static auto get(ResultField* field,
const std::string& fieldName,
const auto& values) ->
void
152template <SociDefaultSupported ResultField>
153struct ObjectFieldFromProjectionValues<ResultField>
155 static auto get(ResultField* field,
const std::string& fieldName,
const auto& values) ->
void
157 if constexpr (std::is_arithmetic_v<ResultField>)
168template <NullableAdaptable ResultField>
169struct ObjectFieldFromProjectionValues<ResultField>
171 static auto get(ResultField* field,
const std::string& fieldName,
const auto& values) ->
void
173 if (values.get_indicator(fieldName) == soci::i_null)
186 if constexpr (std::is_move_constructible_v<contained_type>)
187 field->emplace(std::move(value));
189 field->emplace(value);
196template <
typename ResultField,
typename SociType>
199 static auto get(ResultField* field,
const std::string& fieldName,
const auto& values) ->
void
207template <SociConvertableToDouble ResultField>
208struct ObjectFieldFromProjectionValues<ResultField> : ObjectFieldFromProjectionValuesWithCast<ResultField, double>
212template <SociConvertableToInt ResultField>
213struct ObjectFieldFromProjectionValues<ResultField> : ObjectFieldFromProjectionValuesWithCast<ResultField, int>
217template <SociConvertableToLongLong ResultField>
218struct ObjectFieldFromProjectionValues<ResultField> : ObjectFieldFromProjectionValuesWithCast<ResultField, long long>
222template <SociConvertableToUn
signedLongLong ResultField>
245 bindTypedNull(values, name,
static_cast<unsigned long long>(0));
266 throw std::invalid_argument{
"Cannot bind NULL parameter with unsupported column type"};
283 bindNull(values, name, value.logicalType);
289 throw ConversionError{
"Bound value storage does not match its logical column type"};
292 const auto parameterName = std::string{name};
293 std::visit([&values, ¶meterName, columnType = value.logicalType](
const auto& storedValue)
294 { setScalarFieldValue(values, parameterName, storedValue, columnType); }, value.value.value());
299 bindBoundValue(values, parameter.name, parameter.getBoundValue());
Internal signal for a result value that cannot be represented by the requested model or projection fi...
static auto isCompatibleStorage(model::ColumnType logicalType, const Value &storedValue) noexcept -> bool
Checks both the canonical variant alternative and its logical range.
auto bindBoundValue(soci::values &values, std::string_view name, const BoundValue &value) -> void
auto getEncodedScalarValue(const auto &values, const std::string &name) -> T
auto checkedNumericCast(Source value, std::string_view fieldName) -> Result
auto getNumericValue(const auto &values, const std::string &fieldName) -> Result
auto getNumericProjectionValue(ResultField *field, const std::string &fieldName, const auto &values) -> void
std::vector< query::QueryValue > PrimaryKey
auto parseNumericProjectionValue(const std::string &value, const std::string &fieldName) -> ResultField
auto makeNullableValue(Value value) -> Wrapper
auto tryGetNumericProjectionValue(ResultField *field, const std::string &fieldName, const auto &values) -> bool
auto readProjectedValue(const auto &values, const std::string &fieldName) -> ResultField
auto bindStatementParameter(soci::values &values, const StatementParameter ¶meter) -> void
auto hasCompatibleStorage(const BoundValue &value) -> bool
auto parseNumericValue(std::string_view value, std::string_view fieldName) -> Result
auto bindTypedNull(soci::values &values, std::string_view name, const T &value) -> void
constexpr bool isOptional
auto bindNull(soci::values &values, std::string_view name, model::ColumnType logicalType) -> void
consteval auto logicalType() -> model::ColumnType
static auto get(ResultField *field, const std::string &fieldName, const auto &values) -> void
static auto get(ResultField *field, const std::string &fieldName, const auto &values) -> void
static auto get(ResultField *, const std::string &fieldName, const auto &) -> void