#ifndef QUERY_STATEMENT_HPP #define QUERY_STATEMENT_HPP #include "matador/sql/object_parameter_binder.hpp" #include "matador/sql/query_result.hpp" #include "matador/sql/statement_impl.hpp" #include "matador/utils/logger.hpp" #include namespace matador::sql { class statement { public: explicit statement(std::unique_ptr impl, const utils::logger &logger); template < typename Type > statement& bind(size_t pos, const Type &value) { statement_->bind(pos, value); return *this; } statement& bind(size_t pos, const char *value); statement& bind(size_t pos, std::string &val, size_t size); template < class Type > statement& bind(const Type &obj) { object_binder_.reset(); matador::utils::access::process(object_binder_, obj); return *this; } size_t execute(); template query_result fetch() { logger_.info(statement_->query_.sql); return query_result(statement_->fetch()); } query_result fetch(); void reset(); private: std::unique_ptr statement_; const utils::logger &logger_; object_parameter_binder object_binder_; }; } #endif //QUERY_STATEMENT_HPP