| 71 | } |
| 72 | |
| 73 | void dut_pqxx::test(const std::string &stmt) |
| 74 | { |
| 75 | try { |
| 76 | #if !defined(HAVE_LIBPQXX7) && !defined(HAVE_LIBPQXX8) |
| 77 | if(!c.is_open()) |
| 78 | c.activate(); |
| 79 | #endif |
| 80 | |
| 81 | pqxx::work w(c); |
| 82 | w.exec(stmt.c_str()); |
| 83 | w.abort(); |
| 84 | } catch (const pqxx::failure &e) { |
| 85 | if ((dynamic_cast<const pqxx::broken_connection *>(&e))) { |
| 86 | /* re-throw to outer loop to recover session. */ |
| 87 | throw dut::broken(e.what()); |
| 88 | } |
| 89 | |
| 90 | if (regex_match(e.what(), e_timeout)) |
| 91 | throw dut::timeout(e.what()); |
| 92 | else if (regex_match(e.what(), e_syntax)) |
| 93 | throw dut::syntax(e.what()); |
| 94 | else |
| 95 | throw dut::failure(e.what()); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | |
| 100 | schema_pqxx::schema_pqxx(std::string &conninfo, bool no_catalog) : c(conninfo) |