31 lines
825 B
C++
31 lines
825 B
C++
#ifndef QUERY_POSTGRES_STATEMENT_HPP
|
|
#define QUERY_POSTGRES_STATEMENT_HPP
|
|
|
|
#include "matador/sql/interface/statement_impl.hpp"
|
|
#include "matador/sql/interface/parameter_binder.hpp"
|
|
|
|
#include <libpq-fe.h>
|
|
|
|
namespace matador::backends::postgres {
|
|
|
|
class postgres_statement final : public sql::statement_impl
|
|
{
|
|
public:
|
|
postgres_statement(PGconn *db, std::string name, const sql::query_context &query);
|
|
|
|
utils::result<size_t, utils::error> execute(const sql::parameter_binder& bindings) override;
|
|
utils::result<std::unique_ptr<sql::query_result_impl>, utils::error> fetch(const sql::parameter_binder& bindings) override;
|
|
|
|
protected:
|
|
[[nodiscard]] std::unique_ptr<utils::attribute_writer> create_binder() const override;
|
|
|
|
private:
|
|
PGconn *db_{nullptr};
|
|
|
|
std::string name_;
|
|
};
|
|
|
|
}
|
|
|
|
#endif //QUERY_POSTGRES_STATEMENT_HPP
|