summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-05-09 20:39:50 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2019-05-09 20:39:50 +0100
commitbe913c0bdf2900783d416c611398a52b5f3cb991 (patch)
tree75307e02b22d171b415f9ba194deb7864715f2bc
parentCreate mock databases in a temporary directory (diff)
downloadlibdbpp-postgresql-be913c0bdf2900783d416c611398a52b5f3cb991.tar.bz2
libdbpp-postgresql-be913c0bdf2900783d416c611398a52b5f3cb991.tar.xz
libdbpp-postgresql-be913c0bdf2900783d416c611398a52b5f3cb991.zip
Create hasUnloggedTables, like hasCopyToProgram
-rw-r--r--libpqpp/pq-mock.cpp10
-rw-r--r--libpqpp/pq-mock.h1
2 files changed, 9 insertions, 2 deletions
diff --git a/libpqpp/pq-mock.cpp b/libpqpp/pq-mock.cpp
index 499d839..f0e90ea 100644
--- a/libpqpp/pq-mock.cpp
+++ b/libpqpp/pq-mock.cpp
@@ -37,8 +37,7 @@ AdHocFormatter(MockSetUnlogged, "ALTER TABLE %?.%? SET UNLOGGED");
void
Mock::SetTablesToUnlogged() const
{
- // v9.5 server required for unlogged tables
- if (serverVersion < 90500) {
+ if (!hasUnloggedTables()) {
return;
}
auto s = master->select(R"SQL(
@@ -74,6 +73,13 @@ Mock::~Mock()
}
bool
+Mock::hasUnloggedTables() const
+{
+ // v9.5 server required for unlogged tables
+ return (serverVersion >= 90500);
+}
+
+bool
Mock::hasCopyToProgram() const
{
// v9.3 server required to use COPY ... TO PROGRAM ...
diff --git a/libpqpp/pq-mock.h b/libpqpp/pq-mock.h
index b5f4f24..eccd5ae 100644
--- a/libpqpp/pq-mock.h
+++ b/libpqpp/pq-mock.h
@@ -18,6 +18,7 @@ namespace PQ {
void CreateNewDatabase() const override;
void DropDatabase() const override;
void SetTablesToUnlogged() const;
+ bool hasUnloggedTables() const;
bool hasCopyToProgram() const;
const std::filesystem::path tablespacePath;
const int serverVersion;