summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-10-08 17:59:23 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-10-08 17:59:23 +0100
commit0658fa611f8aaab7aaa7b49c7af2b324e0879ae9 (patch)
treecb882e8f3bb8fde31d881d9ff83d587b0ef57226
parentFix the trivial clang-tidy warnings (diff)
downloadlibdbpp-postgresql-0658fa611f8aaab7aaa7b49c7af2b324e0879ae9.tar.bz2
libdbpp-postgresql-0658fa611f8aaab7aaa7b49c7af2b324e0879ae9.tar.xz
libdbpp-postgresql-0658fa611f8aaab7aaa7b49c7af2b324e0879ae9.zip
Avoid do/while loop
-rw-r--r--libpqpp/pq-mock.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/libpqpp/pq-mock.cpp b/libpqpp/pq-mock.cpp
index 883403c..e7faf32 100644
--- a/libpqpp/pq-mock.cpp
+++ b/libpqpp/pq-mock.cpp
@@ -63,14 +63,16 @@ AND n.oid = c.relnamespace
ORDER BY 1, 2)SQL");
s->bindParamS(0, "pg_catalog");
s->bindParamS(1, "information_schema");
- unsigned int n = 0;
- do {
- n = 0;
+ while ([&s, this]() {
+ unsigned int n = 0;
for (const auto [nspname, relname] : s->as<std::string, std::string>()) {
master->execute(MockSetUnlogged::get(nspname, relname));
n += 1;
}
- } while (n);
+ return n;
+ }()) {
+ ;
+ }
}
Mock::~Mock()