statement binding progress
This commit is contained in:
@@ -17,7 +17,7 @@ class sql_error;
|
||||
class statement_impl
|
||||
{
|
||||
protected:
|
||||
explicit statement_impl(query_context query);
|
||||
explicit statement_impl(query_context query, size_t start_bind_pos);
|
||||
|
||||
public:
|
||||
virtual ~statement_impl() = default;
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
template < class Type >
|
||||
size_t bind_object(Type &obj, parameter_binder& bindings) {
|
||||
object_parameter_binder object_binder_(query_.command != sql_command::SQL_UPDATE);
|
||||
object_parameter_binder object_binder_;
|
||||
object_binder_.reset(start_index());
|
||||
object_binder_.bind(obj, bindings);
|
||||
|
||||
@@ -36,13 +36,21 @@ public:
|
||||
|
||||
template < class Type >
|
||||
void bind(const size_t pos, Type &val, parameter_binder& bindings) {
|
||||
utils::data_type_traits<Type>::bind_value(bindings, adjust_index(pos), val);
|
||||
current_bind_pos_ = pos;
|
||||
bind(val, bindings);
|
||||
}
|
||||
template < class Type >
|
||||
void bind(Type &val, parameter_binder& bindings) {
|
||||
utils::data_type_traits<Type>::bind_value(bindings, adjust_index(current_bind_pos_++), val);
|
||||
}
|
||||
void bind(size_t pos, const char *value, size_t size, parameter_binder& bindings);
|
||||
void bind(const char *value, size_t size, parameter_binder& bindings);
|
||||
void bind(size_t pos, std::string &val, size_t size, parameter_binder& bindings);
|
||||
void bind(std::string &value, size_t size, parameter_binder& bindings);
|
||||
|
||||
void bind(size_t pos, const char *value, size_t size, parameter_binder& bindings) const;
|
||||
void bind(size_t pos, std::string &val, size_t size, parameter_binder& bindings) const;
|
||||
virtual void reset();
|
||||
|
||||
virtual void reset() = 0;
|
||||
[[nodiscard]] size_t bind_pos() const;
|
||||
|
||||
[[nodiscard]] const std::vector<std::string>& bind_vars() const;
|
||||
[[nodiscard]] bool is_valid_host_var(const std::string &host_var, size_t pos) const;
|
||||
@@ -57,6 +65,8 @@ protected:
|
||||
friend class statement_proxy;
|
||||
|
||||
query_context query_;
|
||||
size_t start_bind_pos_{0};
|
||||
size_t current_bind_pos_{0};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user