38 lines
875 B
C++
38 lines
875 B
C++
#ifndef STATEMENT_PROXY_HPP
|
|
#define STATEMENT_PROXY_HPP
|
|
|
|
#include "matador/sql/interface/statement_impl.hpp"
|
|
|
|
namespace matador::sql {
|
|
class statement_proxy {
|
|
protected:
|
|
explicit statement_proxy(std::unique_ptr<statement_impl>&& stmt);
|
|
|
|
public:
|
|
virtual ~statement_proxy() = default;
|
|
|
|
virtual utils::result<size_t, utils::error> execute() = 0;
|
|
virtual utils::result<std::unique_ptr<query_result_impl>, utils::error> fetch() = 0;
|
|
|
|
template<class Type>
|
|
void bind(const Type &obj) {
|
|
statement_->bind_object(obj);
|
|
}
|
|
template<typename Type>
|
|
void bind(size_t pos, Type &value) {
|
|
statement_->bind(pos, value);
|
|
}
|
|
void bind(size_t pos, const char *value, size_t size) const;
|
|
void bind(size_t pos, std::string &val, size_t size) const;
|
|
|
|
void reset() const;
|
|
|
|
protected:
|
|
std::unique_ptr<statement_impl> statement_;
|
|
};
|
|
|
|
|
|
}
|
|
|
|
#endif //STATEMENT_PROXY_HPP
|