diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-05-31 13:18:17 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-05-31 13:18:17 +0100 |
commit | 63b2ca0dbdae190941d60a55c9cff99d4a75a0e1 (patch) | |
tree | d3766bcbc98fb5fb0fb2d8dddf2f194bedcb0325 /lib/output/pq/pqConn.h | |
parent | Map std::size_t to a sensible header (diff) | |
download | mygrate-63b2ca0dbdae190941d60a55c9cff99d4a75a0e1.tar.bz2 mygrate-63b2ca0dbdae190941d60a55c9cff99d4a75a0e1.tar.xz mygrate-63b2ca0dbdae190941d60a55c9cff99d4a75a0e1.zip |
Initial commit of prepstmt, selects, record sets
This is full of holes, but all the basics are covered.
Diffstat (limited to 'lib/output/pq/pqConn.h')
-rw-r--r-- | lib/output/pq/pqConn.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/output/pq/pqConn.h b/lib/output/pq/pqConn.h index 613af6f..856683d 100644 --- a/lib/output/pq/pqConn.h +++ b/lib/output/pq/pqConn.h @@ -1,25 +1,35 @@ #ifndef MYGRATE_OUTPUT_PQ_PQCONN_H #define MYGRATE_OUTPUT_PQ_PQCONN_H +#include <cstddef> #include <dbConn.h> #include <dbTypes.h> +#include <functional> #include <initializer_list> #include <libpq-fe.h> +#include <map> +#include <memory> +#include <string> namespace MyGrate::Output::Pq { class PqConn : public DbConn { public: explicit PqConn(const char * const str); - virtual ~PqConn(); + virtual ~PqConn() = default; void query(const char * const) override; void query(const char * const, const std::initializer_list<DbValue> &) override; + DbPrepStmtPtr prepare(const char * const, std::size_t nParams) override; + private: static void notice_processor(void *, const char *); virtual void notice_processor(const char *) const; - PGconn * const conn; + std::unique_ptr<PGconn, decltype(&PQfinish)> const conn; + + friend class PqPrepStmt; + std::map<std::string, std::string, std::less<>> stmts; }; } |