From 63b2ca0dbdae190941d60a55c9cff99d4a75a0e1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 31 May 2021 13:18:17 +0100 Subject: Initial commit of prepstmt, selects, record sets This is full of holes, but all the basics are covered. --- lib/output/pq/pqStmt.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lib/output/pq/pqStmt.h (limited to 'lib/output/pq/pqStmt.h') diff --git a/lib/output/pq/pqStmt.h b/lib/output/pq/pqStmt.h new file mode 100644 index 0000000..b806617 --- /dev/null +++ b/lib/output/pq/pqStmt.h @@ -0,0 +1,37 @@ +#ifndef MYGRATE_OUTPUT_PQ_PQSTMT_H +#define MYGRATE_OUTPUT_PQ_PQSTMT_H + +#include "dbConn.h" +#include "dbRecordSet.h" +#include "dbTypes.h" +#include +#include +#include +#include +#include + +namespace MyGrate::Output::Pq { + class PqConn; + + using ResPtr = std::unique_ptr; + + class PqPrepStmt : public DbPrepStmt { + public: + PqPrepStmt(const char * const q, std::size_t n, PqConn * c); + + void execute(const std::initializer_list & vs) override; + + std::size_t rows() const override; + + RecordSetPtr recordSet() override; + + private: + static std::string prepareAsNeeded(const char * const q, std::size_t n, PqConn * c); + + PGconn * conn; + std::string name; + ResPtr res; + }; +} + +#endif -- cgit v1.2.3