File: test086.cxx

package info (click to toggle)
libpqxx 4.0.1%2Bdfsg3-8
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 16,012 kB
  • ctags: 9,469
  • sloc: sh: 11,289; cpp: 10,801; xml: 1,256; makefile: 287; ansic: 195; python: 159
file content (39 lines) | stat: -rw-r--r-- 760 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>

#include "test_helpers.hxx"

using namespace PGSTD;
using namespace pqxx;


// Test inhibition of connection reactivation
namespace
{
void test_086(transaction_base &N1)
{
  connection_base &C(N1.conn());
  const string Query = "SELECT * from pg_tables";

  cout << "Some datum: " << N1.exec(Query)[0][0] << endl;
  N1.commit();

  C.inhibit_reactivation(true);
  C.deactivate();

  quiet_errorhandler d(C);
  {
    nontransaction N2(C, "test86N2");
    PQXX_CHECK_THROWS(
	N2.exec(Query),
	broken_connection,
	"Deactivated connection did not throw broken_connection on exec().");
  }

  C.inhibit_reactivation(false);
  work W(C, "test86W");
  W.exec(Query);
  W.commit();
}
} // namespace

PQXX_REGISTER_TEST_T(test_086, nontransaction)