diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-10-08 17:59:23 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-10-08 17:59:23 +0100 |
commit | 0658fa611f8aaab7aaa7b49c7af2b324e0879ae9 (patch) | |
tree | cb882e8f3bb8fde31d881d9ff83d587b0ef57226 /libpqpp | |
parent | Fix the trivial clang-tidy warnings (diff) | |
download | libdbpp-postgresql-0658fa611f8aaab7aaa7b49c7af2b324e0879ae9.tar.bz2 libdbpp-postgresql-0658fa611f8aaab7aaa7b49c7af2b324e0879ae9.tar.xz libdbpp-postgresql-0658fa611f8aaab7aaa7b49c7af2b324e0879ae9.zip |
Avoid do/while loop
Diffstat (limited to 'libpqpp')
-rw-r--r-- | libpqpp/pq-mock.cpp | 10 |
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() |