session update progress
This commit is contained in:
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
template < class V >
|
||||
void on_primary_key(const char *id, V &x, const utils::primary_key_attribute& /*attr*/ = utils::default_pk_attributes) {
|
||||
result_.emplace_back(id, x);
|
||||
// result_.emplace_back(id, x);
|
||||
}
|
||||
void on_revision(const char *id, uint64_t &/*rev*/);
|
||||
|
||||
|
||||
@@ -26,10 +26,12 @@ public:
|
||||
virtual utils::result<std::unique_ptr<query_result_impl>, utils::error> fetch(const parameter_binder& bindings) = 0;
|
||||
|
||||
template < class Type >
|
||||
void bind_object(Type &obj, parameter_binder& bindings) {
|
||||
object_parameter_binder object_binder_;
|
||||
size_t bind_object(Type &obj, parameter_binder& bindings) {
|
||||
object_parameter_binder object_binder_(query_.command != sql_command::SQL_UPDATE);
|
||||
object_binder_.reset(start_index());
|
||||
object_binder_.bind(obj, bindings);
|
||||
|
||||
return object_binder_.current_index();
|
||||
}
|
||||
|
||||
template < class Type >
|
||||
|
||||
@@ -61,6 +61,8 @@ private:
|
||||
|
||||
class object_parameter_binder {
|
||||
public:
|
||||
explicit object_parameter_binder(bool include_primary_key = true);
|
||||
|
||||
template<class Type>
|
||||
void bind(Type &obj, utils::attribute_writer &binder) {
|
||||
binder_ = &binder;
|
||||
@@ -69,10 +71,13 @@ public:
|
||||
}
|
||||
|
||||
void reset(size_t start_index);
|
||||
[[nodiscard]] size_t current_index() const;
|
||||
|
||||
template < class Type >
|
||||
void on_primary_key(const char * /*id*/, Type &val, const utils::primary_key_attribute& attr = utils::default_pk_attributes) {
|
||||
utils::data_type_traits<Type>::bind_value(*binder_, index_++, val, attr.size());
|
||||
if (include_primary_key_) {
|
||||
utils::data_type_traits<Type>::bind_value(*binder_, index_++, val, attr.size());
|
||||
}
|
||||
}
|
||||
void on_revision(const char *id, uint64_t &/*rev*/);
|
||||
|
||||
@@ -109,6 +114,7 @@ private:
|
||||
utils::attribute_writer *binder_{};
|
||||
size_t index_{0};
|
||||
detail::fk_binder fk_binder_;
|
||||
bool include_primary_key_{true};
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
Reference in New Issue
Block a user