diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-06-13 14:05:34 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-06-13 14:05:34 +0100 |
commit | b125cd0df1d6c7a3776b14f3e701402753c79e93 (patch) | |
tree | 2b50f8b91883e04f470b9e8605f8771306b8b625 | |
parent | Fix binding multiple parameters in DbStmt (diff) | |
download | mygrate-b125cd0df1d6c7a3776b14f3e701402753c79e93.tar.bz2 mygrate-b125cd0df1d6c7a3776b14f3e701402753c79e93.tar.xz mygrate-b125cd0df1d6c7a3776b14f3e701402753c79e93.zip |
Remember PQ connection string
-rw-r--r-- | lib/output/pq/pqConn.cpp | 2 | ||||
-rw-r--r-- | lib/output/pq/pqConn.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/output/pq/pqConn.cpp b/lib/output/pq/pqConn.cpp index c1a7362..309b704 100644 --- a/lib/output/pq/pqConn.cpp +++ b/lib/output/pq/pqConn.cpp @@ -15,7 +15,7 @@ namespace MyGrate::Output::Pq { { } - PqConn::PqConn(const char * const str) : conn {PQconnectdb(str), PQfinish} + PqConn::PqConn(const char * const str) : connstr {str}, conn {PQconnectdb(str), PQfinish} { verify<PqErr>(PQstatus(conn.get()) == CONNECTION_OK, "Connection failure", conn.get()); PQsetNoticeProcessor(conn.get(), notice_processor, this); diff --git a/lib/output/pq/pqConn.h b/lib/output/pq/pqConn.h index b8609ea..6db9bcf 100644 --- a/lib/output/pq/pqConn.h +++ b/lib/output/pq/pqConn.h @@ -32,6 +32,8 @@ namespace MyGrate::Output::Pq { DbPrepStmtPtr prepare(const char * const, std::size_t nParams) override; + const std::string connstr; + private: static void notice_processor(void *, const char *); virtual void notice_processor(const char *) const; |