35 lines
741 B
C++
35 lines
741 B
C++
#ifndef QUERY_POSTGRES_STATEMENT_HPP
|
|
#define QUERY_POSTGRES_STATEMENT_HPP
|
|
|
|
#include "matador/sql/statement_impl.hpp"
|
|
|
|
#include "postgres_parameter_binder.h"
|
|
|
|
#include <libpq-fe.h>
|
|
|
|
namespace matador::backends::postgres {
|
|
|
|
class postgres_statement final : public sql::statement_impl
|
|
{
|
|
public:
|
|
postgres_statement(PGconn *db, PGresult *result, const std::string &name, const sql::query_context &query);
|
|
|
|
size_t execute() override;
|
|
std::unique_ptr<sql::query_result_impl> fetch() override;
|
|
void reset() override;
|
|
protected:
|
|
sql::parameter_binder& binder() override;
|
|
|
|
private:
|
|
PGconn *db_{nullptr};
|
|
PGresult *result_{nullptr};
|
|
|
|
std::string name_;
|
|
|
|
postgres_parameter_binder binder_;
|
|
};
|
|
|
|
}
|
|
|
|
#endif //QUERY_POSTGRES_STATEMENT_HPP
|