From 3bc5964793f1700551b7db8107a939c98f1d1be1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 13 Jun 2021 21:29:25 +0100 Subject: Add transaction support --- lib/output/pq/pqConn.cpp | 18 ++++++++++++++++++ lib/output/pq/pqConn.h | 4 ++++ 2 files changed, 22 insertions(+) (limited to 'lib/output') diff --git a/lib/output/pq/pqConn.cpp b/lib/output/pq/pqConn.cpp index 309b704..ba95cad 100644 --- a/lib/output/pq/pqConn.cpp +++ b/lib/output/pq/pqConn.cpp @@ -43,6 +43,24 @@ namespace MyGrate::Output::Pq { return std::make_unique(q, n, this); } + void + PqConn::beginTx() + { + query("BEGIN"); + } + + void + PqConn::commitTx() + { + query("COMMIT"); + } + + void + PqConn::rollbackTx() + { + query("ROLLBACK"); + } + void PqConn::notice_processor(void * p, const char * n) { diff --git a/lib/output/pq/pqConn.h b/lib/output/pq/pqConn.h index 6db9bcf..3b27f97 100644 --- a/lib/output/pq/pqConn.h +++ b/lib/output/pq/pqConn.h @@ -32,6 +32,10 @@ namespace MyGrate::Output::Pq { DbPrepStmtPtr prepare(const char * const, std::size_t nParams) override; + void beginTx() override; + void commitTx() override; + void rollbackTx() override; + const std::string connstr; private: -- cgit v1.2.3