1 #include <pqxx/transaction> 2 3 #include "../test_helpers.hxx" 4 5 extern "C" 6 { 7 #include <libpq-fe.h> 8 } 9 10 namespace 11 { test_error_verbosity()12void test_error_verbosity() 13 { 14 PQXX_CHECK_EQUAL( 15 static_cast<int>(pqxx::error_verbosity::terse), 16 static_cast<int>(PQERRORS_TERSE), 17 "error_verbosity enum should match PGVerbosity."); 18 PQXX_CHECK_EQUAL( 19 static_cast<int>(pqxx::error_verbosity::normal), 20 static_cast<int>(PQERRORS_DEFAULT), 21 "error_verbosity enum should match PGVerbosity."); 22 PQXX_CHECK_EQUAL( 23 static_cast<int>(pqxx::error_verbosity::verbose), 24 static_cast<int>(PQERRORS_VERBOSE), 25 "error_verbosity enum should match PGVerbosity."); 26 27 pqxx::connection conn; 28 pqxx::work tx{conn}; 29 conn.set_verbosity(pqxx::error_verbosity::terse); 30 tx.exec1("SELECT 1"); 31 conn.set_verbosity(pqxx::error_verbosity::verbose); 32 tx.exec1("SELECT 2"); 33 } 34 35 36 PQXX_REGISTER_TEST(test_error_verbosity); 37 } // namespace 38