From fc3fb39c90ab7fe5fccbe3f3bc0eb2645157bb96 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 13 Dec 2023 21:57:53 +0300 Subject: Switch to build2 --- pgsql/bulk/driver.cxx | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'pgsql/bulk/driver.cxx') diff --git a/pgsql/bulk/driver.cxx b/pgsql/bulk/driver.cxx index fd629b8..ba25542 100644 --- a/pgsql/bulk/driver.cxx +++ b/pgsql/bulk/driver.cxx @@ -1,4 +1,4 @@ -// file : pgsql/savepoint/driver.cxx +// file : pgsql/bulk/driver.cxx // license : GNU GPL v2; see accompanying LICENSE file // Test transaction savepoints. @@ -10,7 +10,6 @@ #include #include #include -#include #include // Note: hack. @@ -18,6 +17,9 @@ #include #define htonll(x) ((((long long)htonl(x)) << 32) + htonl((x) >> 32)) +#undef NDEBUG +#include + static const size_t columns = 3; struct data @@ -255,20 +257,22 @@ test (PGconn* conn) } } -#include // std::auto_ptr -#include -#include - #include +#include // std::unique_ptr +#include +#include #include #include -#include +#include #include "test.hxx" #include "test-odb.hxx" +#undef NDEBUG +#include + using namespace std; namespace pgsql = odb::pgsql; using namespace pgsql; @@ -276,9 +280,26 @@ using namespace pgsql; int main (int argc, char* argv[]) { + bool fail_already_persistent (false); + + for (int i (1); i != argc; ++i) + { + if (strcmp (argv[i], "--fail-already-persistent") == 0) + { + fail_already_persistent = true; + + for (; i != argc - 1; ++i) + argv[i] = argv[i + 1]; + + --argc; + + break; + } + } + try { - auto_ptr db (create_specific_database (argc, argv)); + unique_ptr db (create_specific_database (argc, argv)); connection_ptr cn (db->connection ()); @@ -297,7 +318,7 @@ main (int argc, char* argv[]) { os.push_back (object {i, i, string (i, 'x')}); - if (i == n / 2) + if (fail_already_persistent && i == n / 2) os.push_back (object {i, i, to_string (i)}); } -- cgit v1.1