File: test_cancel_query.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 (22 lines) | stat: -rw-r--r-- 512 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <test_helpers.hxx>

using namespace PGSTD;
using namespace pqxx;

namespace
{
void test_cancel_query(transaction_base &t)
{
  // Calling cancel_query() while none is in progress has no effect.
  t.conn().cancel_query();

  // Nothing much is guaranteed about cancel_query, except that it doesn't make
  // the process die in flames.
  pipeline p(t, "test_cancel_query");
  p.retain(0);
  p.insert("SELECT pg_sleep(1)");
  t.conn().cancel_query();
}
} // namespace

PQXX_REGISTER_TEST(test_cancel_query)