summaryrefslogtreecommitdiff
path: root/lib/output
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-06-13 21:29:25 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-06-13 21:29:25 +0100
commit3bc5964793f1700551b7db8107a939c98f1d1be1 (patch)
tree38c77c4e49d54a348e5cdeb402bdd63f2e29d477 /lib/output
parentAdd operator* to RecordSet, shorthand for getting scalar from 0,0 (diff)
downloadmygrate-3bc5964793f1700551b7db8107a939c98f1d1be1.tar.bz2
mygrate-3bc5964793f1700551b7db8107a939c98f1d1be1.tar.xz
mygrate-3bc5964793f1700551b7db8107a939c98f1d1be1.zip
Add transaction support
Diffstat (limited to 'lib/output')
-rw-r--r--lib/output/pq/pqConn.cpp18
-rw-r--r--lib/output/pq/pqConn.h4
2 files changed, 22 insertions, 0 deletions
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
@@ -44,6 +44,24 @@ namespace MyGrate::Output::Pq {
}
void
+ PqConn::beginTx()
+ {
+ query("BEGIN");
+ }
+
+ void
+ PqConn::commitTx()
+ {
+ query("COMMIT");
+ }
+
+ void
+ PqConn::rollbackTx()
+ {
+ query("ROLLBACK");
+ }
+
+ void
PqConn::notice_processor(void * p, const char * n)
{
return static_cast<PqConn *>(p)->notice_processor(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: