{"diffoscope-json-version": 1, "source1": "/srv/reproducible-results/rbuild-debian/r-b-build.c1F7rWsU/b1/libpqxx_6.4.5-2_armhf.changes", "source2": "/srv/reproducible-results/rbuild-debian/r-b-build.c1F7rWsU/b2/libpqxx_6.4.5-2_armhf.changes", "unified_diff": null, "details": [{"source1": "Files", "source2": "Files", "unified_diff": "@@ -1,5 +1,5 @@\n \n 2db6c7975a2b8ee9c1272200b979deca 2047740 debug optional libpqxx-6.4-dbgsym_6.4.5-2_armhf.deb\n 231cfd0bd8738caecc0f5c6b370e679f 136816 libs optional libpqxx-6.4_6.4.5-2_armhf.deb\n ed847aea48b7c28139dbe44f04b6f92e 256632 libdevel optional libpqxx-dev_6.4.5-2_armhf.deb\n- a1729266f10b8f4e1eb43927e70f459d 1862196 doc optional libpqxx-doc_6.4.5-2_all.deb\n+ fcd40df87eca172f0f3a7c96508b878e 1862016 doc optional libpqxx-doc_6.4.5-2_all.deb\n"}, {"source1": "libpqxx-doc_6.4.5-2_all.deb", "source2": "libpqxx-doc_6.4.5-2_all.deb", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -1,3 +1,3 @@\n -rw-r--r-- 0 0 0 4 2019-09-26 12:21:28.000000 debian-binary\n--rw-r--r-- 0 0 0 17804 2019-09-26 12:21:28.000000 control.tar.xz\n--rw-r--r-- 0 0 0 1844200 2019-09-26 12:21:28.000000 data.tar.xz\n+-rw-r--r-- 0 0 0 17796 2019-09-26 12:21:28.000000 control.tar.xz\n+-rw-r--r-- 0 0 0 1844028 2019-09-26 12:21:28.000000 data.tar.xz\n"}, {"source1": "control.tar.xz", "source2": "control.tar.xz", "unified_diff": null, "details": [{"source1": "control.tar", "source2": "control.tar", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "comments": ["Files differ"], "unified_diff": null}]}]}]}, {"source1": "data.tar.xz", "source2": "data.tar.xz", "unified_diff": null, "details": [{"source1": "data.tar", "source2": "data.tar", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -77,57 +77,57 @@\n -rw-r--r-- 0 root (0) root (0) 2067 2019-06-14 08:20:39.000000 ./usr/share/doc/libpqxx-doc/examples/test92.cxx\n -rw-r--r-- 0 root (0) root (0) 1962 2019-06-14 08:20:39.000000 ./usr/share/doc/libpqxx-doc/examples/test93.cxx\n -rw-r--r-- 0 root (0) root (0) 8574 2019-06-14 08:20:39.000000 ./usr/share/doc/libpqxx-doc/examples/test_helpers.hxx\n -rw-r--r-- 0 root (0) root (0) 4738 2019-06-14 08:20:39.000000 ./usr/share/doc/libpqxx-doc/examples/test_main.hxx\n drwxr-xr-x 0 root (0) root (0) 0 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/\n -rw-r--r-- 0 root (0) root (0) 75 2019-06-14 08:20:39.000000 ./usr/share/doc/libpqxx-doc/html/README.md\n drwxr-xr-x 0 root (0) root (0) 0 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/\n--rw-r--r-- 0 root (0) root (0) 4098 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00002_source.html\n--rw-r--r-- 0 root (0) root (0) 26731 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00005_source.html\n--rw-r--r-- 0 root (0) root (0) 4522 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00008_source.html\n--rw-r--r-- 0 root (0) root (0) 10935 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00011_source.html\n--rw-r--r-- 0 root (0) root (0) 64763 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00014_source.html\n--rw-r--r-- 0 root (0) root (0) 13284 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00017_source.html\n--rw-r--r-- 0 root (0) root (0) 13623 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00020_source.html\n--rw-r--r-- 0 root (0) root (0) 16855 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00023_source.html\n--rw-r--r-- 0 root (0) root (0) 18616 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00026_source.html\n--rw-r--r-- 0 root (0) root (0) 102603 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00029_source.html\n--rw-r--r-- 0 root (0) root (0) 45129 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00032_source.html\n--rw-r--r-- 0 root (0) root (0) 4464 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00035_source.html\n--rw-r--r-- 0 root (0) root (0) 13533 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00038_source.html\n--rw-r--r-- 0 root (0) root (0) 10851 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00041_source.html\n--rw-r--r-- 0 root (0) root (0) 7733 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00044_source.html\n--rw-r--r-- 0 root (0) root (0) 6695 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00047_source.html\n--rw-r--r-- 0 root (0) root (0) 6412 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00050_source.html\n--rw-r--r-- 0 root (0) root (0) 76233 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00053_source.html\n--rw-r--r-- 0 root (0) root (0) 13643 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00056_source.html\n--rw-r--r-- 0 root (0) root (0) 63410 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00059_source.html\n--rw-r--r-- 0 root (0) root (0) 19295 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00062_source.html\n--rw-r--r-- 0 root (0) root (0) 33579 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00065_source.html\n+-rw-r--r-- 0 root (0) root (0) 10851 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00002_source.html\n+-rw-r--r-- 0 root (0) root (0) 17940 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00005_source.html\n+-rw-r--r-- 0 root (0) root (0) 7733 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00008_source.html\n+-rw-r--r-- 0 root (0) root (0) 16855 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00011_source.html\n+-rw-r--r-- 0 root (0) root (0) 4522 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00014_source.html\n+-rw-r--r-- 0 root (0) root (0) 92975 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00017_source.html\n+-rw-r--r-- 0 root (0) root (0) 15403 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00020_source.html\n+-rw-r--r-- 0 root (0) root (0) 102603 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00023_source.html\n+-rw-r--r-- 0 root (0) root (0) 21972 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00026_source.html\n+-rw-r--r-- 0 root (0) root (0) 4098 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00029_source.html\n+-rw-r--r-- 0 root (0) root (0) 3959 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00032_source.html\n+-rw-r--r-- 0 root (0) root (0) 24862 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00035_source.html\n+-rw-r--r-- 0 root (0) root (0) 13623 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00038_source.html\n+-rw-r--r-- 0 root (0) root (0) 6412 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00041_source.html\n+-rw-r--r-- 0 root (0) root (0) 76233 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00044_source.html\n+-rw-r--r-- 0 root (0) root (0) 20541 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00047_source.html\n+-rw-r--r-- 0 root (0) root (0) 33729 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00050_source.html\n+-rw-r--r-- 0 root (0) root (0) 20385 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00053_source.html\n+-rw-r--r-- 0 root (0) root (0) 64763 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00056_source.html\n+-rw-r--r-- 0 root (0) root (0) 45129 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00059_source.html\n+-rw-r--r-- 0 root (0) root (0) 84967 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00062_source.html\n+-rw-r--r-- 0 root (0) root (0) 18616 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00065_source.html\n -rw-r--r-- 0 root (0) root (0) 10272 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00068_source.html\n--rw-r--r-- 0 root (0) root (0) 25872 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00071_source.html\n--rw-r--r-- 0 root (0) root (0) 17797 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00074_source.html\n--rw-r--r-- 0 root (0) root (0) 12139 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00077_source.html\n--rw-r--r-- 0 root (0) root (0) 17940 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00080_source.html\n--rw-r--r-- 0 root (0) root (0) 20541 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00083_source.html\n--rw-r--r-- 0 root (0) root (0) 21972 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00086_source.html\n--rw-r--r-- 0 root (0) root (0) 92975 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00089_source.html\n--rw-r--r-- 0 root (0) root (0) 31642 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00092_source.html\n--rw-r--r-- 0 root (0) root (0) 46628 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00095_source.html\n--rw-r--r-- 0 root (0) root (0) 15403 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00098_source.html\n--rw-r--r-- 0 root (0) root (0) 15413 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00101_source.html\n--rw-r--r-- 0 root (0) root (0) 33729 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00104_source.html\n--rw-r--r-- 0 root (0) root (0) 89497 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00107_source.html\n--rw-r--r-- 0 root (0) root (0) 82623 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00110_source.html\n--rw-r--r-- 0 root (0) root (0) 20385 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00113_source.html\n--rw-r--r-- 0 root (0) root (0) 64031 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00116_source.html\n--rw-r--r-- 0 root (0) root (0) 3959 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00119_source.html\n+-rw-r--r-- 0 root (0) root (0) 64031 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00071_source.html\n+-rw-r--r-- 0 root (0) root (0) 13533 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00074_source.html\n+-rw-r--r-- 0 root (0) root (0) 26731 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00077_source.html\n+-rw-r--r-- 0 root (0) root (0) 4464 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00080_source.html\n+-rw-r--r-- 0 root (0) root (0) 13643 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00083_source.html\n+-rw-r--r-- 0 root (0) root (0) 17797 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00086_source.html\n+-rw-r--r-- 0 root (0) root (0) 46628 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00089_source.html\n+-rw-r--r-- 0 root (0) root (0) 33579 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00092_source.html\n+-rw-r--r-- 0 root (0) root (0) 25872 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00095_source.html\n+-rw-r--r-- 0 root (0) root (0) 63410 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00098_source.html\n+-rw-r--r-- 0 root (0) root (0) 6695 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00101_source.html\n+-rw-r--r-- 0 root (0) root (0) 10935 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00104_source.html\n+-rw-r--r-- 0 root (0) root (0) 15413 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00107_source.html\n+-rw-r--r-- 0 root (0) root (0) 19295 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00110_source.html\n+-rw-r--r-- 0 root (0) root (0) 31642 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00113_source.html\n+-rw-r--r-- 0 root (0) root (0) 13284 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00116_source.html\n+-rw-r--r-- 0 root (0) root (0) 89497 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00119_source.html\n -rw-r--r-- 0 root (0) root (0) 49299 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00122_source.html\n--rw-r--r-- 0 root (0) root (0) 84967 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00125_source.html\n--rw-r--r-- 0 root (0) root (0) 24862 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00128_source.html\n+-rw-r--r-- 0 root (0) root (0) 12139 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00125_source.html\n+-rw-r--r-- 0 root (0) root (0) 82623 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00128_source.html\n -rw-r--r-- 0 root (0) root (0) 7851 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00254.html\n -rw-r--r-- 0 root (0) root (0) 5174 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00255.html\n -rw-r--r-- 0 root (0) root (0) 2784 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00255.js\n -rw-r--r-- 0 root (0) root (0) 3863 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00256.html\n -rw-r--r-- 0 root (0) root (0) 6312 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00257.html\n -rw-r--r-- 0 root (0) root (0) 6598 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00257.js\n -rw-r--r-- 0 root (0) root (0) 4968 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00258.html\n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00002_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00002_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: config-internal-compiler.h Source File\n+libpqxx: nontransaction.hxx Source File\n \n \n \n \n \n \n \n@@ -55,28 +55,65 @@\n \n
\n
\n-
config-internal-compiler.h
\n+
nontransaction.hxx
\n
\n
\n-
1/* Automatically generated from config.h: internal/compiler config. */
\n-
2
\n-
3#define HAVE_POLL 1
\n-
4#define HAVE_SYS_TIME_H 1
\n-
5#define HAVE_SYS_TYPES_H 1
\n-
6#define HAVE_UNISTD_H 1
\n-
7#define PQXX_HAVE_GCC_VISIBILITY 1
\n+
1
\n+
13#ifndef PQXX_H_NONTRANSACTION
\n+
14#define PQXX_H_NONTRANSACTION
\n+
15
\n+
16#include "pqxx/compiler-public.hxx"
\n+
17#include "pqxx/compiler-internal-pre.hxx"
\n+
18
\n+
19#include "pqxx/connection_base.hxx"
\n+
20#include "pqxx/result.hxx"
\n+
21#include "pqxx/transaction_base.hxx"
\n+
22
\n+
23// Methods tested in eg. test module test01 are marked with "//[t01]".
\n+
24
\n+
25namespace pqxx
\n+
26{
\n+
27
\n+
29
\n+
54class PQXX_LIBEXPORT nontransaction : public transaction_base
\n+
55{
\n+
56public:
\n+
58
\n+
63 explicit nontransaction( //[t14]
\n+\n+
65 const std::string &Name=std::string{}) :
\n+
66 namedclass{"nontransaction", Name}, transaction_base{C} { Begin(); }
\n+
67
\n+
68 virtual ~nontransaction(); //[t14]
\n+
69
\n+
70private:
\n+
71 virtual void do_begin() override {} //[t14]
\n+
72 virtual result do_exec(const char C[]) override; //[t14]
\n+
73 virtual void do_commit() override {} //[t14]
\n+
74 virtual void do_abort() override {} //[t14]
\n+
75};
\n+
76
\n+
77} // namespace pqxx
\n+
78
\n+
79#include "pqxx/compiler-internal-post.hxx"
\n+
80#endif
\n+
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n+
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n+
Simple "transaction" class offering no transactional integrity.
Definition: nontransaction.hxx:55
\n+
nontransaction(connection_base &C, const std::string &Name=std::string{})
Constructor.
Definition: nontransaction.hxx:63
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,19 +1,67 @@\n \n \n \n \n \n libpqxx\n \n-config-internal-compiler.h\n- 1/* Automatically generated from config.h: internal/compiler config. */\n- 2\n- 3#define HAVE_POLL 1\n- 4#define HAVE_SYS_TIME_H 1\n- 5#define HAVE_SYS_TYPES_H 1\n- 6#define HAVE_UNISTD_H 1\n- 7#define PQXX_HAVE_GCC_VISIBILITY 1\n+nontransaction.hxx\n+ 1\n+ 13#ifndef PQXX_H_NONTRANSACTION\n+ 14#define PQXX_H_NONTRANSACTION\n+ 15\n+ 16#include \"pqxx/compiler-public.hxx\"\n+ 17#include \"pqxx/compiler-internal-pre.hxx\"\n+ 18\n+ 19#include \"pqxx/connection_base.hxx\"\n+ 20#include \"pqxx/result.hxx\"\n+ 21#include \"pqxx/transaction_base.hxx\"\n+ 22\n+ 23// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n+ 24\n+ 25namespace pqxx\n+ 26{\n+ 27\n+ 29\n+54class PQXX_LIBEXPORT nontransaction : public transaction_base\n+ 55{\n+ 56public:\n+ 58\n+63 explicit nontransaction( //[t14]\n+ 64 connection_base &C,\n+ 65 const std::string &Name=std::string{}) :\n+ 66 namedclass{\"nontransaction\", Name}, transaction_base{C} { Begin(); }\n+ 67\n+ 68 virtual ~nontransaction(); //[t14]\n+ 69\n+ 70private:\n+ 71 virtual void do_begin() override {} //[t14]\n+ 72 virtual result do_exec(const char C[]) override; //[t14]\n+ 73 virtual void do_commit() override {} //[t14]\n+ 74 virtual void do_abort() override {} //[t14]\n+ 75};\n+ 76\n+ 77} // namespace pqxx\n+ 78\n+ 79#include \"pqxx/compiler-internal-post.hxx\"\n+ 80#endif\n+pqxx\n+The home of all libpqxx classes, functions, templates, etc.\n+Definition: array.hxx:26\n+pqxx::connection_base\n+connection_base abstract base class; represents a connection to a database.\n+Definition: connection_base.hxx:140\n+pqxx::nontransaction\n+Simple \"transaction\" class offering no transactional integrity.\n+Definition: nontransaction.hxx:55\n+pqxx::nontransaction::nontransaction\n+nontransaction(connection_base &C, const std::string &Name=std::string{})\n+Constructor.\n+Definition: nontransaction.hxx:63\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * config-internal-compiler.h\n+ * nontransaction.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00005_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00005_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: stream_to.hxx Source File\n+libpqxx: connection.hxx Source File\n \n \n \n \n \n \n \n@@ -55,162 +55,101 @@\n \n
\n
\n-
stream_to.hxx
\n+
connection.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_STREAM_TO
\n-
14#define PQXX_H_STREAM_TO
\n+
13#ifndef PQXX_H_CONNECTION
\n+
14#define PQXX_H_CONNECTION
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18#include "pqxx/transaction_base.hxx"
\n-
19#include "pqxx/stream_base.hxx"
\n-
20#include "pqxx/stream_from.hxx"
\n-
21#include "pqxx/internal/type_utils.hxx"
\n-
22
\n-
23#include <string>
\n+
18
\n+
19#include "pqxx/connectionpolicy.hxx"
\n+
20#include "pqxx/basic_connection.hxx"
\n+
21
\n+
22namespace pqxx
\n+
23{
\n
24
\n-
25
\n-
26namespace pqxx
\n-
27{
\n-
28
\n-
30
\n-
59class PQXX_LIBEXPORT stream_to : public stream_base
\n-
60{
\n-
61public:
\n-
63
\n-
70 stream_to(transaction_base &, const std::string &table_name);
\n-
71
\n-
73 template<typename Columns> stream_to(
\n-\n-
75 const std::string &table_name,
\n-
76 const Columns& columns
\n-
77 );
\n-
78
\n-
80 template<typename Iter> stream_to(
\n-\n-
82 const std::string &table_name,
\n-
83 Iter columns_begin,
\n-
84 Iter columns_end
\n-
85 );
\n-
86
\n-
87 ~stream_to() noexcept;
\n-
88
\n-
90
\n-
96 void complete() override;
\n-
97
\n+
77
\n+
87class PQXX_LIBEXPORT connect_direct : public connectionpolicy
\n+
88{
\n+
89public:
\n+
92 explicit connect_direct(const std::string &opts) : connectionpolicy{opts} {}
\n+
93 virtual handle do_startconnect(handle) override;
\n+
94};
\n+
95
\n+\n+
98
\n
99
\n-
106 template<typename Tuple> stream_to & operator<<(const Tuple &);
\n-
107
\n-
109
\n-\n+
101
\n+
105class PQXX_LIBEXPORT connect_lazy : public connectionpolicy
\n+
106{
\n+
107public:
\n+
110 explicit connect_lazy(const std::string &opts) : connectionpolicy{opts} {}
\n+
111 virtual handle do_completeconnect(handle) override;
\n+
112};
\n+
113
\n
114
\n-
115private:
\n-
117 void write_raw_line(const std::string &);
\n+\n+
117
\n
118
\n-
119 void set_up(transaction_base &, const std::string &table_name);
\n-
120 void set_up(
\n-\n-
122 const std::string &table_name,
\n-
123 const std::string &columns
\n-
124 );
\n-
125
\n-
126 void close() override;
\n-
127};
\n-
128
\n-
129
\n-
130template<typename Columns> inline stream_to::stream_to(
\n-\n-
132 const std::string &table_name,
\n-
133 const Columns& columns
\n-
134) : stream_to{
\n-
135 tb,
\n-
136 table_name,
\n-
137 std::begin(columns),
\n-
138 std::end(columns)
\n-
139}
\n-
140{}
\n+
120
\n+
126class PQXX_LIBEXPORT connect_async : public connectionpolicy
\n+
127{
\n+
128public:
\n+
131 explicit connect_async(const std::string &opts);
\n+
132 virtual handle do_startconnect(handle) override;
\n+
133 virtual handle do_completeconnect(handle) override;
\n+
134 virtual handle do_dropconnect(handle) noexcept override;
\n+
135 virtual bool is_ready(handle) const noexcept override;
\n+
136
\n+
137private:
\n+
139 bool m_connecting;
\n+
140};
\n
141
\n
142
\n-
143template<typename Iter> inline stream_to::stream_to(
\n-\n-
145 const std::string &table_name,
\n-
146 Iter columns_begin,
\n-
147 Iter columns_end
\n-
148) :
\n-
149 namedclass{"stream_from", table_name},
\n-
150 stream_base{tb}
\n-
151{
\n-
152 set_up(
\n-
153 tb,
\n-
154 table_name,
\n-
155 columnlist(columns_begin, columns_end)
\n-
156 );
\n-
157}
\n+\n+
145
\n+
146
\n+
148
\n+
152class PQXX_LIBEXPORT connect_null : public connectionpolicy
\n+
153{
\n+
154public:
\n+
155 explicit connect_null(const std::string &opts) : connectionpolicy{opts} {}
\n+
156};
\n+
157
\n
158
\n-
159
\n-
160namespace internal
\n-
161{
\n-
162
\n-
163class PQXX_LIBEXPORT TypedCopyEscaper
\n-
164{
\n-
165 static std::string escape(const std::string &);
\n-
166public:
\n-
167 template<typename T> std::string operator()(const T* t) const
\n-
168 {
\n-
169 return string_traits<T>::is_null(*t) ? "\\\\N" : escape(to_string(*t));
\n-
170 }
\n-
171};
\n-
172
\n-
173// Explicit specialization so we don't need a string_traits<> for nullptr_t
\n-
174template<> inline std::string TypedCopyEscaper::operator()<std::nullptr_t>(
\n-
175 const std::nullptr_t*
\n-
176) const
\n-
177{ return "\\\\N"; }
\n-
178
\n-
179} // namespace pqxx::internal
\n-
180
\n-
181
\n-
182template<typename Tuple> stream_to & stream_to::operator<<(const Tuple &t)
\n-
183{
\n-
184 write_raw_line(separated_list("\\t", t, internal::TypedCopyEscaper()));
\n-
185 return *this;
\n-
186}
\n-
187
\n-
188} // namespace pqxx
\n-
189
\n-
190
\n-
191#include "pqxx/compiler-internal-post.hxx"
\n-
192#endif
\n-
STL namespace.
\n+\n+
161
\n+
166}
\n+
167
\n+
168#include "pqxx/compiler-internal-post.hxx"
\n+
169
\n+
170#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const field &F)
Write a result field to any type of stream.
Definition: field.hxx:355
\n-
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
\n-
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: util.hxx:95
\n-
std::string escape(const std::string &s, const std::string &null)
Definition: tablewriter.cxx:131
\n-
Traits class for use in string conversions.
Definition: strconv.hxx:51
\n-
Definition: stream_base.hxx:29
\n-
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
\n-
Efficiently pull data directly out of a table.
Definition: stream_from.hxx:30
\n-
Efficiently write data directly to a database table.
Definition: stream_to.hxx:60
\n-
stream_to(transaction_base &, const std::string &table_name)
Create a stream, without specifying columns.
Definition: stream_to.cxx:18
\n-
stream_to & operator<<(const Tuple &)
Insert a row of data.
Definition: stream_to.hxx:182
\n-
Definition: stream_to.hxx:164
\n-
std::string operator()(const T *t) const
Definition: stream_to.hxx:167
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
Base-class template for all libpqxx connection types.
Definition: basic_connection.hxx:47
\n+
Connection policy; creates an immediate connection to a database.
Definition: connection.hxx:88
\n+
connect_direct(const std::string &opts)
Definition: connection.hxx:92
\n+
Lazy connection policy; causes connection to be deferred until first use.
Definition: connection.hxx:106
\n+
connect_lazy(const std::string &opts)
Definition: connection.hxx:110
\n+
Asynchronous connection policy; connects "in the background".
Definition: connection.hxx:127
\n+
Nonfunctional, always-down connection policy for testing/debugging purposes.
Definition: connection.hxx:153
\n+
connect_null(const std::string &opts)
Definition: connection.hxx:155
\n+
Definition: connectionpolicy.hxx:32
\n+
internal::pq::PGconn * handle
Definition: connectionpolicy.hxx:34
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,189 +1,113 @@\n \n \n \n \n \n libpqxx\n \n-stream_to.hxx\n+connection.hxx\n 1\n- 13#ifndef PQXX_H_STREAM_TO\n- 14#define PQXX_H_STREAM_TO\n+ 13#ifndef PQXX_H_CONNECTION\n+ 14#define PQXX_H_CONNECTION\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18#include \"pqxx/transaction_base.hxx\"\n- 19#include \"pqxx/stream_base.hxx\"\n- 20#include \"pqxx/stream_from.hxx\"\n- 21#include \"pqxx/internal/type_utils.hxx\"\n- 22\n- 23#include \n+ 18\n+ 19#include \"pqxx/connectionpolicy.hxx\"\n+ 20#include \"pqxx/basic_connection.hxx\"\n+ 21\n+ 22namespace pqxx\n+ 23{\n 24\n- 25\n- 26namespace pqxx\n- 27{\n- 28\n- 30\n-59class PQXX_LIBEXPORT stream_to : public stream_base\n- 60{\n- 61public:\n- 63\n- 70 stream_to(transaction_base &, const std::string &table_name);\n- 71\n- 73 template stream_to(\n- 74 transaction_base &,\n- 75 const std::string &table_name,\n- 76 const Columns& columns\n- 77 );\n- 78\n- 80 template stream_to(\n- 81 transaction_base &,\n- 82 const std::string &table_name,\n- 83 Iter columns_begin,\n- 84 Iter columns_end\n- 85 );\n- 86\n- 87 ~stream_to() noexcept;\n- 88\n- 90\n- 96 void complete() override;\n- 97\n+ 77\n+87class PQXX_LIBEXPORT connect_direct : public connectionpolicy\n+ 88{\n+ 89public:\n+92 explicit connect_direct(const std::string &opts) : connectionpolicy{opts} {}\n+ 93 virtual handle do_startconnect(handle) override;\n+ 94};\n+ 95\n+97using connection = basic_connection_base;\n+ 98\n 99\n- 106 template stream_to & operator<<(const Tuple &);\n- 107\n- 109\n- 113 stream_to &operator<<(stream_from &);\n+ 101\n+105class PQXX_LIBEXPORT connect_lazy : public connectionpolicy\n+ 106{\n+ 107public:\n+110 explicit connect_lazy(const std::string &opts) : connectionpolicy{opts} {}\n+ 111 virtual handle do_completeconnect(handle) override;\n+ 112};\n+ 113\n 114\n- 115private:\n- 117 void write_raw_line(const std::string &);\n+116using lazyconnection = basic_connection_base;\n+ 117\n 118\n- 119 void set_up(transaction_base &, const std::string &table_name);\n- 120 void set_up(\n- 121 transaction_base &,\n- 122 const std::string &table_name,\n- 123 const std::string &columns\n- 124 );\n- 125\n- 126 void close() override;\n- 127};\n- 128\n- 129\n-130template inline stream_to::stream_to(\n- 131 transaction_base &tb,\n- 132 const std::string &table_name,\n- 133 const Columns& columns\n- 134) : stream_to{\n- 135 tb,\n- 136 table_name,\n- 137 std::begin(columns),\n- 138 std::end(columns)\n- 139}\n- 140{}\n+ 120\n+126class PQXX_LIBEXPORT connect_async : public connectionpolicy\n+ 127{\n+ 128public:\n+ 131 explicit connect_async(const std::string &opts);\n+ 132 virtual handle do_startconnect(handle) override;\n+ 133 virtual handle do_completeconnect(handle) override;\n+ 134 virtual handle do_dropconnect(handle) noexcept override;\n+ 135 virtual bool is_ready(handle) const noexcept override;\n+ 136\n+ 137private:\n+ 139 bool m_connecting;\n+ 140};\n 141\n 142\n-143template inline stream_to::stream_to(\n- 144 transaction_base &tb,\n- 145 const std::string &table_name,\n- 146 Iter columns_begin,\n- 147 Iter columns_end\n- 148) :\n- 149 namedclass{\"stream_from\", table_name},\n- 150 stream_base{tb}\n- 151{\n- 152 set_up(\n- 153 tb,\n- 154 table_name,\n- 155 columnlist(columns_begin, columns_end)\n- 156 );\n- 157}\n+144using asyncconnection = basic_connection_base;\n+ 145\n+ 146\n+ 148\n+152class PQXX_LIBEXPORT connect_null : public connectionpolicy\n+ 153{\n+ 154public:\n+155 explicit connect_null(const std::string &opts) : connectionpolicy{opts} {}\n+ 156};\n+ 157\n 158\n- 159\n- 160namespace internal\n- 161{\n- 162\n-163class PQXX_LIBEXPORT TypedCopyEscaper\n- 164{\n- 165 static std::string escape(const std::string &);\n- 166public:\n-167 template std::string operator()(const T* t) const\n- 168 {\n- 169 return string_traits::is_null(*t) ? \"\\\\N\" : escape(to_string(*t));\n- 170 }\n- 171};\n- 172\n- 173// Explicit specialization so we don't need a string_traits<> for nullptr_t\n-174template<> inline std::string TypedCopyEscaper::operator()(\n- 175 const std::nullptr_t*\n- 176) const\n- 177{ return \"\\\\N\"; }\n- 178\n- 179} // namespace pqxx::internal\n- 180\n- 181\n-182template stream_to & stream_to::operator<<(const Tuple &t)\n- 183{\n- 184 write_raw_line(separated_list(\"\\t\", t, internal::TypedCopyEscaper()));\n- 185 return *this;\n- 186}\n- 187\n- 188} // namespace pqxx\n- 189\n- 190\n- 191#include \"pqxx/compiler-internal-post.hxx\"\n- 192#endif\n-std\n-STL namespace.\n+160using nullconnection = basic_connection_base;\n+ 161\n+ 166}\n+ 167\n+ 168#include \"pqxx/compiler-internal-post.hxx\"\n+ 169\n+ 170#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::operator<<\n-std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const\n-field &F)\n-Write a result field to any type of stream.\n-Definition: field.hxx:355\n-pqxx::to_string\n-std::string to_string(const field &Obj)\n-Convert a field to a string.\n-Definition: result.cxx:451\n-pqxx::separated_list\n-std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS\n-access)\n-Represent sequence of values as a string, joined by a given separator.\n-Definition: util.hxx:95\n-pqxx::internal::escape\n-std::string escape(const std::string &s, const std::string &null)\n-Definition: tablewriter.cxx:131\n-pqxx::string_traits\n-Traits class for use in string conversions.\n-Definition: strconv.hxx:51\n-pqxx::stream_base\n-Definition: stream_base.hxx:29\n-pqxx::stream_base::columnlist\n-static std::string columnlist(const C &)\n-Definition: stream_base.hxx:48\n-pqxx::stream_from\n-Efficiently pull data directly out of a table.\n-Definition: stream_from.hxx:30\n-pqxx::stream_to\n-Efficiently write data directly to a database table.\n-Definition: stream_to.hxx:60\n-pqxx::stream_to::stream_to\n-stream_to(transaction_base &, const std::string &table_name)\n-Create a stream, without specifying columns.\n-Definition: stream_to.cxx:18\n-pqxx::stream_to::operator<<\n-stream_to & operator<<(const Tuple &)\n-Insert a row of data.\n-Definition: stream_to.hxx:182\n-pqxx::internal::TypedCopyEscaper\n-Definition: stream_to.hxx:164\n-pqxx::internal::TypedCopyEscaper::operator()\n-std::string operator()(const T *t) const\n-Definition: stream_to.hxx:167\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n+pqxx::basic_connection_base\n+Base-class template for all libpqxx connection types.\n+Definition: basic_connection.hxx:47\n+pqxx::connect_direct\n+Connection policy; creates an immediate connection to a database.\n+Definition: connection.hxx:88\n+pqxx::connect_direct::connect_direct\n+connect_direct(const std::string &opts)\n+Definition: connection.hxx:92\n+pqxx::connect_lazy\n+Lazy connection policy; causes connection to be deferred until first use.\n+Definition: connection.hxx:106\n+pqxx::connect_lazy::connect_lazy\n+connect_lazy(const std::string &opts)\n+Definition: connection.hxx:110\n+pqxx::connect_async\n+Asynchronous connection policy; connects \"in the background\".\n+Definition: connection.hxx:127\n+pqxx::connect_null\n+Nonfunctional, always-down connection policy for testing/debugging purposes.\n+Definition: connection.hxx:153\n+pqxx::connect_null::connect_null\n+connect_null(const std::string &opts)\n+Definition: connection.hxx:155\n+pqxx::connectionpolicy\n+Definition: connectionpolicy.hxx:32\n+pqxx::connectionpolicy::handle\n+internal::pq::PGconn * handle\n+Definition: connectionpolicy.hxx:34\n * include\n * pqxx\n- * stream_to.hxx\n+ * connection.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00008_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00008_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: config-internal-autotools.h Source File\n+libpqxx: compiler-internal.hxx Source File\n \n \n \n \n \n \n \n@@ -55,30 +55,54 @@\n \n
\n
\n-
config-internal-autotools.h
\n+
compiler-internal.hxx
\n
\n
\n-
1/* Automatically generated from config.h: internal/autotools config. */
\n-
2
\n-
3#define PACKAGE "libpqxx"
\n-
4#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen"
\n-
5#define PACKAGE_NAME "libpqxx"
\n-
6#define PACKAGE_STRING "libpqxx 6.4.5"
\n-
7#define PACKAGE_TARNAME "libpqxx"
\n-
8#define PACKAGE_VERSION "6.4.5"
\n-
9#define VERSION "6.4.5"
\n+
1
\n+
11#ifndef PQXX_H_COMPILER_INTERNAL
\n+
12#define PQXX_H_COMPILER_INTERNAL
\n+
13
\n+
14
\n+
15// Workarounds & definitions needed to compile libpqxx into a library
\n+
16#include "pqxx/config-internal-compiler.h"
\n+
17
\n+
18#ifdef _WIN32
\n+
19
\n+
20#ifdef PQXX_SHARED
\n+
21#undef PQXX_LIBEXPORT
\n+
22#define PQXX_LIBEXPORT __declspec(dllexport)
\n+
23#define PQXX_PRIVATE __declspec()
\n+
24#endif // PQXX_SHARED
\n+
25
\n+
26#ifdef _MSC_VER
\n+
27#pragma warning (disable: 4251 4275 4273)
\n+
28#pragma warning (disable: 4355)
\n+
29#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy().
\n+
30#endif
\n+
31
\n+
32#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_VISIBILITY) // !_WIN32
\n+
33
\n+
34#define PQXX_LIBEXPORT __attribute__ ((visibility("default")))
\n+
35#define PQXX_PRIVATE __attribute__ ((visibility("hidden")))
\n+
36
\n+
37#endif // __GNUC__ && PQXX_HAVE_GCC_VISIBILITY
\n+
38
\n+
39
\n+
40#include "pqxx/compiler-public.hxx"
\n+
41
\n+
42#endif
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,21 +1,46 @@\n \n \n \n \n \n libpqxx\n \n-config-internal-autotools.h\n- 1/* Automatically generated from config.h: internal/autotools config. */\n- 2\n- 3#define PACKAGE \"libpqxx\"\n- 4#define PACKAGE_BUGREPORT \"Jeroen T. Vermeulen\"\n- 5#define PACKAGE_NAME \"libpqxx\"\n- 6#define PACKAGE_STRING \"libpqxx 6.4.5\"\n- 7#define PACKAGE_TARNAME \"libpqxx\"\n- 8#define PACKAGE_VERSION \"6.4.5\"\n- 9#define VERSION \"6.4.5\"\n+compiler-internal.hxx\n+ 1\n+ 11#ifndef PQXX_H_COMPILER_INTERNAL\n+ 12#define PQXX_H_COMPILER_INTERNAL\n+ 13\n+ 14\n+ 15// Workarounds & definitions needed to compile libpqxx into a library\n+ 16#include \"pqxx/config-internal-compiler.h\"\n+ 17\n+ 18#ifdef _WIN32\n+ 19\n+ 20#ifdef PQXX_SHARED\n+ 21#undef PQXX_LIBEXPORT\n+ 22#define PQXX_LIBEXPORT __declspec(dllexport)\n+ 23#define PQXX_PRIVATE __declspec()\n+ 24#endif // PQXX_SHARED\n+ 25\n+ 26#ifdef _MSC_VER\n+ 27#pragma warning (disable: 4251 4275 4273)\n+ 28#pragma warning (disable: 4355)\n+ 29#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy\n+().\n+ 30#endif\n+ 31\n+ 32#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_VISIBILITY) // !_WIN32\n+ 33\n+ 34#define PQXX_LIBEXPORT __attribute__ ((visibility(\"default\")))\n+ 35#define PQXX_PRIVATE __attribute__ ((visibility(\"hidden\")))\n+ 36\n+ 37#endif // __GNUC__ && PQXX_HAVE_GCC_VISIBILITY\n+ 38\n+ 39\n+ 40#include \"pqxx/compiler-public.hxx\"\n+ 41\n+ 42#endif\n * include\n * pqxx\n- * config-internal-autotools.h\n+ * compiler-internal.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00011_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00011_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: subtransaction.hxx Source File\n+libpqxx: types.hxx Source File\n \n \n \n \n \n \n \n@@ -55,69 +55,87 @@\n \n
\n
\n-
subtransaction.hxx
\n+
types.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_SUBTRANSACTION
\n-
14#define PQXX_H_SUBTRANSACTION
\n-
15
\n-
16#include "pqxx/compiler-public.hxx"
\n-
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18
\n-
19#include "pqxx/dbtransaction.hxx"
\n-
20
\n-
21
\n-
22/* Methods tested in eg. self-test program test1 are marked with "//[t01]"
\n-
23 */
\n-
24
\n+
10#ifndef PQXX_H_TYPES
\n+
11#define PQXX_H_TYPES
\n+
12
\n+
13#include <cstddef>
\n+
14
\n+
15namespace pqxx
\n+
16{
\n+
18using result_size_type = unsigned long;
\n+
19
\n+
21using result_difference_type = signed long;
\n+
22
\n+
24using row_size_type = unsigned int;
\n
25
\n-
26namespace pqxx
\n-
27{
\n+
27using row_difference_type = signed int;
\n
28
\n-
33
\n-
79class PQXX_LIBEXPORT subtransaction :
\n-\n-
81 public dbtransaction
\n-
82{
\n-
83public:
\n-
85 explicit subtransaction( //[t88]
\n-
86 dbtransaction &T, const std::string &Name=std::string{});
\n-
87
\n-
89 explicit subtransaction(
\n-
90 subtransaction &T, const std::string &Name=std::string{});
\n-
91
\n-
92 virtual ~subtransaction() noexcept
\n-
93 { End(); }
\n-
94
\n-
95private:
\n-
96 virtual void do_begin() override; //[t88]
\n-
97 virtual void do_commit() override; //[t88]
\n-
98 virtual void do_abort() override; //[t88]
\n-
99
\n-
100 dbtransaction &m_parent;
\n-
101};
\n-
102}
\n-
103
\n-
104#include "pqxx/compiler-internal-post.hxx"
\n-
105#endif
\n+
30using field_size_type = std::size_t;
\n+
31
\n+\n+
34
\n+
35
\n+
36// Forward declarations, to help break compilation dependencies.
\n+
37// These won't necessarily include all classes in libpqxx.
\n+
38class binarystring;
\n+\n+
40class connection_base;
\n+\n+\n+\n+\n+
45class dbtransaction;
\n+
46class field;
\n+\n+\n+
49class range_error;
\n+
50class result;
\n+
51class row;
\n+
52class tablereader;
\n+\n+
54
\n+
55} // namespace pqxx
\n+
56
\n+
57#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n+
signed int row_difference_type
Difference between row sizes.
Definition: types.hxx:27
\n+
long large_object_size_type
Number of bytes in a large object. (Unusual: it's signed.)
Definition: types.hxx:33
\n+
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
\n+
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
\n+
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
\n+
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
\n+
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
\n+
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n+
Definition: connectionpolicy.hxx:32
\n
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
\n-
"Transaction" nested within another transaction
Definition: subtransaction.hxx:82
\n-
virtual ~subtransaction() noexcept
Definition: subtransaction.hxx:92
\n-
Definition: transaction_base.hxx:44
\n+
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:253
\n+
Reference to a field in a result set.
Definition: field.hxx:50
\n+
Accessor for large object's contents.
Definition: largeobject.hxx:138
\n+
Definition: notification.hxx:56
\n+
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n+
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
\n+
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:122
\n+
Reference to one row in a result.
Definition: row.hxx:41
\n+
Iterator for fields in a row. Use as row::const_iterator.
Definition: row.hxx:208
\n+
Reverse iterator for a row. Use as row::const_reverse_iterator.
Definition: row.hxx:280
\n+
Definition: tablereader.hxx:30
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,69 +1,127 @@\n \n \n \n \n \n libpqxx\n \n-subtransaction.hxx\n+types.hxx\n 1\n- 13#ifndef PQXX_H_SUBTRANSACTION\n- 14#define PQXX_H_SUBTRANSACTION\n- 15\n- 16#include \"pqxx/compiler-public.hxx\"\n- 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18\n- 19#include \"pqxx/dbtransaction.hxx\"\n- 20\n- 21\n- 22/* Methods tested in eg. self-test program test1 are marked with \"//[t01]\"\n- 23 */\n- 24\n+ 10#ifndef PQXX_H_TYPES\n+ 11#define PQXX_H_TYPES\n+ 12\n+ 13#include \n+ 14\n+ 15namespace pqxx\n+ 16{\n+18using result_size_type = unsigned long;\n+ 19\n+21using result_difference_type = signed long;\n+ 22\n+24using row_size_type = unsigned int;\n 25\n- 26namespace pqxx\n- 27{\n+27using row_difference_type = signed int;\n 28\n- 33\n-79class PQXX_LIBEXPORT subtransaction :\n- 80 public internal::transactionfocus,\n- 81 public dbtransaction\n- 82{\n- 83public:\n- 85 explicit subtransaction( //[t88]\n- 86 dbtransaction &T, const std::string &Name=std::string{});\n- 87\n- 89 explicit subtransaction(\n- 90 subtransaction &T, const std::string &Name=std::string{});\n- 91\n-92 virtual ~subtransaction() noexcept\n- 93 { End(); }\n- 94\n- 95private:\n- 96 virtual void do_begin() override; //[t88]\n- 97 virtual void do_commit() override; //[t88]\n- 98 virtual void do_abort() override; //[t88]\n- 99\n- 100 dbtransaction &m_parent;\n- 101};\n- 102}\n- 103\n- 104#include \"pqxx/compiler-internal-post.hxx\"\n- 105#endif\n+30using field_size_type = std::size_t;\n+ 31\n+33using large_object_size_type = long;\n+ 34\n+ 35\n+ 36// Forward declarations, to help break compilation dependencies.\n+ 37// These won't necessarily include all classes in libpqxx.\n+ 38class binarystring;\n+ 39class connectionpolicy;\n+ 40class connection_base;\n+ 41class const_result_iterator;\n+ 42class const_reverse_result_iterator;\n+ 43class const_reverse_row_iterator;\n+ 44class const_row_iterator;\n+ 45class dbtransaction;\n+ 46class field;\n+ 47class largeobjectaccess;\n+ 48class notification_receiver;\n+ 49class range_error;\n+ 50class result;\n+ 51class row;\n+ 52class tablereader;\n+ 53class transaction_base;\n+ 54\n+ 55} // namespace pqxx\n+ 56\n+ 57#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n+pqxx::row_difference_type\n+signed int row_difference_type\n+Difference between row sizes.\n+Definition: types.hxx:27\n+pqxx::large_object_size_type\n+long large_object_size_type\n+Number of bytes in a large object. (Unusual: it's signed.)\n+Definition: types.hxx:33\n+pqxx::result_difference_type\n+signed long result_difference_type\n+Difference between result sizes.\n+Definition: types.hxx:21\n+pqxx::field_size_type\n+std::size_t field_size_type\n+Number of bytes in a field of database data.\n+Definition: types.hxx:30\n+pqxx::result_size_type\n+unsigned long result_size_type\n+Number of rows in a result set.\n+Definition: types.hxx:18\n+pqxx::row_size_type\n+unsigned int row_size_type\n+Number of fields in a row of database data.\n+Definition: types.hxx:24\n+pqxx::binarystring\n+Binary data corresponding to PostgreSQL's \"BYTEA\" binary-string type.\n+Definition: binarystring.hxx:54\n+pqxx::connection_base\n+connection_base abstract base class; represents a connection to a database.\n+Definition: connection_base.hxx:140\n+pqxx::connectionpolicy\n+Definition: connectionpolicy.hxx:32\n pqxx::dbtransaction\n Abstract base class responsible for bracketing a backend transaction.\n Definition: dbtransaction.hxx:63\n-pqxx::subtransaction\n-\"Transaction\" nested within another transaction\n-Definition: subtransaction.hxx:82\n-pqxx::subtransaction::~subtransaction\n-virtual ~subtransaction() noexcept\n-Definition: subtransaction.hxx:92\n-pqxx::internal::transactionfocus\n-Definition: transaction_base.hxx:44\n+pqxx::range_error\n+Something is out of range, similar to std::out_of_range.\n+Definition: except.hxx:253\n+pqxx::field\n+Reference to a field in a result set.\n+Definition: field.hxx:50\n+pqxx::largeobjectaccess\n+Accessor for large object's contents.\n+Definition: largeobject.hxx:138\n+pqxx::notification_receiver\n+Definition: notification.hxx:56\n+pqxx::result\n+Result set containing data returned by a query or command.\n+Definition: result.hxx:70\n+pqxx::const_result_iterator\n+Iterator for rows in a result. Use as result::const_iterator.\n+Definition: result_iterator.hxx:36\n+pqxx::const_reverse_result_iterator\n+Reverse iterator for result. Use as result::const_reverse_iterator.\n+Definition: result_iterator.hxx:122\n+pqxx::row\n+Reference to one row in a result.\n+Definition: row.hxx:41\n+pqxx::const_row_iterator\n+Iterator for fields in a row. Use as row::const_iterator.\n+Definition: row.hxx:208\n+pqxx::const_reverse_row_iterator\n+Reverse iterator for a row. Use as row::const_reverse_iterator.\n+Definition: row.hxx:280\n+pqxx::tablereader\n+Definition: tablereader.hxx:30\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * subtransaction.hxx\n+ * types.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00014_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00014_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: cursor.hxx Source File\n+libpqxx: config-internal-autotools.h Source File\n \n \n \n \n \n \n \n@@ -55,318 +55,30 @@\n \n
\n
\n-
cursor.hxx
\n+
config-internal-autotools.h
\n
\n
\n-
1
\n-
13#ifndef PQXX_H_CURSOR
\n-
14#define PQXX_H_CURSOR
\n-
15
\n-
16#include "pqxx/compiler-public.hxx"
\n-
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18
\n-
19#include <limits>
\n-
20#include <stdexcept>
\n-
21
\n-
22#include "pqxx/result.hxx"
\n-
23#include "pqxx/transaction_base.hxx"
\n-
24
\n-
25
\n-
26namespace pqxx
\n-
27{
\n-
29
\n-
40class PQXX_LIBEXPORT cursor_base
\n-
41{
\n-
42public:
\n-\n-\n-
45
\n-
47
\n-\n-
51 {
\n-\n-
55 random_access
\n-
56 };
\n-
57
\n-
59
\n-\n-
63 {
\n-\n-
67 update
\n-
68 };
\n-
69
\n-
71
\n-\n-
90 {
\n-\n-
94 loose
\n-
95 };
\n-
96
\n-
97 cursor_base() =delete;
\n-
98 cursor_base(const cursor_base &) =delete;
\n-\n-
100
\n-
105
\n-
107
\n-
110 static difference_type all() noexcept; //[t81]
\n-
111
\n-
113
\n-
115 static difference_type next() noexcept { return 1; } //[t81]
\n-
116
\n-
118
\n-
120 static difference_type prior() noexcept { return -1; } //[t00]
\n-
121
\n-
123
\n-
125 static difference_type backward_all() noexcept; //[t00]
\n-
126
\n-
128
\n-
130
\n-
135 const std::string &name() const noexcept { return m_name; } //[t81]
\n-
136
\n-
137protected:
\n-\n-\n-
140 const std::string &Name,
\n-
141 bool embellish_name=true);
\n-
142
\n-
143 const std::string m_name;
\n-
144};
\n-
145} // namespace pqxx
\n-
146
\n-
147
\n-
148#include <pqxx/internal/sql_cursor.hxx>
\n-
149
\n-
150
\n-
151namespace pqxx
\n-
152{
\n-
154
\n-
160template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
\n-\n-
162{
\n-
163public:
\n-\n-\n-
166
\n-\n-
169 transaction_base &trans,
\n-
170 const std::string &query,
\n-
171 const std::string &cname,
\n-
172 bool hold) :
\n-
173 m_cur{trans, query, cname, cursor_base::random_access, up, op, hold}
\n-
174 {
\n-
175 }
\n-
176
\n-\n-
179 transaction_base &trans,
\n-
180 const std::string adopted_cursor) :
\n-
181 m_cur{trans, adopted_cursor, op}
\n-
182 {
\n-
183 // Put cursor in known position
\n-
184 m_cur.move(cursor_base::backward_all());
\n-
185 }
\n-
186
\n-
187 void close() noexcept { m_cur.close(); }
\n-
188
\n-
190
\n-
193 size_type size() { return internal::obtain_stateless_cursor_size(m_cur); }
\n-
194
\n-
196
\n-\n-
208 {
\n-
209 return internal::stateless_cursor_retrieve(
\n-
210 m_cur,
\n-\n-
212 begin_pos,
\n-
213 end_pos);
\n-
214 }
\n-
215
\n-
216 const std::string &name() const noexcept { return m_cur.name(); }
\n-
217
\n-
218private:
\n-
219 internal::sql_cursor m_cur;
\n-
220};
\n-
221
\n-
222
\n-
223class icursor_iterator;
\n-
224
\n-
225
\n-
226namespace internal
\n-
227{
\n-
228namespace gate
\n-
229{
\n-
230class icursor_iterator_icursorstream;
\n-
231class icursorstream_icursor_iterator;
\n-
232} // namespace internal::gate
\n-
233} // namespace internal
\n-
234
\n-
235
\n-
237
\n-
252class PQXX_LIBEXPORT icursorstream
\n-
253{
\n-
254public:
\n-\n-\n-
257
\n-
259
\n-\n-
271 transaction_base &context,
\n-
272 const std::string &query,
\n-
273 const std::string &basename,
\n-
274 difference_type sstride=1); //[t81]
\n-
275
\n-
277
\n-\n-
302 transaction_base &context,
\n-
303 const field &cname,
\n-
304 difference_type sstride=1,
\n-\n-
306
\n-
307 operator bool() const noexcept { return not m_done; }
\n-
308
\n-
310
\n-
316 icursorstream &get(result &res) { res = fetchblock(); return *this; } //[t81]
\n-
318
\n-
324 icursorstream &operator>>(result &res) { return get(res); } //[t81]
\n-
325
\n-
327
\n-
331 icursorstream &ignore(std::streamsize n=1); //[t81]
\n-
332
\n-
334
\n-
337 void set_stride(difference_type stride); //[t81]
\n-
338 difference_type stride() const noexcept { return m_stride; } //[t81]
\n-
339
\n-
340private:
\n-
341 result fetchblock();
\n-
342
\n-
343 friend class internal::gate::icursorstream_icursor_iterator;
\n-
344 size_type forward(size_type n=1);
\n-
345 void insert_iterator(icursor_iterator *) noexcept;
\n-
346 void remove_iterator(icursor_iterator *) const noexcept;
\n-
347
\n-
348 void service_iterators(difference_type);
\n-
349
\n-
350 internal::sql_cursor m_cur;
\n-
351
\n-
352 difference_type m_stride;
\n-
353 difference_type m_realpos, m_reqpos;
\n-
354
\n-
355 mutable icursor_iterator *m_iterators;
\n-
356
\n-
357 bool m_done;
\n-
358};
\n-
359
\n-
360
\n-
362
\n-
388class PQXX_LIBEXPORT icursor_iterator
\n-
389{
\n-
390public:
\n-
391 using iterator_category = std::input_iterator_tag;
\n-\n-
393 using pointer = const result *;
\n-
394 using reference = const result &;
\n-\n-\n-\n-
398
\n-
399 icursor_iterator() noexcept; //[t84]
\n-
400 explicit icursor_iterator(istream_type &) noexcept; //[t84]
\n-
401 icursor_iterator(const icursor_iterator &) noexcept; //[t84]
\n-
402 ~icursor_iterator() noexcept;
\n-
403
\n-
404 const result &operator*() const { refresh(); return m_here; } //[t84]
\n-
405 const result *operator->() const { refresh(); return &m_here; } //[t84]
\n-
406 icursor_iterator &operator++(); //[t84]
\n-
407 icursor_iterator operator++(int); //[t84]
\n-
408 icursor_iterator &operator+=(difference_type); //[t84]
\n-
409 icursor_iterator &operator=(const icursor_iterator &) noexcept; //[t84]
\n-
410
\n-
411 bool operator==(const icursor_iterator &rhs) const; //[t84]
\n-
412 bool operator!=(const icursor_iterator &rhs) const noexcept //[t84]
\n-
413 { return not operator==(rhs); }
\n-
414 bool operator<(const icursor_iterator &rhs) const; //[t84]
\n-
415 bool operator>(const icursor_iterator &rhs) const //[t84]
\n-
416 { return rhs < *this; }
\n-
417 bool operator<=(const icursor_iterator &rhs) const //[t84]
\n-
418 { return not (*this > rhs); }
\n-
419 bool operator>=(const icursor_iterator &rhs) const //[t84]
\n-
420 { return not (*this < rhs); }
\n-
421
\n-
422private:
\n-
423 void refresh() const;
\n-
424
\n-
425 friend class internal::gate::icursor_iterator_icursorstream;
\n-
426 difference_type pos() const noexcept { return m_pos; }
\n-
427 void fill(const result &);
\n-
428
\n-
429 icursorstream *m_stream = nullptr;
\n-
430 result m_here;
\n-
431 difference_type m_pos;
\n-
432 icursor_iterator *m_prev = nullptr, *m_next = nullptr;
\n-
433};
\n-
434} // namespace pqxx
\n-
435
\n-
436#include "pqxx/compiler-internal-post.hxx"
\n-
437#endif
\n-
STL namespace.
\n-
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
\n-
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
\n-
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
Common definitions for cursor types.
Definition: cursor.hxx:41
\n-
static difference_type prior() noexcept
Special value: read backwards, one row only.
Definition: cursor.hxx:120
\n-
static difference_type backward_all() noexcept
Special value: read backwards from current position back to origin.
Definition: cursor.cxx:35
\n-
cursor_base(const cursor_base &)=delete
\n-
accesspolicy
Cursor access-pattern policy.
Definition: cursor.hxx:51
\n-
@ forward_only
Cursor can move forward only.
Definition: cursor.hxx:53
\n-
result_size_type size_type
Definition: cursor.hxx:43
\n-
ownershippolicy
Cursor destruction policy.
Definition: cursor.hxx:90
\n-
@ owned
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:92
\n-
const std::string m_name
Definition: cursor.hxx:143
\n-
cursor_base()=delete
\n-
updatepolicy
Cursor update policy.
Definition: cursor.hxx:63
\n-
@ read_only
Cursor can be used to read data but not to write.
Definition: cursor.hxx:65
\n-
cursor_base & operator=(const cursor_base &)=delete
\n-
result_difference_type difference_type
Definition: cursor.hxx:44
\n-
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:162
\n-
const std::string & name() const noexcept
Definition: cursor.hxx:216
\n-
void close() noexcept
Definition: cursor.hxx:187
\n-
stateless_cursor(transaction_base &trans, const std::string adopted_cursor)
Adopt existing scrolling SQL cursor.
Definition: cursor.hxx:178
\n-
result_size_type size_type
Definition: cursor.hxx:164
\n-
result_difference_type difference_type
Definition: cursor.hxx:165
\n-
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:207
\n-
stateless_cursor(transaction_base &trans, const std::string &query, const std::string &cname, bool hold)
Create cursor.
Definition: cursor.hxx:168
\n-
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:193
\n-
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:253
\n-
cursor_base::size_type size_type
Definition: cursor.hxx:255
\n-
icursorstream & get(result &res)
Read new value into given result object; same as operator >>
Definition: cursor.hxx:316
\n-
difference_type stride() const noexcept
Definition: cursor.hxx:338
\n-
cursor_base::difference_type difference_type
Definition: cursor.hxx:256
\n-
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result &)
Definition: cursor.hxx:324
\n-
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:389
\n-
bool operator<=(const icursor_iterator &rhs) const
Definition: cursor.hxx:417
\n-
bool operator!=(const icursor_iterator &rhs) const noexcept
Definition: cursor.hxx:412
\n-
bool operator>(const icursor_iterator &rhs) const
Definition: cursor.hxx:415
\n-
istream_type::difference_type difference_type
Definition: cursor.hxx:397
\n-
const result * operator->() const
Definition: cursor.hxx:405
\n-
std::input_iterator_tag iterator_category
Definition: cursor.hxx:391
\n-
bool operator>=(const icursor_iterator &rhs) const
Definition: cursor.hxx:419
\n-
istream_type::size_type size_type
Definition: cursor.hxx:396
\n-
Reference to a field in a result set.
Definition: field.hxx:50
\n-
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n-
result_difference_type difference_type
Definition: result.hxx:73
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
1/* Automatically generated from config.h: internal/autotools config. */
\n+
2
\n+
3#define PACKAGE "libpqxx"
\n+
4#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen"
\n+
5#define PACKAGE_NAME "libpqxx"
\n+
6#define PACKAGE_STRING "libpqxx 6.4.5"
\n+
7#define PACKAGE_TARNAME "libpqxx"
\n+
8#define PACKAGE_VERSION "6.4.5"
\n+
9#define VERSION "6.4.5"
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,419 +1,21 @@\n \n \n \n \n \n libpqxx\n \n-cursor.hxx\n- 1\n- 13#ifndef PQXX_H_CURSOR\n- 14#define PQXX_H_CURSOR\n- 15\n- 16#include \"pqxx/compiler-public.hxx\"\n- 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18\n- 19#include \n- 20#include \n- 21\n- 22#include \"pqxx/result.hxx\"\n- 23#include \"pqxx/transaction_base.hxx\"\n- 24\n- 25\n- 26namespace pqxx\n- 27{\n- 29\n-40class PQXX_LIBEXPORT cursor_base\n- 41{\n- 42public:\n-43 using size_type = result_size_type;\n-44 using difference_type = result_difference_type;\n- 45\n- 47\n-50 enum accesspolicy\n- 51 {\n-53 forward_only,\n- 55 random_access\n-56 };\n- 57\n- 59\n-62 enum updatepolicy\n- 63 {\n-65 read_only,\n- 67 update\n-68 };\n- 69\n- 71\n-89 enum ownershippolicy\n- 90 {\n-92 owned,\n- 94 loose\n-95 };\n- 96\n-97 cursor_base() =delete;\n-98 cursor_base(const cursor_base &) =delete;\n-99 cursor_base &operator=(const cursor_base &) =delete;\n- 100\n- 105\n- 107\n- 110 static difference_type all() noexcept; //[t81]\n- 111\n- 113\n-115 static difference_type next() noexcept { return 1; } //[t81]\n- 116\n- 118\n-120 static difference_type prior() noexcept { return -1; } //[t00]\n- 121\n- 123\n- 125 static difference_type backward_all() noexcept; //[t00]\n- 126\n- 128\n- 130\n-135 const std::string &name() const noexcept { return m_name; } //[t81]\n- 136\n- 137protected:\n- 138 cursor_base(\n- 139 connection_base &,\n- 140 const std::string &Name,\n- 141 bool embellish_name=true);\n- 142\n-143 const std::string m_name;\n- 144};\n- 145} // namespace pqxx\n- 146\n- 147\n- 148#include \n- 149\n- 150\n- 151namespace pqxx\n- 152{\n- 154\n- 160template\n-161class stateless_cursor\n- 162{\n- 163public:\n-164 using size_type = result_size_type;\n-165 using difference_type = result_difference_type;\n- 166\n-168 stateless_cursor(\n- 169 transaction_base &trans,\n- 170 const std::string &query,\n- 171 const std::string &cname,\n- 172 bool hold) :\n- 173 m_cur{trans, query, cname, cursor_base::random_access, up, op, hold}\n- 174 {\n- 175 }\n- 176\n-178 stateless_cursor(\n- 179 transaction_base &trans,\n- 180 const std::string adopted_cursor) :\n- 181 m_cur{trans, adopted_cursor, op}\n- 182 {\n- 183 // Put cursor in known position\n- 184 m_cur.move(cursor_base::backward_all());\n- 185 }\n- 186\n-187 void close() noexcept { m_cur.close(); }\n- 188\n- 190\n-193 size_type size() { return internal::obtain_stateless_cursor_size(m_cur); }\n- 194\n- 196\n-207 result retrieve(difference_type begin_pos, difference_type end_pos)\n- 208 {\n- 209 return internal::stateless_cursor_retrieve(\n- 210 m_cur,\n- 211 result::difference_type(size()),\n- 212 begin_pos,\n- 213 end_pos);\n- 214 }\n- 215\n-216 const std::string &name() const noexcept { return m_cur.name(); }\n- 217\n- 218private:\n- 219 internal::sql_cursor m_cur;\n- 220};\n- 221\n- 222\n- 223class icursor_iterator;\n- 224\n- 225\n- 226namespace internal\n- 227{\n- 228namespace gate\n- 229{\n- 230class icursor_iterator_icursorstream;\n- 231class icursorstream_icursor_iterator;\n- 232} // namespace internal::gate\n- 233} // namespace internal\n- 234\n- 235\n- 237\n-252class PQXX_LIBEXPORT icursorstream\n- 253{\n- 254public:\n-255 using size_type = cursor_base::size_type;\n-256 using difference_type = cursor_base::difference_type;\n- 257\n- 259\n- 270 icursorstream(\n- 271 transaction_base &context,\n- 272 const std::string &query,\n- 273 const std::string &basename,\n- 274 difference_type sstride=1); //[t81]\n- 275\n- 277\n- 301 icursorstream(\n- 302 transaction_base &context,\n- 303 const field &cname,\n- 304 difference_type sstride=1,\n- 305 cursor_base::ownershippolicy op=cursor_base::owned); //[t84]\n- 306\n-307 operator bool() const noexcept { return not m_done; }\n- 308\n- 310\n-316 icursorstream &get(result &res) { res = fetchblock(); return *this; } //\n-[t81]\n- 318\n-324 icursorstream &operator>>(result &res) { return get(res); } //[t81]\n- 325\n- 327\n- 331 icursorstream &ignore(std::streamsize n=1); //[t81]\n- 332\n- 334\n- 337 void set_stride(difference_type stride); //[t81]\n-338 difference_type stride() const noexcept { return m_stride; } //[t81]\n- 339\n- 340private:\n- 341 result fetchblock();\n- 342\n-343 friend class internal::gate::icursorstream_icursor_iterator;\n- 344 size_type forward(size_type n=1);\n- 345 void insert_iterator(icursor_iterator *) noexcept;\n- 346 void remove_iterator(icursor_iterator *) const noexcept;\n- 347\n- 348 void service_iterators(difference_type);\n- 349\n- 350 internal::sql_cursor m_cur;\n- 351\n- 352 difference_type m_stride;\n- 353 difference_type m_realpos, m_reqpos;\n- 354\n- 355 mutable icursor_iterator *m_iterators;\n- 356\n- 357 bool m_done;\n- 358};\n- 359\n- 360\n- 362\n-388class PQXX_LIBEXPORT icursor_iterator\n- 389{\n- 390public:\n-391 using iterator_category = std::input_iterator_tag;\n-392 using value_type = result;\n-393 using pointer = const result *;\n-394 using reference = const result &;\n-395 using istream_type = icursorstream;\n-396 using size_type = istream_type::size_type;\n-397 using difference_type = istream_type::difference_type;\n- 398\n- 399 icursor_iterator() noexcept; //[t84]\n- 400 explicit icursor_iterator(istream_type &) noexcept; //[t84]\n- 401 icursor_iterator(const icursor_iterator &) noexcept; //[t84]\n- 402 ~icursor_iterator() noexcept;\n- 403\n-404 const result &operator*() const { refresh(); return m_here; } //[t84]\n-405 const result *operator->() const { refresh(); return &m_here; } //[t84]\n- 406 icursor_iterator &operator++(); //[t84]\n- 407 icursor_iterator operator++(int); //[t84]\n- 408 icursor_iterator &operator+=(difference_type); //[t84]\n- 409 icursor_iterator &operator=(const icursor_iterator &) noexcept; //[t84]\n- 410\n- 411 bool operator==(const icursor_iterator &rhs) const; //[t84]\n-412 bool operator!=(const icursor_iterator &rhs) const noexcept //[t84]\n- 413 { return not operator==(rhs); }\n- 414 bool operator<(const icursor_iterator &rhs) const; //[t84]\n-415 bool operator>(const icursor_iterator &rhs) const //[t84]\n- 416 { return rhs < *this; }\n-417 bool operator<=(const icursor_iterator &rhs) const //[t84]\n- 418 { return not (*this > rhs); }\n-419 bool operator>=(const icursor_iterator &rhs) const //[t84]\n- 420 { return not (*this < rhs); }\n- 421\n- 422private:\n- 423 void refresh() const;\n- 424\n-425 friend class internal::gate::icursor_iterator_icursorstream;\n- 426 difference_type pos() const noexcept { return m_pos; }\n- 427 void fill(const result &);\n- 428\n- 429 icursorstream *m_stream = nullptr;\n- 430 result m_here;\n- 431 difference_type m_pos;\n- 432 icursor_iterator *m_prev = nullptr, *m_next = nullptr;\n- 433};\n- 434} // namespace pqxx\n- 435\n- 436#include \"pqxx/compiler-internal-post.hxx\"\n- 437#endif\n-std\n-STL namespace.\n-pqxx\n-The home of all libpqxx classes, functions, templates, etc.\n-Definition: array.hxx:26\n-pqxx::result_difference_type\n-signed long result_difference_type\n-Difference between result sizes.\n-Definition: types.hxx:21\n-pqxx::result_size_type\n-unsigned long result_size_type\n-Number of rows in a result set.\n-Definition: types.hxx:18\n-pqxx::connection_base\n-connection_base abstract base class; represents a connection to a database.\n-Definition: connection_base.hxx:140\n-pqxx::cursor_base\n-Common definitions for cursor types.\n-Definition: cursor.hxx:41\n-pqxx::cursor_base::prior\n-static difference_type prior() noexcept\n-Special value: read backwards, one row only.\n-Definition: cursor.hxx:120\n-pqxx::cursor_base::backward_all\n-static difference_type backward_all() noexcept\n-Special value: read backwards from current position back to origin.\n-Definition: cursor.cxx:35\n-pqxx::cursor_base::cursor_base\n-cursor_base(const cursor_base &)=delete\n-pqxx::cursor_base::accesspolicy\n-accesspolicy\n-Cursor access-pattern policy.\n-Definition: cursor.hxx:51\n-pqxx::cursor_base::forward_only\n-@ forward_only\n-Cursor can move forward only.\n-Definition: cursor.hxx:53\n-pqxx::cursor_base::size_type\n-result_size_type size_type\n-Definition: cursor.hxx:43\n-pqxx::cursor_base::ownershippolicy\n-ownershippolicy\n-Cursor destruction policy.\n-Definition: cursor.hxx:90\n-pqxx::cursor_base::owned\n-@ owned\n-Destroy SQL cursor when cursor object is closed at end of transaction.\n-Definition: cursor.hxx:92\n-pqxx::cursor_base::m_name\n-const std::string m_name\n-Definition: cursor.hxx:143\n-pqxx::cursor_base::cursor_base\n-cursor_base()=delete\n-pqxx::cursor_base::updatepolicy\n-updatepolicy\n-Cursor update policy.\n-Definition: cursor.hxx:63\n-pqxx::cursor_base::read_only\n-@ read_only\n-Cursor can be used to read data but not to write.\n-Definition: cursor.hxx:65\n-pqxx::cursor_base::operator=\n-cursor_base & operator=(const cursor_base &)=delete\n-pqxx::cursor_base::difference_type\n-result_difference_type difference_type\n-Definition: cursor.hxx:44\n-pqxx::stateless_cursor\n-\"Stateless cursor\" class: easy API for retrieving parts of result sets\n-Definition: cursor.hxx:162\n-pqxx::stateless_cursor::name\n-const std::string & name() const noexcept\n-Definition: cursor.hxx:216\n-pqxx::stateless_cursor::close\n-void close() noexcept\n-Definition: cursor.hxx:187\n-pqxx::stateless_cursor::stateless_cursor\n-stateless_cursor(transaction_base &trans, const std::string adopted_cursor)\n-Adopt existing scrolling SQL cursor.\n-Definition: cursor.hxx:178\n-pqxx::stateless_cursor::size_type\n-result_size_type size_type\n-Definition: cursor.hxx:164\n-pqxx::stateless_cursor::difference_type\n-result_difference_type difference_type\n-Definition: cursor.hxx:165\n-pqxx::stateless_cursor::retrieve\n-result retrieve(difference_type begin_pos, difference_type end_pos)\n-Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)\n-Definition: cursor.hxx:207\n-pqxx::stateless_cursor::stateless_cursor\n-stateless_cursor(transaction_base &trans, const std::string &query, const std::\n-string &cname, bool hold)\n-Create cursor.\n-Definition: cursor.hxx:168\n-pqxx::stateless_cursor::size\n-size_type size()\n-Number of rows in cursor's result set.\n-Definition: cursor.hxx:193\n-pqxx::icursorstream\n-Simple read-only cursor represented as a stream of results.\n-Definition: cursor.hxx:253\n-pqxx::icursorstream::size_type\n-cursor_base::size_type size_type\n-Definition: cursor.hxx:255\n-pqxx::icursorstream::get\n-icursorstream & get(result &res)\n-Read new value into given result object; same as operator >>\n-Definition: cursor.hxx:316\n-pqxx::icursorstream::stride\n-difference_type stride() const noexcept\n-Definition: cursor.hxx:338\n-pqxx::icursorstream::difference_type\n-cursor_base::difference_type difference_type\n-Definition: cursor.hxx:256\n-pqxx::icursorstream::operator>>\n-icursorstream & operator>>(result &res)\n-Read new value into given result object; same as get(result &)\n-Definition: cursor.hxx:324\n-pqxx::icursor_iterator\n-Approximate istream_iterator for icursorstream.\n-Definition: cursor.hxx:389\n-pqxx::icursor_iterator::operator<=\n-bool operator<=(const icursor_iterator &rhs) const\n-Definition: cursor.hxx:417\n-pqxx::icursor_iterator::operator!=\n-bool operator!=(const icursor_iterator &rhs) const noexcept\n-Definition: cursor.hxx:412\n-pqxx::icursor_iterator::operator>\n-bool operator>(const icursor_iterator &rhs) const\n-Definition: cursor.hxx:415\n-pqxx::icursor_iterator::difference_type\n-istream_type::difference_type difference_type\n-Definition: cursor.hxx:397\n-pqxx::icursor_iterator::operator->\n-const result * operator->() const\n-Definition: cursor.hxx:405\n-pqxx::icursor_iterator::iterator_category\n-std::input_iterator_tag iterator_category\n-Definition: cursor.hxx:391\n-pqxx::icursor_iterator::operator>=\n-bool operator>=(const icursor_iterator &rhs) const\n-Definition: cursor.hxx:419\n-pqxx::icursor_iterator::size_type\n-istream_type::size_type size_type\n-Definition: cursor.hxx:396\n-pqxx::field\n-Reference to a field in a result set.\n-Definition: field.hxx:50\n-pqxx::result\n-Result set containing data returned by a query or command.\n-Definition: result.hxx:70\n-pqxx::result::difference_type\n-result_difference_type difference_type\n-Definition: result.hxx:73\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n+config-internal-autotools.h\n+ 1/* Automatically generated from config.h: internal/autotools config. */\n+ 2\n+ 3#define PACKAGE \"libpqxx\"\n+ 4#define PACKAGE_BUGREPORT \"Jeroen T. Vermeulen\"\n+ 5#define PACKAGE_NAME \"libpqxx\"\n+ 6#define PACKAGE_STRING \"libpqxx 6.4.5\"\n+ 7#define PACKAGE_TARNAME \"libpqxx\"\n+ 8#define PACKAGE_VERSION \"6.4.5\"\n+ 9#define VERSION \"6.4.5\"\n * include\n * pqxx\n- * cursor.hxx\n+ * config-internal-autotools.h\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00017_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00017_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: stream_base.hxx Source File\n+libpqxx: except.hxx Source File\n \n \n \n \n \n \n \n@@ -55,80 +55,500 @@\n \n
\n
\n-
stream_base.hxx
\n+
except.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_STREAM_BASE
\n-
14#define PQXX_H_STREAM_BASE
\n+
13#ifndef PQXX_H_EXCEPT
\n+
14#define PQXX_H_EXCEPT
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18#include "pqxx/transaction_base.hxx"
\n-
19#include "pqxx/util.hxx"
\n+
18
\n+
19#include <stdexcept>
\n
20
\n-
21#include <string>
\n+
21#include "pqxx/util.hxx"
\n
22
\n
23
\n
24namespace pqxx
\n
25{
\n
26
\n-
27class PQXX_LIBEXPORT PQXX_NOVTABLE stream_base :
\n-\n-
29{
\n-
30public:
\n-
31 explicit stream_base(transaction_base &);
\n-
32 // TODO: Can we get rid of the vtable?
\n-
33 virtual ~stream_base() noexcept =default;
\n-
34 virtual void complete() = 0;
\n-
35 operator bool() const noexcept;
\n-
36 bool operator!() const noexcept;
\n-
37protected:
\n-
38 bool m_finished;
\n-
39 virtual void close();
\n-
40 template<typename C> static std::string columnlist(const C &);
\n-
41 template<typename I> static std::string columnlist(I begin, I end);
\n-
42private:
\n-\n-\n-
45 stream_base & operator=(const stream_base &);
\n-
46};
\n-
47
\n-
48template<typename C> std::string stream_base::columnlist(const C &c)
\n-
49{
\n-
50 return columnlist(std::begin(c), std::end(c));
\n-
51}
\n-
52
\n-
53template<typename I> std::string stream_base::columnlist(I begin, I end)
\n-
54{
\n-
55 return separated_list(",", begin, end);
\n-
56}
\n-
57
\n-
58} // namespace pqxx
\n-
59
\n+
44
\n+
55class PQXX_LIBEXPORT PQXX_NOVTABLE pqxx_exception
\n+
56{
\n+
57public:
\n+
59 virtual ~pqxx_exception() noexcept =0;
\n
60
\n-
61#include "pqxx/compiler-internal-post.hxx"
\n-
62#endif
\n+
62
\n+
84 PQXX_CONST virtual const std::exception &base() const noexcept =0; //[t00]
\n+
85};
\n+
86
\n+
87
\n+
89class PQXX_LIBEXPORT failure :
\n+
90 public pqxx_exception, public std::runtime_error
\n+
91{
\n+
92 virtual const std::exception &base() const noexcept override
\n+
93 { return *this; }
\n+
94public:
\n+
95 explicit failure(const std::string &);
\n+
96};
\n+
97
\n+
98
\n+
100
\n+
118class PQXX_LIBEXPORT broken_connection : public failure
\n+
119{
\n+
120public:
\n+\n+
122 explicit broken_connection(const std::string &);
\n+
123};
\n+
124
\n+
125
\n+
127
\n+
130class PQXX_LIBEXPORT sql_error : public failure
\n+
131{
\n+
133 const std::string m_query;
\n+
135 const std::string m_sqlstate;
\n+
136
\n+
137public:
\n+
138 explicit sql_error(
\n+
139 const std::string &msg="",
\n+
140 const std::string &Q="",
\n+
141 const char sqlstate[]=nullptr);
\n+
142 virtual ~sql_error() noexcept;
\n+
143
\n+
145 PQXX_PURE const std::string &query() const noexcept; //[t56]
\n+
146
\n+
148 PQXX_PURE const std::string &sqlstate() const noexcept;
\n+
149};
\n+
150
\n+
151
\n+
153
\n+
159class PQXX_LIBEXPORT in_doubt_error : public failure
\n+
160{
\n+
161public:
\n+
162 explicit in_doubt_error(const std::string &);
\n+
163};
\n+
164
\n+
165
\n+
167class PQXX_LIBEXPORT transaction_rollback : public failure
\n+
168{
\n+
169public:
\n+
170 explicit transaction_rollback(const std::string &);
\n+
171};
\n+
172
\n+
173
\n+
175
\n+
183class PQXX_LIBEXPORT serialization_failure : public transaction_rollback
\n+
184{
\n+
185public:
\n+
186 explicit serialization_failure(const std::string &);
\n+
187};
\n+
188
\n+
189
\n+\n+
192{
\n+
193public:
\n+
194 explicit statement_completion_unknown(const std::string &);
\n+
195};
\n+
196
\n+
197
\n+
199class PQXX_LIBEXPORT deadlock_detected : public transaction_rollback
\n+
200{
\n+
201public:
\n+
202 explicit deadlock_detected(const std::string &);
\n+
203};
\n+
204
\n+
205
\n+
207class PQXX_LIBEXPORT internal_error :
\n+
208 public pqxx_exception, public std::logic_error
\n+
209{
\n+
210 virtual const std::exception &base() const noexcept override
\n+
211 { return *this; }
\n+
212public:
\n+
213 explicit internal_error(const std::string &);
\n+
214};
\n+
215
\n+
216
\n+
218class PQXX_LIBEXPORT usage_error :
\n+
219 public pqxx_exception, public std::logic_error
\n+
220{
\n+
221 virtual const std::exception &base() const noexcept override
\n+
222 { return *this; }
\n+
223public:
\n+
224 explicit usage_error(const std::string &);
\n+
225};
\n+
226
\n+
227
\n+
229class PQXX_LIBEXPORT argument_error :
\n+
230 public pqxx_exception, public std::invalid_argument
\n+
231{
\n+
232 virtual const std::exception &base() const noexcept override
\n+
233 { return *this; }
\n+
234public:
\n+
235 explicit argument_error(const std::string &);
\n+
236};
\n+
237
\n+
238
\n+
240class PQXX_LIBEXPORT conversion_error :
\n+
241 public pqxx_exception, public std::domain_error
\n+
242{
\n+
243 virtual const std::exception &base() const noexcept override
\n+
244 { return *this; }
\n+
245public:
\n+
246 explicit conversion_error(const std::string &);
\n+
247};
\n+
248
\n+
249
\n+
251class PQXX_LIBEXPORT range_error :
\n+
252 public pqxx_exception, public std::out_of_range
\n+
253{
\n+
254 virtual const std::exception &base() const noexcept override
\n+
255 { return *this; }
\n+
256public:
\n+
257 explicit range_error(const std::string &);
\n+
258};
\n+
259
\n+
260
\n+
262class PQXX_LIBEXPORT unexpected_rows : public range_error
\n+
263{
\n+
264 virtual const std::exception &base() const noexcept override
\n+
265 { return *this; }
\n+
266public:
\n+
267 explicit unexpected_rows(const std::string &msg) : range_error{msg} {}
\n+
268};
\n+
269
\n+
270
\n+
272class PQXX_LIBEXPORT feature_not_supported : public sql_error
\n+
273{
\n+
274public:
\n+\n+
276 const std::string &err,
\n+
277 const std::string &Q="",
\n+
278 const char sqlstate[]=nullptr) :
\n+
279 sql_error{err, Q, sqlstate} {}
\n+
280};
\n+
281
\n+
283class PQXX_LIBEXPORT data_exception : public sql_error
\n+
284{
\n+
285public:
\n+\n+
287 const std::string &err,
\n+
288 const std::string &Q="",
\n+
289 const char sqlstate[]=nullptr) :
\n+
290 sql_error{err, Q, sqlstate} {}
\n+
291};
\n+
292
\n+
293class PQXX_LIBEXPORT integrity_constraint_violation : public sql_error
\n+
294{
\n+
295public:
\n+\n+
297 const std::string &err,
\n+
298 const std::string &Q="",
\n+
299 const char sqlstate[]=nullptr) :
\n+
300 sql_error{err, Q, sqlstate} {}
\n+
301};
\n+
302
\n+
303class PQXX_LIBEXPORT restrict_violation :
\n+\n+
305{
\n+
306public:
\n+\n+
308 const std::string &err,
\n+
309 const std::string &Q="",
\n+
310 const char sqlstate[]=nullptr) :
\n+
311 integrity_constraint_violation{err, Q, sqlstate} {}
\n+
312};
\n+
313
\n+
314class PQXX_LIBEXPORT not_null_violation :
\n+\n+
316{
\n+
317public:
\n+\n+
319 const std::string &err,
\n+
320 const std::string &Q="",
\n+
321 const char sqlstate[]=nullptr) :
\n+
322 integrity_constraint_violation{err, Q, sqlstate} {}
\n+
323};
\n+
324
\n+
325class PQXX_LIBEXPORT foreign_key_violation :
\n+\n+
327{
\n+
328public:
\n+\n+
330 const std::string &err,
\n+
331 const std::string &Q="",
\n+
332 const char sqlstate[]=nullptr) :
\n+
333 integrity_constraint_violation{err, Q, sqlstate} {}
\n+
334};
\n+
335
\n+
336class PQXX_LIBEXPORT unique_violation :
\n+\n+
338{
\n+
339public:
\n+\n+
341 const std::string &err,
\n+
342 const std::string &Q="",
\n+
343 const char sqlstate[]=nullptr) :
\n+
344 integrity_constraint_violation{err, Q, sqlstate} {}
\n+
345};
\n+
346
\n+
347class PQXX_LIBEXPORT check_violation :
\n+\n+
349{
\n+
350public:
\n+\n+
352 const std::string &err,
\n+
353 const std::string &Q="",
\n+
354 const char sqlstate[]=nullptr) :
\n+
355 integrity_constraint_violation{err, Q, sqlstate} {}
\n+
356};
\n+
357
\n+
358class PQXX_LIBEXPORT invalid_cursor_state : public sql_error
\n+
359{
\n+
360public:
\n+\n+
362 const std::string &err,
\n+
363 const std::string &Q="",
\n+
364 const char sqlstate[]=nullptr) :
\n+
365 sql_error{err, Q, sqlstate} {}
\n+
366};
\n+
367
\n+
368class PQXX_LIBEXPORT invalid_sql_statement_name : public sql_error
\n+
369{
\n+
370public:
\n+\n+
372 const std::string &err,
\n+
373 const std::string &Q="",
\n+
374 const char sqlstate[]=nullptr) :
\n+
375 sql_error{err, Q, sqlstate} {}
\n+
376};
\n+
377
\n+
378class PQXX_LIBEXPORT invalid_cursor_name : public sql_error
\n+
379{
\n+
380public:
\n+\n+
382 const std::string &err,
\n+
383 const std::string &Q="",
\n+
384 const char sqlstate[]=nullptr) :
\n+
385 sql_error{err, Q, sqlstate} {}
\n+
386};
\n+
387
\n+
388class PQXX_LIBEXPORT syntax_error : public sql_error
\n+
389{
\n+
390public:
\n+
392 const int error_position;
\n+
393
\n+
394 explicit syntax_error(
\n+
395 const std::string &err,
\n+
396 const std::string &Q="",
\n+
397 const char sqlstate[]=nullptr,
\n+
398 int pos=-1) :
\n+
399 sql_error{err, Q, sqlstate}, error_position{pos} {}
\n+
400};
\n+
401
\n+
402class PQXX_LIBEXPORT undefined_column : public syntax_error
\n+
403{
\n+
404public:
\n+\n+
406 const std::string &err,
\n+
407 const std::string &Q="",
\n+
408 const char sqlstate[]=nullptr) :
\n+
409 syntax_error{err, Q, sqlstate} {}
\n+
410};
\n+
411
\n+
412class PQXX_LIBEXPORT undefined_function : public syntax_error
\n+
413{
\n+
414public:
\n+\n+
416 const std::string &err,
\n+
417 const std::string &Q="",
\n+
418 const char sqlstate[]=nullptr) :
\n+
419 syntax_error{err, Q, sqlstate} {}
\n+
420};
\n+
421
\n+
422class PQXX_LIBEXPORT undefined_table : public syntax_error
\n+
423{
\n+
424public:
\n+\n+
426 const std::string &err,
\n+
427 const std::string &Q="",
\n+
428 const char sqlstate[]=nullptr) :
\n+
429 syntax_error{err, Q, sqlstate} {}
\n+
430};
\n+
431
\n+
432class PQXX_LIBEXPORT insufficient_privilege : public sql_error
\n+
433{
\n+
434public:
\n+\n+
436 const std::string &err,
\n+
437 const std::string &Q="",
\n+
438 const char sqlstate[]=nullptr) :
\n+
439 sql_error{err, Q, sqlstate} {}
\n+
440};
\n+
441
\n+
443class PQXX_LIBEXPORT insufficient_resources : public sql_error
\n+
444{
\n+
445public:
\n+\n+
447 const std::string &err,
\n+
448 const std::string &Q="",
\n+
449 const char sqlstate[]=nullptr) :
\n+
450 sql_error{err,Q, sqlstate} {}
\n+
451};
\n+
452
\n+
453class PQXX_LIBEXPORT disk_full : public insufficient_resources
\n+
454{
\n+
455public:
\n+
456 explicit disk_full(
\n+
457 const std::string &err,
\n+
458 const std::string &Q="",
\n+
459 const char sqlstate[]=nullptr) :
\n+
460 insufficient_resources{err, Q, sqlstate} {}
\n+
461};
\n+
462
\n+
463class PQXX_LIBEXPORT out_of_memory : public insufficient_resources
\n+
464{
\n+
465public:
\n+\n+
467 const std::string &err,
\n+
468 const std::string &Q="",
\n+
469 const char sqlstate[]=nullptr) :
\n+
470 insufficient_resources{err, Q, sqlstate} {}
\n+
471};
\n+
472
\n+
473class PQXX_LIBEXPORT too_many_connections : public broken_connection
\n+
474{
\n+
475public:
\n+
476 explicit too_many_connections(const std::string &err) :
\n+
477 broken_connection{err} {}
\n+
478};
\n+
479
\n+
481
\n+
483class PQXX_LIBEXPORT plpgsql_error : public sql_error
\n+
484{
\n+
485public:
\n+\n+
487 const std::string &err,
\n+
488 const std::string &Q="",
\n+
489 const char sqlstate[]=nullptr) :
\n+
490 sql_error{err, Q, sqlstate} {}
\n+
491};
\n+
492
\n+
494class PQXX_LIBEXPORT plpgsql_raise : public plpgsql_error
\n+
495{
\n+
496public:
\n+\n+
498 const std::string &err,
\n+
499 const std::string &Q="",
\n+
500 const char sqlstate[]=nullptr) :
\n+
501 plpgsql_error{err, Q, sqlstate} {}
\n+
502};
\n+
503
\n+
504class PQXX_LIBEXPORT plpgsql_no_data_found : public plpgsql_error
\n+
505{
\n+
506public:
\n+\n+
508 const std::string &err,
\n+
509 const std::string &Q="",
\n+
510 const char sqlstate[]=nullptr) :
\n+
511 plpgsql_error{err, Q, sqlstate} {}
\n+
512};
\n+
513
\n+
514class PQXX_LIBEXPORT plpgsql_too_many_rows : public plpgsql_error
\n+
515{
\n+
516public:
\n+\n+
518 const std::string &err,
\n+
519 const std::string &Q="",
\n+
520 const char sqlstate[]=nullptr) :
\n+
521 plpgsql_error{err, Q, sqlstate} {}
\n+
522};
\n+
523
\n+
528}
\n+
529
\n+
530#include "pqxx/compiler-internal-post.hxx"
\n+
531
\n+
532#endif
\n
STL namespace.
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: util.hxx:95
\n-
Definition: stream_base.hxx:29
\n-
virtual ~stream_base() noexcept=default
\n-
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
\n-
Definition: transaction_base.hxx:44
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
Mixin base class to identify libpqxx-specific exception types.
Definition: except.hxx:56
\n+
virtual PQXX_CONST const std::exception & base() const noexcept=0
Return std::exception base-class object.
\n+
Run-time failure encountered by libpqxx, similar to std::runtime_error.
Definition: except.hxx:91
\n+
Exception class for lost or failed backend connection.
Definition: except.hxx:119
\n+
Exception class for failed queries.
Definition: except.hxx:131
\n+
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:160
\n+
The backend saw itself forced to roll back the ongoing transaction.
Definition: except.hxx:168
\n+
Transaction failed to serialize. Please retry it.
Definition: except.hxx:184
\n+
We can't tell whether our last statement succeeded.
Definition: except.hxx:192
\n+
The ongoing transaction has deadlocked. Retrying it may help.
Definition: except.hxx:200
\n+
Internal error in libpqxx library.
Definition: except.hxx:209
\n+
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:220
\n+
Invalid argument passed to libpqxx, similar to std::invalid_argument.
Definition: except.hxx:231
\n+
Value conversion failed, e.g. when converting "Hello" to int.
Definition: except.hxx:242
\n+
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:253
\n+
Query returned an unexpected number of rows.
Definition: except.hxx:263
\n+
unexpected_rows(const std::string &msg)
Definition: except.hxx:267
\n+
Database feature not supported in current setup.
Definition: except.hxx:273
\n+
feature_not_supported(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:275
\n+
Error in data provided to SQL statement.
Definition: except.hxx:284
\n+
data_exception(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:286
\n+
Definition: except.hxx:294
\n+
integrity_constraint_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:296
\n+
Definition: except.hxx:305
\n+
restrict_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:307
\n+
Definition: except.hxx:316
\n+
not_null_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:318
\n+
Definition: except.hxx:327
\n+
foreign_key_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:329
\n+
Definition: except.hxx:338
\n+
unique_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:340
\n+
Definition: except.hxx:349
\n+
check_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:351
\n+
Definition: except.hxx:359
\n+
invalid_cursor_state(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:361
\n+
Definition: except.hxx:369
\n+
invalid_sql_statement_name(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:371
\n+
Definition: except.hxx:379
\n+
invalid_cursor_name(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:381
\n+
Definition: except.hxx:389
\n+
const int error_position
Approximate position in string where error occurred, or -1 if unknown.
Definition: except.hxx:392
\n+
syntax_error(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr, int pos=-1)
Definition: except.hxx:394
\n+
Definition: except.hxx:403
\n+
undefined_column(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:405
\n+
Definition: except.hxx:413
\n+
undefined_function(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:415
\n+
Definition: except.hxx:423
\n+
undefined_table(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:425
\n+
Definition: except.hxx:433
\n+
insufficient_privilege(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:435
\n+
Resource shortage on the server.
Definition: except.hxx:444
\n+
insufficient_resources(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:446
\n+
Definition: except.hxx:454
\n+
disk_full(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:456
\n+
Definition: except.hxx:464
\n+
out_of_memory(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:466
\n+
Definition: except.hxx:474
\n+
too_many_connections(const std::string &err)
Definition: except.hxx:476
\n+
PL/pgSQL error.
Definition: except.hxx:484
\n+
plpgsql_error(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:486
\n+
Exception raised in PL/pgSQL procedure.
Definition: except.hxx:495
\n+
plpgsql_raise(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:497
\n+
Definition: except.hxx:505
\n+
plpgsql_no_data_found(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:507
\n+
Definition: except.hxx:515
\n+
plpgsql_too_many_rows(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:517
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,85 +1,632 @@\n \n \n \n \n \n libpqxx\n \n-stream_base.hxx\n+except.hxx\n 1\n- 13#ifndef PQXX_H_STREAM_BASE\n- 14#define PQXX_H_STREAM_BASE\n+ 13#ifndef PQXX_H_EXCEPT\n+ 14#define PQXX_H_EXCEPT\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18#include \"pqxx/transaction_base.hxx\"\n- 19#include \"pqxx/util.hxx\"\n+ 18\n+ 19#include \n 20\n- 21#include \n+ 21#include \"pqxx/util.hxx\"\n 22\n 23\n 24namespace pqxx\n 25{\n 26\n-27class PQXX_LIBEXPORT PQXX_NOVTABLE stream_base :\n- 28 public internal::transactionfocus\n- 29{\n- 30public:\n- 31 explicit stream_base(transaction_base &);\n- 32 // TODO: Can we get rid of the vtable?\n-33 virtual ~stream_base() noexcept =default;\n-34 virtual void complete() = 0;\n- 35 operator bool() const noexcept;\n- 36 bool operator!() const noexcept;\n- 37protected:\n-38 bool m_finished;\n- 39 virtual void close();\n- 40 template static std::string columnlist(const C &);\n- 41 template static std::string columnlist(I begin, I end);\n- 42private:\n- 43 stream_base();\n- 44 stream_base(const stream_base&);\n- 45 stream_base & operator=(const stream_base &);\n- 46};\n- 47\n-48template std::string stream_base::columnlist(const C &c)\n- 49{\n- 50 return columnlist(std::begin(c), std::end(c));\n- 51}\n- 52\n-53template std::string stream_base::columnlist(I begin, I end)\n- 54{\n- 55 return separated_list(\",\", begin, end);\n- 56}\n- 57\n- 58} // namespace pqxx\n- 59\n+ 44\n+55class PQXX_LIBEXPORT PQXX_NOVTABLE pqxx_exception\n+ 56{\n+ 57public:\n+ 59 virtual ~pqxx_exception() noexcept =0;\n 60\n- 61#include \"pqxx/compiler-internal-post.hxx\"\n- 62#endif\n+ 62\n+84 PQXX_CONST virtual const std::exception &base() const noexcept =0; //[t00]\n+ 85};\n+ 86\n+ 87\n+89class PQXX_LIBEXPORT failure :\n+ 90 public pqxx_exception, public std::runtime_error\n+ 91{\n+ 92 virtual const std::exception &base() const noexcept override\n+ 93 { return *this; }\n+ 94public:\n+ 95 explicit failure(const std::string &);\n+ 96};\n+ 97\n+ 98\n+ 100\n+118class PQXX_LIBEXPORT broken_connection : public failure\n+ 119{\n+ 120public:\n+ 121 broken_connection();\n+ 122 explicit broken_connection(const std::string &);\n+ 123};\n+ 124\n+ 125\n+ 127\n+130class PQXX_LIBEXPORT sql_error : public failure\n+ 131{\n+ 133 const std::string m_query;\n+ 135 const std::string m_sqlstate;\n+ 136\n+ 137public:\n+ 138 explicit sql_error(\n+ 139 const std::string &msg=\"\",\n+ 140 const std::string &Q=\"\",\n+ 141 const char sqlstate[]=nullptr);\n+ 142 virtual ~sql_error() noexcept;\n+ 143\n+ 145 PQXX_PURE const std::string &query() const noexcept; //[t56]\n+ 146\n+ 148 PQXX_PURE const std::string &sqlstate() const noexcept;\n+ 149};\n+ 150\n+ 151\n+ 153\n+159class PQXX_LIBEXPORT in_doubt_error : public failure\n+ 160{\n+ 161public:\n+ 162 explicit in_doubt_error(const std::string &);\n+ 163};\n+ 164\n+ 165\n+167class PQXX_LIBEXPORT transaction_rollback : public failure\n+ 168{\n+ 169public:\n+ 170 explicit transaction_rollback(const std::string &);\n+ 171};\n+ 172\n+ 173\n+ 175\n+183class PQXX_LIBEXPORT serialization_failure : public transaction_rollback\n+ 184{\n+ 185public:\n+ 186 explicit serialization_failure(const std::string &);\n+ 187};\n+ 188\n+ 189\n+191class PQXX_LIBEXPORT statement_completion_unknown : public\n+transaction_rollback\n+ 192{\n+ 193public:\n+ 194 explicit statement_completion_unknown(const std::string &);\n+ 195};\n+ 196\n+ 197\n+199class PQXX_LIBEXPORT deadlock_detected : public transaction_rollback\n+ 200{\n+ 201public:\n+ 202 explicit deadlock_detected(const std::string &);\n+ 203};\n+ 204\n+ 205\n+207class PQXX_LIBEXPORT internal_error :\n+ 208 public pqxx_exception, public std::logic_error\n+ 209{\n+ 210 virtual const std::exception &base() const noexcept override\n+ 211 { return *this; }\n+ 212public:\n+ 213 explicit internal_error(const std::string &);\n+ 214};\n+ 215\n+ 216\n+218class PQXX_LIBEXPORT usage_error :\n+ 219 public pqxx_exception, public std::logic_error\n+ 220{\n+ 221 virtual const std::exception &base() const noexcept override\n+ 222 { return *this; }\n+ 223public:\n+ 224 explicit usage_error(const std::string &);\n+ 225};\n+ 226\n+ 227\n+229class PQXX_LIBEXPORT argument_error :\n+ 230 public pqxx_exception, public std::invalid_argument\n+ 231{\n+ 232 virtual const std::exception &base() const noexcept override\n+ 233 { return *this; }\n+ 234public:\n+ 235 explicit argument_error(const std::string &);\n+ 236};\n+ 237\n+ 238\n+240class PQXX_LIBEXPORT conversion_error :\n+ 241 public pqxx_exception, public std::domain_error\n+ 242{\n+ 243 virtual const std::exception &base() const noexcept override\n+ 244 { return *this; }\n+ 245public:\n+ 246 explicit conversion_error(const std::string &);\n+ 247};\n+ 248\n+ 249\n+251class PQXX_LIBEXPORT range_error :\n+ 252 public pqxx_exception, public std::out_of_range\n+ 253{\n+ 254 virtual const std::exception &base() const noexcept override\n+ 255 { return *this; }\n+ 256public:\n+ 257 explicit range_error(const std::string &);\n+ 258};\n+ 259\n+ 260\n+262class PQXX_LIBEXPORT unexpected_rows : public range_error\n+ 263{\n+ 264 virtual const std::exception &base() const noexcept override\n+ 265 { return *this; }\n+ 266public:\n+267 explicit unexpected_rows(const std::string &msg) : range_error{msg} {}\n+ 268};\n+ 269\n+ 270\n+272class PQXX_LIBEXPORT feature_not_supported : public sql_error\n+ 273{\n+ 274public:\n+275 explicit feature_not_supported(\n+ 276 const std::string &err,\n+ 277 const std::string &Q=\"\",\n+ 278 const char sqlstate[]=nullptr) :\n+ 279 sql_error{err, Q, sqlstate} {}\n+ 280};\n+ 281\n+283class PQXX_LIBEXPORT data_exception : public sql_error\n+ 284{\n+ 285public:\n+286 explicit data_exception(\n+ 287 const std::string &err,\n+ 288 const std::string &Q=\"\",\n+ 289 const char sqlstate[]=nullptr) :\n+ 290 sql_error{err, Q, sqlstate} {}\n+ 291};\n+ 292\n+293class PQXX_LIBEXPORT integrity_constraint_violation : public sql_error\n+ 294{\n+ 295public:\n+296 explicit integrity_constraint_violation(\n+ 297 const std::string &err,\n+ 298 const std::string &Q=\"\",\n+ 299 const char sqlstate[]=nullptr) :\n+ 300 sql_error{err, Q, sqlstate} {}\n+ 301};\n+ 302\n+303class PQXX_LIBEXPORT restrict_violation :\n+ 304 public integrity_constraint_violation\n+ 305{\n+ 306public:\n+307 explicit restrict_violation(\n+ 308 const std::string &err,\n+ 309 const std::string &Q=\"\",\n+ 310 const char sqlstate[]=nullptr) :\n+ 311 integrity_constraint_violation{err, Q, sqlstate} {}\n+ 312};\n+ 313\n+314class PQXX_LIBEXPORT not_null_violation :\n+ 315 public integrity_constraint_violation\n+ 316{\n+ 317public:\n+318 explicit not_null_violation(\n+ 319 const std::string &err,\n+ 320 const std::string &Q=\"\",\n+ 321 const char sqlstate[]=nullptr) :\n+ 322 integrity_constraint_violation{err, Q, sqlstate} {}\n+ 323};\n+ 324\n+325class PQXX_LIBEXPORT foreign_key_violation :\n+ 326 public integrity_constraint_violation\n+ 327{\n+ 328public:\n+329 explicit foreign_key_violation(\n+ 330 const std::string &err,\n+ 331 const std::string &Q=\"\",\n+ 332 const char sqlstate[]=nullptr) :\n+ 333 integrity_constraint_violation{err, Q, sqlstate} {}\n+ 334};\n+ 335\n+336class PQXX_LIBEXPORT unique_violation :\n+ 337 public integrity_constraint_violation\n+ 338{\n+ 339public:\n+340 explicit unique_violation(\n+ 341 const std::string &err,\n+ 342 const std::string &Q=\"\",\n+ 343 const char sqlstate[]=nullptr) :\n+ 344 integrity_constraint_violation{err, Q, sqlstate} {}\n+ 345};\n+ 346\n+347class PQXX_LIBEXPORT check_violation :\n+ 348 public integrity_constraint_violation\n+ 349{\n+ 350public:\n+351 explicit check_violation(\n+ 352 const std::string &err,\n+ 353 const std::string &Q=\"\",\n+ 354 const char sqlstate[]=nullptr) :\n+ 355 integrity_constraint_violation{err, Q, sqlstate} {}\n+ 356};\n+ 357\n+358class PQXX_LIBEXPORT invalid_cursor_state : public sql_error\n+ 359{\n+ 360public:\n+361 explicit invalid_cursor_state(\n+ 362 const std::string &err,\n+ 363 const std::string &Q=\"\",\n+ 364 const char sqlstate[]=nullptr) :\n+ 365 sql_error{err, Q, sqlstate} {}\n+ 366};\n+ 367\n+368class PQXX_LIBEXPORT invalid_sql_statement_name : public sql_error\n+ 369{\n+ 370public:\n+371 explicit invalid_sql_statement_name(\n+ 372 const std::string &err,\n+ 373 const std::string &Q=\"\",\n+ 374 const char sqlstate[]=nullptr) :\n+ 375 sql_error{err, Q, sqlstate} {}\n+ 376};\n+ 377\n+378class PQXX_LIBEXPORT invalid_cursor_name : public sql_error\n+ 379{\n+ 380public:\n+381 explicit invalid_cursor_name(\n+ 382 const std::string &err,\n+ 383 const std::string &Q=\"\",\n+ 384 const char sqlstate[]=nullptr) :\n+ 385 sql_error{err, Q, sqlstate} {}\n+ 386};\n+ 387\n+388class PQXX_LIBEXPORT syntax_error : public sql_error\n+ 389{\n+ 390public:\n+392 const int error_position;\n+ 393\n+394 explicit syntax_error(\n+ 395 const std::string &err,\n+ 396 const std::string &Q=\"\",\n+ 397 const char sqlstate[]=nullptr,\n+ 398 int pos=-1) :\n+ 399 sql_error{err, Q, sqlstate}, error_position{pos} {}\n+ 400};\n+ 401\n+402class PQXX_LIBEXPORT undefined_column : public syntax_error\n+ 403{\n+ 404public:\n+405 explicit undefined_column(\n+ 406 const std::string &err,\n+ 407 const std::string &Q=\"\",\n+ 408 const char sqlstate[]=nullptr) :\n+ 409 syntax_error{err, Q, sqlstate} {}\n+ 410};\n+ 411\n+412class PQXX_LIBEXPORT undefined_function : public syntax_error\n+ 413{\n+ 414public:\n+415 explicit undefined_function(\n+ 416 const std::string &err,\n+ 417 const std::string &Q=\"\",\n+ 418 const char sqlstate[]=nullptr) :\n+ 419 syntax_error{err, Q, sqlstate} {}\n+ 420};\n+ 421\n+422class PQXX_LIBEXPORT undefined_table : public syntax_error\n+ 423{\n+ 424public:\n+425 explicit undefined_table(\n+ 426 const std::string &err,\n+ 427 const std::string &Q=\"\",\n+ 428 const char sqlstate[]=nullptr) :\n+ 429 syntax_error{err, Q, sqlstate} {}\n+ 430};\n+ 431\n+432class PQXX_LIBEXPORT insufficient_privilege : public sql_error\n+ 433{\n+ 434public:\n+435 explicit insufficient_privilege(\n+ 436 const std::string &err,\n+ 437 const std::string &Q=\"\",\n+ 438 const char sqlstate[]=nullptr) :\n+ 439 sql_error{err, Q, sqlstate} {}\n+ 440};\n+ 441\n+443class PQXX_LIBEXPORT insufficient_resources : public sql_error\n+ 444{\n+ 445public:\n+446 explicit insufficient_resources(\n+ 447 const std::string &err,\n+ 448 const std::string &Q=\"\",\n+ 449 const char sqlstate[]=nullptr) :\n+ 450 sql_error{err,Q, sqlstate} {}\n+ 451};\n+ 452\n+453class PQXX_LIBEXPORT disk_full : public insufficient_resources\n+ 454{\n+ 455public:\n+456 explicit disk_full(\n+ 457 const std::string &err,\n+ 458 const std::string &Q=\"\",\n+ 459 const char sqlstate[]=nullptr) :\n+ 460 insufficient_resources{err, Q, sqlstate} {}\n+ 461};\n+ 462\n+463class PQXX_LIBEXPORT out_of_memory : public insufficient_resources\n+ 464{\n+ 465public:\n+466 explicit out_of_memory(\n+ 467 const std::string &err,\n+ 468 const std::string &Q=\"\",\n+ 469 const char sqlstate[]=nullptr) :\n+ 470 insufficient_resources{err, Q, sqlstate} {}\n+ 471};\n+ 472\n+473class PQXX_LIBEXPORT too_many_connections : public broken_connection\n+ 474{\n+ 475public:\n+476 explicit too_many_connections(const std::string &err) :\n+ 477 broken_connection{err} {}\n+ 478};\n+ 479\n+ 481\n+483class PQXX_LIBEXPORT plpgsql_error : public sql_error\n+ 484{\n+ 485public:\n+486 explicit plpgsql_error(\n+ 487 const std::string &err,\n+ 488 const std::string &Q=\"\",\n+ 489 const char sqlstate[]=nullptr) :\n+ 490 sql_error{err, Q, sqlstate} {}\n+ 491};\n+ 492\n+494class PQXX_LIBEXPORT plpgsql_raise : public plpgsql_error\n+ 495{\n+ 496public:\n+497 explicit plpgsql_raise(\n+ 498 const std::string &err,\n+ 499 const std::string &Q=\"\",\n+ 500 const char sqlstate[]=nullptr) :\n+ 501 plpgsql_error{err, Q, sqlstate} {}\n+ 502};\n+ 503\n+504class PQXX_LIBEXPORT plpgsql_no_data_found : public plpgsql_error\n+ 505{\n+ 506public:\n+507 explicit plpgsql_no_data_found(\n+ 508 const std::string &err,\n+ 509 const std::string &Q=\"\",\n+ 510 const char sqlstate[]=nullptr) :\n+ 511 plpgsql_error{err, Q, sqlstate} {}\n+ 512};\n+ 513\n+514class PQXX_LIBEXPORT plpgsql_too_many_rows : public plpgsql_error\n+ 515{\n+ 516public:\n+517 explicit plpgsql_too_many_rows(\n+ 518 const std::string &err,\n+ 519 const std::string &Q=\"\",\n+ 520 const char sqlstate[]=nullptr) :\n+ 521 plpgsql_error{err, Q, sqlstate} {}\n+ 522};\n+ 523\n+ 528}\n+ 529\n+ 530#include \"pqxx/compiler-internal-post.hxx\"\n+ 531\n+ 532#endif\n std\n STL namespace.\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::separated_list\n-std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS\n-access)\n-Represent sequence of values as a string, joined by a given separator.\n-Definition: util.hxx:95\n-pqxx::stream_base\n-Definition: stream_base.hxx:29\n-pqxx::stream_base::~stream_base\n-virtual ~stream_base() noexcept=default\n-pqxx::stream_base::columnlist\n-static std::string columnlist(const C &)\n-Definition: stream_base.hxx:48\n-pqxx::internal::transactionfocus\n-Definition: transaction_base.hxx:44\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n+pqxx::pqxx_exception\n+Mixin base class to identify libpqxx-specific exception types.\n+Definition: except.hxx:56\n+pqxx::pqxx_exception::base\n+virtual PQXX_CONST const std::exception & base() const noexcept=0\n+Return std::exception base-class object.\n+pqxx::failure\n+Run-time failure encountered by libpqxx, similar to std::runtime_error.\n+Definition: except.hxx:91\n+pqxx::broken_connection\n+Exception class for lost or failed backend connection.\n+Definition: except.hxx:119\n+pqxx::sql_error\n+Exception class for failed queries.\n+Definition: except.hxx:131\n+pqxx::in_doubt_error\n+\"Help, I don't know whether transaction was committed successfully!\"\n+Definition: except.hxx:160\n+pqxx::transaction_rollback\n+The backend saw itself forced to roll back the ongoing transaction.\n+Definition: except.hxx:168\n+pqxx::serialization_failure\n+Transaction failed to serialize. Please retry it.\n+Definition: except.hxx:184\n+pqxx::statement_completion_unknown\n+We can't tell whether our last statement succeeded.\n+Definition: except.hxx:192\n+pqxx::deadlock_detected\n+The ongoing transaction has deadlocked. Retrying it may help.\n+Definition: except.hxx:200\n+pqxx::internal_error\n+Internal error in libpqxx library.\n+Definition: except.hxx:209\n+pqxx::usage_error\n+Error in usage of libpqxx library, similar to std::logic_error.\n+Definition: except.hxx:220\n+pqxx::argument_error\n+Invalid argument passed to libpqxx, similar to std::invalid_argument.\n+Definition: except.hxx:231\n+pqxx::conversion_error\n+Value conversion failed, e.g. when converting \"Hello\" to int.\n+Definition: except.hxx:242\n+pqxx::range_error\n+Something is out of range, similar to std::out_of_range.\n+Definition: except.hxx:253\n+pqxx::unexpected_rows\n+Query returned an unexpected number of rows.\n+Definition: except.hxx:263\n+pqxx::unexpected_rows::unexpected_rows\n+unexpected_rows(const std::string &msg)\n+Definition: except.hxx:267\n+pqxx::feature_not_supported\n+Database feature not supported in current setup.\n+Definition: except.hxx:273\n+pqxx::feature_not_supported::feature_not_supported\n+feature_not_supported(const std::string &err, const std::string &Q=\"\", const\n+char sqlstate[]=nullptr)\n+Definition: except.hxx:275\n+pqxx::data_exception\n+Error in data provided to SQL statement.\n+Definition: except.hxx:284\n+pqxx::data_exception::data_exception\n+data_exception(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:286\n+pqxx::integrity_constraint_violation\n+Definition: except.hxx:294\n+pqxx::integrity_constraint_violation::integrity_constraint_violation\n+integrity_constraint_violation(const std::string &err, const std::string &Q=\"\",\n+const char sqlstate[]=nullptr)\n+Definition: except.hxx:296\n+pqxx::restrict_violation\n+Definition: except.hxx:305\n+pqxx::restrict_violation::restrict_violation\n+restrict_violation(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:307\n+pqxx::not_null_violation\n+Definition: except.hxx:316\n+pqxx::not_null_violation::not_null_violation\n+not_null_violation(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:318\n+pqxx::foreign_key_violation\n+Definition: except.hxx:327\n+pqxx::foreign_key_violation::foreign_key_violation\n+foreign_key_violation(const std::string &err, const std::string &Q=\"\", const\n+char sqlstate[]=nullptr)\n+Definition: except.hxx:329\n+pqxx::unique_violation\n+Definition: except.hxx:338\n+pqxx::unique_violation::unique_violation\n+unique_violation(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:340\n+pqxx::check_violation\n+Definition: except.hxx:349\n+pqxx::check_violation::check_violation\n+check_violation(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:351\n+pqxx::invalid_cursor_state\n+Definition: except.hxx:359\n+pqxx::invalid_cursor_state::invalid_cursor_state\n+invalid_cursor_state(const std::string &err, const std::string &Q=\"\", const\n+char sqlstate[]=nullptr)\n+Definition: except.hxx:361\n+pqxx::invalid_sql_statement_name\n+Definition: except.hxx:369\n+pqxx::invalid_sql_statement_name::invalid_sql_statement_name\n+invalid_sql_statement_name(const std::string &err, const std::string &Q=\"\",\n+const char sqlstate[]=nullptr)\n+Definition: except.hxx:371\n+pqxx::invalid_cursor_name\n+Definition: except.hxx:379\n+pqxx::invalid_cursor_name::invalid_cursor_name\n+invalid_cursor_name(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:381\n+pqxx::syntax_error\n+Definition: except.hxx:389\n+pqxx::syntax_error::error_position\n+const int error_position\n+Approximate position in string where error occurred, or -1 if unknown.\n+Definition: except.hxx:392\n+pqxx::syntax_error::syntax_error\n+syntax_error(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr, int pos=-1)\n+Definition: except.hxx:394\n+pqxx::undefined_column\n+Definition: except.hxx:403\n+pqxx::undefined_column::undefined_column\n+undefined_column(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:405\n+pqxx::undefined_function\n+Definition: except.hxx:413\n+pqxx::undefined_function::undefined_function\n+undefined_function(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:415\n+pqxx::undefined_table\n+Definition: except.hxx:423\n+pqxx::undefined_table::undefined_table\n+undefined_table(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:425\n+pqxx::insufficient_privilege\n+Definition: except.hxx:433\n+pqxx::insufficient_privilege::insufficient_privilege\n+insufficient_privilege(const std::string &err, const std::string &Q=\"\", const\n+char sqlstate[]=nullptr)\n+Definition: except.hxx:435\n+pqxx::insufficient_resources\n+Resource shortage on the server.\n+Definition: except.hxx:444\n+pqxx::insufficient_resources::insufficient_resources\n+insufficient_resources(const std::string &err, const std::string &Q=\"\", const\n+char sqlstate[]=nullptr)\n+Definition: except.hxx:446\n+pqxx::disk_full\n+Definition: except.hxx:454\n+pqxx::disk_full::disk_full\n+disk_full(const std::string &err, const std::string &Q=\"\", const char sqlstate\n+[]=nullptr)\n+Definition: except.hxx:456\n+pqxx::out_of_memory\n+Definition: except.hxx:464\n+pqxx::out_of_memory::out_of_memory\n+out_of_memory(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:466\n+pqxx::too_many_connections\n+Definition: except.hxx:474\n+pqxx::too_many_connections::too_many_connections\n+too_many_connections(const std::string &err)\n+Definition: except.hxx:476\n+pqxx::plpgsql_error\n+PL/pgSQL error.\n+Definition: except.hxx:484\n+pqxx::plpgsql_error::plpgsql_error\n+plpgsql_error(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:486\n+pqxx::plpgsql_raise\n+Exception raised in PL/pgSQL procedure.\n+Definition: except.hxx:495\n+pqxx::plpgsql_raise::plpgsql_raise\n+plpgsql_raise(const std::string &err, const std::string &Q=\"\", const char\n+sqlstate[]=nullptr)\n+Definition: except.hxx:497\n+pqxx::plpgsql_no_data_found\n+Definition: except.hxx:505\n+pqxx::plpgsql_no_data_found::plpgsql_no_data_found\n+plpgsql_no_data_found(const std::string &err, const std::string &Q=\"\", const\n+char sqlstate[]=nullptr)\n+Definition: except.hxx:507\n+pqxx::plpgsql_too_many_rows\n+Definition: except.hxx:515\n+pqxx::plpgsql_too_many_rows::plpgsql_too_many_rows\n+plpgsql_too_many_rows(const std::string &err, const std::string &Q=\"\", const\n+char sqlstate[]=nullptr)\n+Definition: except.hxx:517\n * include\n * pqxx\n- * stream_base.hxx\n+ * except.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00020_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00020_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: errorhandler.hxx Source File\n+libpqxx: dbtransaction.hxx Source File\n \n \n \n \n \n \n \n@@ -55,83 +55,88 @@\n \n
\n
\n-
errorhandler.hxx
\n+
dbtransaction.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_ERRORHANDLER
\n-
14#define PQXX_H_ERRORHANDLER
\n+
13#ifndef PQXX_H_DBTRANSACTION
\n+
14#define PQXX_H_DBTRANSACTION
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n
18
\n-
19#include "pqxx/types.hxx"
\n+
19#include "pqxx/transaction_base.hxx"
\n
20
\n-
21
\n-
22namespace pqxx
\n-
23{
\n-
24namespace internal
\n+
21namespace pqxx
\n+
22{
\n+
23
\n+\n
25{
\n-
26namespace gate
\n-
27{
\n-
28class errorhandler_connection_base;
\n-
29}
\n-
30}
\n-
31
\n-
38
\n-
54class PQXX_LIBEXPORT errorhandler
\n-
55{
\n-
56public:
\n-
57 explicit errorhandler(connection_base &);
\n-
58 virtual ~errorhandler();
\n-
59
\n-
61
\n-
65 virtual bool operator()(const char msg[]) noexcept =0;
\n+\n+\n+
28};
\n+
29
\n+
30
\n+
32
\n+
62class PQXX_LIBEXPORT PQXX_NOVTABLE dbtransaction : public transaction_base
\n+
63{
\n+
64public:
\n+
65 virtual ~dbtransaction();
\n
66
\n-
67private:
\n-
68 connection_base *m_home;
\n-
69
\n-
70 friend class internal::gate::errorhandler_connection_base;
\n-
71 void unregister() noexcept;
\n+
67protected:
\n+\n+\n+
70 const std::string &IsolationString,
\n+\n
72
\n-
73 errorhandler() =delete;
\n-
74 errorhandler(const errorhandler &) =delete;
\n-
75 errorhandler &operator=(const errorhandler &) =delete;
\n-
76};
\n+
73 explicit dbtransaction(
\n+\n+
75 bool direct=true,
\n+\n
77
\n
78
\n-\n-
81{
\n-
82public:
\n-\n-
84
\n-
85 virtual bool operator()(const char[]) noexcept override { return false; }
\n-
86};
\n-
87
\n-
92} // namespace pqxx
\n-
93
\n-
94#include "pqxx/compiler-internal-post.hxx"
\n-
95
\n-
96#endif
\n+\n+
81
\n+
83 virtual void do_begin() override; //[t01]
\n+
85 virtual result do_exec(const char Query[]) override;
\n+
87 virtual void do_commit() override =0;
\n+
89
\n+
95 virtual void do_abort() override; //[t13]
\n+
96
\n+
97 static std::string fullname(const std::string &ttype,
\n+
98 const std::string &isolation);
\n+
99
\n+
100private:
\n+
102 std::string m_start_cmd;
\n+
103};
\n+
104
\n+
105} // namespace pqxx
\n+
106
\n+
107#include "pqxx/compiler-internal-post.hxx"
\n+
108
\n+
109#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n+
readwrite_policy
Definition: dbtransaction.hxx:25
\n+
@ read_only
Definition: dbtransaction.hxx:26
\n+
@ read_write
Definition: dbtransaction.hxx:27
\n
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
Base class for error-handler callbacks.
Definition: errorhandler.hxx:55
\n-
virtual bool operator()(const char msg[]) noexcept=0
Define in subclass: receive an error or warning message from the database.
\n-
An error handler that suppresses any previously registered error handlers.
Definition: errorhandler.hxx:81
\n-
virtual bool operator()(const char[]) noexcept override
Define in subclass: receive an error or warning message from the database.
Definition: errorhandler.hxx:85
\n-
quiet_errorhandler(connection_base &conn)
Definition: errorhandler.hxx:83
\n+
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
\n+
void start_backend_transaction()
Start a transaction on the backend and set desired isolation level.
\n+
virtual void do_commit() override=0
To be implemented by derived class: commit backend transaction.
\n+
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,89 +1,99 @@\n \n \n \n \n \n libpqxx\n \n-errorhandler.hxx\n+dbtransaction.hxx\n 1\n- 13#ifndef PQXX_H_ERRORHANDLER\n- 14#define PQXX_H_ERRORHANDLER\n+ 13#ifndef PQXX_H_DBTRANSACTION\n+ 14#define PQXX_H_DBTRANSACTION\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n 18\n- 19#include \"pqxx/types.hxx\"\n+ 19#include \"pqxx/transaction_base.hxx\"\n 20\n- 21\n- 22namespace pqxx\n- 23{\n- 24namespace internal\n+ 21namespace pqxx\n+ 22{\n+ 23\n+24enum readwrite_policy\n 25{\n- 26namespace gate\n- 27{\n- 28class errorhandler_connection_base;\n- 29}\n- 30}\n- 31\n- 38\n-54class PQXX_LIBEXPORT errorhandler\n- 55{\n- 56public:\n- 57 explicit errorhandler(connection_base &);\n- 58 virtual ~errorhandler();\n- 59\n- 61\n-65 virtual bool operator()(const char msg[]) noexcept =0;\n+26 read_only,\n+ 27 read_write\n+28};\n+ 29\n+ 30\n+ 32\n+62class PQXX_LIBEXPORT PQXX_NOVTABLE dbtransaction : public transaction_base\n+ 63{\n+ 64public:\n+ 65 virtual ~dbtransaction();\n 66\n- 67private:\n- 68 connection_base *m_home;\n- 69\n-70 friend class internal::gate::errorhandler_connection_base;\n- 71 void unregister() noexcept;\n+ 67protected:\n+ 68 dbtransaction(\n+ 69 connection_base &,\n+ 70 const std::string &IsolationString,\n+ 71 readwrite_policy rw=read_write);\n 72\n- 73 errorhandler() =delete;\n- 74 errorhandler(const errorhandler &) =delete;\n- 75 errorhandler &operator=(const errorhandler &) =delete;\n- 76};\n+ 73 explicit dbtransaction(\n+ 74 connection_base &,\n+ 75 bool direct=true,\n+ 76 readwrite_policy rw=read_write);\n 77\n 78\n-80class quiet_errorhandler : public errorhandler\n- 81{\n- 82public:\n-83 quiet_errorhandler(connection_base &conn) : errorhandler{conn} {}\n- 84\n-85 virtual bool operator()(const char[]) noexcept override { return false; }\n- 86};\n- 87\n- 92} // namespace pqxx\n- 93\n- 94#include \"pqxx/compiler-internal-post.hxx\"\n- 95\n- 96#endif\n+80 void start_backend_transaction();\n+ 81\n+ 83 virtual void do_begin() override; //[t01]\n+ 85 virtual result do_exec(const char Query[]) override;\n+87 virtual void do_commit() override =0;\n+ 89\n+ 95 virtual void do_abort() override; //[t13]\n+ 96\n+ 97 static std::string fullname(const std::string &ttype,\n+ 98 const std::string &isolation);\n+ 99\n+ 100private:\n+ 102 std::string m_start_cmd;\n+ 103};\n+ 104\n+ 105} // namespace pqxx\n+ 106\n+ 107#include \"pqxx/compiler-internal-post.hxx\"\n+ 108\n+ 109#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n+pqxx::readwrite_policy\n+readwrite_policy\n+Definition: dbtransaction.hxx:25\n+pqxx::read_only\n+@ read_only\n+Definition: dbtransaction.hxx:26\n+pqxx::read_write\n+@ read_write\n+Definition: dbtransaction.hxx:27\n pqxx::connection_base\n connection_base abstract base class; represents a connection to a database.\n Definition: connection_base.hxx:140\n-pqxx::errorhandler\n-Base class for error-handler callbacks.\n-Definition: errorhandler.hxx:55\n-pqxx::errorhandler::operator()\n-virtual bool operator()(const char msg[]) noexcept=0\n-Define in subclass: receive an error or warning message from the database.\n-pqxx::quiet_errorhandler\n-An error handler that suppresses any previously registered error handlers.\n-Definition: errorhandler.hxx:81\n-pqxx::quiet_errorhandler::operator()\n-virtual bool operator()(const char[]) noexcept override\n-Define in subclass: receive an error or warning message from the database.\n-Definition: errorhandler.hxx:85\n-pqxx::quiet_errorhandler::quiet_errorhandler\n-quiet_errorhandler(connection_base &conn)\n-Definition: errorhandler.hxx:83\n+pqxx::dbtransaction\n+Abstract base class responsible for bracketing a backend transaction.\n+Definition: dbtransaction.hxx:63\n+pqxx::dbtransaction::start_backend_transaction\n+void start_backend_transaction()\n+Start a transaction on the backend and set desired isolation level.\n+pqxx::dbtransaction::do_commit\n+virtual void do_commit() override=0\n+To be implemented by derived class: commit backend transaction.\n+pqxx::result\n+Result set containing data returned by a query or command.\n+Definition: result.hxx:70\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * errorhandler.hxx\n+ * dbtransaction.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00023_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00023_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: types.hxx Source File\n+libpqxx: largeobject.hxx Source File\n \n \n \n \n \n \n \n@@ -55,87 +55,537 @@\n \n
\n
\n-
types.hxx
\n+
largeobject.hxx
\n
\n
\n
1
\n-
10#ifndef PQXX_H_TYPES
\n-
11#define PQXX_H_TYPES
\n-
12
\n-
13#include <cstddef>
\n-
14
\n-
15namespace pqxx
\n-
16{
\n-
18using result_size_type = unsigned long;
\n-
19
\n-
21using result_difference_type = signed long;
\n+
13#ifndef PQXX_H_LARGEOBJECT
\n+
14#define PQXX_H_LARGEOBJECT
\n+
15
\n+
16#include "pqxx/compiler-public.hxx"
\n+
17#include "pqxx/compiler-internal-pre.hxx"
\n+
18
\n+
19#include <streambuf>
\n+
20
\n+
21#include "pqxx/dbtransaction.hxx"
\n
22
\n-
24using row_size_type = unsigned int;
\n-
25
\n-
27using row_difference_type = signed int;
\n-
28
\n-
30using field_size_type = std::size_t;
\n-
31
\n-\n-
34
\n-
35
\n-
36// Forward declarations, to help break compilation dependencies.
\n-
37// These won't necessarily include all classes in libpqxx.
\n-
38class binarystring;
\n-\n-
40class connection_base;
\n-\n-\n-\n-\n-
45class dbtransaction;
\n-
46class field;
\n-\n-\n-
49class range_error;
\n-
50class result;
\n-
51class row;
\n-
52class tablereader;
\n-\n-
54
\n-
55} // namespace pqxx
\n-
56
\n-
57#endif
\n+
23
\n+
24namespace pqxx
\n+
25{
\n+
27
\n+
34class PQXX_LIBEXPORT largeobject
\n+
35{
\n+
36public:
\n+\n+
38
\n+
40 largeobject() noexcept =default; //[t48]
\n+
41
\n+
43
\n+
45 explicit largeobject(dbtransaction &T); //[t48]
\n+
46
\n+
48
\n+
52 explicit largeobject(oid O) noexcept : m_id{O} {} //[t48]
\n+
53
\n+
55
\n+
59 largeobject(dbtransaction &T, const std::string &File); //[t53]
\n+
60
\n+
62
\n+
66 largeobject(const largeobjectaccess &O) noexcept; //[t50]
\n+
67
\n+
69
\n+
73 oid id() const noexcept { return m_id; } //[t48]
\n+
74
\n+
84
\n+
85 bool operator==(const largeobject &other) const //[t51]
\n+
86 { return m_id == other.m_id; }
\n+
88
\n+
89 bool operator!=(const largeobject &other) const //[t51]
\n+
90 { return m_id != other.m_id; }
\n+
92
\n+
93 bool operator<=(const largeobject &other) const //[t51]
\n+
94 { return m_id <= other.m_id; }
\n+
96
\n+
97 bool operator>=(const largeobject &other) const //[t51]
\n+
98 { return m_id >= other.m_id; }
\n+
100
\n+
101 bool operator<(const largeobject &other) const //[t51]
\n+
102 { return m_id < other.m_id; }
\n+
104
\n+
105 bool operator>(const largeobject &other) const //[t51]
\n+
106 { return m_id > other.m_id; }
\n+
108
\n+
110
\n+
114 void to_file(dbtransaction &T, const std::string &File) const; //[t52]
\n+
115
\n+
117
\n+
121 void remove(dbtransaction &T) const; //[t48]
\n+
122
\n+
123protected:
\n+
124 PQXX_PURE static internal::pq::PGconn *raw_connection(
\n+
125 const dbtransaction &T);
\n+
126
\n+
127 PQXX_PRIVATE std::string reason(const connection_base &, int err) const;
\n+
128
\n+
129private:
\n+
130 oid m_id = oid_none;
\n+
131};
\n+
132
\n+
133
\n+
134// TODO: New hierarchy with separate read / write / mixed-mode access
\n+
135
\n+
137class PQXX_LIBEXPORT largeobjectaccess : private largeobject
\n+
138{
\n+
139public:
\n+\n+
141 using off_type = long;
\n+\n+
143
\n+
145
\n+
149 using openmode = std::ios::openmode;
\n+
150
\n+
152
\n+
156 using seekdir = std::ios::seekdir;
\n+
157
\n+
159
\n+
163 explicit largeobjectaccess( //[t51]
\n+
164 dbtransaction &T,
\n+
165 openmode mode=std::ios::in|std::ios::out);
\n+
166
\n+
168
\n+
174 largeobjectaccess( //[t52]
\n+
175 dbtransaction &T,
\n+
176 oid O,
\n+
177 openmode mode=std::ios::in|std::ios::out);
\n+
178
\n+
180
\n+
185 largeobjectaccess( //[t50]
\n+
186 dbtransaction &T,
\n+
187 largeobject O,
\n+
188 openmode mode=std::ios::in|std::ios::out);
\n+
189
\n+
191
\n+
196 largeobjectaccess( //[t55]
\n+
197 dbtransaction &T,
\n+
198 const std::string &File,
\n+
199 openmode mode=std::ios::in|std::ios::out);
\n+
200
\n+
201 ~largeobjectaccess() noexcept { close(); }
\n+
202
\n+
204
\n+
207 using largeobject::id;
\n+
208
\n+
210
\n+
213 void to_file(const std::string &File) const //[t54]
\n+
214 { largeobject::to_file(m_trans, File); }
\n+
215
\n+\n+
217
\n+
223
\n+
227 void write(const char Buf[], size_type Len); //[t51]
\n+
228
\n+
230
\n+
233 void write(const std::string &Buf) //[t50]
\n+
234 { write(Buf.c_str(), static_cast<size_type>(Buf.size())); }
\n+
235
\n+
237
\n+
243 size_type read(char Buf[], size_type Len); //[t50]
\n+
244
\n+
246
\n+
249 size_type seek(size_type dest, seekdir dir); //[t51]
\n+
250
\n+
252
\n+
255 size_type tell() const; //[t50]
\n+
257
\n+
268
\n+
276 pos_type cseek(off_type dest, seekdir dir) noexcept; //[t50]
\n+
277
\n+
279
\n+
285 off_type cwrite(const char Buf[], size_type Len) noexcept; //[t50]
\n+
286
\n+
288
\n+
294 off_type cread(char Buf[], size_type Len) noexcept; //[t50]
\n+
295
\n+
297
\n+
301 pos_type ctell() const noexcept; //[t50]
\n+
303
\n+
309 void process_notice(const std::string &) noexcept; //[t50]
\n+
311
\n+
312 using largeobject::remove;
\n+
313
\n+
314 using largeobject::operator==;
\n+
315 using largeobject::operator!=;
\n+
316 using largeobject::operator<;
\n+
317 using largeobject::operator<=;
\n+
318 using largeobject::operator>;
\n+
319 using largeobject::operator>=;
\n+
320
\n+
321private:
\n+
322 PQXX_PRIVATE std::string reason(int err) const;
\n+
323 internal::pq::PGconn *raw_connection() const
\n+
324 { return largeobject::raw_connection(m_trans); }
\n+
325
\n+
326 PQXX_PRIVATE void open(openmode mode);
\n+
327 void close() noexcept;
\n+
328
\n+
329 dbtransaction &m_trans;
\n+
330 int m_fd = -1;
\n+
331
\n+
332 largeobjectaccess() =delete;
\n+
333 largeobjectaccess(const largeobjectaccess &) =delete;
\n+
334 largeobjectaccess operator=(const largeobjectaccess &) =delete;
\n+
335};
\n+
336
\n+
337
\n+
339
\n+
347template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n+\n+
349 public std::basic_streambuf<CHAR, TRAITS>
\n+
350{
\n+
351 using size_type = long;
\n+
352public:
\n+
353 using char_type = CHAR;
\n+
354 using traits_type = TRAITS;
\n+
355 using int_type = typename traits_type::int_type;
\n+
356 using pos_type = typename traits_type::pos_type;
\n+
357 using off_type = typename traits_type::off_type;
\n+\n+\n+
360
\n+\n+
362 dbtransaction &T,
\n+
363 largeobject O,
\n+
364 openmode mode=std::ios::in|std::ios::out,
\n+
365 size_type BufSize=512) :
\n+
366 m_bufsize{BufSize},
\n+
367 m_obj{T, O, mode},
\n+
368 m_g{nullptr},
\n+
369 m_p{nullptr}
\n+
370 { initialize(mode); }
\n+
371
\n+\n+
373 dbtransaction &T,
\n+
374 oid O,
\n+
375 openmode mode=std::ios::in|std::ios::out,
\n+
376 size_type BufSize=512) :
\n+
377 m_bufsize{BufSize},
\n+
378 m_obj{T, O, mode},
\n+
379 m_g{nullptr},
\n+
380 m_p{nullptr}
\n+
381 { initialize(mode); }
\n+
382
\n+
383 virtual ~largeobject_streambuf() noexcept
\n+
384 { delete [] m_p; delete [] m_g; }
\n+
385
\n+
386
\n+
388 void process_notice(const std::string &s) { m_obj.process_notice(s); }
\n+
389
\n+
390protected:
\n+
391 virtual int sync() override
\n+
392 {
\n+
393 // setg() sets eback, gptr, egptr
\n+
394 this->setg(this->eback(), this->eback(), this->egptr());
\n+
395 return overflow(EoF());
\n+
396 }
\n+
397
\n+\n+
399 off_type offset,
\n+
400 seekdir dir,
\n+
401 openmode)
\n+
402 override
\n+
403 {
\n+
404 return AdjustEOF(m_obj.cseek(largeobjectaccess::off_type(offset), dir));
\n+
405 }
\n+
406
\n+
407 virtual pos_type seekpos(pos_type pos, openmode) override
\n+
408 {
\n+
409 const largeobjectaccess::pos_type newpos = m_obj.cseek(
\n+\n+
411 std::ios::beg);
\n+
412 return AdjustEOF(newpos);
\n+
413 }
\n+
414
\n+
415 virtual int_type overflow(int_type ch = EoF()) override
\n+
416 {
\n+
417 char *const pp = this->pptr();
\n+
418 if (pp == nullptr) return EoF();
\n+
419 char *const pb = this->pbase();
\n+
420 int_type res = 0;
\n+
421
\n+
422 if (pp > pb) res = int_type(AdjustEOF(m_obj.cwrite(pb, pp-pb)));
\n+
423 this->setp(m_p, m_p + m_bufsize);
\n+
424
\n+
425 // Write that one more character, if it's there.
\n+
426 if (ch != EoF())
\n+
427 {
\n+
428 *this->pptr() = char(ch);
\n+
429 this->pbump(1);
\n+
430 }
\n+
431 return res;
\n+
432 }
\n+
433
\n+
434 virtual int_type underflow() override
\n+
435 {
\n+
436 if (this->gptr() == nullptr) return EoF();
\n+
437 char *const eb = this->eback();
\n+
438 const int_type res(static_cast<int_type>(
\n+
439 AdjustEOF(m_obj.cread(this->eback(), m_bufsize))));
\n+
440 this->setg(eb, eb, eb + ((res==EoF()) ? 0 : res));
\n+
441 return ((res == 0) or (res == EoF())) ? EoF() : *eb;
\n+
442 }
\n+
443
\n+
444private:
\n+
446 static int_type EoF() { return traits_type::eof(); }
\n+
447
\n+
449 template<typename INTYPE>
\n+
450 static std::streampos AdjustEOF(INTYPE pos)
\n+
451 { return (pos==-1) ? std::streampos(EoF()) : std::streampos(pos); }
\n+
452
\n+
453 void initialize(openmode mode)
\n+
454 {
\n+
455 if (mode & std::ios::in)
\n+
456 {
\n+
457 m_g = new char_type[unsigned(m_bufsize)];
\n+
458 this->setg(m_g, m_g, m_g);
\n+
459 }
\n+
460 if (mode & std::ios::out)
\n+
461 {
\n+
462 m_p = new char_type[unsigned(m_bufsize)];
\n+
463 this->setp(m_p, m_p + m_bufsize);
\n+
464 }
\n+
465 }
\n+
466
\n+
467 const size_type m_bufsize;
\n+
468 largeobjectaccess m_obj;
\n+
469
\n+
471 char_type *m_g, *m_p;
\n+
472};
\n+
473
\n+
474
\n+
476
\n+
484template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n+\n+
486 public std::basic_istream<CHAR, TRAITS>
\n+
487{
\n+
488 using super = std::basic_istream<CHAR, TRAITS>;
\n+
489
\n+
490public:
\n+
491 using char_type = CHAR;
\n+
492 using traits_type = TRAITS;
\n+
493 using int_type = typename traits_type::int_type;
\n+
494 using pos_type = typename traits_type::pos_type;
\n+
495 using off_type = typename traits_type::off_type;
\n+
496
\n+
498
\n+\n+
504 dbtransaction &T,
\n+
505 largeobject O,
\n+
506 largeobject::size_type BufSize=512) :
\n+
507 super{nullptr},
\n+
508 m_buf{T, O, std::ios::in, BufSize}
\n+
509 { super::init(&m_buf); }
\n+
510
\n+
512
\n+\n+
518 dbtransaction &T,
\n+
519 oid O,
\n+
520 largeobject::size_type BufSize=512) :
\n+
521 super{nullptr},
\n+
522 m_buf{T, O, std::ios::in, BufSize}
\n+
523 { super::init(&m_buf); }
\n+
524
\n+
525private:
\n+\n+
527};
\n+
528
\n+\n+
530
\n+
531
\n+
533
\n+
541template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n+\n+
543 public std::basic_ostream<CHAR, TRAITS>
\n+
544{
\n+
545 using super = std::basic_ostream<CHAR, TRAITS>;
\n+
546public:
\n+
547 using char_type = CHAR;
\n+
548 using traits_type = TRAITS;
\n+
549 using int_type = typename traits_type::int_type;
\n+
550 using pos_type = typename traits_type::pos_type;
\n+
551 using off_type = typename traits_type::off_type;
\n+
552
\n+
554
\n+\n+
560 dbtransaction &T,
\n+
561 largeobject O,
\n+
562 largeobject::size_type BufSize=512) :
\n+
563 super{nullptr},
\n+
564 m_buf{T, O, std::ios::out, BufSize}
\n+
565 { super::init(&m_buf); }
\n+
566
\n+
568
\n+\n+
574 dbtransaction &T,
\n+
575 oid O,
\n+
576 largeobject::size_type BufSize=512) :
\n+
577 super{nullptr},
\n+
578 m_buf{T, O, std::ios::out, BufSize}
\n+
579 { super::init(&m_buf); }
\n+
580
\n+\n+
582 {
\n+
583 try
\n+
584 {
\n+
585 m_buf.pubsync(); m_buf.pubsync();
\n+
586 }
\n+
587 catch (const std::exception &e)
\n+
588 {
\n+
589 m_buf.process_notice(e.what());
\n+
590 }
\n+
591 }
\n+
592
\n+
593private:
\n+\n+
595};
\n+
596
\n+\n+
598
\n+
599
\n+
601
\n+
609template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n+\n+
611 public std::basic_iostream<CHAR, TRAITS>
\n+
612{
\n+
613 using super = std::basic_iostream<CHAR, TRAITS>;
\n+
614
\n+
615public:
\n+
616 using char_type = CHAR;
\n+
617 using traits_type = TRAITS;
\n+
618 using int_type = typename traits_type::int_type;
\n+
619 using pos_type = typename traits_type::pos_type;
\n+
620 using off_type = typename traits_type::off_type;
\n+
621
\n+
623
\n+\n+
629 dbtransaction &T,
\n+
630 largeobject O,
\n+
631 largeobject::size_type BufSize=512) :
\n+
632 super{nullptr},
\n+
633 m_buf{T, O, std::ios::in | std::ios::out, BufSize}
\n+
634 { super::init(&m_buf); }
\n+
635
\n+
637
\n+\n+
643 dbtransaction &T,
\n+
644 oid O,
\n+
645 largeobject::size_type BufSize=512) :
\n+
646 super{nullptr},
\n+
647 m_buf{T, O, std::ios::in | std::ios::out, BufSize}
\n+
648 { super::init(&m_buf); }
\n+
649
\n+\n+
651 {
\n+
652 try
\n+
653 {
\n+
654 m_buf.pubsync(); m_buf.pubsync();
\n+
655 }
\n+
656 catch (const std::exception &e)
\n+
657 {
\n+
658 m_buf.process_notice(e.what());
\n+
659 }
\n+
660 }
\n+
661
\n+
662private:
\n+\n+
664};
\n+
665
\n+\n+
667
\n+
668} // namespace pqxx
\n+
669
\n+
670#include "pqxx/compiler-internal-post.hxx"
\n+
671
\n+
672#endif
\n+
STL namespace.
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
signed int row_difference_type
Difference between row sizes.
Definition: types.hxx:27
\n
long large_object_size_type
Number of bytes in a large object. (Unusual: it's signed.)
Definition: types.hxx:33
\n-
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
\n-
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
\n-
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
\n-
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
\n-
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
\n+
constexpr oid oid_none
The "null" oid.
Definition: util.hxx:77
\n
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
Definition: connectionpolicy.hxx:32
\n
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
\n-
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:253
\n-
Reference to a field in a result set.
Definition: field.hxx:50
\n+
Identity of a large object.
Definition: largeobject.hxx:35
\n+
static PQXX_PURE internal::pq::PGconn * raw_connection(const dbtransaction &T)
Definition: largeobject.cxx:134
\n+
large_object_size_type size_type
Definition: largeobject.hxx:37
\n+
bool operator<(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:101
\n+
bool operator==(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:85
\n+
void to_file(dbtransaction &T, const std::string &File) const
Export large object's contents to a local file.
Definition: largeobject.cxx:106
\n+
bool operator>(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:105
\n+
bool operator<=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:93
\n+
largeobject() noexcept=default
Refer to a nonexistent large object (similar to what a null pointer does)
\n+
bool operator!=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:89
\n+
bool operator>=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:97
\n+
oid id() const noexcept
Object identifier.
Definition: largeobject.hxx:73
\n
Accessor for large object's contents.
Definition: largeobject.hxx:138
\n-
Definition: notification.hxx:56
\n-
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n-
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
\n-
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:122
\n-
Reference to one row in a result.
Definition: row.hxx:41
\n-
Iterator for fields in a row. Use as row::const_iterator.
Definition: row.hxx:208
\n-
Reverse iterator for a row. Use as row::const_reverse_iterator.
Definition: row.hxx:280
\n-
Definition: tablereader.hxx:30
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
size_type pos_type
Definition: largeobject.hxx:142
\n+
std::ios::openmode openmode
Open mode: in, out (can be combined with the "or" operator)
Definition: largeobject.hxx:149
\n+
std::ios::seekdir seekdir
Seek direction: beg, cur, end.
Definition: largeobject.hxx:156
\n+
void write(const std::string &Buf)
Write string to large object.
Definition: largeobject.hxx:233
\n+
long off_type
Definition: largeobject.hxx:141
\n+
~largeobjectaccess() noexcept
Definition: largeobject.hxx:201
\n+
void to_file(const std::string &File) const
Export large object's contents to a local file.
Definition: largeobject.hxx:213
\n+
Streambuf to use large objects in standard I/O streams.
Definition: largeobject.hxx:350
\n+
virtual pos_type seekoff(off_type offset, seekdir dir, openmode) override
Definition: largeobject.hxx:398
\n+
TRAITS traits_type
Definition: largeobject.hxx:354
\n+
typename traits_type::int_type int_type
Definition: largeobject.hxx:355
\n+
virtual pos_type seekpos(pos_type pos, openmode) override
Definition: largeobject.hxx:407
\n+
void process_notice(const std::string &s)
For use by large object stream classes.
Definition: largeobject.hxx:388
\n+
CHAR char_type
Definition: largeobject.hxx:353
\n+
typename traits_type::off_type off_type
Definition: largeobject.hxx:357
\n+
largeobject_streambuf(dbtransaction &T, largeobject O, openmode mode=std::ios::in|std::ios::out, size_type BufSize=512)
Definition: largeobject.hxx:361
\n+
largeobject_streambuf(dbtransaction &T, oid O, openmode mode=std::ios::in|std::ios::out, size_type BufSize=512)
Definition: largeobject.hxx:372
\n+
virtual ~largeobject_streambuf() noexcept
Definition: largeobject.hxx:383
\n+
virtual int sync() override
Definition: largeobject.hxx:391
\n+
largeobjectaccess::seekdir seekdir
Definition: largeobject.hxx:359
\n+
virtual int_type underflow() override
Definition: largeobject.hxx:434
\n+
virtual int_type overflow(int_type ch=EoF()) override
Definition: largeobject.hxx:415
\n+
largeobjectaccess::openmode openmode
Definition: largeobject.hxx:358
\n+
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:356
\n+
Input stream that gets its data from a large object.
Definition: largeobject.hxx:487
\n+
CHAR char_type
Definition: largeobject.hxx:491
\n+
basic_ilostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_ilostream.
Definition: largeobject.hxx:503
\n+
typename traits_type::int_type int_type
Definition: largeobject.hxx:493
\n+
TRAITS traits_type
Definition: largeobject.hxx:492
\n+
typename traits_type::off_type off_type
Definition: largeobject.hxx:495
\n+
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:494
\n+
basic_ilostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_ilostream.
Definition: largeobject.hxx:517
\n+
Output stream that writes data back to a large object.
Definition: largeobject.hxx:544
\n+
typename traits_type::off_type off_type
Definition: largeobject.hxx:551
\n+
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:550
\n+
typename traits_type::int_type int_type
Definition: largeobject.hxx:549
\n+
~basic_olostream()
Definition: largeobject.hxx:581
\n+
basic_olostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_olostream.
Definition: largeobject.hxx:559
\n+
CHAR char_type
Definition: largeobject.hxx:547
\n+
TRAITS traits_type
Definition: largeobject.hxx:548
\n+
basic_olostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_olostream.
Definition: largeobject.hxx:573
\n+
Stream that reads and writes a large object.
Definition: largeobject.hxx:612
\n+
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:619
\n+
~basic_lostream()
Definition: largeobject.hxx:650
\n+
basic_lostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_lostream.
Definition: largeobject.hxx:642
\n+
typename traits_type::int_type int_type
Definition: largeobject.hxx:618
\n+
basic_lostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_lostream.
Definition: largeobject.hxx:628
\n+
typename traits_type::off_type off_type
Definition: largeobject.hxx:620
\n+
TRAITS traits_type
Definition: largeobject.hxx:617
\n+
CHAR char_type
Definition: largeobject.hxx:616
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,127 +1,691 @@\n \n \n \n \n \n libpqxx\n \n-types.hxx\n+largeobject.hxx\n 1\n- 10#ifndef PQXX_H_TYPES\n- 11#define PQXX_H_TYPES\n- 12\n- 13#include \n- 14\n- 15namespace pqxx\n- 16{\n-18using result_size_type = unsigned long;\n- 19\n-21using result_difference_type = signed long;\n+ 13#ifndef PQXX_H_LARGEOBJECT\n+ 14#define PQXX_H_LARGEOBJECT\n+ 15\n+ 16#include \"pqxx/compiler-public.hxx\"\n+ 17#include \"pqxx/compiler-internal-pre.hxx\"\n+ 18\n+ 19#include \n+ 20\n+ 21#include \"pqxx/dbtransaction.hxx\"\n 22\n-24using row_size_type = unsigned int;\n- 25\n-27using row_difference_type = signed int;\n- 28\n-30using field_size_type = std::size_t;\n- 31\n-33using large_object_size_type = long;\n- 34\n- 35\n- 36// Forward declarations, to help break compilation dependencies.\n- 37// These won't necessarily include all classes in libpqxx.\n- 38class binarystring;\n- 39class connectionpolicy;\n- 40class connection_base;\n- 41class const_result_iterator;\n- 42class const_reverse_result_iterator;\n- 43class const_reverse_row_iterator;\n- 44class const_row_iterator;\n- 45class dbtransaction;\n- 46class field;\n- 47class largeobjectaccess;\n- 48class notification_receiver;\n- 49class range_error;\n- 50class result;\n- 51class row;\n- 52class tablereader;\n- 53class transaction_base;\n- 54\n- 55} // namespace pqxx\n- 56\n- 57#endif\n+ 23\n+ 24namespace pqxx\n+ 25{\n+ 27\n+34class PQXX_LIBEXPORT largeobject\n+ 35{\n+ 36public:\n+37 using size_type = large_object_size_type;\n+ 38\n+40 largeobject() noexcept =default; //[t48]\n+ 41\n+ 43\n+ 45 explicit largeobject(dbtransaction &T); //[t48]\n+ 46\n+ 48\n+52 explicit largeobject(oid O) noexcept : m_id{O} {} //[t48]\n+ 53\n+ 55\n+ 59 largeobject(dbtransaction &T, const std::string &File); //[t53]\n+ 60\n+ 62\n+ 66 largeobject(const largeobjectaccess &O) noexcept; //[t50]\n+ 67\n+ 69\n+73 oid id() const noexcept { return m_id; } //[t48]\n+ 74\n+ 84\n+85 bool operator==(const largeobject &other) const //[t51]\n+ 86 { return m_id == other.m_id; }\n+ 88\n+89 bool operator!=(const largeobject &other) const //[t51]\n+ 90 { return m_id != other.m_id; }\n+ 92\n+93 bool operator<=(const largeobject &other) const //[t51]\n+ 94 { return m_id <= other.m_id; }\n+ 96\n+97 bool operator>=(const largeobject &other) const //[t51]\n+ 98 { return m_id >= other.m_id; }\n+ 100\n+101 bool operator<(const largeobject &other) const //[t51]\n+ 102 { return m_id < other.m_id; }\n+ 104\n+105 bool operator>(const largeobject &other) const //[t51]\n+ 106 { return m_id > other.m_id; }\n+ 108\n+ 110\n+ 114 void to_file(dbtransaction &T, const std::string &File) const; //[t52]\n+ 115\n+ 117\n+ 121 void remove(dbtransaction &T) const; //[t48]\n+ 122\n+ 123protected:\n+ 124 PQXX_PURE static internal::pq::PGconn *raw_connection(\n+ 125 const dbtransaction &T);\n+ 126\n+ 127 PQXX_PRIVATE std::string reason(const connection_base &, int err) const;\n+ 128\n+ 129private:\n+ 130 oid m_id = oid_none;\n+ 131};\n+ 132\n+ 133\n+ 134// TODO: New hierarchy with separate read / write / mixed-mode access\n+ 135\n+137class PQXX_LIBEXPORT largeobjectaccess : private largeobject\n+ 138{\n+ 139public:\n+ 140 using largeobject::size_type;\n+141 using off_type = long;\n+142 using pos_type = size_type;\n+ 143\n+ 145\n+149 using openmode = std::ios::openmode;\n+ 150\n+ 152\n+156 using seekdir = std::ios::seekdir;\n+ 157\n+ 159\n+ 163 explicit largeobjectaccess( //[t51]\n+ 164 dbtransaction &T,\n+ 165 openmode mode=std::ios::in|std::ios::out);\n+ 166\n+ 168\n+ 174 largeobjectaccess( //[t52]\n+ 175 dbtransaction &T,\n+ 176 oid O,\n+ 177 openmode mode=std::ios::in|std::ios::out);\n+ 178\n+ 180\n+ 185 largeobjectaccess( //[t50]\n+ 186 dbtransaction &T,\n+ 187 largeobject O,\n+ 188 openmode mode=std::ios::in|std::ios::out);\n+ 189\n+ 191\n+ 196 largeobjectaccess( //[t55]\n+ 197 dbtransaction &T,\n+ 198 const std::string &File,\n+ 199 openmode mode=std::ios::in|std::ios::out);\n+ 200\n+201 ~largeobjectaccess() noexcept { close(); }\n+ 202\n+ 204\n+ 207 using largeobject::id;\n+ 208\n+ 210\n+213 void to_file(const std::string &File) const //[t54]\n+ 214 { largeobject::to_file(m_trans, File); }\n+ 215\n+ 216 using largeobject::to_file;\n+ 217\n+ 223\n+ 227 void write(const char Buf[], size_type Len); //[t51]\n+ 228\n+ 230\n+233 void write(const std::string &Buf) //[t50]\n+ 234 { write(Buf.c_str(), static_cast(Buf.size())); }\n+ 235\n+ 237\n+ 243 size_type read(char Buf[], size_type Len); //[t50]\n+ 244\n+ 246\n+ 249 size_type seek(size_type dest, seekdir dir); //[t51]\n+ 250\n+ 252\n+ 255 size_type tell() const; //[t50]\n+ 257\n+ 268\n+ 276 pos_type cseek(off_type dest, seekdir dir) noexcept; //[t50]\n+ 277\n+ 279\n+ 285 off_type cwrite(const char Buf[], size_type Len) noexcept; //[t50]\n+ 286\n+ 288\n+ 294 off_type cread(char Buf[], size_type Len) noexcept; //[t50]\n+ 295\n+ 297\n+ 301 pos_type ctell() const noexcept; //[t50]\n+ 303\n+ 309 void process_notice(const std::string &) noexcept; //[t50]\n+ 311\n+ 312 using largeobject::remove;\n+ 313\n+ 314 using largeobject::operator==;\n+ 315 using largeobject::operator!=;\n+ 316 using largeobject::operator<;\n+ 317 using largeobject::operator<=;\n+ 318 using largeobject::operator>;\n+ 319 using largeobject::operator>=;\n+ 320\n+ 321private:\n+ 322 PQXX_PRIVATE std::string reason(int err) const;\n+ 323 internal::pq::PGconn *raw_connection() const\n+ 324 { return largeobject::raw_connection(m_trans); }\n+ 325\n+ 326 PQXX_PRIVATE void open(openmode mode);\n+ 327 void close() noexcept;\n+ 328\n+ 329 dbtransaction &m_trans;\n+ 330 int m_fd = -1;\n+ 331\n+ 332 largeobjectaccess() =delete;\n+ 333 largeobjectaccess(const largeobjectaccess &) =delete;\n+ 334 largeobjectaccess operator=(const largeobjectaccess &) =delete;\n+ 335};\n+ 336\n+ 337\n+ 339\n+ 347template>\n+348 class largeobject_streambuf :\n+ 349 public std::basic_streambuf\n+ 350{\n+ 351 using size_type = long;\n+ 352public:\n+353 using char_type = CHAR;\n+354 using traits_type = TRAITS;\n+355 using int_type = typename traits_type::int_type;\n+356 using pos_type = typename traits_type::pos_type;\n+357 using off_type = typename traits_type::off_type;\n+358 using openmode = largeobjectaccess::openmode;\n+359 using seekdir = largeobjectaccess::seekdir;\n+ 360\n+361 largeobject_streambuf( //[t48]\n+ 362 dbtransaction &T,\n+ 363 largeobject O,\n+ 364 openmode mode=std::ios::in|std::ios::out,\n+ 365 size_type BufSize=512) :\n+ 366 m_bufsize{BufSize},\n+ 367 m_obj{T, O, mode},\n+ 368 m_g{nullptr},\n+ 369 m_p{nullptr}\n+ 370 { initialize(mode); }\n+ 371\n+372 largeobject_streambuf( //[t48]\n+ 373 dbtransaction &T,\n+ 374 oid O,\n+ 375 openmode mode=std::ios::in|std::ios::out,\n+ 376 size_type BufSize=512) :\n+ 377 m_bufsize{BufSize},\n+ 378 m_obj{T, O, mode},\n+ 379 m_g{nullptr},\n+ 380 m_p{nullptr}\n+ 381 { initialize(mode); }\n+ 382\n+383 virtual ~largeobject_streambuf() noexcept\n+ 384 { delete [] m_p; delete [] m_g; }\n+ 385\n+ 386\n+388 void process_notice(const std::string &s) { m_obj.process_notice(s); }\n+ 389\n+ 390protected:\n+391 virtual int sync() override\n+ 392 {\n+ 393 // setg() sets eback, gptr, egptr\n+ 394 this->setg(this->eback(), this->eback(), this->egptr());\n+ 395 return overflow(EoF());\n+ 396 }\n+ 397\n+398 virtual pos_type seekoff(\n+ 399 off_type offset,\n+ 400 seekdir dir,\n+ 401 openmode)\n+ 402 override\n+ 403 {\n+ 404 return AdjustEOF(m_obj.cseek(largeobjectaccess::off_type(offset), dir));\n+ 405 }\n+ 406\n+407 virtual pos_type seekpos(pos_type pos, openmode) override\n+ 408 {\n+ 409 const largeobjectaccess::pos_type newpos = m_obj.cseek(\n+ 410 largeobjectaccess::off_type(pos),\n+ 411 std::ios::beg);\n+ 412 return AdjustEOF(newpos);\n+ 413 }\n+ 414\n+415 virtual int_type overflow(int_type ch = EoF()) override\n+ 416 {\n+ 417 char *const pp = this->pptr();\n+ 418 if (pp == nullptr) return EoF();\n+ 419 char *const pb = this->pbase();\n+ 420 int_type res = 0;\n+ 421\n+ 422 if (pp > pb) res = int_type(AdjustEOF(m_obj.cwrite(pb, pp-pb)));\n+ 423 this->setp(m_p, m_p + m_bufsize);\n+ 424\n+ 425 // Write that one more character, if it's there.\n+ 426 if (ch != EoF())\n+ 427 {\n+ 428 *this->pptr() = char(ch);\n+ 429 this->pbump(1);\n+ 430 }\n+ 431 return res;\n+ 432 }\n+ 433\n+434 virtual int_type underflow() override\n+ 435 {\n+ 436 if (this->gptr() == nullptr) return EoF();\n+ 437 char *const eb = this->eback();\n+ 438 const int_type res(static_cast(\n+ 439 AdjustEOF(m_obj.cread(this->eback(), m_bufsize))));\n+ 440 this->setg(eb, eb, eb + ((res==EoF()) ? 0 : res));\n+ 441 return ((res == 0) or (res == EoF())) ? EoF() : *eb;\n+ 442 }\n+ 443\n+ 444private:\n+ 446 static int_type EoF() { return traits_type::eof(); }\n+ 447\n+ 449 template\n+ 450 static std::streampos AdjustEOF(INTYPE pos)\n+ 451 { return (pos==-1) ? std::streampos(EoF()) : std::streampos(pos); }\n+ 452\n+ 453 void initialize(openmode mode)\n+ 454 {\n+ 455 if (mode & std::ios::in)\n+ 456 {\n+ 457 m_g = new char_type[unsigned(m_bufsize)];\n+ 458 this->setg(m_g, m_g, m_g);\n+ 459 }\n+ 460 if (mode & std::ios::out)\n+ 461 {\n+ 462 m_p = new char_type[unsigned(m_bufsize)];\n+ 463 this->setp(m_p, m_p + m_bufsize);\n+ 464 }\n+ 465 }\n+ 466\n+ 467 const size_type m_bufsize;\n+ 468 largeobjectaccess m_obj;\n+ 469\n+ 471 char_type *m_g, *m_p;\n+ 472};\n+ 473\n+ 474\n+ 476\n+ 484template>\n+485 class basic_ilostream :\n+ 486 public std::basic_istream\n+ 487{\n+ 488 using super = std::basic_istream;\n+ 489\n+ 490public:\n+491 using char_type = CHAR;\n+492 using traits_type = TRAITS;\n+493 using int_type = typename traits_type::int_type;\n+494 using pos_type = typename traits_type::pos_type;\n+495 using off_type = typename traits_type::off_type;\n+ 496\n+ 498\n+503 basic_ilostream( //[t57]\n+ 504 dbtransaction &T,\n+ 505 largeobject O,\n+ 506 largeobject::size_type BufSize=512) :\n+ 507 super{nullptr},\n+ 508 m_buf{T, O, std::ios::in, BufSize}\n+ 509 { super::init(&m_buf); }\n+ 510\n+ 512\n+517 basic_ilostream( //[t48]\n+ 518 dbtransaction &T,\n+ 519 oid O,\n+ 520 largeobject::size_type BufSize=512) :\n+ 521 super{nullptr},\n+ 522 m_buf{T, O, std::ios::in, BufSize}\n+ 523 { super::init(&m_buf); }\n+ 524\n+ 525private:\n+ 526 largeobject_streambuf m_buf;\n+ 527};\n+ 528\n+529using ilostream = basic_ilostream;\n+ 530\n+ 531\n+ 533\n+ 541template>\n+542 class basic_olostream :\n+ 543 public std::basic_ostream\n+ 544{\n+ 545 using super = std::basic_ostream;\n+ 546public:\n+547 using char_type = CHAR;\n+548 using traits_type = TRAITS;\n+549 using int_type = typename traits_type::int_type;\n+550 using pos_type = typename traits_type::pos_type;\n+551 using off_type = typename traits_type::off_type;\n+ 552\n+ 554\n+559 basic_olostream( //[t48]\n+ 560 dbtransaction &T,\n+ 561 largeobject O,\n+ 562 largeobject::size_type BufSize=512) :\n+ 563 super{nullptr},\n+ 564 m_buf{T, O, std::ios::out, BufSize}\n+ 565 { super::init(&m_buf); }\n+ 566\n+ 568\n+573 basic_olostream( //[t57]\n+ 574 dbtransaction &T,\n+ 575 oid O,\n+ 576 largeobject::size_type BufSize=512) :\n+ 577 super{nullptr},\n+ 578 m_buf{T, O, std::ios::out, BufSize}\n+ 579 { super::init(&m_buf); }\n+ 580\n+581 ~basic_olostream()\n+ 582 {\n+ 583 try\n+ 584 {\n+ 585 m_buf.pubsync(); m_buf.pubsync();\n+ 586 }\n+ 587 catch (const std::exception &e)\n+ 588 {\n+ 589 m_buf.process_notice(e.what());\n+ 590 }\n+ 591 }\n+ 592\n+ 593private:\n+ 594 largeobject_streambuf m_buf;\n+ 595};\n+ 596\n+597using olostream = basic_olostream;\n+ 598\n+ 599\n+ 601\n+ 609template>\n+610 class basic_lostream :\n+ 611 public std::basic_iostream\n+ 612{\n+ 613 using super = std::basic_iostream;\n+ 614\n+ 615public:\n+616 using char_type = CHAR;\n+617 using traits_type = TRAITS;\n+618 using int_type = typename traits_type::int_type;\n+619 using pos_type = typename traits_type::pos_type;\n+620 using off_type = typename traits_type::off_type;\n+ 621\n+ 623\n+628 basic_lostream( //[t59]\n+ 629 dbtransaction &T,\n+ 630 largeobject O,\n+ 631 largeobject::size_type BufSize=512) :\n+ 632 super{nullptr},\n+ 633 m_buf{T, O, std::ios::in | std::ios::out, BufSize}\n+ 634 { super::init(&m_buf); }\n+ 635\n+ 637\n+642 basic_lostream( //[t59]\n+ 643 dbtransaction &T,\n+ 644 oid O,\n+ 645 largeobject::size_type BufSize=512) :\n+ 646 super{nullptr},\n+ 647 m_buf{T, O, std::ios::in | std::ios::out, BufSize}\n+ 648 { super::init(&m_buf); }\n+ 649\n+650 ~basic_lostream()\n+ 651 {\n+ 652 try\n+ 653 {\n+ 654 m_buf.pubsync(); m_buf.pubsync();\n+ 655 }\n+ 656 catch (const std::exception &e)\n+ 657 {\n+ 658 m_buf.process_notice(e.what());\n+ 659 }\n+ 660 }\n+ 661\n+ 662private:\n+ 663 largeobject_streambuf m_buf;\n+ 664};\n+ 665\n+666using lostream = basic_lostream;\n+ 667\n+ 668} // namespace pqxx\n+ 669\n+ 670#include \"pqxx/compiler-internal-post.hxx\"\n+ 671\n+ 672#endif\n+std\n+STL namespace.\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::row_difference_type\n-signed int row_difference_type\n-Difference between row sizes.\n-Definition: types.hxx:27\n pqxx::large_object_size_type\n long large_object_size_type\n Number of bytes in a large object. (Unusual: it's signed.)\n Definition: types.hxx:33\n-pqxx::result_difference_type\n-signed long result_difference_type\n-Difference between result sizes.\n-Definition: types.hxx:21\n-pqxx::field_size_type\n-std::size_t field_size_type\n-Number of bytes in a field of database data.\n-Definition: types.hxx:30\n-pqxx::result_size_type\n-unsigned long result_size_type\n-Number of rows in a result set.\n-Definition: types.hxx:18\n-pqxx::row_size_type\n-unsigned int row_size_type\n-Number of fields in a row of database data.\n-Definition: types.hxx:24\n-pqxx::binarystring\n-Binary data corresponding to PostgreSQL's \"BYTEA\" binary-string type.\n-Definition: binarystring.hxx:54\n+pqxx::oid_none\n+constexpr oid oid_none\n+The \"null\" oid.\n+Definition: util.hxx:77\n pqxx::connection_base\n connection_base abstract base class; represents a connection to a database.\n Definition: connection_base.hxx:140\n-pqxx::connectionpolicy\n-Definition: connectionpolicy.hxx:32\n pqxx::dbtransaction\n Abstract base class responsible for bracketing a backend transaction.\n Definition: dbtransaction.hxx:63\n-pqxx::range_error\n-Something is out of range, similar to std::out_of_range.\n-Definition: except.hxx:253\n-pqxx::field\n-Reference to a field in a result set.\n-Definition: field.hxx:50\n+pqxx::largeobject\n+Identity of a large object.\n+Definition: largeobject.hxx:35\n+pqxx::largeobject::raw_connection\n+static PQXX_PURE internal::pq::PGconn * raw_connection(const dbtransaction &T)\n+Definition: largeobject.cxx:134\n+pqxx::largeobject::size_type\n+large_object_size_type size_type\n+Definition: largeobject.hxx:37\n+pqxx::largeobject::operator<\n+bool operator<(const largeobject &other) const\n+Compare object identities.\n+Definition: largeobject.hxx:101\n+pqxx::largeobject::operator==\n+bool operator==(const largeobject &other) const\n+Compare object identities.\n+Definition: largeobject.hxx:85\n+pqxx::largeobject::to_file\n+void to_file(dbtransaction &T, const std::string &File) const\n+Export large object's contents to a local file.\n+Definition: largeobject.cxx:106\n+pqxx::largeobject::operator>\n+bool operator>(const largeobject &other) const\n+Compare object identities.\n+Definition: largeobject.hxx:105\n+pqxx::largeobject::operator<=\n+bool operator<=(const largeobject &other) const\n+Compare object identities.\n+Definition: largeobject.hxx:93\n+pqxx::largeobject::largeobject\n+largeobject() noexcept=default\n+Refer to a nonexistent large object (similar to what a null pointer does)\n+pqxx::largeobject::operator!=\n+bool operator!=(const largeobject &other) const\n+Compare object identities.\n+Definition: largeobject.hxx:89\n+pqxx::largeobject::operator>=\n+bool operator>=(const largeobject &other) const\n+Compare object identities.\n+Definition: largeobject.hxx:97\n+pqxx::largeobject::id\n+oid id() const noexcept\n+Object identifier.\n+Definition: largeobject.hxx:73\n pqxx::largeobjectaccess\n Accessor for large object's contents.\n Definition: largeobject.hxx:138\n-pqxx::notification_receiver\n-Definition: notification.hxx:56\n-pqxx::result\n-Result set containing data returned by a query or command.\n-Definition: result.hxx:70\n-pqxx::const_result_iterator\n-Iterator for rows in a result. Use as result::const_iterator.\n-Definition: result_iterator.hxx:36\n-pqxx::const_reverse_result_iterator\n-Reverse iterator for result. Use as result::const_reverse_iterator.\n-Definition: result_iterator.hxx:122\n-pqxx::row\n-Reference to one row in a result.\n-Definition: row.hxx:41\n-pqxx::const_row_iterator\n-Iterator for fields in a row. Use as row::const_iterator.\n-Definition: row.hxx:208\n-pqxx::const_reverse_row_iterator\n-Reverse iterator for a row. Use as row::const_reverse_iterator.\n-Definition: row.hxx:280\n-pqxx::tablereader\n-Definition: tablereader.hxx:30\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n+pqxx::largeobjectaccess::pos_type\n+size_type pos_type\n+Definition: largeobject.hxx:142\n+pqxx::largeobjectaccess::openmode\n+std::ios::openmode openmode\n+Open mode: in, out (can be combined with the \"or\" operator)\n+Definition: largeobject.hxx:149\n+pqxx::largeobjectaccess::seekdir\n+std::ios::seekdir seekdir\n+Seek direction: beg, cur, end.\n+Definition: largeobject.hxx:156\n+pqxx::largeobjectaccess::write\n+void write(const std::string &Buf)\n+Write string to large object.\n+Definition: largeobject.hxx:233\n+pqxx::largeobjectaccess::off_type\n+long off_type\n+Definition: largeobject.hxx:141\n+pqxx::largeobjectaccess::~largeobjectaccess\n+~largeobjectaccess() noexcept\n+Definition: largeobject.hxx:201\n+pqxx::largeobjectaccess::to_file\n+void to_file(const std::string &File) const\n+Export large object's contents to a local file.\n+Definition: largeobject.hxx:213\n+pqxx::largeobject_streambuf\n+Streambuf to use large objects in standard I/O streams.\n+Definition: largeobject.hxx:350\n+pqxx::largeobject_streambuf::seekoff\n+virtual pos_type seekoff(off_type offset, seekdir dir, openmode) override\n+Definition: largeobject.hxx:398\n+pqxx::largeobject_streambuf::traits_type\n+TRAITS traits_type\n+Definition: largeobject.hxx:354\n+pqxx::largeobject_streambuf::int_type\n+typename traits_type::int_type int_type\n+Definition: largeobject.hxx:355\n+pqxx::largeobject_streambuf::seekpos\n+virtual pos_type seekpos(pos_type pos, openmode) override\n+Definition: largeobject.hxx:407\n+pqxx::largeobject_streambuf::process_notice\n+void process_notice(const std::string &s)\n+For use by large object stream classes.\n+Definition: largeobject.hxx:388\n+pqxx::largeobject_streambuf::char_type\n+CHAR char_type\n+Definition: largeobject.hxx:353\n+pqxx::largeobject_streambuf::off_type\n+typename traits_type::off_type off_type\n+Definition: largeobject.hxx:357\n+pqxx::largeobject_streambuf::largeobject_streambuf\n+largeobject_streambuf(dbtransaction &T, largeobject O, openmode mode=std::ios::\n+in|std::ios::out, size_type BufSize=512)\n+Definition: largeobject.hxx:361\n+pqxx::largeobject_streambuf::largeobject_streambuf\n+largeobject_streambuf(dbtransaction &T, oid O, openmode mode=std::ios::in|std::\n+ios::out, size_type BufSize=512)\n+Definition: largeobject.hxx:372\n+pqxx::largeobject_streambuf::~largeobject_streambuf\n+virtual ~largeobject_streambuf() noexcept\n+Definition: largeobject.hxx:383\n+pqxx::largeobject_streambuf::sync\n+virtual int sync() override\n+Definition: largeobject.hxx:391\n+pqxx::largeobject_streambuf::seekdir\n+largeobjectaccess::seekdir seekdir\n+Definition: largeobject.hxx:359\n+pqxx::largeobject_streambuf::underflow\n+virtual int_type underflow() override\n+Definition: largeobject.hxx:434\n+pqxx::largeobject_streambuf::overflow\n+virtual int_type overflow(int_type ch=EoF()) override\n+Definition: largeobject.hxx:415\n+pqxx::largeobject_streambuf::openmode\n+largeobjectaccess::openmode openmode\n+Definition: largeobject.hxx:358\n+pqxx::largeobject_streambuf::pos_type\n+typename traits_type::pos_type pos_type\n+Definition: largeobject.hxx:356\n+pqxx::basic_ilostream\n+Input stream that gets its data from a large object.\n+Definition: largeobject.hxx:487\n+pqxx::basic_ilostream::char_type\n+CHAR char_type\n+Definition: largeobject.hxx:491\n+pqxx::basic_ilostream::basic_ilostream\n+basic_ilostream(dbtransaction &T, largeobject O, largeobject::size_type\n+BufSize=512)\n+Create a basic_ilostream.\n+Definition: largeobject.hxx:503\n+pqxx::basic_ilostream::int_type\n+typename traits_type::int_type int_type\n+Definition: largeobject.hxx:493\n+pqxx::basic_ilostream::traits_type\n+TRAITS traits_type\n+Definition: largeobject.hxx:492\n+pqxx::basic_ilostream::off_type\n+typename traits_type::off_type off_type\n+Definition: largeobject.hxx:495\n+pqxx::basic_ilostream::pos_type\n+typename traits_type::pos_type pos_type\n+Definition: largeobject.hxx:494\n+pqxx::basic_ilostream::basic_ilostream\n+basic_ilostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)\n+Create a basic_ilostream.\n+Definition: largeobject.hxx:517\n+pqxx::basic_olostream\n+Output stream that writes data back to a large object.\n+Definition: largeobject.hxx:544\n+pqxx::basic_olostream::off_type\n+typename traits_type::off_type off_type\n+Definition: largeobject.hxx:551\n+pqxx::basic_olostream::pos_type\n+typename traits_type::pos_type pos_type\n+Definition: largeobject.hxx:550\n+pqxx::basic_olostream::int_type\n+typename traits_type::int_type int_type\n+Definition: largeobject.hxx:549\n+pqxx::basic_olostream::~basic_olostream\n+~basic_olostream()\n+Definition: largeobject.hxx:581\n+pqxx::basic_olostream::basic_olostream\n+basic_olostream(dbtransaction &T, largeobject O, largeobject::size_type\n+BufSize=512)\n+Create a basic_olostream.\n+Definition: largeobject.hxx:559\n+pqxx::basic_olostream::char_type\n+CHAR char_type\n+Definition: largeobject.hxx:547\n+pqxx::basic_olostream::traits_type\n+TRAITS traits_type\n+Definition: largeobject.hxx:548\n+pqxx::basic_olostream::basic_olostream\n+basic_olostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)\n+Create a basic_olostream.\n+Definition: largeobject.hxx:573\n+pqxx::basic_lostream\n+Stream that reads and writes a large object.\n+Definition: largeobject.hxx:612\n+pqxx::basic_lostream::pos_type\n+typename traits_type::pos_type pos_type\n+Definition: largeobject.hxx:619\n+pqxx::basic_lostream::~basic_lostream\n+~basic_lostream()\n+Definition: largeobject.hxx:650\n+pqxx::basic_lostream::basic_lostream\n+basic_lostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)\n+Create a basic_lostream.\n+Definition: largeobject.hxx:642\n+pqxx::basic_lostream::int_type\n+typename traits_type::int_type int_type\n+Definition: largeobject.hxx:618\n+pqxx::basic_lostream::basic_lostream\n+basic_lostream(dbtransaction &T, largeobject O, largeobject::size_type\n+BufSize=512)\n+Create a basic_lostream.\n+Definition: largeobject.hxx:628\n+pqxx::basic_lostream::off_type\n+typename traits_type::off_type off_type\n+Definition: largeobject.hxx:620\n+pqxx::basic_lostream::traits_type\n+TRAITS traits_type\n+Definition: largeobject.hxx:617\n+pqxx::basic_lostream::char_type\n+CHAR char_type\n+Definition: largeobject.hxx:616\n * include\n * pqxx\n- * types.hxx\n+ * largeobject.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00026_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00026_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: config.h Source File\n+libpqxx: tablereader.hxx Source File\n \n \n \n \n \n \n \n@@ -55,130 +55,134 @@\n \n
\n
\n-
config.h
\n+
tablereader.hxx
\n
\n
\n-
1/* include/pqxx/config.h. Generated from config.h.in by configure. */
\n-
2/* include/pqxx/config.h.in. Generated from configure.ac by autoheader. */
\n-
3
\n-
4/* most gcc compilers know a function __attribute__((__const__)) */
\n-
5#define GCC_CONST_CALL __attribute__((__const__))
\n-
6
\n-
7/* define if the compiler supports basic C++11 syntax */
\n-
8#define HAVE_CXX11 1
\n-
9
\n-
10/* Define to 1 if you have the <dlfcn.h> header file. */
\n-
11#define HAVE_DLFCN_H 1
\n-
12
\n-
13/* Define to 1 if you have the <inttypes.h> header file. */
\n-
14#define HAVE_INTTYPES_H 1
\n+
1
\n+
13#ifndef PQXX_H_TABLEREADER
\n+
14#define PQXX_H_TABLEREADER
\n
15
\n-
16/* Define to 1 if you have the `pq' library (-lpq). */
\n-
17#define HAVE_LIBPQ 1
\n-
18
\n-
19/* System supports poll(). */
\n-
20#define HAVE_POLL 1
\n+
16#include "pqxx/compiler-public.hxx"
\n+
17#include "pqxx/compiler-internal-pre.hxx"
\n+
18#include "pqxx/result.hxx"
\n+
19#include "pqxx/tablestream.hxx"
\n+
20
\n
21
\n-
22/* Define to 1 if you have the <stdint.h> header file. */
\n-
23#define HAVE_STDINT_H 1
\n-
24
\n-
25/* Define to 1 if you have the <stdio.h> header file. */
\n-
26#define HAVE_STDIO_H 1
\n-
27
\n-
28/* Define to 1 if you have the <stdlib.h> header file. */
\n-
29#define HAVE_STDLIB_H 1
\n-
30
\n-
31/* Define to 1 if you have the <strings.h> header file. */
\n-
32#define HAVE_STRINGS_H 1
\n-
33
\n-
34/* Define to 1 if you have the <string.h> header file. */
\n-
35#define HAVE_STRING_H 1
\n-
36
\n-
37/* Define to 1 if you have the <sys/select.h> header file. */
\n-
38/* #undef HAVE_SYS_SELECT_H */
\n-
39
\n-
40/* Define to 1 if you have the <sys/stat.h> header file. */
\n-
41#define HAVE_SYS_STAT_H 1
\n-
42
\n-
43/* Define to 1 if you have the <sys/time.h> header file. */
\n-
44#define HAVE_SYS_TIME_H 1
\n-
45
\n-
46/* Define to 1 if you have the <sys/types.h> header file. */
\n-
47#define HAVE_SYS_TYPES_H 1
\n-
48
\n-
49/* Define to 1 if you have the <unistd.h> header file. */
\n-
50#define HAVE_UNISTD_H 1
\n-
51
\n-
52/* Define to the sub-directory where libtool stores uninstalled libraries. */
\n-
53#define LT_OBJDIR ".libs/"
\n-
54
\n-
55/* Name of package */
\n-
56#define PACKAGE "libpqxx"
\n-
57
\n-
58/* Define to the address where bug reports for this package should be sent. */
\n-
59#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen"
\n-
60
\n-
61/* Define to the full name of this package. */
\n-
62#define PACKAGE_NAME "libpqxx"
\n-
63
\n-
64/* Define to the full name and version of this package. */
\n-
65#define PACKAGE_STRING "libpqxx 6.4.5"
\n-
66
\n-
67/* Define to the one symbol short name of this package. */
\n-
68#define PACKAGE_TARNAME "libpqxx"
\n+
22namespace pqxx
\n+
23{
\n+
25
\n+
29class PQXX_LIBEXPORT tablereader : public tablestream
\n+
30{
\n+
31public:
\n+
32 PQXX_DEPRECATED tablereader(
\n+\n+
34 const std::string &Name,
\n+
35 const std::string &Null=std::string{});
\n+
36 template<typename ITER>
\n+
37 PQXX_DEPRECATED tablereader(
\n+\n+
39 const std::string &Name,
\n+
40 ITER begincolumns,
\n+
41 ITER endcolumns);
\n+
42 template<typename ITER>
\n+
43 PQXX_DEPRECATED tablereader(
\n+\n+
45 const std::string &Name,
\n+
46 ITER begincolumns,
\n+
47 ITER endcolumns,
\n+
48 const std::string &Null);
\n+
49 ~tablereader() noexcept;
\n+
50 template<typename TUPLE> tablereader &operator>>(TUPLE &);
\n+
51 operator bool() const noexcept { return not m_done; }
\n+
52 bool operator!() const noexcept { return m_done; }
\n+
53 bool get_raw_line(std::string &Line);
\n+
54 template<typename TUPLE>
\n+
55 void tokenize(std::string, TUPLE &) const;
\n+
56 virtual void complete() override;
\n+
57private:
\n+
58 void set_up(
\n+\n+
60 const std::string &RName,
\n+
61 const std::string &Columns=std::string{});
\n+
62 PQXX_PRIVATE void reader_close();
\n+
63 std::string extract_field(
\n+
64 const std::string &,
\n+
65 std::string::size_type &) const;
\n+
66 bool m_done;
\n+
67};
\n+
68
\n
69
\n-
70/* Define to the home page for this package. */
\n-
71#define PACKAGE_URL ""
\n-
72
\n-
73/* Define to the version of this package. */
\n-
74#define PACKAGE_VERSION "6.4.5"
\n-
75
\n-
76/* Define if <charconv> supports floating-point conversion. */
\n-
77/* #undef PQXX_HAVE_CHARCONV_FLOAT */
\n-
78
\n-
79/* Define if <charconv> supports integer conversion. */
\n-
80/* #undef PQXX_HAVE_CHARCONV_INT */
\n-
81
\n-
82/* Define if compiler supports [[deprecated]] attribute */
\n-
83#define PQXX_HAVE_DEPRECATED 1
\n-
84
\n-
85/* Define if the compiler supports std::experimental::optional. */
\n-
86/* #undef PQXX_HAVE_EXP_OPTIONAL */
\n-
87
\n-
88/* Define if g++ supports const attribute. */
\n-
89#define PQXX_HAVE_GCC_CONST 1
\n-
90
\n-
91/* Define if g++ supports deprecated attribute. */
\n-
92#define PQXX_HAVE_GCC_DEPRECATED 1
\n-
93
\n-
94/* Define if g++ supports pure attribute */
\n-
95#define PQXX_HAVE_GCC_PURE 1
\n-
96
\n-
97/* Define if g++ supports visibility attribute. */
\n-
98#define PQXX_HAVE_GCC_VISIBILITY 1
\n-
99
\n-
100/* Define if the compiler supports std::optional. */
\n-
101/* #undef PQXX_HAVE_OPTIONAL */
\n-
102
\n-
103/* Define to 1 if all of the C90 standard headers exist (not just the ones
\n-
104 required in a freestanding environment). This macro is provided for
\n-
105 backward compatibility; new code need not use it. */
\n-
106#define STDC_HEADERS 1
\n+
70template<typename ITER> inline
\n+\n+\n+
73 const std::string &Name,
\n+
74 ITER begincolumns,
\n+
75 ITER endcolumns) :
\n+
76 namedclass{Name, "tablereader"},
\n+
77 tablestream{T, std::string{}},
\n+
78 m_done{true}
\n+
79{
\n+
80 set_up(T, Name, columnlist(begincolumns, endcolumns));
\n+
81}
\n+
82
\n+
83
\n+
84template<typename ITER> inline
\n+\n+\n+
87 const std::string &Name,
\n+
88 ITER begincolumns,
\n+
89 ITER endcolumns,
\n+
90 const std::string &Null) :
\n+
91 namedclass{Name, "tablereader"},
\n+
92 tablestream{T, Null},
\n+
93 m_done{true}
\n+
94{
\n+
95 set_up(T, Name, columnlist(begincolumns, endcolumns));
\n+
96}
\n+
97
\n+
98
\n+
99template<typename TUPLE>
\n+
100inline void tablereader::tokenize(std::string Line, TUPLE &T) const
\n+
101{
\n+
102 std::back_insert_iterator<TUPLE> ins = std::back_inserter(T);
\n+
103 std::string::size_type here = 0;
\n+
104 while (here < Line.size()) *ins++ = extract_field(Line, here);
\n+
105}
\n+
106
\n
107
\n-
108/* Version number of package */
\n-
109#define VERSION "6.4.5"
\n+
108template<typename TUPLE>
\n+\n+
110{
\n+
111 std::string Line;
\n+
112 if (get_raw_line(Line)) tokenize(Line, T);
\n+
113 return *this;
\n+
114}
\n+
115} // namespace pqxx
\n+
116
\n+
117#include "pqxx/compiler-internal-post.hxx"
\n+
118#endif
\n+
STL namespace.
\n+
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n+
Definition: tablereader.hxx:30
\n+
void tokenize(std::string, TUPLE &) const
Definition: tablereader.hxx:100
\n+
tablereader(transaction_base &, const std::string &Name, const std::string &Null=std::string{})
Definition: tablereader.cxx:21
\n+
bool operator!() const noexcept
Definition: tablereader.hxx:52
\n+
tablereader & operator>>(TUPLE &)
Definition: tablereader.hxx:109
\n+
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
\n+
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,123 +1,144 @@\n \n \n \n \n \n libpqxx\n \n-config.h\n- 1/* include/pqxx/config.h. Generated from config.h.in by configure. */\n- 2/* include/pqxx/config.h.in. Generated from configure.ac by autoheader. */\n- 3\n- 4/* most gcc compilers know a function __attribute__((__const__)) */\n- 5#define GCC_CONST_CALL __attribute__((__const__))\n- 6\n- 7/* define if the compiler supports basic C++11 syntax */\n- 8#define HAVE_CXX11 1\n- 9\n- 10/* Define to 1 if you have the header file. */\n- 11#define HAVE_DLFCN_H 1\n- 12\n- 13/* Define to 1 if you have the header file. */\n- 14#define HAVE_INTTYPES_H 1\n+tablereader.hxx\n+ 1\n+ 13#ifndef PQXX_H_TABLEREADER\n+ 14#define PQXX_H_TABLEREADER\n 15\n- 16/* Define to 1 if you have the `pq' library (-lpq). */\n- 17#define HAVE_LIBPQ 1\n- 18\n- 19/* System supports poll(). */\n- 20#define HAVE_POLL 1\n+ 16#include \"pqxx/compiler-public.hxx\"\n+ 17#include \"pqxx/compiler-internal-pre.hxx\"\n+ 18#include \"pqxx/result.hxx\"\n+ 19#include \"pqxx/tablestream.hxx\"\n+ 20\n 21\n- 22/* Define to 1 if you have the header file. */\n- 23#define HAVE_STDINT_H 1\n- 24\n- 25/* Define to 1 if you have the header file. */\n- 26#define HAVE_STDIO_H 1\n- 27\n- 28/* Define to 1 if you have the header file. */\n- 29#define HAVE_STDLIB_H 1\n- 30\n- 31/* Define to 1 if you have the header file. */\n- 32#define HAVE_STRINGS_H 1\n- 33\n- 34/* Define to 1 if you have the header file. */\n- 35#define HAVE_STRING_H 1\n- 36\n- 37/* Define to 1 if you have the header file. */\n- 38/* #undef HAVE_SYS_SELECT_H */\n- 39\n- 40/* Define to 1 if you have the header file. */\n- 41#define HAVE_SYS_STAT_H 1\n- 42\n- 43/* Define to 1 if you have the header file. */\n- 44#define HAVE_SYS_TIME_H 1\n- 45\n- 46/* Define to 1 if you have the header file. */\n- 47#define HAVE_SYS_TYPES_H 1\n- 48\n- 49/* Define to 1 if you have the header file. */\n- 50#define HAVE_UNISTD_H 1\n- 51\n- 52/* Define to the sub-directory where libtool stores uninstalled libraries.\n-*/\n- 53#define LT_OBJDIR \".libs/\"\n- 54\n- 55/* Name of package */\n- 56#define PACKAGE \"libpqxx\"\n- 57\n- 58/* Define to the address where bug reports for this package should be sent.\n-*/\n- 59#define PACKAGE_BUGREPORT \"Jeroen T. Vermeulen\"\n- 60\n- 61/* Define to the full name of this package. */\n- 62#define PACKAGE_NAME \"libpqxx\"\n- 63\n- 64/* Define to the full name and version of this package. */\n- 65#define PACKAGE_STRING \"libpqxx 6.4.5\"\n- 66\n- 67/* Define to the one symbol short name of this package. */\n- 68#define PACKAGE_TARNAME \"libpqxx\"\n+ 22namespace pqxx\n+ 23{\n+ 25\n+29class PQXX_LIBEXPORT tablereader : public tablestream\n+ 30{\n+ 31public:\n+ 32 PQXX_DEPRECATED tablereader(\n+ 33 transaction_base &,\n+ 34 const std::string &Name,\n+ 35 const std::string &Null=std::string{});\n+ 36 template\n+ 37 PQXX_DEPRECATED tablereader(\n+ 38 transaction_base &,\n+ 39 const std::string &Name,\n+ 40 ITER begincolumns,\n+ 41 ITER endcolumns);\n+ 42 template\n+ 43 PQXX_DEPRECATED tablereader(\n+ 44 transaction_base &,\n+ 45 const std::string &Name,\n+ 46 ITER begincolumns,\n+ 47 ITER endcolumns,\n+ 48 const std::string &Null);\n+ 49 ~tablereader() noexcept;\n+ 50 template tablereader &operator>>(TUPLE &);\n+51 operator bool() const noexcept { return not m_done; }\n+52 bool operator!() const noexcept { return m_done; }\n+ 53 bool get_raw_line(std::string &Line);\n+ 54 template\n+ 55 void tokenize(std::string, TUPLE &) const;\n+ 56 virtual void complete() override;\n+ 57private:\n+ 58 void set_up(\n+ 59 transaction_base &T,\n+ 60 const std::string &RName,\n+ 61 const std::string &Columns=std::string{});\n+ 62 PQXX_PRIVATE void reader_close();\n+ 63 std::string extract_field(\n+ 64 const std::string &,\n+ 65 std::string::size_type &) const;\n+ 66 bool m_done;\n+ 67};\n+ 68\n 69\n- 70/* Define to the home page for this package. */\n- 71#define PACKAGE_URL \"\"\n- 72\n- 73/* Define to the version of this package. */\n- 74#define PACKAGE_VERSION \"6.4.5\"\n- 75\n- 76/* Define if supports floating-point conversion. */\n- 77/* #undef PQXX_HAVE_CHARCONV_FLOAT */\n- 78\n- 79/* Define if supports integer conversion. */\n- 80/* #undef PQXX_HAVE_CHARCONV_INT */\n- 81\n- 82/* Define if compiler supports [[deprecated]] attribute */\n- 83#define PQXX_HAVE_DEPRECATED 1\n- 84\n- 85/* Define if the compiler supports std::experimental::optional. */\n- 86/* #undef PQXX_HAVE_EXP_OPTIONAL */\n- 87\n- 88/* Define if g++ supports const attribute. */\n- 89#define PQXX_HAVE_GCC_CONST 1\n- 90\n- 91/* Define if g++ supports deprecated attribute. */\n- 92#define PQXX_HAVE_GCC_DEPRECATED 1\n- 93\n- 94/* Define if g++ supports pure attribute */\n- 95#define PQXX_HAVE_GCC_PURE 1\n- 96\n- 97/* Define if g++ supports visibility attribute. */\n- 98#define PQXX_HAVE_GCC_VISIBILITY 1\n- 99\n- 100/* Define if the compiler supports std::optional. */\n- 101/* #undef PQXX_HAVE_OPTIONAL */\n- 102\n- 103/* Define to 1 if all of the C90 standard headers exist (not just the ones\n- 104 required in a freestanding environment). This macro is provided for\n- 105 backward compatibility; new code need not use it. */\n- 106#define STDC_HEADERS 1\n+ 70template inline\n+71tablereader::tablereader(\n+ 72 transaction_base &T,\n+ 73 const std::string &Name,\n+ 74 ITER begincolumns,\n+ 75 ITER endcolumns) :\n+ 76 namedclass{Name, \"tablereader\"},\n+ 77 tablestream{T, std::string{}},\n+ 78 m_done{true}\n+ 79{\n+ 80 set_up(T, Name, columnlist(begincolumns, endcolumns));\n+ 81}\n+ 82\n+ 83\n+ 84template inline\n+85tablereader::tablereader(\n+ 86 transaction_base &T,\n+ 87 const std::string &Name,\n+ 88 ITER begincolumns,\n+ 89 ITER endcolumns,\n+ 90 const std::string &Null) :\n+ 91 namedclass{Name, \"tablereader\"},\n+ 92 tablestream{T, Null},\n+ 93 m_done{true}\n+ 94{\n+ 95 set_up(T, Name, columnlist(begincolumns, endcolumns));\n+ 96}\n+ 97\n+ 98\n+ 99template\n+100inline void tablereader::tokenize(std::string Line, TUPLE &T) const\n+ 101{\n+ 102 std::back_insert_iterator ins = std::back_inserter(T);\n+ 103 std::string::size_type here = 0;\n+ 104 while (here < Line.size()) *ins++ = extract_field(Line, here);\n+ 105}\n+ 106\n 107\n- 108/* Version number of package */\n- 109#define VERSION \"6.4.5\"\n+ 108template\n+109inline tablereader &pqxx::tablereader::operator>>(TUPLE &T)\n+ 110{\n+ 111 std::string Line;\n+ 112 if (get_raw_line(Line)) tokenize(Line, T);\n+ 113 return *this;\n+ 114}\n+ 115} // namespace pqxx\n+ 116\n+ 117#include \"pqxx/compiler-internal-post.hxx\"\n+ 118#endif\n+std\n+STL namespace.\n+pqxx\n+The home of all libpqxx classes, functions, templates, etc.\n+Definition: array.hxx:26\n+pqxx::tablereader\n+Definition: tablereader.hxx:30\n+pqxx::tablereader::tokenize\n+void tokenize(std::string, TUPLE &) const\n+Definition: tablereader.hxx:100\n+pqxx::tablereader::tablereader\n+tablereader(transaction_base &, const std::string &Name, const std::string\n+&Null=std::string{})\n+Definition: tablereader.cxx:21\n+pqxx::tablereader::operator!\n+bool operator!() const noexcept\n+Definition: tablereader.hxx:52\n+pqxx::tablereader::operator>>\n+tablereader & operator>>(TUPLE &)\n+Definition: tablereader.hxx:109\n+pqxx::tablestream\n+Base class for obsolete tablereader/tablewriter classes.\n+Definition: tablestream.hxx:28\n+pqxx::tablestream::columnlist\n+static std::string columnlist(ITER colbegin, ITER colend)\n+Definition: tablestream.hxx:52\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * config.h\n+ * tablereader.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00029_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00029_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: largeobject.hxx Source File\n+libpqxx: config-internal-compiler.h Source File\n \n \n \n \n \n \n \n@@ -55,537 +55,28 @@\n \n
\n
\n-
largeobject.hxx
\n+
config-internal-compiler.h
\n
\n
\n-
1
\n-
13#ifndef PQXX_H_LARGEOBJECT
\n-
14#define PQXX_H_LARGEOBJECT
\n-
15
\n-
16#include "pqxx/compiler-public.hxx"
\n-
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18
\n-
19#include <streambuf>
\n-
20
\n-
21#include "pqxx/dbtransaction.hxx"
\n-
22
\n-
23
\n-
24namespace pqxx
\n-
25{
\n-
27
\n-
34class PQXX_LIBEXPORT largeobject
\n-
35{
\n-
36public:
\n-\n-
38
\n-
40 largeobject() noexcept =default; //[t48]
\n-
41
\n-
43
\n-
45 explicit largeobject(dbtransaction &T); //[t48]
\n-
46
\n-
48
\n-
52 explicit largeobject(oid O) noexcept : m_id{O} {} //[t48]
\n-
53
\n-
55
\n-
59 largeobject(dbtransaction &T, const std::string &File); //[t53]
\n-
60
\n-
62
\n-
66 largeobject(const largeobjectaccess &O) noexcept; //[t50]
\n-
67
\n-
69
\n-
73 oid id() const noexcept { return m_id; } //[t48]
\n-
74
\n-
84
\n-
85 bool operator==(const largeobject &other) const //[t51]
\n-
86 { return m_id == other.m_id; }
\n-
88
\n-
89 bool operator!=(const largeobject &other) const //[t51]
\n-
90 { return m_id != other.m_id; }
\n-
92
\n-
93 bool operator<=(const largeobject &other) const //[t51]
\n-
94 { return m_id <= other.m_id; }
\n-
96
\n-
97 bool operator>=(const largeobject &other) const //[t51]
\n-
98 { return m_id >= other.m_id; }
\n-
100
\n-
101 bool operator<(const largeobject &other) const //[t51]
\n-
102 { return m_id < other.m_id; }
\n-
104
\n-
105 bool operator>(const largeobject &other) const //[t51]
\n-
106 { return m_id > other.m_id; }
\n-
108
\n-
110
\n-
114 void to_file(dbtransaction &T, const std::string &File) const; //[t52]
\n-
115
\n-
117
\n-
121 void remove(dbtransaction &T) const; //[t48]
\n-
122
\n-
123protected:
\n-
124 PQXX_PURE static internal::pq::PGconn *raw_connection(
\n-
125 const dbtransaction &T);
\n-
126
\n-
127 PQXX_PRIVATE std::string reason(const connection_base &, int err) const;
\n-
128
\n-
129private:
\n-
130 oid m_id = oid_none;
\n-
131};
\n-
132
\n-
133
\n-
134// TODO: New hierarchy with separate read / write / mixed-mode access
\n-
135
\n-
137class PQXX_LIBEXPORT largeobjectaccess : private largeobject
\n-
138{
\n-
139public:
\n-\n-
141 using off_type = long;
\n-\n-
143
\n-
145
\n-
149 using openmode = std::ios::openmode;
\n-
150
\n-
152
\n-
156 using seekdir = std::ios::seekdir;
\n-
157
\n-
159
\n-
163 explicit largeobjectaccess( //[t51]
\n-
164 dbtransaction &T,
\n-
165 openmode mode=std::ios::in|std::ios::out);
\n-
166
\n-
168
\n-
174 largeobjectaccess( //[t52]
\n-
175 dbtransaction &T,
\n-
176 oid O,
\n-
177 openmode mode=std::ios::in|std::ios::out);
\n-
178
\n-
180
\n-
185 largeobjectaccess( //[t50]
\n-
186 dbtransaction &T,
\n-
187 largeobject O,
\n-
188 openmode mode=std::ios::in|std::ios::out);
\n-
189
\n-
191
\n-
196 largeobjectaccess( //[t55]
\n-
197 dbtransaction &T,
\n-
198 const std::string &File,
\n-
199 openmode mode=std::ios::in|std::ios::out);
\n-
200
\n-
201 ~largeobjectaccess() noexcept { close(); }
\n-
202
\n-
204
\n-
207 using largeobject::id;
\n-
208
\n-
210
\n-
213 void to_file(const std::string &File) const //[t54]
\n-
214 { largeobject::to_file(m_trans, File); }
\n-
215
\n-\n-
217
\n-
223
\n-
227 void write(const char Buf[], size_type Len); //[t51]
\n-
228
\n-
230
\n-
233 void write(const std::string &Buf) //[t50]
\n-
234 { write(Buf.c_str(), static_cast<size_type>(Buf.size())); }
\n-
235
\n-
237
\n-
243 size_type read(char Buf[], size_type Len); //[t50]
\n-
244
\n-
246
\n-
249 size_type seek(size_type dest, seekdir dir); //[t51]
\n-
250
\n-
252
\n-
255 size_type tell() const; //[t50]
\n-
257
\n-
268
\n-
276 pos_type cseek(off_type dest, seekdir dir) noexcept; //[t50]
\n-
277
\n-
279
\n-
285 off_type cwrite(const char Buf[], size_type Len) noexcept; //[t50]
\n-
286
\n-
288
\n-
294 off_type cread(char Buf[], size_type Len) noexcept; //[t50]
\n-
295
\n-
297
\n-
301 pos_type ctell() const noexcept; //[t50]
\n-
303
\n-
309 void process_notice(const std::string &) noexcept; //[t50]
\n-
311
\n-
312 using largeobject::remove;
\n-
313
\n-
314 using largeobject::operator==;
\n-
315 using largeobject::operator!=;
\n-
316 using largeobject::operator<;
\n-
317 using largeobject::operator<=;
\n-
318 using largeobject::operator>;
\n-
319 using largeobject::operator>=;
\n-
320
\n-
321private:
\n-
322 PQXX_PRIVATE std::string reason(int err) const;
\n-
323 internal::pq::PGconn *raw_connection() const
\n-
324 { return largeobject::raw_connection(m_trans); }
\n-
325
\n-
326 PQXX_PRIVATE void open(openmode mode);
\n-
327 void close() noexcept;
\n-
328
\n-
329 dbtransaction &m_trans;
\n-
330 int m_fd = -1;
\n-
331
\n-
332 largeobjectaccess() =delete;
\n-
333 largeobjectaccess(const largeobjectaccess &) =delete;
\n-
334 largeobjectaccess operator=(const largeobjectaccess &) =delete;
\n-
335};
\n-
336
\n-
337
\n-
339
\n-
347template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n-\n-
349 public std::basic_streambuf<CHAR, TRAITS>
\n-
350{
\n-
351 using size_type = long;
\n-
352public:
\n-
353 using char_type = CHAR;
\n-
354 using traits_type = TRAITS;
\n-
355 using int_type = typename traits_type::int_type;
\n-
356 using pos_type = typename traits_type::pos_type;
\n-
357 using off_type = typename traits_type::off_type;
\n-\n-\n-
360
\n-\n-
362 dbtransaction &T,
\n-
363 largeobject O,
\n-
364 openmode mode=std::ios::in|std::ios::out,
\n-
365 size_type BufSize=512) :
\n-
366 m_bufsize{BufSize},
\n-
367 m_obj{T, O, mode},
\n-
368 m_g{nullptr},
\n-
369 m_p{nullptr}
\n-
370 { initialize(mode); }
\n-
371
\n-\n-
373 dbtransaction &T,
\n-
374 oid O,
\n-
375 openmode mode=std::ios::in|std::ios::out,
\n-
376 size_type BufSize=512) :
\n-
377 m_bufsize{BufSize},
\n-
378 m_obj{T, O, mode},
\n-
379 m_g{nullptr},
\n-
380 m_p{nullptr}
\n-
381 { initialize(mode); }
\n-
382
\n-
383 virtual ~largeobject_streambuf() noexcept
\n-
384 { delete [] m_p; delete [] m_g; }
\n-
385
\n-
386
\n-
388 void process_notice(const std::string &s) { m_obj.process_notice(s); }
\n-
389
\n-
390protected:
\n-
391 virtual int sync() override
\n-
392 {
\n-
393 // setg() sets eback, gptr, egptr
\n-
394 this->setg(this->eback(), this->eback(), this->egptr());
\n-
395 return overflow(EoF());
\n-
396 }
\n-
397
\n-\n-
399 off_type offset,
\n-
400 seekdir dir,
\n-
401 openmode)
\n-
402 override
\n-
403 {
\n-
404 return AdjustEOF(m_obj.cseek(largeobjectaccess::off_type(offset), dir));
\n-
405 }
\n-
406
\n-
407 virtual pos_type seekpos(pos_type pos, openmode) override
\n-
408 {
\n-
409 const largeobjectaccess::pos_type newpos = m_obj.cseek(
\n-\n-
411 std::ios::beg);
\n-
412 return AdjustEOF(newpos);
\n-
413 }
\n-
414
\n-
415 virtual int_type overflow(int_type ch = EoF()) override
\n-
416 {
\n-
417 char *const pp = this->pptr();
\n-
418 if (pp == nullptr) return EoF();
\n-
419 char *const pb = this->pbase();
\n-
420 int_type res = 0;
\n-
421
\n-
422 if (pp > pb) res = int_type(AdjustEOF(m_obj.cwrite(pb, pp-pb)));
\n-
423 this->setp(m_p, m_p + m_bufsize);
\n-
424
\n-
425 // Write that one more character, if it's there.
\n-
426 if (ch != EoF())
\n-
427 {
\n-
428 *this->pptr() = char(ch);
\n-
429 this->pbump(1);
\n-
430 }
\n-
431 return res;
\n-
432 }
\n-
433
\n-
434 virtual int_type underflow() override
\n-
435 {
\n-
436 if (this->gptr() == nullptr) return EoF();
\n-
437 char *const eb = this->eback();
\n-
438 const int_type res(static_cast<int_type>(
\n-
439 AdjustEOF(m_obj.cread(this->eback(), m_bufsize))));
\n-
440 this->setg(eb, eb, eb + ((res==EoF()) ? 0 : res));
\n-
441 return ((res == 0) or (res == EoF())) ? EoF() : *eb;
\n-
442 }
\n-
443
\n-
444private:
\n-
446 static int_type EoF() { return traits_type::eof(); }
\n-
447
\n-
449 template<typename INTYPE>
\n-
450 static std::streampos AdjustEOF(INTYPE pos)
\n-
451 { return (pos==-1) ? std::streampos(EoF()) : std::streampos(pos); }
\n-
452
\n-
453 void initialize(openmode mode)
\n-
454 {
\n-
455 if (mode & std::ios::in)
\n-
456 {
\n-
457 m_g = new char_type[unsigned(m_bufsize)];
\n-
458 this->setg(m_g, m_g, m_g);
\n-
459 }
\n-
460 if (mode & std::ios::out)
\n-
461 {
\n-
462 m_p = new char_type[unsigned(m_bufsize)];
\n-
463 this->setp(m_p, m_p + m_bufsize);
\n-
464 }
\n-
465 }
\n-
466
\n-
467 const size_type m_bufsize;
\n-
468 largeobjectaccess m_obj;
\n-
469
\n-
471 char_type *m_g, *m_p;
\n-
472};
\n-
473
\n-
474
\n-
476
\n-
484template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n-\n-
486 public std::basic_istream<CHAR, TRAITS>
\n-
487{
\n-
488 using super = std::basic_istream<CHAR, TRAITS>;
\n-
489
\n-
490public:
\n-
491 using char_type = CHAR;
\n-
492 using traits_type = TRAITS;
\n-
493 using int_type = typename traits_type::int_type;
\n-
494 using pos_type = typename traits_type::pos_type;
\n-
495 using off_type = typename traits_type::off_type;
\n-
496
\n-
498
\n-\n-
504 dbtransaction &T,
\n-
505 largeobject O,
\n-
506 largeobject::size_type BufSize=512) :
\n-
507 super{nullptr},
\n-
508 m_buf{T, O, std::ios::in, BufSize}
\n-
509 { super::init(&m_buf); }
\n-
510
\n-
512
\n-\n-
518 dbtransaction &T,
\n-
519 oid O,
\n-
520 largeobject::size_type BufSize=512) :
\n-
521 super{nullptr},
\n-
522 m_buf{T, O, std::ios::in, BufSize}
\n-
523 { super::init(&m_buf); }
\n-
524
\n-
525private:
\n-\n-
527};
\n-
528
\n-\n-
530
\n-
531
\n-
533
\n-
541template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n-\n-
543 public std::basic_ostream<CHAR, TRAITS>
\n-
544{
\n-
545 using super = std::basic_ostream<CHAR, TRAITS>;
\n-
546public:
\n-
547 using char_type = CHAR;
\n-
548 using traits_type = TRAITS;
\n-
549 using int_type = typename traits_type::int_type;
\n-
550 using pos_type = typename traits_type::pos_type;
\n-
551 using off_type = typename traits_type::off_type;
\n-
552
\n-
554
\n-\n-
560 dbtransaction &T,
\n-
561 largeobject O,
\n-
562 largeobject::size_type BufSize=512) :
\n-
563 super{nullptr},
\n-
564 m_buf{T, O, std::ios::out, BufSize}
\n-
565 { super::init(&m_buf); }
\n-
566
\n-
568
\n-\n-
574 dbtransaction &T,
\n-
575 oid O,
\n-
576 largeobject::size_type BufSize=512) :
\n-
577 super{nullptr},
\n-
578 m_buf{T, O, std::ios::out, BufSize}
\n-
579 { super::init(&m_buf); }
\n-
580
\n-\n-
582 {
\n-
583 try
\n-
584 {
\n-
585 m_buf.pubsync(); m_buf.pubsync();
\n-
586 }
\n-
587 catch (const std::exception &e)
\n-
588 {
\n-
589 m_buf.process_notice(e.what());
\n-
590 }
\n-
591 }
\n-
592
\n-
593private:
\n-\n-
595};
\n-
596
\n-\n-
598
\n-
599
\n-
601
\n-
609template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n-\n-
611 public std::basic_iostream<CHAR, TRAITS>
\n-
612{
\n-
613 using super = std::basic_iostream<CHAR, TRAITS>;
\n-
614
\n-
615public:
\n-
616 using char_type = CHAR;
\n-
617 using traits_type = TRAITS;
\n-
618 using int_type = typename traits_type::int_type;
\n-
619 using pos_type = typename traits_type::pos_type;
\n-
620 using off_type = typename traits_type::off_type;
\n-
621
\n-
623
\n-\n-
629 dbtransaction &T,
\n-
630 largeobject O,
\n-
631 largeobject::size_type BufSize=512) :
\n-
632 super{nullptr},
\n-
633 m_buf{T, O, std::ios::in | std::ios::out, BufSize}
\n-
634 { super::init(&m_buf); }
\n-
635
\n-
637
\n-\n-
643 dbtransaction &T,
\n-
644 oid O,
\n-
645 largeobject::size_type BufSize=512) :
\n-
646 super{nullptr},
\n-
647 m_buf{T, O, std::ios::in | std::ios::out, BufSize}
\n-
648 { super::init(&m_buf); }
\n-
649
\n-\n-
651 {
\n-
652 try
\n-
653 {
\n-
654 m_buf.pubsync(); m_buf.pubsync();
\n-
655 }
\n-
656 catch (const std::exception &e)
\n-
657 {
\n-
658 m_buf.process_notice(e.what());
\n-
659 }
\n-
660 }
\n-
661
\n-
662private:
\n-\n-
664};
\n-
665
\n-\n-
667
\n-
668} // namespace pqxx
\n-
669
\n-
670#include "pqxx/compiler-internal-post.hxx"
\n-
671
\n-
672#endif
\n-
STL namespace.
\n-
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
long large_object_size_type
Number of bytes in a large object. (Unusual: it's signed.)
Definition: types.hxx:33
\n-
constexpr oid oid_none
The "null" oid.
Definition: util.hxx:77
\n-
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
\n-
Identity of a large object.
Definition: largeobject.hxx:35
\n-
static PQXX_PURE internal::pq::PGconn * raw_connection(const dbtransaction &T)
Definition: largeobject.cxx:134
\n-
large_object_size_type size_type
Definition: largeobject.hxx:37
\n-
bool operator<(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:101
\n-
bool operator==(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:85
\n-
void to_file(dbtransaction &T, const std::string &File) const
Export large object's contents to a local file.
Definition: largeobject.cxx:106
\n-
bool operator>(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:105
\n-
bool operator<=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:93
\n-
largeobject() noexcept=default
Refer to a nonexistent large object (similar to what a null pointer does)
\n-
bool operator!=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:89
\n-
bool operator>=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:97
\n-
oid id() const noexcept
Object identifier.
Definition: largeobject.hxx:73
\n-
Accessor for large object's contents.
Definition: largeobject.hxx:138
\n-
size_type pos_type
Definition: largeobject.hxx:142
\n-
std::ios::openmode openmode
Open mode: in, out (can be combined with the "or" operator)
Definition: largeobject.hxx:149
\n-
std::ios::seekdir seekdir
Seek direction: beg, cur, end.
Definition: largeobject.hxx:156
\n-
void write(const std::string &Buf)
Write string to large object.
Definition: largeobject.hxx:233
\n-
long off_type
Definition: largeobject.hxx:141
\n-
~largeobjectaccess() noexcept
Definition: largeobject.hxx:201
\n-
void to_file(const std::string &File) const
Export large object's contents to a local file.
Definition: largeobject.hxx:213
\n-
Streambuf to use large objects in standard I/O streams.
Definition: largeobject.hxx:350
\n-
virtual pos_type seekoff(off_type offset, seekdir dir, openmode) override
Definition: largeobject.hxx:398
\n-
TRAITS traits_type
Definition: largeobject.hxx:354
\n-
typename traits_type::int_type int_type
Definition: largeobject.hxx:355
\n-
virtual pos_type seekpos(pos_type pos, openmode) override
Definition: largeobject.hxx:407
\n-
void process_notice(const std::string &s)
For use by large object stream classes.
Definition: largeobject.hxx:388
\n-
CHAR char_type
Definition: largeobject.hxx:353
\n-
typename traits_type::off_type off_type
Definition: largeobject.hxx:357
\n-
largeobject_streambuf(dbtransaction &T, largeobject O, openmode mode=std::ios::in|std::ios::out, size_type BufSize=512)
Definition: largeobject.hxx:361
\n-
largeobject_streambuf(dbtransaction &T, oid O, openmode mode=std::ios::in|std::ios::out, size_type BufSize=512)
Definition: largeobject.hxx:372
\n-
virtual ~largeobject_streambuf() noexcept
Definition: largeobject.hxx:383
\n-
virtual int sync() override
Definition: largeobject.hxx:391
\n-
largeobjectaccess::seekdir seekdir
Definition: largeobject.hxx:359
\n-
virtual int_type underflow() override
Definition: largeobject.hxx:434
\n-
virtual int_type overflow(int_type ch=EoF()) override
Definition: largeobject.hxx:415
\n-
largeobjectaccess::openmode openmode
Definition: largeobject.hxx:358
\n-
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:356
\n-
Input stream that gets its data from a large object.
Definition: largeobject.hxx:487
\n-
CHAR char_type
Definition: largeobject.hxx:491
\n-
basic_ilostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_ilostream.
Definition: largeobject.hxx:503
\n-
typename traits_type::int_type int_type
Definition: largeobject.hxx:493
\n-
TRAITS traits_type
Definition: largeobject.hxx:492
\n-
typename traits_type::off_type off_type
Definition: largeobject.hxx:495
\n-
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:494
\n-
basic_ilostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_ilostream.
Definition: largeobject.hxx:517
\n-
Output stream that writes data back to a large object.
Definition: largeobject.hxx:544
\n-
typename traits_type::off_type off_type
Definition: largeobject.hxx:551
\n-
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:550
\n-
typename traits_type::int_type int_type
Definition: largeobject.hxx:549
\n-
~basic_olostream()
Definition: largeobject.hxx:581
\n-
basic_olostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_olostream.
Definition: largeobject.hxx:559
\n-
CHAR char_type
Definition: largeobject.hxx:547
\n-
TRAITS traits_type
Definition: largeobject.hxx:548
\n-
basic_olostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_olostream.
Definition: largeobject.hxx:573
\n-
Stream that reads and writes a large object.
Definition: largeobject.hxx:612
\n-
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:619
\n-
~basic_lostream()
Definition: largeobject.hxx:650
\n-
basic_lostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_lostream.
Definition: largeobject.hxx:642
\n-
typename traits_type::int_type int_type
Definition: largeobject.hxx:618
\n-
basic_lostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_lostream.
Definition: largeobject.hxx:628
\n-
typename traits_type::off_type off_type
Definition: largeobject.hxx:620
\n-
TRAITS traits_type
Definition: largeobject.hxx:617
\n-
CHAR char_type
Definition: largeobject.hxx:616
\n+
1/* Automatically generated from config.h: internal/compiler config. */
\n+
2
\n+
3#define HAVE_POLL 1
\n+
4#define HAVE_SYS_TIME_H 1
\n+
5#define HAVE_SYS_TYPES_H 1
\n+
6#define HAVE_UNISTD_H 1
\n+
7#define PQXX_HAVE_GCC_VISIBILITY 1
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,691 +1,19 @@\n \n \n \n \n \n libpqxx\n \n-largeobject.hxx\n- 1\n- 13#ifndef PQXX_H_LARGEOBJECT\n- 14#define PQXX_H_LARGEOBJECT\n- 15\n- 16#include \"pqxx/compiler-public.hxx\"\n- 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18\n- 19#include \n- 20\n- 21#include \"pqxx/dbtransaction.hxx\"\n- 22\n- 23\n- 24namespace pqxx\n- 25{\n- 27\n-34class PQXX_LIBEXPORT largeobject\n- 35{\n- 36public:\n-37 using size_type = large_object_size_type;\n- 38\n-40 largeobject() noexcept =default; //[t48]\n- 41\n- 43\n- 45 explicit largeobject(dbtransaction &T); //[t48]\n- 46\n- 48\n-52 explicit largeobject(oid O) noexcept : m_id{O} {} //[t48]\n- 53\n- 55\n- 59 largeobject(dbtransaction &T, const std::string &File); //[t53]\n- 60\n- 62\n- 66 largeobject(const largeobjectaccess &O) noexcept; //[t50]\n- 67\n- 69\n-73 oid id() const noexcept { return m_id; } //[t48]\n- 74\n- 84\n-85 bool operator==(const largeobject &other) const //[t51]\n- 86 { return m_id == other.m_id; }\n- 88\n-89 bool operator!=(const largeobject &other) const //[t51]\n- 90 { return m_id != other.m_id; }\n- 92\n-93 bool operator<=(const largeobject &other) const //[t51]\n- 94 { return m_id <= other.m_id; }\n- 96\n-97 bool operator>=(const largeobject &other) const //[t51]\n- 98 { return m_id >= other.m_id; }\n- 100\n-101 bool operator<(const largeobject &other) const //[t51]\n- 102 { return m_id < other.m_id; }\n- 104\n-105 bool operator>(const largeobject &other) const //[t51]\n- 106 { return m_id > other.m_id; }\n- 108\n- 110\n- 114 void to_file(dbtransaction &T, const std::string &File) const; //[t52]\n- 115\n- 117\n- 121 void remove(dbtransaction &T) const; //[t48]\n- 122\n- 123protected:\n- 124 PQXX_PURE static internal::pq::PGconn *raw_connection(\n- 125 const dbtransaction &T);\n- 126\n- 127 PQXX_PRIVATE std::string reason(const connection_base &, int err) const;\n- 128\n- 129private:\n- 130 oid m_id = oid_none;\n- 131};\n- 132\n- 133\n- 134// TODO: New hierarchy with separate read / write / mixed-mode access\n- 135\n-137class PQXX_LIBEXPORT largeobjectaccess : private largeobject\n- 138{\n- 139public:\n- 140 using largeobject::size_type;\n-141 using off_type = long;\n-142 using pos_type = size_type;\n- 143\n- 145\n-149 using openmode = std::ios::openmode;\n- 150\n- 152\n-156 using seekdir = std::ios::seekdir;\n- 157\n- 159\n- 163 explicit largeobjectaccess( //[t51]\n- 164 dbtransaction &T,\n- 165 openmode mode=std::ios::in|std::ios::out);\n- 166\n- 168\n- 174 largeobjectaccess( //[t52]\n- 175 dbtransaction &T,\n- 176 oid O,\n- 177 openmode mode=std::ios::in|std::ios::out);\n- 178\n- 180\n- 185 largeobjectaccess( //[t50]\n- 186 dbtransaction &T,\n- 187 largeobject O,\n- 188 openmode mode=std::ios::in|std::ios::out);\n- 189\n- 191\n- 196 largeobjectaccess( //[t55]\n- 197 dbtransaction &T,\n- 198 const std::string &File,\n- 199 openmode mode=std::ios::in|std::ios::out);\n- 200\n-201 ~largeobjectaccess() noexcept { close(); }\n- 202\n- 204\n- 207 using largeobject::id;\n- 208\n- 210\n-213 void to_file(const std::string &File) const //[t54]\n- 214 { largeobject::to_file(m_trans, File); }\n- 215\n- 216 using largeobject::to_file;\n- 217\n- 223\n- 227 void write(const char Buf[], size_type Len); //[t51]\n- 228\n- 230\n-233 void write(const std::string &Buf) //[t50]\n- 234 { write(Buf.c_str(), static_cast(Buf.size())); }\n- 235\n- 237\n- 243 size_type read(char Buf[], size_type Len); //[t50]\n- 244\n- 246\n- 249 size_type seek(size_type dest, seekdir dir); //[t51]\n- 250\n- 252\n- 255 size_type tell() const; //[t50]\n- 257\n- 268\n- 276 pos_type cseek(off_type dest, seekdir dir) noexcept; //[t50]\n- 277\n- 279\n- 285 off_type cwrite(const char Buf[], size_type Len) noexcept; //[t50]\n- 286\n- 288\n- 294 off_type cread(char Buf[], size_type Len) noexcept; //[t50]\n- 295\n- 297\n- 301 pos_type ctell() const noexcept; //[t50]\n- 303\n- 309 void process_notice(const std::string &) noexcept; //[t50]\n- 311\n- 312 using largeobject::remove;\n- 313\n- 314 using largeobject::operator==;\n- 315 using largeobject::operator!=;\n- 316 using largeobject::operator<;\n- 317 using largeobject::operator<=;\n- 318 using largeobject::operator>;\n- 319 using largeobject::operator>=;\n- 320\n- 321private:\n- 322 PQXX_PRIVATE std::string reason(int err) const;\n- 323 internal::pq::PGconn *raw_connection() const\n- 324 { return largeobject::raw_connection(m_trans); }\n- 325\n- 326 PQXX_PRIVATE void open(openmode mode);\n- 327 void close() noexcept;\n- 328\n- 329 dbtransaction &m_trans;\n- 330 int m_fd = -1;\n- 331\n- 332 largeobjectaccess() =delete;\n- 333 largeobjectaccess(const largeobjectaccess &) =delete;\n- 334 largeobjectaccess operator=(const largeobjectaccess &) =delete;\n- 335};\n- 336\n- 337\n- 339\n- 347template>\n-348 class largeobject_streambuf :\n- 349 public std::basic_streambuf\n- 350{\n- 351 using size_type = long;\n- 352public:\n-353 using char_type = CHAR;\n-354 using traits_type = TRAITS;\n-355 using int_type = typename traits_type::int_type;\n-356 using pos_type = typename traits_type::pos_type;\n-357 using off_type = typename traits_type::off_type;\n-358 using openmode = largeobjectaccess::openmode;\n-359 using seekdir = largeobjectaccess::seekdir;\n- 360\n-361 largeobject_streambuf( //[t48]\n- 362 dbtransaction &T,\n- 363 largeobject O,\n- 364 openmode mode=std::ios::in|std::ios::out,\n- 365 size_type BufSize=512) :\n- 366 m_bufsize{BufSize},\n- 367 m_obj{T, O, mode},\n- 368 m_g{nullptr},\n- 369 m_p{nullptr}\n- 370 { initialize(mode); }\n- 371\n-372 largeobject_streambuf( //[t48]\n- 373 dbtransaction &T,\n- 374 oid O,\n- 375 openmode mode=std::ios::in|std::ios::out,\n- 376 size_type BufSize=512) :\n- 377 m_bufsize{BufSize},\n- 378 m_obj{T, O, mode},\n- 379 m_g{nullptr},\n- 380 m_p{nullptr}\n- 381 { initialize(mode); }\n- 382\n-383 virtual ~largeobject_streambuf() noexcept\n- 384 { delete [] m_p; delete [] m_g; }\n- 385\n- 386\n-388 void process_notice(const std::string &s) { m_obj.process_notice(s); }\n- 389\n- 390protected:\n-391 virtual int sync() override\n- 392 {\n- 393 // setg() sets eback, gptr, egptr\n- 394 this->setg(this->eback(), this->eback(), this->egptr());\n- 395 return overflow(EoF());\n- 396 }\n- 397\n-398 virtual pos_type seekoff(\n- 399 off_type offset,\n- 400 seekdir dir,\n- 401 openmode)\n- 402 override\n- 403 {\n- 404 return AdjustEOF(m_obj.cseek(largeobjectaccess::off_type(offset), dir));\n- 405 }\n- 406\n-407 virtual pos_type seekpos(pos_type pos, openmode) override\n- 408 {\n- 409 const largeobjectaccess::pos_type newpos = m_obj.cseek(\n- 410 largeobjectaccess::off_type(pos),\n- 411 std::ios::beg);\n- 412 return AdjustEOF(newpos);\n- 413 }\n- 414\n-415 virtual int_type overflow(int_type ch = EoF()) override\n- 416 {\n- 417 char *const pp = this->pptr();\n- 418 if (pp == nullptr) return EoF();\n- 419 char *const pb = this->pbase();\n- 420 int_type res = 0;\n- 421\n- 422 if (pp > pb) res = int_type(AdjustEOF(m_obj.cwrite(pb, pp-pb)));\n- 423 this->setp(m_p, m_p + m_bufsize);\n- 424\n- 425 // Write that one more character, if it's there.\n- 426 if (ch != EoF())\n- 427 {\n- 428 *this->pptr() = char(ch);\n- 429 this->pbump(1);\n- 430 }\n- 431 return res;\n- 432 }\n- 433\n-434 virtual int_type underflow() override\n- 435 {\n- 436 if (this->gptr() == nullptr) return EoF();\n- 437 char *const eb = this->eback();\n- 438 const int_type res(static_cast(\n- 439 AdjustEOF(m_obj.cread(this->eback(), m_bufsize))));\n- 440 this->setg(eb, eb, eb + ((res==EoF()) ? 0 : res));\n- 441 return ((res == 0) or (res == EoF())) ? EoF() : *eb;\n- 442 }\n- 443\n- 444private:\n- 446 static int_type EoF() { return traits_type::eof(); }\n- 447\n- 449 template\n- 450 static std::streampos AdjustEOF(INTYPE pos)\n- 451 { return (pos==-1) ? std::streampos(EoF()) : std::streampos(pos); }\n- 452\n- 453 void initialize(openmode mode)\n- 454 {\n- 455 if (mode & std::ios::in)\n- 456 {\n- 457 m_g = new char_type[unsigned(m_bufsize)];\n- 458 this->setg(m_g, m_g, m_g);\n- 459 }\n- 460 if (mode & std::ios::out)\n- 461 {\n- 462 m_p = new char_type[unsigned(m_bufsize)];\n- 463 this->setp(m_p, m_p + m_bufsize);\n- 464 }\n- 465 }\n- 466\n- 467 const size_type m_bufsize;\n- 468 largeobjectaccess m_obj;\n- 469\n- 471 char_type *m_g, *m_p;\n- 472};\n- 473\n- 474\n- 476\n- 484template>\n-485 class basic_ilostream :\n- 486 public std::basic_istream\n- 487{\n- 488 using super = std::basic_istream;\n- 489\n- 490public:\n-491 using char_type = CHAR;\n-492 using traits_type = TRAITS;\n-493 using int_type = typename traits_type::int_type;\n-494 using pos_type = typename traits_type::pos_type;\n-495 using off_type = typename traits_type::off_type;\n- 496\n- 498\n-503 basic_ilostream( //[t57]\n- 504 dbtransaction &T,\n- 505 largeobject O,\n- 506 largeobject::size_type BufSize=512) :\n- 507 super{nullptr},\n- 508 m_buf{T, O, std::ios::in, BufSize}\n- 509 { super::init(&m_buf); }\n- 510\n- 512\n-517 basic_ilostream( //[t48]\n- 518 dbtransaction &T,\n- 519 oid O,\n- 520 largeobject::size_type BufSize=512) :\n- 521 super{nullptr},\n- 522 m_buf{T, O, std::ios::in, BufSize}\n- 523 { super::init(&m_buf); }\n- 524\n- 525private:\n- 526 largeobject_streambuf m_buf;\n- 527};\n- 528\n-529using ilostream = basic_ilostream;\n- 530\n- 531\n- 533\n- 541template>\n-542 class basic_olostream :\n- 543 public std::basic_ostream\n- 544{\n- 545 using super = std::basic_ostream;\n- 546public:\n-547 using char_type = CHAR;\n-548 using traits_type = TRAITS;\n-549 using int_type = typename traits_type::int_type;\n-550 using pos_type = typename traits_type::pos_type;\n-551 using off_type = typename traits_type::off_type;\n- 552\n- 554\n-559 basic_olostream( //[t48]\n- 560 dbtransaction &T,\n- 561 largeobject O,\n- 562 largeobject::size_type BufSize=512) :\n- 563 super{nullptr},\n- 564 m_buf{T, O, std::ios::out, BufSize}\n- 565 { super::init(&m_buf); }\n- 566\n- 568\n-573 basic_olostream( //[t57]\n- 574 dbtransaction &T,\n- 575 oid O,\n- 576 largeobject::size_type BufSize=512) :\n- 577 super{nullptr},\n- 578 m_buf{T, O, std::ios::out, BufSize}\n- 579 { super::init(&m_buf); }\n- 580\n-581 ~basic_olostream()\n- 582 {\n- 583 try\n- 584 {\n- 585 m_buf.pubsync(); m_buf.pubsync();\n- 586 }\n- 587 catch (const std::exception &e)\n- 588 {\n- 589 m_buf.process_notice(e.what());\n- 590 }\n- 591 }\n- 592\n- 593private:\n- 594 largeobject_streambuf m_buf;\n- 595};\n- 596\n-597using olostream = basic_olostream;\n- 598\n- 599\n- 601\n- 609template>\n-610 class basic_lostream :\n- 611 public std::basic_iostream\n- 612{\n- 613 using super = std::basic_iostream;\n- 614\n- 615public:\n-616 using char_type = CHAR;\n-617 using traits_type = TRAITS;\n-618 using int_type = typename traits_type::int_type;\n-619 using pos_type = typename traits_type::pos_type;\n-620 using off_type = typename traits_type::off_type;\n- 621\n- 623\n-628 basic_lostream( //[t59]\n- 629 dbtransaction &T,\n- 630 largeobject O,\n- 631 largeobject::size_type BufSize=512) :\n- 632 super{nullptr},\n- 633 m_buf{T, O, std::ios::in | std::ios::out, BufSize}\n- 634 { super::init(&m_buf); }\n- 635\n- 637\n-642 basic_lostream( //[t59]\n- 643 dbtransaction &T,\n- 644 oid O,\n- 645 largeobject::size_type BufSize=512) :\n- 646 super{nullptr},\n- 647 m_buf{T, O, std::ios::in | std::ios::out, BufSize}\n- 648 { super::init(&m_buf); }\n- 649\n-650 ~basic_lostream()\n- 651 {\n- 652 try\n- 653 {\n- 654 m_buf.pubsync(); m_buf.pubsync();\n- 655 }\n- 656 catch (const std::exception &e)\n- 657 {\n- 658 m_buf.process_notice(e.what());\n- 659 }\n- 660 }\n- 661\n- 662private:\n- 663 largeobject_streambuf m_buf;\n- 664};\n- 665\n-666using lostream = basic_lostream;\n- 667\n- 668} // namespace pqxx\n- 669\n- 670#include \"pqxx/compiler-internal-post.hxx\"\n- 671\n- 672#endif\n-std\n-STL namespace.\n-pqxx\n-The home of all libpqxx classes, functions, templates, etc.\n-Definition: array.hxx:26\n-pqxx::large_object_size_type\n-long large_object_size_type\n-Number of bytes in a large object. (Unusual: it's signed.)\n-Definition: types.hxx:33\n-pqxx::oid_none\n-constexpr oid oid_none\n-The \"null\" oid.\n-Definition: util.hxx:77\n-pqxx::connection_base\n-connection_base abstract base class; represents a connection to a database.\n-Definition: connection_base.hxx:140\n-pqxx::dbtransaction\n-Abstract base class responsible for bracketing a backend transaction.\n-Definition: dbtransaction.hxx:63\n-pqxx::largeobject\n-Identity of a large object.\n-Definition: largeobject.hxx:35\n-pqxx::largeobject::raw_connection\n-static PQXX_PURE internal::pq::PGconn * raw_connection(const dbtransaction &T)\n-Definition: largeobject.cxx:134\n-pqxx::largeobject::size_type\n-large_object_size_type size_type\n-Definition: largeobject.hxx:37\n-pqxx::largeobject::operator<\n-bool operator<(const largeobject &other) const\n-Compare object identities.\n-Definition: largeobject.hxx:101\n-pqxx::largeobject::operator==\n-bool operator==(const largeobject &other) const\n-Compare object identities.\n-Definition: largeobject.hxx:85\n-pqxx::largeobject::to_file\n-void to_file(dbtransaction &T, const std::string &File) const\n-Export large object's contents to a local file.\n-Definition: largeobject.cxx:106\n-pqxx::largeobject::operator>\n-bool operator>(const largeobject &other) const\n-Compare object identities.\n-Definition: largeobject.hxx:105\n-pqxx::largeobject::operator<=\n-bool operator<=(const largeobject &other) const\n-Compare object identities.\n-Definition: largeobject.hxx:93\n-pqxx::largeobject::largeobject\n-largeobject() noexcept=default\n-Refer to a nonexistent large object (similar to what a null pointer does)\n-pqxx::largeobject::operator!=\n-bool operator!=(const largeobject &other) const\n-Compare object identities.\n-Definition: largeobject.hxx:89\n-pqxx::largeobject::operator>=\n-bool operator>=(const largeobject &other) const\n-Compare object identities.\n-Definition: largeobject.hxx:97\n-pqxx::largeobject::id\n-oid id() const noexcept\n-Object identifier.\n-Definition: largeobject.hxx:73\n-pqxx::largeobjectaccess\n-Accessor for large object's contents.\n-Definition: largeobject.hxx:138\n-pqxx::largeobjectaccess::pos_type\n-size_type pos_type\n-Definition: largeobject.hxx:142\n-pqxx::largeobjectaccess::openmode\n-std::ios::openmode openmode\n-Open mode: in, out (can be combined with the \"or\" operator)\n-Definition: largeobject.hxx:149\n-pqxx::largeobjectaccess::seekdir\n-std::ios::seekdir seekdir\n-Seek direction: beg, cur, end.\n-Definition: largeobject.hxx:156\n-pqxx::largeobjectaccess::write\n-void write(const std::string &Buf)\n-Write string to large object.\n-Definition: largeobject.hxx:233\n-pqxx::largeobjectaccess::off_type\n-long off_type\n-Definition: largeobject.hxx:141\n-pqxx::largeobjectaccess::~largeobjectaccess\n-~largeobjectaccess() noexcept\n-Definition: largeobject.hxx:201\n-pqxx::largeobjectaccess::to_file\n-void to_file(const std::string &File) const\n-Export large object's contents to a local file.\n-Definition: largeobject.hxx:213\n-pqxx::largeobject_streambuf\n-Streambuf to use large objects in standard I/O streams.\n-Definition: largeobject.hxx:350\n-pqxx::largeobject_streambuf::seekoff\n-virtual pos_type seekoff(off_type offset, seekdir dir, openmode) override\n-Definition: largeobject.hxx:398\n-pqxx::largeobject_streambuf::traits_type\n-TRAITS traits_type\n-Definition: largeobject.hxx:354\n-pqxx::largeobject_streambuf::int_type\n-typename traits_type::int_type int_type\n-Definition: largeobject.hxx:355\n-pqxx::largeobject_streambuf::seekpos\n-virtual pos_type seekpos(pos_type pos, openmode) override\n-Definition: largeobject.hxx:407\n-pqxx::largeobject_streambuf::process_notice\n-void process_notice(const std::string &s)\n-For use by large object stream classes.\n-Definition: largeobject.hxx:388\n-pqxx::largeobject_streambuf::char_type\n-CHAR char_type\n-Definition: largeobject.hxx:353\n-pqxx::largeobject_streambuf::off_type\n-typename traits_type::off_type off_type\n-Definition: largeobject.hxx:357\n-pqxx::largeobject_streambuf::largeobject_streambuf\n-largeobject_streambuf(dbtransaction &T, largeobject O, openmode mode=std::ios::\n-in|std::ios::out, size_type BufSize=512)\n-Definition: largeobject.hxx:361\n-pqxx::largeobject_streambuf::largeobject_streambuf\n-largeobject_streambuf(dbtransaction &T, oid O, openmode mode=std::ios::in|std::\n-ios::out, size_type BufSize=512)\n-Definition: largeobject.hxx:372\n-pqxx::largeobject_streambuf::~largeobject_streambuf\n-virtual ~largeobject_streambuf() noexcept\n-Definition: largeobject.hxx:383\n-pqxx::largeobject_streambuf::sync\n-virtual int sync() override\n-Definition: largeobject.hxx:391\n-pqxx::largeobject_streambuf::seekdir\n-largeobjectaccess::seekdir seekdir\n-Definition: largeobject.hxx:359\n-pqxx::largeobject_streambuf::underflow\n-virtual int_type underflow() override\n-Definition: largeobject.hxx:434\n-pqxx::largeobject_streambuf::overflow\n-virtual int_type overflow(int_type ch=EoF()) override\n-Definition: largeobject.hxx:415\n-pqxx::largeobject_streambuf::openmode\n-largeobjectaccess::openmode openmode\n-Definition: largeobject.hxx:358\n-pqxx::largeobject_streambuf::pos_type\n-typename traits_type::pos_type pos_type\n-Definition: largeobject.hxx:356\n-pqxx::basic_ilostream\n-Input stream that gets its data from a large object.\n-Definition: largeobject.hxx:487\n-pqxx::basic_ilostream::char_type\n-CHAR char_type\n-Definition: largeobject.hxx:491\n-pqxx::basic_ilostream::basic_ilostream\n-basic_ilostream(dbtransaction &T, largeobject O, largeobject::size_type\n-BufSize=512)\n-Create a basic_ilostream.\n-Definition: largeobject.hxx:503\n-pqxx::basic_ilostream::int_type\n-typename traits_type::int_type int_type\n-Definition: largeobject.hxx:493\n-pqxx::basic_ilostream::traits_type\n-TRAITS traits_type\n-Definition: largeobject.hxx:492\n-pqxx::basic_ilostream::off_type\n-typename traits_type::off_type off_type\n-Definition: largeobject.hxx:495\n-pqxx::basic_ilostream::pos_type\n-typename traits_type::pos_type pos_type\n-Definition: largeobject.hxx:494\n-pqxx::basic_ilostream::basic_ilostream\n-basic_ilostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)\n-Create a basic_ilostream.\n-Definition: largeobject.hxx:517\n-pqxx::basic_olostream\n-Output stream that writes data back to a large object.\n-Definition: largeobject.hxx:544\n-pqxx::basic_olostream::off_type\n-typename traits_type::off_type off_type\n-Definition: largeobject.hxx:551\n-pqxx::basic_olostream::pos_type\n-typename traits_type::pos_type pos_type\n-Definition: largeobject.hxx:550\n-pqxx::basic_olostream::int_type\n-typename traits_type::int_type int_type\n-Definition: largeobject.hxx:549\n-pqxx::basic_olostream::~basic_olostream\n-~basic_olostream()\n-Definition: largeobject.hxx:581\n-pqxx::basic_olostream::basic_olostream\n-basic_olostream(dbtransaction &T, largeobject O, largeobject::size_type\n-BufSize=512)\n-Create a basic_olostream.\n-Definition: largeobject.hxx:559\n-pqxx::basic_olostream::char_type\n-CHAR char_type\n-Definition: largeobject.hxx:547\n-pqxx::basic_olostream::traits_type\n-TRAITS traits_type\n-Definition: largeobject.hxx:548\n-pqxx::basic_olostream::basic_olostream\n-basic_olostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)\n-Create a basic_olostream.\n-Definition: largeobject.hxx:573\n-pqxx::basic_lostream\n-Stream that reads and writes a large object.\n-Definition: largeobject.hxx:612\n-pqxx::basic_lostream::pos_type\n-typename traits_type::pos_type pos_type\n-Definition: largeobject.hxx:619\n-pqxx::basic_lostream::~basic_lostream\n-~basic_lostream()\n-Definition: largeobject.hxx:650\n-pqxx::basic_lostream::basic_lostream\n-basic_lostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)\n-Create a basic_lostream.\n-Definition: largeobject.hxx:642\n-pqxx::basic_lostream::int_type\n-typename traits_type::int_type int_type\n-Definition: largeobject.hxx:618\n-pqxx::basic_lostream::basic_lostream\n-basic_lostream(dbtransaction &T, largeobject O, largeobject::size_type\n-BufSize=512)\n-Create a basic_lostream.\n-Definition: largeobject.hxx:628\n-pqxx::basic_lostream::off_type\n-typename traits_type::off_type off_type\n-Definition: largeobject.hxx:620\n-pqxx::basic_lostream::traits_type\n-TRAITS traits_type\n-Definition: largeobject.hxx:617\n-pqxx::basic_lostream::char_type\n-CHAR char_type\n-Definition: largeobject.hxx:616\n+config-internal-compiler.h\n+ 1/* Automatically generated from config.h: internal/compiler config. */\n+ 2\n+ 3#define HAVE_POLL 1\n+ 4#define HAVE_SYS_TIME_H 1\n+ 5#define HAVE_SYS_TYPES_H 1\n+ 6#define HAVE_UNISTD_H 1\n+ 7#define PQXX_HAVE_GCC_VISIBILITY 1\n * include\n * pqxx\n- * largeobject.hxx\n+ * config-internal-compiler.h\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00032_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00032_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: result.hxx Source File\n+libpqxx: config-public-compiler.h Source File\n \n \n \n \n \n \n \n@@ -55,224 +55,27 @@\n \n
\n
\n-
result.hxx
\n+
config-public-compiler.h
\n
\n
\n-
1
\n-
13#ifndef PQXX_H_RESULT
\n-
14#define PQXX_H_RESULT
\n-
15
\n-
16#include "pqxx/compiler-public.hxx"
\n-
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18
\n-
19#include <ios>
\n-
20#include <memory>
\n-
21#include <stdexcept>
\n-
22
\n-
23#include "pqxx/except.hxx"
\n-
24#include "pqxx/types.hxx"
\n-
25#include "pqxx/util.hxx"
\n-
26
\n-
27#include "pqxx/internal/encodings.hxx"
\n-
28
\n-
29
\n-
30// Methods tested in eg. test module test01 are marked with "//[t01]".
\n-
31
\n-
32namespace pqxx
\n-
33{
\n-
34namespace internal
\n-
35{
\n-
36PQXX_LIBEXPORT void clear_result(const pq::PGresult *);
\n-
37
\n-
38namespace gate
\n-
39{
\n-
40class result_connection;
\n-
41class result_creation;
\n-
42class result_row;
\n-
43class result_sql_cursor;
\n-
44} // namespace internal::gate
\n-
45} // namespace internal
\n-
46
\n-
47
\n-
49
\n-
69class PQXX_LIBEXPORT result
\n-
70{
\n-
71public:
\n-\n-\n-
74 using reference = row;
\n-\n-\n-\n-\n-\n-
80
\n-
81 result() noexcept : //[t03]
\n-
82 m_data(make_data_pointer()),
\n-
83 m_query(),
\n-
84 m_encoding(internal::encoding_group::MONOBYTE)
\n-
85 {}
\n-
86 result(const result &rhs) noexcept =default; //[t01]
\n-
87
\n-
88 result &operator=(const result &rhs) noexcept =default; //[t10]
\n-
89
\n-
94 bool operator==(const result &) const noexcept; //[t70]
\n-
95 bool operator!=(const result &rhs) const noexcept //[t70]
\n-
96 { return not operator==(rhs); }
\n-
98
\n-
99 const_reverse_iterator rbegin() const; //[t75]
\n-
100 const_reverse_iterator crbegin() const;
\n-
101 const_reverse_iterator rend() const; //[t75]
\n-
102 const_reverse_iterator crend() const;
\n-
103
\n-
104 const_iterator begin() const noexcept; //[t01]
\n-
105 const_iterator cbegin() const noexcept;
\n-
106 inline const_iterator end() const noexcept; //[t01]
\n-
107 inline const_iterator cend() const noexcept;
\n-
108
\n-
109 reference front() const noexcept; //[t74]
\n-
110 reference back() const noexcept; //[t75]
\n-
111
\n-
112 PQXX_PURE size_type size() const noexcept; //[t02]
\n-
113 PQXX_PURE bool empty() const noexcept; //[t11]
\n-
114 size_type capacity() const noexcept { return size(); } //[t20]
\n-
115
\n-
116 void swap(result &) noexcept; //[t77]
\n-
117
\n-
118 const row operator[](size_type i) const noexcept; //[t02]
\n-
119 const row at(size_type) const; //[t10]
\n-
120
\n-
121 void clear() noexcept { m_data.reset(); m_query = nullptr; } //[t20]
\n-
122
\n-
128 PQXX_PURE row_size_type columns() const noexcept; //[t11]
\n-
129
\n-
131 row_size_type column_number(const char ColName[]) const; //[t11]
\n-
132
\n-
134 row_size_type column_number(const std::string &Name) const //[t11]
\n-
135 {return column_number(Name.c_str());}
\n-
136
\n-
138 const char *column_name(row_size_type Number) const; //[t11]
\n-
139
\n-
141 oid column_type(row_size_type ColNum) const; //[t07]
\n-
143 oid column_type(int ColNum) const //[t07]
\n-
144 { return column_type(row_size_type(ColNum)); }
\n-
145
\n-
147 oid column_type(const std::string &ColName) const //[t07]
\n-
148 { return column_type(column_number(ColName)); }
\n-
149
\n-
151 oid column_type(const char ColName[]) const //[t07]
\n-
152 { return column_type(column_number(ColName)); }
\n-
153
\n-
155 oid column_table(row_size_type ColNum) const; //[t02]
\n-
156
\n-
158 oid column_table(int ColNum) const //[t02]
\n-
159 { return column_table(row_size_type(ColNum)); }
\n-
160
\n-
162 oid column_table(const std::string &ColName) const //[t02]
\n-
163 { return column_table(column_number(ColName)); }
\n-
164
\n-
166 row_size_type table_column(row_size_type ColNum) const; //[t93]
\n-
167
\n-
169 row_size_type table_column(int ColNum) const //[t93]
\n-
170 { return table_column(row_size_type(ColNum)); }
\n-
171
\n-
173 row_size_type table_column(const std::string &ColName) const //[t93]
\n-
174 { return table_column(column_number(ColName)); }
\n-
176
\n-
178 PQXX_PURE const std::string &query() const noexcept; //[t70]
\n-
179
\n-
181
\n-
184 PQXX_PURE oid inserted_oid() const; //[t13]
\n-
185
\n-
187
\n-
190 PQXX_PURE size_type affected_rows() const; //[t07]
\n-
191
\n-
192
\n-
193private:
\n-
194 using data_pointer = std::shared_ptr<const internal::pq::PGresult>;
\n-
195
\n-
197 data_pointer m_data;
\n-
198
\n-
200 static data_pointer make_data_pointer(
\n-
201 const internal::pq::PGresult *res=nullptr)
\n-
202 { return data_pointer{res, internal::clear_result}; }
\n-
203
\n-
205 std::shared_ptr<std::string> m_query;
\n-
206
\n-
207 internal::encoding_group m_encoding;
\n-
208
\n-
209 static const std::string s_empty_string;
\n-
210
\n-
211 friend class pqxx::field;
\n-
212 PQXX_PURE const char *GetValue(size_type Row, row_size_type Col) const;
\n-
213 PQXX_PURE bool get_is_null(size_type Row, row_size_type Col) const;
\n-
214 PQXX_PURE field_size_type get_length(
\n-
215 size_type,
\n-
216 row_size_type) const noexcept;
\n-
217
\n-
218 friend class pqxx::internal::gate::result_creation;
\n-
219 result(
\n-
220 internal::pq::PGresult *rhs,
\n-
221 const std::string &Query,
\n-
222 internal::encoding_group enc);
\n-
223
\n-
224 PQXX_PRIVATE void check_status() const;
\n-
225
\n-
226 friend class pqxx::internal::gate::result_connection;
\n-
227 friend class pqxx::internal::gate::result_row;
\n-
228 bool operator!() const noexcept { return not m_data.get(); }
\n-
229 operator bool() const noexcept { return m_data.get() != nullptr; }
\n-
230
\n-
231 [[noreturn]] PQXX_PRIVATE void ThrowSQLError(
\n-
232 const std::string &Err,
\n-
233 const std::string &Query) const;
\n-
234 PQXX_PRIVATE PQXX_PURE int errorposition() const;
\n-
235 PQXX_PRIVATE std::string StatusError() const;
\n-
236
\n-
237 friend class pqxx::internal::gate::result_sql_cursor;
\n-
238 PQXX_PURE const char *cmd_status() const noexcept;
\n-
239};
\n-
240} // namespace pqxx
\n-
241#include "pqxx/compiler-internal-post.hxx"
\n-
242#endif
\n-
STL namespace.
\n-
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
\n-
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
\n-
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
\n-
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
\n-
void clear_result(const pq::PGresult *)
C++ wrapper for libpq's PQclear.
Definition: result.cxx:30
\n-
Reference to a field in a result set.
Definition: field.hxx:50
\n-
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n-
oid column_type(const char ColName[]) const
Type of given column.
Definition: result.hxx:151
\n-
row_size_type table_column(int ColNum) const
What column in its table did this column come from?
Definition: result.hxx:169
\n-
result() noexcept
Definition: result.hxx:81
\n-
oid column_type(const std::string &ColName) const
Type of given column.
Definition: result.hxx:147
\n-
result_size_type size_type
Definition: result.hxx:72
\n-
oid column_type(int ColNum) const
Type of given column.
Definition: result.hxx:143
\n-
void clear() noexcept
Definition: result.hxx:121
\n-
oid column_table(int ColNum) const
What table did this column come from?
Definition: result.hxx:158
\n-
result & operator=(const result &rhs) noexcept=default
\n-
oid column_table(const std::string &ColName) const
What table did this column come from?
Definition: result.hxx:162
\n-
result_difference_type difference_type
Definition: result.hxx:73
\n-
result(const result &rhs) noexcept=default
\n-
row_size_type table_column(const std::string &ColName) const
What column in its table did this column come from?
Definition: result.hxx:173
\n-
bool operator!=(const result &rhs) const noexcept
Definition: result.hxx:95
\n-
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
\n-
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:122
\n-
Reference to one row in a result.
Definition: row.hxx:41
\n+
1/* Automatically generated from config.h: public/compiler config. */
\n+
2
\n+
3#define PQXX_HAVE_DEPRECATED 1
\n+
4#define PQXX_HAVE_GCC_CONST 1
\n+
5#define PQXX_HAVE_GCC_DEPRECATED 1
\n+
6#define PQXX_HAVE_GCC_PURE 1
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,276 +1,18 @@\n \n \n \n \n \n libpqxx\n \n-result.hxx\n- 1\n- 13#ifndef PQXX_H_RESULT\n- 14#define PQXX_H_RESULT\n- 15\n- 16#include \"pqxx/compiler-public.hxx\"\n- 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18\n- 19#include \n- 20#include \n- 21#include \n- 22\n- 23#include \"pqxx/except.hxx\"\n- 24#include \"pqxx/types.hxx\"\n- 25#include \"pqxx/util.hxx\"\n- 26\n- 27#include \"pqxx/internal/encodings.hxx\"\n- 28\n- 29\n- 30// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n- 31\n- 32namespace pqxx\n- 33{\n- 34namespace internal\n- 35{\n- 36PQXX_LIBEXPORT void clear_result(const pq::PGresult *);\n- 37\n- 38namespace gate\n- 39{\n- 40class result_connection;\n- 41class result_creation;\n- 42class result_row;\n- 43class result_sql_cursor;\n- 44} // namespace internal::gate\n- 45} // namespace internal\n- 46\n- 47\n- 49\n-69class PQXX_LIBEXPORT result\n- 70{\n- 71public:\n-72 using size_type = result_size_type;\n-73 using difference_type = result_difference_type;\n-74 using reference = row;\n-75 using const_iterator = const_result_iterator;\n-76 using pointer = const_iterator;\n-77 using iterator = const_iterator;\n-78 using const_reverse_iterator = const_reverse_result_iterator;\n-79 using reverse_iterator = const_reverse_iterator;\n- 80\n-81 result() noexcept : //[t03]\n- 82 m_data(make_data_pointer()),\n- 83 m_query(),\n- 84 m_encoding(internal::encoding_group::MONOBYTE)\n- 85 {}\n-86 result(const result &rhs) noexcept =default; //[t01]\n- 87\n-88 result &operator=(const result &rhs) noexcept =default; //[t10]\n- 89\n- 94 bool operator==(const result &) const noexcept; //[t70]\n-95 bool operator!=(const result &rhs) const noexcept //[t70]\n- 96 { return not operator==(rhs); }\n- 98\n- 99 const_reverse_iterator rbegin() const; //[t75]\n- 100 const_reverse_iterator crbegin() const;\n- 101 const_reverse_iterator rend() const; //[t75]\n- 102 const_reverse_iterator crend() const;\n- 103\n- 104 const_iterator begin() const noexcept; //[t01]\n- 105 const_iterator cbegin() const noexcept;\n- 106 inline const_iterator end() const noexcept; //[t01]\n- 107 inline const_iterator cend() const noexcept;\n- 108\n- 109 reference front() const noexcept; //[t74]\n- 110 reference back() const noexcept; //[t75]\n- 111\n- 112 PQXX_PURE size_type size() const noexcept; //[t02]\n- 113 PQXX_PURE bool empty() const noexcept; //[t11]\n-114 size_type capacity() const noexcept { return size(); } //[t20]\n- 115\n- 116 void swap(result &) noexcept; //[t77]\n- 117\n- 118 const row operator[](size_type i) const noexcept; //[t02]\n- 119 const row at(size_type) const; //[t10]\n- 120\n-121 void clear() noexcept { m_data.reset(); m_query = nullptr; } //[t20]\n- 122\n- 128 PQXX_PURE row_size_type columns() const noexcept; //[t11]\n- 129\n- 131 row_size_type column_number(const char ColName[]) const; //[t11]\n- 132\n-134 row_size_type column_number(const std::string &Name) const //[t11]\n- 135 {return column_number(Name.c_str());}\n- 136\n- 138 const char *column_name(row_size_type Number) const; //[t11]\n- 139\n- 141 oid column_type(row_size_type ColNum) const; //[t07]\n-143 oid column_type(int ColNum) const //[t07]\n- 144 { return column_type(row_size_type(ColNum)); }\n- 145\n-147 oid column_type(const std::string &ColName) const //[t07]\n- 148 { return column_type(column_number(ColName)); }\n- 149\n-151 oid column_type(const char ColName[]) const //[t07]\n- 152 { return column_type(column_number(ColName)); }\n- 153\n- 155 oid column_table(row_size_type ColNum) const; //[t02]\n- 156\n-158 oid column_table(int ColNum) const //[t02]\n- 159 { return column_table(row_size_type(ColNum)); }\n- 160\n-162 oid column_table(const std::string &ColName) const //[t02]\n- 163 { return column_table(column_number(ColName)); }\n- 164\n- 166 row_size_type table_column(row_size_type ColNum) const; //[t93]\n- 167\n-169 row_size_type table_column(int ColNum) const //[t93]\n- 170 { return table_column(row_size_type(ColNum)); }\n- 171\n-173 row_size_type table_column(const std::string &ColName) const //[t93]\n- 174 { return table_column(column_number(ColName)); }\n- 176\n- 178 PQXX_PURE const std::string &query() const noexcept; //[t70]\n- 179\n- 181\n- 184 PQXX_PURE oid inserted_oid() const; //[t13]\n- 185\n- 187\n- 190 PQXX_PURE size_type affected_rows() const; //[t07]\n- 191\n- 192\n- 193private:\n- 194 using data_pointer = std::shared_ptr;\n- 195\n- 197 data_pointer m_data;\n- 198\n- 200 static data_pointer make_data_pointer(\n- 201 const internal::pq::PGresult *res=nullptr)\n- 202 { return data_pointer{res, internal::clear_result}; }\n- 203\n- 205 std::shared_ptr m_query;\n- 206\n- 207 internal::encoding_group m_encoding;\n- 208\n- 209 static const std::string s_empty_string;\n- 210\n-211 friend class pqxx::field;\n- 212 PQXX_PURE const char *GetValue(size_type Row, row_size_type Col) const;\n- 213 PQXX_PURE bool get_is_null(size_type Row, row_size_type Col) const;\n- 214 PQXX_PURE field_size_type get_length(\n- 215 size_type,\n- 216 row_size_type) const noexcept;\n- 217\n-218 friend class pqxx::internal::gate::result_creation;\n- 219 result(\n- 220 internal::pq::PGresult *rhs,\n- 221 const std::string &Query,\n- 222 internal::encoding_group enc);\n- 223\n- 224 PQXX_PRIVATE void check_status() const;\n- 225\n-226 friend class pqxx::internal::gate::result_connection;\n-227 friend class pqxx::internal::gate::result_row;\n- 228 bool operator!() const noexcept { return not m_data.get(); }\n- 229 operator bool() const noexcept { return m_data.get() != nullptr; }\n- 230\n- 231 [[noreturn]] PQXX_PRIVATE void ThrowSQLError(\n- 232 const std::string &Err,\n- 233 const std::string &Query) const;\n- 234 PQXX_PRIVATE PQXX_PURE int errorposition() const;\n- 235 PQXX_PRIVATE std::string StatusError() const;\n- 236\n-237 friend class pqxx::internal::gate::result_sql_cursor;\n- 238 PQXX_PURE const char *cmd_status() const noexcept;\n- 239};\n- 240} // namespace pqxx\n- 241#include \"pqxx/compiler-internal-post.hxx\"\n- 242#endif\n-std\n-STL namespace.\n-pqxx\n-The home of all libpqxx classes, functions, templates, etc.\n-Definition: array.hxx:26\n-pqxx::result_difference_type\n-signed long result_difference_type\n-Difference between result sizes.\n-Definition: types.hxx:21\n-pqxx::field_size_type\n-std::size_t field_size_type\n-Number of bytes in a field of database data.\n-Definition: types.hxx:30\n-pqxx::result_size_type\n-unsigned long result_size_type\n-Number of rows in a result set.\n-Definition: types.hxx:18\n-pqxx::row_size_type\n-unsigned int row_size_type\n-Number of fields in a row of database data.\n-Definition: types.hxx:24\n-pqxx::internal::clear_result\n-void clear_result(const pq::PGresult *)\n-C++ wrapper for libpq's PQclear.\n-Definition: result.cxx:30\n-pqxx::field\n-Reference to a field in a result set.\n-Definition: field.hxx:50\n-pqxx::result\n-Result set containing data returned by a query or command.\n-Definition: result.hxx:70\n-pqxx::result::column_type\n-oid column_type(const char ColName[]) const\n-Type of given column.\n-Definition: result.hxx:151\n-pqxx::result::table_column\n-row_size_type table_column(int ColNum) const\n-What column in its table did this column come from?\n-Definition: result.hxx:169\n-pqxx::result::result\n-result() noexcept\n-Definition: result.hxx:81\n-pqxx::result::column_type\n-oid column_type(const std::string &ColName) const\n-Type of given column.\n-Definition: result.hxx:147\n-pqxx::result::size_type\n-result_size_type size_type\n-Definition: result.hxx:72\n-pqxx::result::column_type\n-oid column_type(int ColNum) const\n-Type of given column.\n-Definition: result.hxx:143\n-pqxx::result::clear\n-void clear() noexcept\n-Definition: result.hxx:121\n-pqxx::result::column_table\n-oid column_table(int ColNum) const\n-What table did this column come from?\n-Definition: result.hxx:158\n-pqxx::result::operator=\n-result & operator=(const result &rhs) noexcept=default\n-pqxx::result::column_table\n-oid column_table(const std::string &ColName) const\n-What table did this column come from?\n-Definition: result.hxx:162\n-pqxx::result::difference_type\n-result_difference_type difference_type\n-Definition: result.hxx:73\n-pqxx::result::result\n-result(const result &rhs) noexcept=default\n-pqxx::result::table_column\n-row_size_type table_column(const std::string &ColName) const\n-What column in its table did this column come from?\n-Definition: result.hxx:173\n-pqxx::result::operator!=\n-bool operator!=(const result &rhs) const noexcept\n-Definition: result.hxx:95\n-pqxx::const_result_iterator\n-Iterator for rows in a result. Use as result::const_iterator.\n-Definition: result_iterator.hxx:36\n-pqxx::const_reverse_result_iterator\n-Reverse iterator for result. Use as result::const_reverse_iterator.\n-Definition: result_iterator.hxx:122\n-pqxx::row\n-Reference to one row in a result.\n-Definition: row.hxx:41\n+config-public-compiler.h\n+ 1/* Automatically generated from config.h: public/compiler config. */\n+ 2\n+ 3#define PQXX_HAVE_DEPRECATED 1\n+ 4#define PQXX_HAVE_GCC_CONST 1\n+ 5#define PQXX_HAVE_GCC_DEPRECATED 1\n+ 6#define PQXX_HAVE_GCC_PURE 1\n * include\n * pqxx\n- * result.hxx\n+ * config-public-compiler.h\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00035_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00035_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: compiler-internal-post.hxx Source File\n+libpqxx: pipeline.hxx Source File\n \n \n \n \n \n \n \n@@ -55,32 +55,162 @@\n \n
\n
\n-
compiler-internal-post.hxx
\n+
pipeline.hxx
\n
\n
\n
1
\n-
12// NO GUARDS HERE! This code should be executed every time!
\n-
13
\n-
14#ifdef _WIN32
\n+
13#ifndef PQXX_H_PIPELINE
\n+
14#define PQXX_H_PIPELINE
\n
15
\n-
16#ifdef _MSC_VER
\n-
17#pragma warning (pop) // Restore client program's warning state
\n-
18#endif
\n-
19
\n-
20#endif
\n-
21
\n+
16#include "pqxx/compiler-public.hxx"
\n+
17#include "pqxx/compiler-internal-pre.hxx"
\n+
18
\n+
19#include <limits>
\n+
20#include <map>
\n+
21#include <string>
\n+
22
\n+
23#include "pqxx/transaction_base.hxx"
\n+
24
\n+
25
\n+
26// Methods tested in eg. test module test01 are marked with "//[t01]".
\n+
27
\n+
28namespace pqxx
\n+
29{
\n+
30
\n+
32
\n+
48class PQXX_LIBEXPORT pipeline : public internal::transactionfocus
\n+
49{
\n+
50public:
\n+
51 using query_id = long;
\n+
52
\n+
53 pipeline(const pipeline &) =delete;
\n+
54 pipeline &operator=(const pipeline &) =delete;
\n+
55
\n+
56 explicit pipeline( //[t69]
\n+\n+
58 const std::string &Name=std::string{});
\n+
59
\n+
60 ~pipeline() noexcept;
\n+
61
\n+
63
\n+
69 query_id insert(const std::string &); //[t69]
\n+
70
\n+
72
\n+
73 void complete(); //[t71]
\n+
74
\n+
76
\n+
85 void flush(); //[t70]
\n+
86
\n+
88
\n+
96 void cancel();
\n+
97
\n+
99 bool is_finished(query_id) const; //[t71]
\n+
100
\n+
102
\n+
108 result retrieve(query_id qid) //[t71]
\n+
109 { return retrieve(m_queries.find(qid)).second; }
\n+
110
\n+
112
\n+
113 std::pair<query_id, result> retrieve(); //[t69]
\n+
114
\n+
115 bool empty() const noexcept { return m_queries.empty(); } //[t69]
\n+
116
\n+
118
\n+
129 int retain(int retain_max=2); //[t70]
\n+
130
\n+
131
\n+
133 void resume(); //[t70]
\n+
134
\n+
135private:
\n+
136 class PQXX_PRIVATE Query
\n+
137 {
\n+
138 public:
\n+
139 explicit Query(const std::string &q) : m_query{q}, m_res{} {}
\n+
140
\n+
141 const result &get_result() const noexcept { return m_res; }
\n+
142 void set_result(const result &r) noexcept { m_res = r; }
\n+
143 const std::string &get_query() const noexcept { return m_query; }
\n+
144
\n+
145 private:
\n+
146 std::string m_query;
\n+
147 result m_res;
\n+
148 };
\n+
149
\n+
150 using QueryMap = std::map<query_id,Query>;
\n+
151
\n+
152 void attach();
\n+
153 void detach();
\n+
154
\n+
156 static constexpr query_id qid_limit() noexcept
\n+
157 {
\n+
158 // Parenthesise this to work around an eternal Visual C++ problem:
\n+
159 // Without the extra parentheses, unless NOMINMAX is defined, the
\n+
160 // preprocessor will mistake this "max" for its annoying built-in macro
\n+
161 // of the same name.
\n+
162 return (std::numeric_limits<query_id>::max)();
\n+
163 }
\n+
164
\n+
166 PQXX_PRIVATE query_id generate_id();
\n+
167
\n+
168 bool have_pending() const noexcept
\n+
169 { return m_issuedrange.second != m_issuedrange.first; }
\n+
170
\n+
171 PQXX_PRIVATE void issue();
\n+
172
\n+
174 void set_error_at(query_id qid) noexcept
\n+
175 { if (qid < m_error) m_error = qid; }
\n+
176
\n+
178 [[noreturn]] PQXX_PRIVATE void internal_error(const std::string &err);
\n+
179
\n+
180 PQXX_PRIVATE bool obtain_result(bool expect_none=false);
\n+
181
\n+
182 PQXX_PRIVATE void obtain_dummy();
\n+
183 PQXX_PRIVATE void get_further_available_results();
\n+
184 PQXX_PRIVATE void check_end_results();
\n+
185
\n+
187 PQXX_PRIVATE void receive_if_available();
\n+
188
\n+
190 PQXX_PRIVATE void receive(pipeline::QueryMap::const_iterator stop);
\n+
191 std::pair<pipeline::query_id, result>
\n+
192 retrieve(pipeline::QueryMap::iterator);
\n+
193
\n+
194 QueryMap m_queries;
\n+
195 std::pair<QueryMap::iterator,QueryMap::iterator> m_issuedrange;
\n+
196 int m_retain = 0;
\n+
197 int m_num_waiting = 0;
\n+
198 query_id m_q_id = 0;
\n+
199
\n+
201 bool m_dummy_pending = false;
\n+
202
\n+
204 query_id m_error = qid_limit();
\n+
205};
\n+
206
\n+
207} // namespace
\n+
208
\n+
209#include "pqxx/compiler-internal-post.hxx"
\n+
210#endif
\n+
STL namespace.
\n+
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n+
Processes several queries in FIFO manner, optimized for high throughput.
Definition: pipeline.hxx:49
\n+
pipeline & operator=(const pipeline &)=delete
\n+
bool empty() const noexcept
Definition: pipeline.hxx:115
\n+
pipeline(const pipeline &)=delete
\n+
long query_id
Definition: pipeline.hxx:51
\n+
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n+
Definition: transaction_base.hxx:44
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,23 +1,169 @@\n \n \n \n \n \n libpqxx\n \n-compiler-internal-post.hxx\n+pipeline.hxx\n 1\n- 12// NO GUARDS HERE! This code should be executed every time!\n- 13\n- 14#ifdef _WIN32\n+ 13#ifndef PQXX_H_PIPELINE\n+ 14#define PQXX_H_PIPELINE\n 15\n- 16#ifdef _MSC_VER\n- 17#pragma warning (pop) // Restore client program's warning state\n- 18#endif\n- 19\n- 20#endif\n- 21\n+ 16#include \"pqxx/compiler-public.hxx\"\n+ 17#include \"pqxx/compiler-internal-pre.hxx\"\n+ 18\n+ 19#include \n+ 20#include \n+ 21#include \n+ 22\n+ 23#include \"pqxx/transaction_base.hxx\"\n+ 24\n+ 25\n+ 26// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n+ 27\n+ 28namespace pqxx\n+ 29{\n+ 30\n+ 32\n+48class PQXX_LIBEXPORT pipeline : public internal::transactionfocus\n+ 49{\n+ 50public:\n+51 using query_id = long;\n+ 52\n+53 pipeline(const pipeline &) =delete;\n+54 pipeline &operator=(const pipeline &) =delete;\n+ 55\n+ 56 explicit pipeline( //[t69]\n+ 57 transaction_base &,\n+ 58 const std::string &Name=std::string{});\n+ 59\n+ 60 ~pipeline() noexcept;\n+ 61\n+ 63\n+ 69 query_id insert(const std::string &); //[t69]\n+ 70\n+ 72\n+ 73 void complete(); //[t71]\n+ 74\n+ 76\n+ 85 void flush(); //[t70]\n+ 86\n+ 88\n+ 96 void cancel();\n+ 97\n+ 99 bool is_finished(query_id) const; //[t71]\n+ 100\n+ 102\n+108 result retrieve(query_id qid) //[t71]\n+ 109 { return retrieve(m_queries.find(qid)).second; }\n+ 110\n+ 112\n+ 113 std::pair retrieve(); //[t69]\n+ 114\n+115 bool empty() const noexcept { return m_queries.empty(); } //[t69]\n+ 116\n+ 118\n+ 129 int retain(int retain_max=2); //[t70]\n+ 130\n+ 131\n+ 133 void resume(); //[t70]\n+ 134\n+ 135private:\n+ 136 class PQXX_PRIVATE Query\n+ 137 {\n+ 138 public:\n+ 139 explicit Query(const std::string &q) : m_query{q}, m_res{} {}\n+ 140\n+ 141 const result &get_result() const noexcept { return m_res; }\n+ 142 void set_result(const result &r) noexcept { m_res = r; }\n+ 143 const std::string &get_query() const noexcept { return m_query; }\n+ 144\n+ 145 private:\n+ 146 std::string m_query;\n+ 147 result m_res;\n+ 148 };\n+ 149\n+ 150 using QueryMap = std::map;\n+ 151\n+ 152 void attach();\n+ 153 void detach();\n+ 154\n+ 156 static constexpr query_id qid_limit() noexcept\n+ 157 {\n+ 158 // Parenthesise this to work around an eternal Visual C++ problem:\n+ 159 // Without the extra parentheses, unless NOMINMAX is defined, the\n+ 160 // preprocessor will mistake this \"max\" for its annoying built-in macro\n+ 161 // of the same name.\n+ 162 return (std::numeric_limits::max)();\n+ 163 }\n+ 164\n+ 166 PQXX_PRIVATE query_id generate_id();\n+ 167\n+ 168 bool have_pending() const noexcept\n+ 169 { return m_issuedrange.second != m_issuedrange.first; }\n+ 170\n+ 171 PQXX_PRIVATE void issue();\n+ 172\n+ 174 void set_error_at(query_id qid) noexcept\n+ 175 { if (qid < m_error) m_error = qid; }\n+ 176\n+ 178 [[noreturn]] PQXX_PRIVATE void internal_error(const std::string &err);\n+ 179\n+ 180 PQXX_PRIVATE bool obtain_result(bool expect_none=false);\n+ 181\n+ 182 PQXX_PRIVATE void obtain_dummy();\n+ 183 PQXX_PRIVATE void get_further_available_results();\n+ 184 PQXX_PRIVATE void check_end_results();\n+ 185\n+ 187 PQXX_PRIVATE void receive_if_available();\n+ 188\n+ 190 PQXX_PRIVATE void receive(pipeline::QueryMap::const_iterator stop);\n+ 191 std::pair\n+ 192 retrieve(pipeline::QueryMap::iterator);\n+ 193\n+ 194 QueryMap m_queries;\n+ 195 std::pair m_issuedrange;\n+ 196 int m_retain = 0;\n+ 197 int m_num_waiting = 0;\n+ 198 query_id m_q_id = 0;\n+ 199\n+ 201 bool m_dummy_pending = false;\n+ 202\n+ 204 query_id m_error = qid_limit();\n+ 205};\n+ 206\n+ 207} // namespace\n+ 208\n+ 209#include \"pqxx/compiler-internal-post.hxx\"\n+ 210#endif\n+std\n+STL namespace.\n+pqxx\n+The home of all libpqxx classes, functions, templates, etc.\n+Definition: array.hxx:26\n+pqxx::pipeline\n+Processes several queries in FIFO manner, optimized for high throughput.\n+Definition: pipeline.hxx:49\n+pqxx::pipeline::operator=\n+pipeline & operator=(const pipeline &)=delete\n+pqxx::pipeline::empty\n+bool empty() const noexcept\n+Definition: pipeline.hxx:115\n+pqxx::pipeline::pipeline\n+pipeline(const pipeline &)=delete\n+pqxx::pipeline::query_id\n+long query_id\n+Definition: pipeline.hxx:51\n+pqxx::result\n+Result set containing data returned by a query or command.\n+Definition: result.hxx:70\n+pqxx::internal::transactionfocus\n+Definition: transaction_base.hxx:44\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * compiler-internal-post.hxx\n+ * pipeline.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00038_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00038_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: tablestream.hxx Source File\n+libpqxx: errorhandler.hxx Source File\n \n \n \n \n \n \n \n@@ -55,76 +55,83 @@\n \n
\n
\n-
tablestream.hxx
\n+
errorhandler.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_TABLESTREAM
\n-
14#define PQXX_H_TABLESTREAM
\n+
13#ifndef PQXX_H_ERRORHANDLER
\n+
14#define PQXX_H_ERRORHANDLER
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18#include "pqxx/transaction_base.hxx"
\n-
19
\n+
18
\n+
19#include "pqxx/types.hxx"
\n
20
\n-
21namespace pqxx
\n-
22{
\n-
24
\n-
26class PQXX_LIBEXPORT PQXX_NOVTABLE tablestream :
\n-\n-
28{
\n-
29public:
\n-
30 explicit tablestream(
\n-
31 transaction_base &Trans,
\n-
32 const std::string &Null=std::string{});
\n-
33 virtual ~tablestream() noexcept =0;
\n-
34 virtual void complete() =0;
\n-
35protected:
\n-
36 const std::string &NullStr() const { return m_null; }
\n-
37 bool is_finished() const noexcept { return m_finished; }
\n-
38 void base_close();
\n-
39 template<typename ITER>
\n-
40 static std::string columnlist(ITER colbegin, ITER colend);
\n-
41private:
\n-
42 std::string m_null;
\n-
43 bool m_finished = false;
\n-
44
\n-
45 tablestream() =delete;
\n-
46 tablestream(const tablestream &) =delete;
\n-
47 tablestream &operator=(const tablestream &) =delete;
\n-
48};
\n-
49
\n-
50
\n-
51template<typename ITER> inline
\n-
52std::string tablestream::columnlist(ITER colbegin, ITER colend)
\n-
53{
\n-
54 return separated_list(",", colbegin, colend);
\n-
55}
\n-
56} // namespace pqxx
\n-
57
\n-
58#include "pqxx/compiler-internal-post.hxx"
\n-
59#endif
\n+
21
\n+
22namespace pqxx
\n+
23{
\n+
24namespace internal
\n+
25{
\n+
26namespace gate
\n+
27{
\n+
28class errorhandler_connection_base;
\n+
29}
\n+
30}
\n+
31
\n+
38
\n+
54class PQXX_LIBEXPORT errorhandler
\n+
55{
\n+
56public:
\n+
57 explicit errorhandler(connection_base &);
\n+
58 virtual ~errorhandler();
\n+
59
\n+
61
\n+
65 virtual bool operator()(const char msg[]) noexcept =0;
\n+
66
\n+
67private:
\n+
68 connection_base *m_home;
\n+
69
\n+
70 friend class internal::gate::errorhandler_connection_base;
\n+
71 void unregister() noexcept;
\n+
72
\n+
73 errorhandler() =delete;
\n+
74 errorhandler(const errorhandler &) =delete;
\n+
75 errorhandler &operator=(const errorhandler &) =delete;
\n+
76};
\n+
77
\n+
78
\n+\n+
81{
\n+
82public:
\n+\n+
84
\n+
85 virtual bool operator()(const char[]) noexcept override { return false; }
\n+
86};
\n+
87
\n+
92} // namespace pqxx
\n+
93
\n+
94#include "pqxx/compiler-internal-post.hxx"
\n+
95
\n+
96#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: util.hxx:95
\n-
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
\n-
virtual void complete()=0
\n-
const std::string & NullStr() const
Definition: tablestream.hxx:36
\n-
bool is_finished() const noexcept
Definition: tablestream.hxx:37
\n-
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
\n-
Definition: transaction_base.hxx:44
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n+
Base class for error-handler callbacks.
Definition: errorhandler.hxx:55
\n+
virtual bool operator()(const char msg[]) noexcept=0
Define in subclass: receive an error or warning message from the database.
\n+
An error handler that suppresses any previously registered error handlers.
Definition: errorhandler.hxx:81
\n+
virtual bool operator()(const char[]) noexcept override
Define in subclass: receive an error or warning message from the database.
Definition: errorhandler.hxx:85
\n+
quiet_errorhandler(connection_base &conn)
Definition: errorhandler.hxx:83
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,85 +1,89 @@\n \n \n \n \n \n libpqxx\n \n-tablestream.hxx\n+errorhandler.hxx\n 1\n- 13#ifndef PQXX_H_TABLESTREAM\n- 14#define PQXX_H_TABLESTREAM\n+ 13#ifndef PQXX_H_ERRORHANDLER\n+ 14#define PQXX_H_ERRORHANDLER\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18#include \"pqxx/transaction_base.hxx\"\n- 19\n+ 18\n+ 19#include \"pqxx/types.hxx\"\n 20\n- 21namespace pqxx\n- 22{\n- 24\n-26class PQXX_LIBEXPORT PQXX_NOVTABLE tablestream :\n- 27 public internal::transactionfocus\n- 28{\n- 29public:\n- 30 explicit tablestream(\n- 31 transaction_base &Trans,\n- 32 const std::string &Null=std::string{});\n- 33 virtual ~tablestream() noexcept =0;\n-34 virtual void complete() =0;\n- 35protected:\n-36 const std::string &NullStr() const { return m_null; }\n-37 bool is_finished() const noexcept { return m_finished; }\n- 38 void base_close();\n- 39 template\n- 40 static std::string columnlist(ITER colbegin, ITER colend);\n- 41private:\n- 42 std::string m_null;\n- 43 bool m_finished = false;\n- 44\n- 45 tablestream() =delete;\n- 46 tablestream(const tablestream &) =delete;\n- 47 tablestream &operator=(const tablestream &) =delete;\n- 48};\n- 49\n- 50\n- 51template inline\n-52std::string tablestream::columnlist(ITER colbegin, ITER colend)\n- 53{\n- 54 return separated_list(\",\", colbegin, colend);\n- 55}\n- 56} // namespace pqxx\n- 57\n- 58#include \"pqxx/compiler-internal-post.hxx\"\n- 59#endif\n+ 21\n+ 22namespace pqxx\n+ 23{\n+ 24namespace internal\n+ 25{\n+ 26namespace gate\n+ 27{\n+ 28class errorhandler_connection_base;\n+ 29}\n+ 30}\n+ 31\n+ 38\n+54class PQXX_LIBEXPORT errorhandler\n+ 55{\n+ 56public:\n+ 57 explicit errorhandler(connection_base &);\n+ 58 virtual ~errorhandler();\n+ 59\n+ 61\n+65 virtual bool operator()(const char msg[]) noexcept =0;\n+ 66\n+ 67private:\n+ 68 connection_base *m_home;\n+ 69\n+70 friend class internal::gate::errorhandler_connection_base;\n+ 71 void unregister() noexcept;\n+ 72\n+ 73 errorhandler() =delete;\n+ 74 errorhandler(const errorhandler &) =delete;\n+ 75 errorhandler &operator=(const errorhandler &) =delete;\n+ 76};\n+ 77\n+ 78\n+80class quiet_errorhandler : public errorhandler\n+ 81{\n+ 82public:\n+83 quiet_errorhandler(connection_base &conn) : errorhandler{conn} {}\n+ 84\n+85 virtual bool operator()(const char[]) noexcept override { return false; }\n+ 86};\n+ 87\n+ 92} // namespace pqxx\n+ 93\n+ 94#include \"pqxx/compiler-internal-post.hxx\"\n+ 95\n+ 96#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::separated_list\n-std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS\n-access)\n-Represent sequence of values as a string, joined by a given separator.\n-Definition: util.hxx:95\n-pqxx::tablestream\n-Base class for obsolete tablereader/tablewriter classes.\n-Definition: tablestream.hxx:28\n-pqxx::tablestream::complete\n-virtual void complete()=0\n-pqxx::tablestream::NullStr\n-const std::string & NullStr() const\n-Definition: tablestream.hxx:36\n-pqxx::tablestream::is_finished\n-bool is_finished() const noexcept\n-Definition: tablestream.hxx:37\n-pqxx::tablestream::columnlist\n-static std::string columnlist(ITER colbegin, ITER colend)\n-Definition: tablestream.hxx:52\n-pqxx::internal::transactionfocus\n-Definition: transaction_base.hxx:44\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n+pqxx::connection_base\n+connection_base abstract base class; represents a connection to a database.\n+Definition: connection_base.hxx:140\n+pqxx::errorhandler\n+Base class for error-handler callbacks.\n+Definition: errorhandler.hxx:55\n+pqxx::errorhandler::operator()\n+virtual bool operator()(const char msg[]) noexcept=0\n+Define in subclass: receive an error or warning message from the database.\n+pqxx::quiet_errorhandler\n+An error handler that suppresses any previously registered error handlers.\n+Definition: errorhandler.hxx:81\n+pqxx::quiet_errorhandler::operator()\n+virtual bool operator()(const char[]) noexcept override\n+Define in subclass: receive an error or warning message from the database.\n+Definition: errorhandler.hxx:85\n+pqxx::quiet_errorhandler::quiet_errorhandler\n+quiet_errorhandler(connection_base &conn)\n+Definition: errorhandler.hxx:83\n * include\n * pqxx\n- * tablestream.hxx\n+ * errorhandler.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00041_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00041_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: nontransaction.hxx Source File\n+libpqxx: compiler-internal-pre.hxx Source File\n \n \n \n \n \n \n \n@@ -55,65 +55,43 @@\n \n
\n
\n-
nontransaction.hxx
\n+
compiler-internal-pre.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_NONTRANSACTION
\n-
14#define PQXX_H_NONTRANSACTION
\n-
15
\n-
16#include "pqxx/compiler-public.hxx"
\n-
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18
\n-
19#include "pqxx/connection_base.hxx"
\n-
20#include "pqxx/result.hxx"
\n-
21#include "pqxx/transaction_base.hxx"
\n-
22
\n-
23// Methods tested in eg. test module test01 are marked with "//[t01]".
\n+
15// NO GUARDS HERE! This code should be executed every time!
\n+
16
\n+
17#ifdef _WIN32
\n+
18#ifdef _MSC_VER
\n+
19
\n+
20// Save client program warning state, and set warning level 4.
\n+
21// Setting the warning level explicitly ensures that libpqxx
\n+
22// headers will work with this warning level as well.
\n+
23#pragma warning (push,4)
\n
24
\n-
25namespace pqxx
\n-
26{
\n-
27
\n-
29
\n-
54class PQXX_LIBEXPORT nontransaction : public transaction_base
\n-
55{
\n-
56public:
\n-
58
\n-
63 explicit nontransaction( //[t14]
\n-\n-
65 const std::string &Name=std::string{}) :
\n-
66 namedclass{"nontransaction", Name}, transaction_base{C} { Begin(); }
\n-
67
\n-
68 virtual ~nontransaction(); //[t14]
\n-
69
\n-
70private:
\n-
71 virtual void do_begin() override {} //[t14]
\n-
72 virtual result do_exec(const char C[]) override; //[t14]
\n-
73 virtual void do_commit() override {} //[t14]
\n-
74 virtual void do_abort() override {} //[t14]
\n-
75};
\n-
76
\n-
77} // namespace pqxx
\n-
78
\n-
79#include "pqxx/compiler-internal-post.hxx"
\n-
80#endif
\n-
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
Simple "transaction" class offering no transactional integrity.
Definition: nontransaction.hxx:55
\n-
nontransaction(connection_base &C, const std::string &Name=std::string{})
Constructor.
Definition: nontransaction.hxx:63
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
25#pragma warning (disable: 4251)
\n+
26#pragma warning (disable: 4273)
\n+
27#pragma warning (disable: 4275)
\n+
28#pragma warning (disable: 4355)
\n+
29#pragma warning (disable: 4511) // Copy constructor could not be generated.
\n+
30#pragma warning (disable: 4512) // Assignment operator could not be generated.
\n+
31#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy().
\n+
32
\n+
33#endif // _MSC_VER
\n+
34#endif // _WIN32
\n+
35
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,67 +1,36 @@\n \n \n \n \n \n libpqxx\n \n-nontransaction.hxx\n+compiler-internal-pre.hxx\n 1\n- 13#ifndef PQXX_H_NONTRANSACTION\n- 14#define PQXX_H_NONTRANSACTION\n- 15\n- 16#include \"pqxx/compiler-public.hxx\"\n- 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18\n- 19#include \"pqxx/connection_base.hxx\"\n- 20#include \"pqxx/result.hxx\"\n- 21#include \"pqxx/transaction_base.hxx\"\n- 22\n- 23// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n+ 15// NO GUARDS HERE! This code should be executed every time!\n+ 16\n+ 17#ifdef _WIN32\n+ 18#ifdef _MSC_VER\n+ 19\n+ 20// Save client program warning state, and set warning level 4.\n+ 21// Setting the warning level explicitly ensures that libpqxx\n+ 22// headers will work with this warning level as well.\n+ 23#pragma warning (push,4)\n 24\n- 25namespace pqxx\n- 26{\n- 27\n- 29\n-54class PQXX_LIBEXPORT nontransaction : public transaction_base\n- 55{\n- 56public:\n- 58\n-63 explicit nontransaction( //[t14]\n- 64 connection_base &C,\n- 65 const std::string &Name=std::string{}) :\n- 66 namedclass{\"nontransaction\", Name}, transaction_base{C} { Begin(); }\n- 67\n- 68 virtual ~nontransaction(); //[t14]\n- 69\n- 70private:\n- 71 virtual void do_begin() override {} //[t14]\n- 72 virtual result do_exec(const char C[]) override; //[t14]\n- 73 virtual void do_commit() override {} //[t14]\n- 74 virtual void do_abort() override {} //[t14]\n- 75};\n- 76\n- 77} // namespace pqxx\n- 78\n- 79#include \"pqxx/compiler-internal-post.hxx\"\n- 80#endif\n-pqxx\n-The home of all libpqxx classes, functions, templates, etc.\n-Definition: array.hxx:26\n-pqxx::connection_base\n-connection_base abstract base class; represents a connection to a database.\n-Definition: connection_base.hxx:140\n-pqxx::nontransaction\n-Simple \"transaction\" class offering no transactional integrity.\n-Definition: nontransaction.hxx:55\n-pqxx::nontransaction::nontransaction\n-nontransaction(connection_base &C, const std::string &Name=std::string{})\n-Constructor.\n-Definition: nontransaction.hxx:63\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n+ 25#pragma warning (disable: 4251)\n+ 26#pragma warning (disable: 4273)\n+ 27#pragma warning (disable: 4275)\n+ 28#pragma warning (disable: 4355)\n+ 29#pragma warning (disable: 4511) // Copy constructor could not be generated.\n+ 30#pragma warning (disable: 4512) // Assignment operator could not be\n+generated.\n+ 31#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy\n+().\n+ 32\n+ 33#endif // _MSC_VER\n+ 34#endif // _WIN32\n+ 35\n * include\n * pqxx\n- * nontransaction.hxx\n+ * compiler-internal-pre.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00044_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00044_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: compiler-internal.hxx Source File\n+libpqxx: strconv.hxx Source File\n \n \n \n \n \n \n \n@@ -55,54 +55,322 @@\n \n
\n
\n-
compiler-internal.hxx
\n+
strconv.hxx
\n
\n
\n
1
\n-
11#ifndef PQXX_H_COMPILER_INTERNAL
\n-
12#define PQXX_H_COMPILER_INTERNAL
\n+
11#ifndef PQXX_H_STRINGCONV
\n+
12#define PQXX_H_STRINGCONV
\n
13
\n-
14
\n-
15// Workarounds & definitions needed to compile libpqxx into a library
\n-
16#include "pqxx/config-internal-compiler.h"
\n-
17
\n-
18#ifdef _WIN32
\n+
14#include "pqxx/compiler-public.hxx"
\n+
15
\n+
16#include <limits>
\n+
17#include <sstream>
\n+
18#include <stdexcept>
\n
19
\n-
20#ifdef PQXX_SHARED
\n-
21#undef PQXX_LIBEXPORT
\n-
22#define PQXX_LIBEXPORT __declspec(dllexport)
\n-
23#define PQXX_PRIVATE __declspec()
\n-
24#endif // PQXX_SHARED
\n-
25
\n-
26#ifdef _MSC_VER
\n-
27#pragma warning (disable: 4251 4275 4273)
\n-
28#pragma warning (disable: 4355)
\n-
29#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy().
\n-
30#endif
\n-
31
\n-
32#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_VISIBILITY) // !_WIN32
\n-
33
\n-
34#define PQXX_LIBEXPORT __attribute__ ((visibility("default")))
\n-
35#define PQXX_PRIVATE __attribute__ ((visibility("hidden")))
\n-
36
\n-
37#endif // __GNUC__ && PQXX_HAVE_GCC_VISIBILITY
\n-
38
\n-
39
\n-
40#include "pqxx/compiler-public.hxx"
\n-
41
\n-
42#endif
\n+
20
\n+
21namespace pqxx
\n+
22{
\n+
23
\n+
46
\n+
48
\n+
51template<typename T, typename = void> struct string_traits;
\n+
52
\n+
53namespace internal
\n+
54{
\n+
56[[noreturn]] PQXX_LIBEXPORT void throw_null_conversion(
\n+
57 const std::string &type);
\n+
58
\n+
60
\n+
67template<typename TYPE> struct type_name;
\n+
68#define PQXX_DECLARE_TYPE_NAME(TYPE) \\
\n+
69 template<> struct type_name<TYPE> \\
\n+
70 { static constexpr const char *value = #TYPE; }
\n+
71
\n+\n+\n+
74PQXX_DECLARE_TYPE_NAME(unsigned short);
\n+\n+\n+\n+\n+\n+
80PQXX_DECLARE_TYPE_NAME(unsigned long long);
\n+\n+\n+\n+\n+\n+\n+
87PQXX_DECLARE_TYPE_NAME(const std::string);
\n+
88PQXX_DECLARE_TYPE_NAME(std::stringstream);
\n+
89#undef PQXX_DECLARE_TYPE_NAME
\n+
90
\n+
91template<size_t N> struct type_name<char[N]>
\n+
92{ static constexpr const char *value = "char[]"; };
\n+
93
\n+
94
\n+
96
\n+
102template<typename TYPE> struct PQXX_LIBEXPORT builtin_traits
\n+
103{
\n+
104 static constexpr const char *name() noexcept
\n+\n+
106 static constexpr bool has_null() noexcept { return false; }
\n+
107 static bool is_null(TYPE) { return false; }
\n+
108 [[noreturn]] static TYPE null() { throw_null_conversion(name()); }
\n+
109 static void from_string(const char Str[], TYPE &Obj);
\n+
110 static std::string to_string(TYPE Obj);
\n+
111};
\n+
112} // namespace pqxx::internal
\n+
113
\n+
114
\n+
116#define PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(TYPE) \\
\n+
117 template<> struct PQXX_LIBEXPORT string_traits<TYPE> : \\
\n+
118 internal::builtin_traits<TYPE> {};
\n+
119
\n+
120PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(bool)
\n+
121
\n+
122PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(short)
\n+
123PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned short)
\n+
124PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(int)
\n+
125PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned int)
\n+
126PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long)
\n+
127PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long)
\n+
128PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long long)
\n+
129PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long long)
\n+
130
\n+
131PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(float)
\n+
132PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(double)
\n+
133PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long double)
\n+
134
\n+
135#undef PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION
\n+
136
\n+
137
\n+
139
\n+
148template<typename ENUM>
\n+\n+
150{
\n+
151 using underlying_type = typename std::underlying_type<ENUM>::type;
\n+\n+
153
\n+
154 static constexpr bool has_null() noexcept { return false; }
\n+
155 [[noreturn]] static ENUM null()
\n+
156 { internal::throw_null_conversion("enum type"); }
\n+
157
\n+
158 static void from_string(const char Str[], ENUM &Obj)
\n+
159 {
\n+
160 underlying_type tmp;
\n+
161 underlying_traits::from_string(Str, tmp);
\n+
162 Obj = ENUM(tmp);
\n+
163 }
\n+
164
\n+
165 static std::string to_string(ENUM Obj)
\n+
166 { return underlying_traits::to_string(underlying_type(Obj)); }
\n+
167};
\n+
168
\n+
169
\n+
171
\n+
182#define PQXX_DECLARE_ENUM_CONVERSION(ENUM) \\
\n+
183template<> \\
\n+
184struct string_traits<ENUM> : pqxx::enum_traits<ENUM> \\
\n+
185{ \\
\n+
186 static constexpr const char *name() noexcept { return #ENUM; } \\
\n+
187 [[noreturn]] static ENUM null() \\
\n+
188 { internal::throw_null_conversion(name()); } \\
\n+
189}
\n+
190
\n+
191
\n+
193template<> struct PQXX_LIBEXPORT string_traits<const char *>
\n+
194{
\n+
195 static constexpr const char *name() noexcept { return "const char *"; }
\n+
196 static constexpr bool has_null() noexcept { return true; }
\n+
197 static bool is_null(const char *t) { return t == nullptr; }
\n+
198 static const char *null() { return nullptr; }
\n+
199 static void from_string(const char Str[], const char *&Obj) { Obj = Str; }
\n+
200 static std::string to_string(const char *Obj) { return Obj; }
\n+
201};
\n+
202
\n+
204template<> struct PQXX_LIBEXPORT string_traits<char *>
\n+
205{
\n+
206 static constexpr const char *name() noexcept { return "char *"; }
\n+
207 static constexpr bool has_null() noexcept { return true; }
\n+
208 static bool is_null(const char *t) { return t == nullptr; }
\n+
209 static const char *null() { return nullptr; }
\n+
210
\n+
211 // Don't allow this conversion since it breaks const-safety.
\n+
212 // static void from_string(const char Str[], char *&Obj);
\n+
213
\n+
214 static std::string to_string(char *Obj) { return Obj; }
\n+
215};
\n+
216
\n+
218template<size_t N> struct PQXX_LIBEXPORT string_traits<char[N]>
\n+
219{
\n+
220 static constexpr const char *name() noexcept { return "char[]"; }
\n+
221 static constexpr bool has_null() noexcept { return true; }
\n+
222 static bool is_null(const char t[]) { return t == nullptr; }
\n+
223 static const char *null() { return nullptr; }
\n+
224 static std::string to_string(const char Obj[]) { return Obj; }
\n+
225};
\n+
226
\n+
227template<> struct PQXX_LIBEXPORT string_traits<std::string>
\n+
228{
\n+
229 static constexpr const char *name() noexcept { return "string"; }
\n+
230 static constexpr bool has_null() noexcept { return false; }
\n+
231 static bool is_null(const std::string &) { return false; }
\n+
232 [[noreturn]] static std::string null()
\n+\n+
234 static void from_string(const char Str[], std::string &Obj) { Obj=Str; }
\n+
235 static std::string to_string(const std::string &Obj) { return Obj; }
\n+
236};
\n+
237
\n+
238template<> struct PQXX_LIBEXPORT string_traits<const std::string>
\n+
239{
\n+
240 static constexpr const char *name() noexcept { return "const string"; }
\n+
241 static constexpr bool has_null() noexcept { return false; }
\n+
242 static bool is_null(const std::string &) { return false; }
\n+
243 [[noreturn]] static const std::string null()
\n+\n+
245 static const std::string to_string(const std::string &Obj) { return Obj; }
\n+
246};
\n+
247
\n+
248template<> struct PQXX_LIBEXPORT string_traits<std::stringstream>
\n+
249{
\n+
250 static constexpr const char *name() noexcept { return "stringstream"; }
\n+
251 static constexpr bool has_null() noexcept { return false; }
\n+
252 static bool is_null(const std::stringstream &) { return false; }
\n+
253 [[noreturn]] static std::stringstream null()
\n+\n+
255 static void from_string(const char Str[], std::stringstream &Obj)
\n+
256 { Obj.clear(); Obj << Str; }
\n+
257 static std::string to_string(const std::stringstream &Obj)
\n+
258 { return Obj.str(); }
\n+
259};
\n+
260
\n+
261
\n+
262// TODO: Implement date conversions.
\n+
263
\n+
265
\n+
277template<typename T>
\n+
278 inline void from_string(const char Str[], T &Obj)
\n+
279{
\n+
280 if (Str == nullptr) throw std::runtime_error{"Attempt to read null string."};
\n+\n+
282}
\n+
283
\n+
284
\n+
286
\n+
292template<typename T> inline void from_string(const char Str[], T &Obj, size_t)
\n+
293{
\n+
294 return from_string(Str, Obj);
\n+
295}
\n+
296
\n+
297template<>
\n+
298 inline void from_string<std::string>( //[t00]
\n+
299 const char Str[],
\n+
300 std::string &Obj,
\n+
301 size_t len)
\n+
302{
\n+
303 if (Str == nullptr) throw std::runtime_error{"Attempt to read null string."};
\n+
304 Obj.assign(Str, len);
\n+
305}
\n+
306
\n+
307template<typename T>
\n+
308 inline void from_string(const std::string &Str, T &Obj) //[t45]
\n+
309 { from_string(Str.c_str(), Obj); }
\n+
310
\n+
311template<typename T>
\n+
312 inline void from_string(const std::stringstream &Str, T &Obj) //[t00]
\n+
313 { from_string(Str.str(), Obj); }
\n+
314
\n+
315template<> inline void
\n+
316from_string(const std::string &Str, std::string &Obj) //[t46]
\n+
317 { Obj = Str; }
\n+
318
\n+
319
\n+
320namespace internal
\n+
321{
\n+
323constexpr int digit_to_number(char c) noexcept { return c-'0'; }
\n+
324constexpr char number_to_digit(int i) noexcept
\n+
325 { return static_cast<char>(i+'0'); }
\n+
326} // namespace pqxx::internal
\n+
327
\n+
328
\n+
330
\n+
334template<typename T> inline std::string to_string(const T &Obj)
\n+
335 { return string_traits<T>::to_string(Obj); }
\n+
336
\n+
338
\n+
339} // namespace pqxx
\n+
340
\n+
341#endif
\n+
STL namespace.
\n+
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n+
void from_string(const field &F, T &Obj)
Convert a field's string contents to another type.
Definition: field.hxx:365
\n+
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
\n+
PQXX_DECLARE_TYPE_NAME(bool)
\n+
constexpr char number_to_digit(int i) noexcept
Definition: strconv.hxx:324
\n+
constexpr int digit_to_number(char c) noexcept
Compute numeric value of given textual digit (assuming that it is a digit)
Definition: strconv.hxx:323
\n+
void throw_null_conversion(const std::string &type)
Throw exception for attempt to convert null to given type.
Definition: strconv.cxx:58
\n+
Traits class for use in string conversions.
Definition: strconv.hxx:51
\n+
Give a human-readable name for a type, at compile time.
Definition: strconv.hxx:67
\n+
Helper: string traits implementation for built-in types.
Definition: strconv.hxx:103
\n+
static void from_string(const char Str[], TYPE &Obj)
\n+
static bool is_null(TYPE)
Definition: strconv.hxx:107
\n+
static std::string to_string(TYPE Obj)
\n+
static TYPE null()
Definition: strconv.hxx:108
\n+
static constexpr const char * name() noexcept
Definition: strconv.hxx:104
\n+
static constexpr bool has_null() noexcept
Definition: strconv.hxx:106
\n+
Helper class for defining enum conversions.
Definition: strconv.hxx:150
\n+
static std::string to_string(ENUM Obj)
Definition: strconv.hxx:165
\n+
static ENUM null()
Definition: strconv.hxx:155
\n+
static constexpr bool has_null() noexcept
Definition: strconv.hxx:154
\n+
static void from_string(const char Str[], ENUM &Obj)
Definition: strconv.hxx:158
\n+
typename std::underlying_type< ENUM >::type underlying_type
Definition: strconv.hxx:151
\n+
static const char * null()
Definition: strconv.hxx:198
\n+
static std::string to_string(const char *Obj)
Definition: strconv.hxx:200
\n+
static bool is_null(const char *t)
Definition: strconv.hxx:197
\n+
static constexpr const char * name() noexcept
Definition: strconv.hxx:195
\n+
static void from_string(const char Str[], const char *&Obj)
Definition: strconv.hxx:199
\n+
static constexpr bool has_null() noexcept
Definition: strconv.hxx:196
\n+
static constexpr const char * name() noexcept
Definition: strconv.hxx:206
\n+
static bool is_null(const char *t)
Definition: strconv.hxx:208
\n+
static std::string to_string(char *Obj)
Definition: strconv.hxx:214
\n+
static constexpr bool has_null() noexcept
Definition: strconv.hxx:207
\n+
static const char * null()
Definition: strconv.hxx:209
\n+
static constexpr bool has_null() noexcept
Definition: strconv.hxx:221
\n+
static constexpr const char * name() noexcept
Definition: strconv.hxx:220
\n+
static const char * null()
Definition: strconv.hxx:223
\n+
static bool is_null(const char t[])
Definition: strconv.hxx:222
\n+
static std::string to_string(const char Obj[])
Definition: strconv.hxx:224
\n+
static bool is_null(const std::string &)
Definition: strconv.hxx:231
\n+
static void from_string(const char Str[], std::string &Obj)
Definition: strconv.hxx:234
\n+
static std::string to_string(const std::string &Obj)
Definition: strconv.hxx:235
\n+
static constexpr bool has_null() noexcept
Definition: strconv.hxx:230
\n+
static constexpr const char * name() noexcept
Definition: strconv.hxx:229
\n+
static std::string null()
Definition: strconv.hxx:232
\n+
static const std::string null()
Definition: strconv.hxx:243
\n+
static constexpr const char * name() noexcept
Definition: strconv.hxx:240
\n+
static const std::string to_string(const std::string &Obj)
Definition: strconv.hxx:245
\n+
static bool is_null(const std::string &)
Definition: strconv.hxx:242
\n+
static constexpr bool has_null() noexcept
Definition: strconv.hxx:241
\n+
static constexpr bool has_null() noexcept
Definition: strconv.hxx:251
\n+
static bool is_null(const std::stringstream &)
Definition: strconv.hxx:252
\n+
static std::string to_string(const std::stringstream &Obj)
Definition: strconv.hxx:257
\n+
static void from_string(const char Str[], std::stringstream &Obj)
Definition: strconv.hxx:255
\n+
static constexpr const char * name() noexcept
Definition: strconv.hxx:250
\n+
static std::stringstream null()
Definition: strconv.hxx:253
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,46 +1,428 @@\n \n \n \n \n \n libpqxx\n \n-compiler-internal.hxx\n+strconv.hxx\n 1\n- 11#ifndef PQXX_H_COMPILER_INTERNAL\n- 12#define PQXX_H_COMPILER_INTERNAL\n+ 11#ifndef PQXX_H_STRINGCONV\n+ 12#define PQXX_H_STRINGCONV\n 13\n- 14\n- 15// Workarounds & definitions needed to compile libpqxx into a library\n- 16#include \"pqxx/config-internal-compiler.h\"\n- 17\n- 18#ifdef _WIN32\n+ 14#include \"pqxx/compiler-public.hxx\"\n+ 15\n+ 16#include \n+ 17#include \n+ 18#include \n 19\n- 20#ifdef PQXX_SHARED\n- 21#undef PQXX_LIBEXPORT\n- 22#define PQXX_LIBEXPORT __declspec(dllexport)\n- 23#define PQXX_PRIVATE __declspec()\n- 24#endif // PQXX_SHARED\n- 25\n- 26#ifdef _MSC_VER\n- 27#pragma warning (disable: 4251 4275 4273)\n- 28#pragma warning (disable: 4355)\n- 29#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy\n-().\n- 30#endif\n- 31\n- 32#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_VISIBILITY) // !_WIN32\n- 33\n- 34#define PQXX_LIBEXPORT __attribute__ ((visibility(\"default\")))\n- 35#define PQXX_PRIVATE __attribute__ ((visibility(\"hidden\")))\n- 36\n- 37#endif // __GNUC__ && PQXX_HAVE_GCC_VISIBILITY\n- 38\n- 39\n- 40#include \"pqxx/compiler-public.hxx\"\n- 41\n- 42#endif\n+ 20\n+ 21namespace pqxx\n+ 22{\n+ 23\n+ 46\n+ 48\n+51template struct string_traits;\n+ 52\n+ 53namespace internal\n+ 54{\n+ 56[[noreturn]] PQXX_LIBEXPORT void throw_null_conversion(\n+ 57 const std::string &type);\n+ 58\n+ 60\n+67template struct type_name;\n+ 68#define PQXX_DECLARE_TYPE_NAME(TYPE) \\\n+ 69 template<> struct type_name \\\n+ 70 { static constexpr const char *value = #TYPE; }\n+ 71\n+72PQXX_DECLARE_TYPE_NAME(bool);\n+73PQXX_DECLARE_TYPE_NAME(short);\n+74PQXX_DECLARE_TYPE_NAME(unsigned short);\n+75PQXX_DECLARE_TYPE_NAME(int);\n+76PQXX_DECLARE_TYPE_NAME(unsigned int);\n+77PQXX_DECLARE_TYPE_NAME(long);\n+78PQXX_DECLARE_TYPE_NAME(unsigned long);\n+79PQXX_DECLARE_TYPE_NAME(long long);\n+80PQXX_DECLARE_TYPE_NAME(unsigned long long);\n+81PQXX_DECLARE_TYPE_NAME(float);\n+82PQXX_DECLARE_TYPE_NAME(double);\n+83PQXX_DECLARE_TYPE_NAME(long double);\n+84PQXX_DECLARE_TYPE_NAME(char *);\n+85PQXX_DECLARE_TYPE_NAME(const char *);\n+86PQXX_DECLARE_TYPE_NAME(std::string);\n+ 87PQXX_DECLARE_TYPE_NAME(const std::string);\n+88PQXX_DECLARE_TYPE_NAME(std::stringstream);\n+ 89#undef PQXX_DECLARE_TYPE_NAME\n+ 90\n+91template struct type_name\n+92{ static constexpr const char *value = \"char[]\"; };\n+ 93\n+ 94\n+ 96\n+102template struct PQXX_LIBEXPORT builtin_traits\n+ 103{\n+104 static constexpr const char *name() noexcept\n+ 105 { return internal::type_name::value; }\n+106 static constexpr bool has_null() noexcept { return false; }\n+107 static bool is_null(TYPE) { return false; }\n+108 [[noreturn]] static TYPE null() { throw_null_conversion(name()); }\n+109 static void from_string(const char Str[], TYPE &Obj);\n+110 static std::string to_string(TYPE Obj);\n+ 111};\n+ 112} // namespace pqxx::internal\n+ 113\n+ 114\n+ 116#define PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(TYPE) \\\n+ 117 template<> struct PQXX_LIBEXPORT string_traits : \\\n+ 118 internal::builtin_traits {};\n+ 119\n+ 120PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(bool)\n+ 121\n+ 122PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(short)\n+ 123PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned short)\n+ 124PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(int)\n+ 125PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned int)\n+ 126PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long)\n+ 127PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long)\n+ 128PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long long)\n+ 129PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long long)\n+ 130\n+ 131PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(float)\n+ 132PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(double)\n+ 133PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long double)\n+ 134\n+ 135#undef PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION\n+ 136\n+ 137\n+ 139\n+ 148template\n+149struct enum_traits\n+ 150{\n+151 using underlying_type = typename std::underlying_type::type;\n+152 using underlying_traits = string_traits;\n+ 153\n+154 static constexpr bool has_null() noexcept { return false; }\n+155 [[noreturn]] static ENUM null()\n+ 156 { internal::throw_null_conversion(\"enum type\"); }\n+ 157\n+158 static void from_string(const char Str[], ENUM &Obj)\n+ 159 {\n+ 160 underlying_type tmp;\n+ 161 underlying_traits::from_string(Str, tmp);\n+ 162 Obj = ENUM(tmp);\n+ 163 }\n+ 164\n+165 static std::string to_string(ENUM Obj)\n+ 166 { return underlying_traits::to_string(underlying_type(Obj)); }\n+ 167};\n+ 168\n+ 169\n+ 171\n+ 182#define PQXX_DECLARE_ENUM_CONVERSION(ENUM) \\\n+ 183template<> \\\n+ 184struct string_traits : pqxx::enum_traits \\\n+ 185{ \\\n+ 186 static constexpr const char *name() noexcept { return #ENUM; } \\\n+ 187 [[noreturn]] static ENUM null() \\\n+ 188 { internal::throw_null_conversion(name()); } \\\n+ 189}\n+ 190\n+ 191\n+193template<> struct PQXX_LIBEXPORT string_traits\n+ 194{\n+195 static constexpr const char *name() noexcept { return \"const char *\"; }\n+196 static constexpr bool has_null() noexcept { return true; }\n+197 static bool is_null(const char *t) { return t == nullptr; }\n+198 static const char *null() { return nullptr; }\n+199 static void from_string(const char Str[], const char *&Obj) { Obj = Str; }\n+200 static std::string to_string(const char *Obj) { return Obj; }\n+ 201};\n+ 202\n+204template<> struct PQXX_LIBEXPORT string_traits\n+ 205{\n+206 static constexpr const char *name() noexcept { return \"char *\"; }\n+207 static constexpr bool has_null() noexcept { return true; }\n+208 static bool is_null(const char *t) { return t == nullptr; }\n+209 static const char *null() { return nullptr; }\n+ 210\n+ 211 // Don't allow this conversion since it breaks const-safety.\n+ 212 // static void from_string(const char Str[], char *&Obj);\n+ 213\n+214 static std::string to_string(char *Obj) { return Obj; }\n+ 215};\n+ 216\n+218template struct PQXX_LIBEXPORT string_traits\n+ 219{\n+220 static constexpr const char *name() noexcept { return \"char[]\"; }\n+221 static constexpr bool has_null() noexcept { return true; }\n+222 static bool is_null(const char t[]) { return t == nullptr; }\n+223 static const char *null() { return nullptr; }\n+224 static std::string to_string(const char Obj[]) { return Obj; }\n+ 225};\n+ 226\n+227template<> struct PQXX_LIBEXPORT string_traits\n+ 228{\n+229 static constexpr const char *name() noexcept { return \"string\"; }\n+230 static constexpr bool has_null() noexcept { return false; }\n+231 static bool is_null(const std::string &) { return false; }\n+232 [[noreturn]] static std::string null()\n+ 233 { internal::throw_null_conversion(name()); }\n+234 static void from_string(const char Str[], std::string &Obj) { Obj=Str; }\n+235 static std::string to_string(const std::string &Obj) { return Obj; }\n+ 236};\n+ 237\n+238template<> struct PQXX_LIBEXPORT string_traits\n+ 239{\n+240 static constexpr const char *name() noexcept { return \"const string\"; }\n+241 static constexpr bool has_null() noexcept { return false; }\n+242 static bool is_null(const std::string &) { return false; }\n+243 [[noreturn]] static const std::string null()\n+ 244 { internal::throw_null_conversion(name()); }\n+245 static const std::string to_string(const std::string &Obj) { return Obj; }\n+ 246};\n+ 247\n+248template<> struct PQXX_LIBEXPORT string_traits\n+ 249{\n+250 static constexpr const char *name() noexcept { return \"stringstream\"; }\n+251 static constexpr bool has_null() noexcept { return false; }\n+252 static bool is_null(const std::stringstream &) { return false; }\n+253 [[noreturn]] static std::stringstream null()\n+ 254 { internal::throw_null_conversion(name()); }\n+255 static void from_string(const char Str[], std::stringstream &Obj)\n+ 256 { Obj.clear(); Obj << Str; }\n+257 static std::string to_string(const std::stringstream &Obj)\n+ 258 { return Obj.str(); }\n+ 259};\n+ 260\n+ 261\n+ 262// TODO: Implement date conversions.\n+ 263\n+ 265\n+ 277template\n+278 inline void from_string(const char Str[], T &Obj)\n+ 279{\n+ 280 if (Str == nullptr) throw std::runtime_error{\"Attempt to read null\n+string.\"};\n+ 281 string_traits::from_string(Str, Obj);\n+ 282}\n+ 283\n+ 284\n+ 286\n+292template inline void from_string(const char Str[], T &Obj,\n+size_t)\n+ 293{\n+ 294 return from_string(Str, Obj);\n+ 295}\n+ 296\n+ 297template<>\n+298 inline void from_string( //[t00]\n+ 299 const char Str[],\n+ 300 std::string &Obj,\n+ 301 size_t len)\n+ 302{\n+ 303 if (Str == nullptr) throw std::runtime_error{\"Attempt to read null\n+string.\"};\n+ 304 Obj.assign(Str, len);\n+ 305}\n+ 306\n+ 307template\n+308 inline void from_string(const std::string &Str, T &Obj) //[t45]\n+ 309 { from_string(Str.c_str(), Obj); }\n+ 310\n+ 311template\n+312 inline void from_string(const std::stringstream &Str, T &Obj) //[t00]\n+ 313 { from_string(Str.str(), Obj); }\n+ 314\n+ 315template<> inline void\n+316from_string(const std::string &Str, std::string &Obj) //[t46]\n+ 317 { Obj = Str; }\n+ 318\n+ 319\n+ 320namespace internal\n+ 321{\n+323constexpr int digit_to_number(char c) noexcept { return c-'0'; }\n+324constexpr char number_to_digit(int i) noexcept\n+ 325 { return static_cast(i+'0'); }\n+ 326} // namespace pqxx::internal\n+ 327\n+ 328\n+ 330\n+334template inline std::string to_string(const T &Obj)\n+ 335 { return string_traits::to_string(Obj); }\n+ 336\n+ 338\n+ 339} // namespace pqxx\n+ 340\n+ 341#endif\n+std\n+STL namespace.\n+pqxx\n+The home of all libpqxx classes, functions, templates, etc.\n+Definition: array.hxx:26\n+pqxx::from_string\n+void from_string(const field &F, T &Obj)\n+Convert a field's string contents to another type.\n+Definition: field.hxx:365\n+pqxx::to_string\n+std::string to_string(const field &Obj)\n+Convert a field to a string.\n+Definition: result.cxx:451\n+pqxx::internal::PQXX_DECLARE_TYPE_NAME\n+PQXX_DECLARE_TYPE_NAME(bool)\n+pqxx::internal::number_to_digit\n+constexpr char number_to_digit(int i) noexcept\n+Definition: strconv.hxx:324\n+pqxx::internal::digit_to_number\n+constexpr int digit_to_number(char c) noexcept\n+Compute numeric value of given textual digit (assuming that it is a digit)\n+Definition: strconv.hxx:323\n+pqxx::internal::throw_null_conversion\n+void throw_null_conversion(const std::string &type)\n+Throw exception for attempt to convert null to given type.\n+Definition: strconv.cxx:58\n+pqxx::string_traits\n+Traits class for use in string conversions.\n+Definition: strconv.hxx:51\n+pqxx::internal::type_name\n+Give a human-readable name for a type, at compile time.\n+Definition: strconv.hxx:67\n+pqxx::internal::builtin_traits\n+Helper: string traits implementation for built-in types.\n+Definition: strconv.hxx:103\n+pqxx::internal::builtin_traits::from_string\n+static void from_string(const char Str[], TYPE &Obj)\n+pqxx::internal::builtin_traits::is_null\n+static bool is_null(TYPE)\n+Definition: strconv.hxx:107\n+pqxx::internal::builtin_traits::to_string\n+static std::string to_string(TYPE Obj)\n+pqxx::internal::builtin_traits::null\n+static TYPE null()\n+Definition: strconv.hxx:108\n+pqxx::internal::builtin_traits::name\n+static constexpr const char * name() noexcept\n+Definition: strconv.hxx:104\n+pqxx::internal::builtin_traits::has_null\n+static constexpr bool has_null() noexcept\n+Definition: strconv.hxx:106\n+pqxx::enum_traits\n+Helper class for defining enum conversions.\n+Definition: strconv.hxx:150\n+pqxx::enum_traits::to_string\n+static std::string to_string(ENUM Obj)\n+Definition: strconv.hxx:165\n+pqxx::enum_traits::null\n+static ENUM null()\n+Definition: strconv.hxx:155\n+pqxx::enum_traits::has_null\n+static constexpr bool has_null() noexcept\n+Definition: strconv.hxx:154\n+pqxx::enum_traits::from_string\n+static void from_string(const char Str[], ENUM &Obj)\n+Definition: strconv.hxx:158\n+pqxx::enum_traits::underlying_type\n+typename std::underlying_type< ENUM >::type underlying_type\n+Definition: strconv.hxx:151\n+pqxx::string_traits<_const_char_*_>::null\n+static const char * null()\n+Definition: strconv.hxx:198\n+pqxx::string_traits<_const_char_*_>::to_string\n+static std::string to_string(const char *Obj)\n+Definition: strconv.hxx:200\n+pqxx::string_traits<_const_char_*_>::is_null\n+static bool is_null(const char *t)\n+Definition: strconv.hxx:197\n+pqxx::string_traits<_const_char_*_>::name\n+static constexpr const char * name() noexcept\n+Definition: strconv.hxx:195\n+pqxx::string_traits<_const_char_*_>::from_string\n+static void from_string(const char Str[], const char *&Obj)\n+Definition: strconv.hxx:199\n+pqxx::string_traits<_const_char_*_>::has_null\n+static constexpr bool has_null() noexcept\n+Definition: strconv.hxx:196\n+pqxx::string_traits<_char_*_>::name\n+static constexpr const char * name() noexcept\n+Definition: strconv.hxx:206\n+pqxx::string_traits<_char_*_>::is_null\n+static bool is_null(const char *t)\n+Definition: strconv.hxx:208\n+pqxx::string_traits<_char_*_>::to_string\n+static std::string to_string(char *Obj)\n+Definition: strconv.hxx:214\n+pqxx::string_traits<_char_*_>::has_null\n+static constexpr bool has_null() noexcept\n+Definition: strconv.hxx:207\n+pqxx::string_traits<_char_*_>::null\n+static const char * null()\n+Definition: strconv.hxx:209\n+pqxx::string_traits<_char[N]>::has_null\n+static constexpr bool has_null() noexcept\n+Definition: strconv.hxx:221\n+pqxx::string_traits<_char[N]>::name\n+static constexpr const char * name() noexcept\n+Definition: strconv.hxx:220\n+pqxx::string_traits<_char[N]>::null\n+static const char * null()\n+Definition: strconv.hxx:223\n+pqxx::string_traits<_char[N]>::is_null\n+static bool is_null(const char t[])\n+Definition: strconv.hxx:222\n+pqxx::string_traits<_char[N]>::to_string\n+static std::string to_string(const char Obj[])\n+Definition: strconv.hxx:224\n+pqxx::string_traits<_std::string_>::is_null\n+static bool is_null(const std::string &)\n+Definition: strconv.hxx:231\n+pqxx::string_traits<_std::string_>::from_string\n+static void from_string(const char Str[], std::string &Obj)\n+Definition: strconv.hxx:234\n+pqxx::string_traits<_std::string_>::to_string\n+static std::string to_string(const std::string &Obj)\n+Definition: strconv.hxx:235\n+pqxx::string_traits<_std::string_>::has_null\n+static constexpr bool has_null() noexcept\n+Definition: strconv.hxx:230\n+pqxx::string_traits<_std::string_>::name\n+static constexpr const char * name() noexcept\n+Definition: strconv.hxx:229\n+pqxx::string_traits<_std::string_>::null\n+static std::string null()\n+Definition: strconv.hxx:232\n+pqxx::string_traits<_const_std::string_>::null\n+static const std::string null()\n+Definition: strconv.hxx:243\n+pqxx::string_traits<_const_std::string_>::name\n+static constexpr const char * name() noexcept\n+Definition: strconv.hxx:240\n+pqxx::string_traits<_const_std::string_>::to_string\n+static const std::string to_string(const std::string &Obj)\n+Definition: strconv.hxx:245\n+pqxx::string_traits<_const_std::string_>::is_null\n+static bool is_null(const std::string &)\n+Definition: strconv.hxx:242\n+pqxx::string_traits<_const_std::string_>::has_null\n+static constexpr bool has_null() noexcept\n+Definition: strconv.hxx:241\n+pqxx::string_traits<_std::stringstream_>::has_null\n+static constexpr bool has_null() noexcept\n+Definition: strconv.hxx:251\n+pqxx::string_traits<_std::stringstream_>::is_null\n+static bool is_null(const std::stringstream &)\n+Definition: strconv.hxx:252\n+pqxx::string_traits<_std::stringstream_>::to_string\n+static std::string to_string(const std::stringstream &Obj)\n+Definition: strconv.hxx:257\n+pqxx::string_traits<_std::stringstream_>::from_string\n+static void from_string(const char Str[], std::stringstream &Obj)\n+Definition: strconv.hxx:255\n+pqxx::string_traits<_std::stringstream_>::name\n+static constexpr const char * name() noexcept\n+Definition: strconv.hxx:250\n+pqxx::string_traits<_std::stringstream_>::null\n+static std::stringstream null()\n+Definition: strconv.hxx:253\n * include\n * pqxx\n- * compiler-internal.hxx\n+ * strconv.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00047_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00047_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: version.hxx Source File\n+libpqxx: transaction.hxx Source File\n \n \n \n \n \n \n \n@@ -55,45 +55,105 @@\n \n
\n
\n-
version.hxx
\n+
transaction.hxx
\n
\n
\n
1
\n-
11#ifndef PQXX_H_VERSION
\n-
12
\n-
13#include "pqxx/compiler-public.hxx"
\n-
14#include "pqxx/compiler-internal-pre.hxx"
\n-
15
\n-
17#define PQXX_VERSION "6.4.4"
\n-
19#define PQXX_ABI "6.4"
\n+
12#ifndef PQXX_H_TRANSACTION
\n+
13#define PQXX_H_TRANSACTION
\n+
14
\n+
15#include "pqxx/compiler-public.hxx"
\n+
16#include "pqxx/compiler-internal-pre.hxx"
\n+
17
\n+
18#include "pqxx/dbtransaction.hxx"
\n+
19
\n
20
\n-
22#define PQXX_VERSION_MAJOR 6
\n-
24#define PQXX_VERSION_MINOR 4
\n-
25
\n-
26namespace pqxx
\n-
27{
\n+
21/* Methods tested in eg. self-test program test1 are marked with "//[t01]"
\n+
22 */
\n+
23
\n+
24
\n+
25namespace pqxx
\n+
26{
\n+
27
\n
28namespace internal
\n
29{
\n-
31
\n-
53template<int, int> PQXX_LIBEXPORT int check_library_version() noexcept;
\n-
54}
\n-
55}
\n-
56#include "pqxx/compiler-internal-post.hxx"
\n-
57#endif
\n+
31class PQXX_LIBEXPORT basic_transaction : public dbtransaction
\n+
32{
\n+
33protected:
\n+
34 basic_transaction( //[t01]
\n+\n+
36 const std::string &IsolationLevel,
\n+\n+
38
\n+
39private:
\n+
40 virtual void do_commit() override; //[t01]
\n+
41};
\n+
42} // namespace internal
\n+
43
\n+
44
\n+
49
\n+
51
\n+
79template<
\n+
80 isolation_level ISOLATIONLEVEL=read_committed,
\n+\n+\n+
83{
\n+
84public:
\n+\n+
86
\n+
88
\n+
93 explicit transaction(connection_base &C, const std::string &TName): //[t01]
\n+
94 namedclass{fullname("transaction", isolation_tag::name()), TName},
\n+
95 internal::basic_transaction(C, isolation_tag::name(), READWRITE)
\n+
96 { Begin(); }
\n+
97
\n+
98 explicit transaction(connection_base &C) : //[t01]
\n+
99 transaction(C, "") {}
\n+
100
\n+
101 virtual ~transaction() noexcept
\n+
102 { End(); }
\n+
103};
\n+
104
\n+
105
\n+\n+
108
\n+\n+
111
\n+
113}
\n+
114
\n+
115#include "pqxx/compiler-internal-post.hxx"
\n+
116#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
int check_library_version() noexcept
Library version check stub.
\n+
readwrite_policy
Definition: dbtransaction.hxx:25
\n+
@ read_write
Definition: dbtransaction.hxx:27
\n+
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:57
\n+
@ read_committed
Definition: isolation.hxx:59
\n+
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n+
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
\n+
static std::string fullname(const std::string &ttype, const std::string &isolation)
Definition: dbtransaction.cxx:95
\n+
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
\n+
Helper base class for the transaction class template.
Definition: transaction.hxx:32
\n+
basic_transaction(connection_base &C, const std::string &IsolationLevel, readwrite_policy)
Definition: transaction.cxx:20
\n+
Standard back-end transaction, templatized on isolation level.
Definition: transaction.hxx:83
\n+
transaction(connection_base &C, const std::string &TName)
Create a transaction.
Definition: transaction.hxx:93
\n+
transaction(connection_base &C)
Definition: transaction.hxx:98
\n+
virtual ~transaction() noexcept
Definition: transaction.hxx:101
\n+
void Begin()
Begin transaction (to be called by implementing class)
Definition: transaction_base.cxx:386
\n+
void End() noexcept
End transaction. To be called by implementing class' destructor.
Definition: transaction_base.cxx:408
\n+
namedclass(const std::string &Classname)
Definition: util.hxx:236
\n+
const std::string & name() const noexcept
Object name, or the empty string if no name was given.
Definition: util.hxx:249
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,40 +1,141 @@\n \n \n \n \n \n libpqxx\n \n-version.hxx\n+transaction.hxx\n 1\n- 11#ifndef PQXX_H_VERSION\n- 12\n- 13#include \"pqxx/compiler-public.hxx\"\n- 14#include \"pqxx/compiler-internal-pre.hxx\"\n- 15\n- 17#define PQXX_VERSION \"6.4.4\"\n- 19#define PQXX_ABI \"6.4\"\n+ 12#ifndef PQXX_H_TRANSACTION\n+ 13#define PQXX_H_TRANSACTION\n+ 14\n+ 15#include \"pqxx/compiler-public.hxx\"\n+ 16#include \"pqxx/compiler-internal-pre.hxx\"\n+ 17\n+ 18#include \"pqxx/dbtransaction.hxx\"\n+ 19\n 20\n- 22#define PQXX_VERSION_MAJOR 6\n- 24#define PQXX_VERSION_MINOR 4\n- 25\n- 26namespace pqxx\n- 27{\n+ 21/* Methods tested in eg. self-test program test1 are marked with \"//[t01]\"\n+ 22 */\n+ 23\n+ 24\n+ 25namespace pqxx\n+ 26{\n+ 27\n 28namespace internal\n 29{\n- 31\n-53template PQXX_LIBEXPORT int check_library_version() noexcept;\n- 54}\n- 55}\n- 56#include \"pqxx/compiler-internal-post.hxx\"\n- 57#endif\n+31class PQXX_LIBEXPORT basic_transaction : public dbtransaction\n+ 32{\n+ 33protected:\n+ 34 basic_transaction( //[t01]\n+ 35 connection_base &C,\n+ 36 const std::string &IsolationLevel,\n+ 37 readwrite_policy);\n+ 38\n+ 39private:\n+ 40 virtual void do_commit() override; //[t01]\n+ 41};\n+ 42} // namespace internal\n+ 43\n+ 44\n+ 49\n+ 51\n+ 79template<\n+ 80 isolation_level ISOLATIONLEVEL=read_committed,\n+ 81 readwrite_policy READWRITE=read_write>\n+82class transaction : public internal::basic_transaction\n+ 83{\n+ 84public:\n+85 using isolation_tag = isolation_traits;\n+ 86\n+ 88\n+93 explicit transaction(connection_base &C, const std::string &TName): //[t01]\n+ 94 namedclass{fullname(\"transaction\", isolation_tag::name()), TName},\n+ 95 internal::basic_transaction(C, isolation_tag::name(), READWRITE)\n+ 96 { Begin(); }\n+ 97\n+98 explicit transaction(connection_base &C) : //[t01]\n+ 99 transaction(C, \"\") {}\n+ 100\n+101 virtual ~transaction() noexcept\n+ 102 { End(); }\n+ 103};\n+ 104\n+ 105\n+107using work = transaction<>;\n+ 108\n+110using read_transaction = transaction;\n+ 111\n+ 113}\n+ 114\n+ 115#include \"pqxx/compiler-internal-post.hxx\"\n+ 116#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::internal::check_library_version\n-int check_library_version() noexcept\n-Library version check stub.\n+pqxx::readwrite_policy\n+readwrite_policy\n+Definition: dbtransaction.hxx:25\n+pqxx::read_write\n+@ read_write\n+Definition: dbtransaction.hxx:27\n+pqxx::isolation_level\n+isolation_level\n+Transaction isolation levels.\n+Definition: isolation.hxx:57\n+pqxx::read_committed\n+@ read_committed\n+Definition: isolation.hxx:59\n+pqxx::connection_base\n+connection_base abstract base class; represents a connection to a database.\n+Definition: connection_base.hxx:140\n+pqxx::dbtransaction\n+Abstract base class responsible for bracketing a backend transaction.\n+Definition: dbtransaction.hxx:63\n+pqxx::dbtransaction::fullname\n+static std::string fullname(const std::string &ttype, const std::string\n+&isolation)\n+Definition: dbtransaction.cxx:95\n+pqxx::isolation_traits\n+Traits class to describe an isolation level; primarly for libpqxx's own use.\n+Definition: isolation.hxx:66\n+pqxx::internal::basic_transaction\n+Helper base class for the transaction class template.\n+Definition: transaction.hxx:32\n+pqxx::internal::basic_transaction::basic_transaction\n+basic_transaction(connection_base &C, const std::string &IsolationLevel,\n+readwrite_policy)\n+Definition: transaction.cxx:20\n+pqxx::transaction\n+Standard back-end transaction, templatized on isolation level.\n+Definition: transaction.hxx:83\n+pqxx::transaction::transaction\n+transaction(connection_base &C, const std::string &TName)\n+Create a transaction.\n+Definition: transaction.hxx:93\n+pqxx::transaction::transaction\n+transaction(connection_base &C)\n+Definition: transaction.hxx:98\n+pqxx::transaction::~transaction\n+virtual ~transaction() noexcept\n+Definition: transaction.hxx:101\n+pqxx::transaction_base::Begin\n+void Begin()\n+Begin transaction (to be called by implementing class)\n+Definition: transaction_base.cxx:386\n+pqxx::transaction_base::End\n+void End() noexcept\n+End transaction. To be called by implementing class' destructor.\n+Definition: transaction_base.cxx:408\n+pqxx::internal::namedclass::namedclass\n+namedclass(const std::string &Classname)\n+Definition: util.hxx:236\n+pqxx::internal::namedclass::name\n+const std::string & name() const noexcept\n+Object name, or the empty string if no name was given.\n+Definition: util.hxx:249\n * include\n * pqxx\n- * version.hxx\n+ * transaction.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00050_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00050_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: compiler-internal-pre.hxx Source File\n+libpqxx: binarystring.hxx Source File\n \n \n \n \n \n \n \n@@ -55,43 +55,148 @@\n \n
\n
\n-
compiler-internal-pre.hxx
\n+
binarystring.hxx
\n
\n
\n
1
\n-
15// NO GUARDS HERE! This code should be executed every time!
\n+
11#ifndef PQXX_H_BINARYSTRING
\n+
12#define PQXX_H_BINARYSTRING
\n+
13
\n+
14#include "pqxx/compiler-public.hxx"
\n+
15#include "pqxx/compiler-internal-pre.hxx"
\n
16
\n-
17#ifdef _WIN32
\n-
18#ifdef _MSC_VER
\n+
17#include <memory>
\n+
18#include <string>
\n
19
\n-
20// Save client program warning state, and set warning level 4.
\n-
21// Setting the warning level explicitly ensures that libpqxx
\n-
22// headers will work with this warning level as well.
\n-
23#pragma warning (push,4)
\n-
24
\n-
25#pragma warning (disable: 4251)
\n-
26#pragma warning (disable: 4273)
\n-
27#pragma warning (disable: 4275)
\n-
28#pragma warning (disable: 4355)
\n-
29#pragma warning (disable: 4511) // Copy constructor could not be generated.
\n-
30#pragma warning (disable: 4512) // Assignment operator could not be generated.
\n-
31#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy().
\n-
32
\n-
33#endif // _MSC_VER
\n-
34#endif // _WIN32
\n-
35
\n+
20#include "pqxx/result.hxx"
\n+
21
\n+
22
\n+
23namespace pqxx
\n+
24{
\n+
25
\n+
27
\n+
53class PQXX_LIBEXPORT binarystring
\n+
54{
\n+
55public:
\n+
56 using char_type = unsigned char;
\n+
57 using value_type = std::char_traits<char_type>::char_type;
\n+
58 using size_type = size_t;
\n+
59 using difference_type = long;
\n+
60 using const_reference = const value_type &;
\n+
61 using const_pointer = const value_type *;
\n+\n+
63 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
\n+
64
\n+
65 binarystring(const binarystring &) =default;
\n+
66
\n+
68
\n+
71 explicit binarystring(const field &); //[t62]
\n+
72
\n+
74 explicit binarystring(const std::string &);
\n+
75
\n+
77 binarystring(const void *, size_t);
\n+
78
\n+
80 size_type size() const noexcept { return m_size; } //[t62]
\n+
82 size_type length() const noexcept { return size(); } //[t62]
\n+
83 bool empty() const noexcept { return size()==0; } //[t62]
\n+
84
\n+
85 const_iterator begin() const noexcept { return data(); } //[t62]
\n+
86 const_iterator cbegin() const noexcept { return begin(); }
\n+
87 const_iterator end() const noexcept { return data()+m_size; } //[t62]
\n+
88 const_iterator cend() const noexcept { return end(); }
\n+
89
\n+
90 const_reference front() const noexcept { return *begin(); } //[t62]
\n+
91 const_reference back() const noexcept //[t62]
\n+
92 { return *(data()+m_size-1); }
\n+
93
\n+\n+
95 { return const_reverse_iterator{end()}; }
\n+
96 const_reverse_iterator crbegin() const { return rbegin(); }
\n+\n+
98 { return const_reverse_iterator{begin()}; }
\n+
99 const_reverse_iterator crend() const { return rend(); }
\n+
100
\n+
102 const value_type *data() const noexcept {return m_buf.get();} //[t62]
\n+
103
\n+
104 const_reference operator[](size_type i) const noexcept //[t62]
\n+
105 { return data()[i]; }
\n+
106
\n+
107 PQXX_PURE bool operator==(const binarystring &) const noexcept; //[t62]
\n+
108 bool operator!=(const binarystring &rhs) const noexcept //[t62]
\n+
109 { return not operator==(rhs); }
\n+
110
\n+
111 binarystring &operator=(const binarystring &);
\n+
112
\n+
114 const_reference at(size_type) const; //[t62]
\n+
115
\n+
117 void swap(binarystring &); //[t62]
\n+
118
\n+
120
\n+
123 const char *get() const noexcept //[t62]
\n+
124 { return reinterpret_cast<const char *>(m_buf.get()); }
\n+
125
\n+
127
\n+
133 std::string str() const; //[t62]
\n+
134
\n+
135private:
\n+
136 using smart_pointer_type = std::shared_ptr<value_type>;
\n+
137
\n+
139 static smart_pointer_type make_smart_pointer(unsigned char *buf=nullptr)
\n+
140 {
\n+
141 return smart_pointer_type{
\n+
142 buf,
\n+
143 internal::freemallocmem_templated<unsigned char>};
\n+
144 }
\n+
145
\n+
146 smart_pointer_type m_buf;
\n+
147 size_type m_size;
\n+
148};
\n+
149}
\n+
150
\n+
151#include "pqxx/compiler-internal-post.hxx"
\n+
152
\n+
153#endif
\n+
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n+
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
\n+
const_reverse_iterator crend() const
Definition: binarystring.hxx:99
\n+
const_reverse_iterator rbegin() const
Definition: binarystring.hxx:94
\n+
const_pointer const_iterator
Definition: binarystring.hxx:62
\n+
const value_type & const_reference
Definition: binarystring.hxx:60
\n+
const value_type * const_pointer
Definition: binarystring.hxx:61
\n+
const_iterator end() const noexcept
Definition: binarystring.hxx:87
\n+
const_iterator begin() const noexcept
Definition: binarystring.hxx:85
\n+
std::char_traits< char_type >::char_type value_type
Definition: binarystring.hxx:57
\n+
long difference_type
Definition: binarystring.hxx:59
\n+
const_reverse_iterator crbegin() const
Definition: binarystring.hxx:96
\n+
const_reference front() const noexcept
Definition: binarystring.hxx:90
\n+
const_reference back() const noexcept
Definition: binarystring.hxx:91
\n+
bool operator!=(const binarystring &rhs) const noexcept
Definition: binarystring.hxx:108
\n+
bool empty() const noexcept
Definition: binarystring.hxx:83
\n+
binarystring(const binarystring &)=default
\n+
const_reference operator[](size_type i) const noexcept
Definition: binarystring.hxx:104
\n+
const_iterator cend() const noexcept
Definition: binarystring.hxx:88
\n+
const_reverse_iterator rend() const
Definition: binarystring.hxx:97
\n+
size_type length() const noexcept
Size of converted string in bytes.
Definition: binarystring.hxx:82
\n+
unsigned char char_type
Definition: binarystring.hxx:56
\n+
size_t size_type
Definition: binarystring.hxx:58
\n+
const value_type * data() const noexcept
Unescaped field contents.
Definition: binarystring.hxx:102
\n+
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: binarystring.hxx:63
\n+
const_iterator cbegin() const noexcept
Definition: binarystring.hxx:86
\n+
const char * get() const noexcept
Raw character buffer (no terminating zero is added)
Definition: binarystring.hxx:123
\n+
size_type size() const noexcept
Size of converted string in bytes.
Definition: binarystring.hxx:80
\n+
Reference to a field in a result set.
Definition: field.hxx:50
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,36 +1,200 @@\n \n \n \n \n \n libpqxx\n \n-compiler-internal-pre.hxx\n+binarystring.hxx\n 1\n- 15// NO GUARDS HERE! This code should be executed every time!\n+ 11#ifndef PQXX_H_BINARYSTRING\n+ 12#define PQXX_H_BINARYSTRING\n+ 13\n+ 14#include \"pqxx/compiler-public.hxx\"\n+ 15#include \"pqxx/compiler-internal-pre.hxx\"\n 16\n- 17#ifdef _WIN32\n- 18#ifdef _MSC_VER\n+ 17#include \n+ 18#include \n 19\n- 20// Save client program warning state, and set warning level 4.\n- 21// Setting the warning level explicitly ensures that libpqxx\n- 22// headers will work with this warning level as well.\n- 23#pragma warning (push,4)\n- 24\n- 25#pragma warning (disable: 4251)\n- 26#pragma warning (disable: 4273)\n- 27#pragma warning (disable: 4275)\n- 28#pragma warning (disable: 4355)\n- 29#pragma warning (disable: 4511) // Copy constructor could not be generated.\n- 30#pragma warning (disable: 4512) // Assignment operator could not be\n-generated.\n- 31#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy\n-().\n- 32\n- 33#endif // _MSC_VER\n- 34#endif // _WIN32\n- 35\n+ 20#include \"pqxx/result.hxx\"\n+ 21\n+ 22\n+ 23namespace pqxx\n+ 24{\n+ 25\n+ 27\n+53class PQXX_LIBEXPORT binarystring\n+ 54{\n+ 55public:\n+56 using char_type = unsigned char;\n+57 using value_type = std::char_traits::char_type;\n+58 using size_type = size_t;\n+59 using difference_type = long;\n+60 using const_reference = const value_type &;\n+61 using const_pointer = const value_type *;\n+62 using const_iterator = const_pointer;\n+63 using const_reverse_iterator = std::reverse_iterator;\n+ 64\n+65 binarystring(const binarystring &) =default;\n+ 66\n+ 68\n+ 71 explicit binarystring(const field &); //[t62]\n+ 72\n+ 74 explicit binarystring(const std::string &);\n+ 75\n+ 77 binarystring(const void *, size_t);\n+ 78\n+80 size_type size() const noexcept { return m_size; } //[t62]\n+82 size_type length() const noexcept { return size(); } //[t62]\n+83 bool empty() const noexcept { return size()==0; } //[t62]\n+ 84\n+85 const_iterator begin() const noexcept { return data(); } //[t62]\n+86 const_iterator cbegin() const noexcept { return begin(); }\n+87 const_iterator end() const noexcept { return data()+m_size; } //[t62]\n+88 const_iterator cend() const noexcept { return end(); }\n+ 89\n+90 const_reference front() const noexcept { return *begin(); } //[t62]\n+91 const_reference back() const noexcept //[t62]\n+ 92 { return *(data()+m_size-1); }\n+ 93\n+94 const_reverse_iterator rbegin() const //[t62]\n+ 95 { return const_reverse_iterator{end()}; }\n+96 const_reverse_iterator crbegin() const { return rbegin(); }\n+97 const_reverse_iterator rend() const //[t62]\n+ 98 { return const_reverse_iterator{begin()}; }\n+99 const_reverse_iterator crend() const { return rend(); }\n+ 100\n+102 const value_type *data() const noexcept {return m_buf.get();} //[t62]\n+ 103\n+104 const_reference operator[](size_type i) const noexcept //[t62]\n+ 105 { return data()[i]; }\n+ 106\n+ 107 PQXX_PURE bool operator==(const binarystring &) const noexcept; //[t62]\n+108 bool operator!=(const binarystring &rhs) const noexcept //[t62]\n+ 109 { return not operator==(rhs); }\n+ 110\n+ 111 binarystring &operator=(const binarystring &);\n+ 112\n+ 114 const_reference at(size_type) const; //[t62]\n+ 115\n+ 117 void swap(binarystring &); //[t62]\n+ 118\n+ 120\n+123 const char *get() const noexcept //[t62]\n+ 124 { return reinterpret_cast(m_buf.get()); }\n+ 125\n+ 127\n+ 133 std::string str() const; //[t62]\n+ 134\n+ 135private:\n+ 136 using smart_pointer_type = std::shared_ptr;\n+ 137\n+ 139 static smart_pointer_type make_smart_pointer(unsigned char *buf=nullptr)\n+ 140 {\n+ 141 return smart_pointer_type{\n+ 142 buf,\n+ 143 internal::freemallocmem_templated};\n+ 144 }\n+ 145\n+ 146 smart_pointer_type m_buf;\n+ 147 size_type m_size;\n+ 148};\n+ 149}\n+ 150\n+ 151#include \"pqxx/compiler-internal-post.hxx\"\n+ 152\n+ 153#endif\n+pqxx\n+The home of all libpqxx classes, functions, templates, etc.\n+Definition: array.hxx:26\n+pqxx::binarystring\n+Binary data corresponding to PostgreSQL's \"BYTEA\" binary-string type.\n+Definition: binarystring.hxx:54\n+pqxx::binarystring::crend\n+const_reverse_iterator crend() const\n+Definition: binarystring.hxx:99\n+pqxx::binarystring::rbegin\n+const_reverse_iterator rbegin() const\n+Definition: binarystring.hxx:94\n+pqxx::binarystring::const_iterator\n+const_pointer const_iterator\n+Definition: binarystring.hxx:62\n+pqxx::binarystring::const_reference\n+const value_type & const_reference\n+Definition: binarystring.hxx:60\n+pqxx::binarystring::const_pointer\n+const value_type * const_pointer\n+Definition: binarystring.hxx:61\n+pqxx::binarystring::end\n+const_iterator end() const noexcept\n+Definition: binarystring.hxx:87\n+pqxx::binarystring::begin\n+const_iterator begin() const noexcept\n+Definition: binarystring.hxx:85\n+pqxx::binarystring::value_type\n+std::char_traits< char_type >::char_type value_type\n+Definition: binarystring.hxx:57\n+pqxx::binarystring::difference_type\n+long difference_type\n+Definition: binarystring.hxx:59\n+pqxx::binarystring::crbegin\n+const_reverse_iterator crbegin() const\n+Definition: binarystring.hxx:96\n+pqxx::binarystring::front\n+const_reference front() const noexcept\n+Definition: binarystring.hxx:90\n+pqxx::binarystring::back\n+const_reference back() const noexcept\n+Definition: binarystring.hxx:91\n+pqxx::binarystring::operator!=\n+bool operator!=(const binarystring &rhs) const noexcept\n+Definition: binarystring.hxx:108\n+pqxx::binarystring::empty\n+bool empty() const noexcept\n+Definition: binarystring.hxx:83\n+pqxx::binarystring::binarystring\n+binarystring(const binarystring &)=default\n+pqxx::binarystring::operator[]\n+const_reference operator[](size_type i) const noexcept\n+Definition: binarystring.hxx:104\n+pqxx::binarystring::cend\n+const_iterator cend() const noexcept\n+Definition: binarystring.hxx:88\n+pqxx::binarystring::rend\n+const_reverse_iterator rend() const\n+Definition: binarystring.hxx:97\n+pqxx::binarystring::length\n+size_type length() const noexcept\n+Size of converted string in bytes.\n+Definition: binarystring.hxx:82\n+pqxx::binarystring::char_type\n+unsigned char char_type\n+Definition: binarystring.hxx:56\n+pqxx::binarystring::size_type\n+size_t size_type\n+Definition: binarystring.hxx:58\n+pqxx::binarystring::data\n+const value_type * data() const noexcept\n+Unescaped field contents.\n+Definition: binarystring.hxx:102\n+pqxx::binarystring::const_reverse_iterator\n+std::reverse_iterator< const_iterator > const_reverse_iterator\n+Definition: binarystring.hxx:63\n+pqxx::binarystring::cbegin\n+const_iterator cbegin() const noexcept\n+Definition: binarystring.hxx:86\n+pqxx::binarystring::get\n+const char * get() const noexcept\n+Raw character buffer (no terminating zero is added)\n+Definition: binarystring.hxx:123\n+pqxx::binarystring::size\n+size_type size() const noexcept\n+Size of converted string in bytes.\n+Definition: binarystring.hxx:80\n+pqxx::field\n+Reference to a field in a result set.\n+Definition: field.hxx:50\n * include\n * pqxx\n- * compiler-internal-pre.hxx\n+ * binarystring.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00053_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00053_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: strconv.hxx Source File\n+libpqxx: basic_connection.hxx Source File\n \n \n \n \n \n \n \n@@ -55,322 +55,110 @@\n \n
\n
\n-
strconv.hxx
\n+
basic_connection.hxx
\n
\n
\n
1
\n-
11#ifndef PQXX_H_STRINGCONV
\n-
12#define PQXX_H_STRINGCONV
\n-
13
\n-
14#include "pqxx/compiler-public.hxx"
\n+
13#ifndef PQXX_H_BASIC_CONNECTION
\n+
14#define PQXX_H_BASIC_CONNECTION
\n
15
\n-
16#include <limits>
\n-
17#include <sstream>
\n-
18#include <stdexcept>
\n-
19
\n-
20
\n-
21namespace pqxx
\n-
22{
\n-
23
\n-
46
\n-
48
\n-
51template<typename T, typename = void> struct string_traits;
\n-
52
\n-
53namespace internal
\n-
54{
\n-
56[[noreturn]] PQXX_LIBEXPORT void throw_null_conversion(
\n-
57 const std::string &type);
\n-
58
\n-
60
\n-
67template<typename TYPE> struct type_name;
\n-
68#define PQXX_DECLARE_TYPE_NAME(TYPE) \\
\n-
69 template<> struct type_name<TYPE> \\
\n-
70 { static constexpr const char *value = #TYPE; }
\n+
16#include "pqxx/compiler-public.hxx"
\n+
17#include "pqxx/compiler-internal-pre.hxx"
\n+
18
\n+
19#include <cstddef>
\n+
20#include <memory>
\n+
21#include <string>
\n+
22
\n+
23#include "pqxx/connection_base.hxx"
\n+
24
\n+
25
\n+
26namespace pqxx
\n+
27{
\n+
28
\n+
30
\n+
45template<typename CONNECTPOLICY> class basic_connection_base :
\n+
46 public connection_base
\n+
47{
\n+
48public:
\n+\n+
50 connection_base(m_policy),
\n+
51 m_options(std::string{}),
\n+
52 m_policy(m_options)
\n+
53 { init(); }
\n+
54
\n+
57 explicit basic_connection_base(const std::string &opt) :
\n+
58 connection_base(m_policy),
\n+
59 m_options(opt),
\n+
60 m_policy(m_options)
\n+
61 {init();}
\n+
62
\n+
64 explicit basic_connection_base(const char opt[]) :
\n+
65 basic_connection_base(opt ? std::string{opt} : std::string{}) {}
\n+
66
\n+
67 explicit basic_connection_base(std::nullptr_t) : basic_connection_base() {}
\n+
68
\n+\n+
70 { close(); }
\n
71
\n-\n-\n-
74PQXX_DECLARE_TYPE_NAME(unsigned short);
\n-\n-\n-\n-\n-\n-
80PQXX_DECLARE_TYPE_NAME(unsigned long long);
\n-\n-\n-\n-\n-\n-\n-
87PQXX_DECLARE_TYPE_NAME(const std::string);
\n-
88PQXX_DECLARE_TYPE_NAME(std::stringstream);
\n-
89#undef PQXX_DECLARE_TYPE_NAME
\n-
90
\n-
91template<size_t N> struct type_name<char[N]>
\n-
92{ static constexpr const char *value = "char[]"; };
\n-
93
\n-
94
\n+
72 const std::string &options() const noexcept //[t01]
\n+
73 {return m_policy.options();}
\n+
74
\n+
75private:
\n+
77 std::string m_options;
\n+
79 CONNECTPOLICY m_policy;
\n+
80};
\n+
81
\n+
82
\n+
84
\n+
88template<typename CONNECTPOLICY> struct basic_connection :
\n+
89 basic_connection_base<CONNECTPOLICY>
\n+
90{
\n+
91 PQXX_DEPRECATED basic_connection() =default;
\n+
92 PQXX_DEPRECATED explicit basic_connection(const std::string &opt) :
\n+
93 basic_connection(opt) {}
\n+
94 PQXX_DEPRECATED explicit basic_connection(const char opt[]) :
\n+
95 basic_connection(opt) {}
\n
96
\n-
102template<typename TYPE> struct PQXX_LIBEXPORT builtin_traits
\n-
103{
\n-
104 static constexpr const char *name() noexcept
\n-\n-
106 static constexpr bool has_null() noexcept { return false; }
\n-
107 static bool is_null(TYPE) { return false; }
\n-
108 [[noreturn]] static TYPE null() { throw_null_conversion(name()); }
\n-
109 static void from_string(const char Str[], TYPE &Obj);
\n-
110 static std::string to_string(TYPE Obj);
\n-
111};
\n-
112} // namespace pqxx::internal
\n-
113
\n-
114
\n-
116#define PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(TYPE) \\
\n-
117 template<> struct PQXX_LIBEXPORT string_traits<TYPE> : \\
\n-
118 internal::builtin_traits<TYPE> {};
\n-
119
\n-
120PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(bool)
\n-
121
\n-
122PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(short)
\n-
123PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned short)
\n-
124PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(int)
\n-
125PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned int)
\n-
126PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long)
\n-
127PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long)
\n-
128PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long long)
\n-
129PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long long)
\n-
130
\n-
131PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(float)
\n-
132PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(double)
\n-
133PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long double)
\n-
134
\n-
135#undef PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION
\n-
136
\n-
137
\n-
139
\n-
148template<typename ENUM>
\n-\n-
150{
\n-
151 using underlying_type = typename std::underlying_type<ENUM>::type;
\n-\n-
153
\n-
154 static constexpr bool has_null() noexcept { return false; }
\n-
155 [[noreturn]] static ENUM null()
\n-
156 { internal::throw_null_conversion("enum type"); }
\n-
157
\n-
158 static void from_string(const char Str[], ENUM &Obj)
\n-
159 {
\n-
160 underlying_type tmp;
\n-
161 underlying_traits::from_string(Str, tmp);
\n-
162 Obj = ENUM(tmp);
\n-
163 }
\n-
164
\n-
165 static std::string to_string(ENUM Obj)
\n-
166 { return underlying_traits::to_string(underlying_type(Obj)); }
\n-
167};
\n-
168
\n-
169
\n-
171
\n-
182#define PQXX_DECLARE_ENUM_CONVERSION(ENUM) \\
\n-
183template<> \\
\n-
184struct string_traits<ENUM> : pqxx::enum_traits<ENUM> \\
\n-
185{ \\
\n-
186 static constexpr const char *name() noexcept { return #ENUM; } \\
\n-
187 [[noreturn]] static ENUM null() \\
\n-
188 { internal::throw_null_conversion(name()); } \\
\n-
189}
\n-
190
\n-
191
\n-
193template<> struct PQXX_LIBEXPORT string_traits<const char *>
\n-
194{
\n-
195 static constexpr const char *name() noexcept { return "const char *"; }
\n-
196 static constexpr bool has_null() noexcept { return true; }
\n-
197 static bool is_null(const char *t) { return t == nullptr; }
\n-
198 static const char *null() { return nullptr; }
\n-
199 static void from_string(const char Str[], const char *&Obj) { Obj = Str; }
\n-
200 static std::string to_string(const char *Obj) { return Obj; }
\n-
201};
\n-
202
\n-
204template<> struct PQXX_LIBEXPORT string_traits<char *>
\n-
205{
\n-
206 static constexpr const char *name() noexcept { return "char *"; }
\n-
207 static constexpr bool has_null() noexcept { return true; }
\n-
208 static bool is_null(const char *t) { return t == nullptr; }
\n-
209 static const char *null() { return nullptr; }
\n-
210
\n-
211 // Don't allow this conversion since it breaks const-safety.
\n-
212 // static void from_string(const char Str[], char *&Obj);
\n-
213
\n-
214 static std::string to_string(char *Obj) { return Obj; }
\n-
215};
\n-
216
\n-
218template<size_t N> struct PQXX_LIBEXPORT string_traits<char[N]>
\n-
219{
\n-
220 static constexpr const char *name() noexcept { return "char[]"; }
\n-
221 static constexpr bool has_null() noexcept { return true; }
\n-
222 static bool is_null(const char t[]) { return t == nullptr; }
\n-
223 static const char *null() { return nullptr; }
\n-
224 static std::string to_string(const char Obj[]) { return Obj; }
\n-
225};
\n-
226
\n-
227template<> struct PQXX_LIBEXPORT string_traits<std::string>
\n-
228{
\n-
229 static constexpr const char *name() noexcept { return "string"; }
\n-
230 static constexpr bool has_null() noexcept { return false; }
\n-
231 static bool is_null(const std::string &) { return false; }
\n-
232 [[noreturn]] static std::string null()
\n-\n-
234 static void from_string(const char Str[], std::string &Obj) { Obj=Str; }
\n-
235 static std::string to_string(const std::string &Obj) { return Obj; }
\n-
236};
\n-
237
\n-
238template<> struct PQXX_LIBEXPORT string_traits<const std::string>
\n-
239{
\n-
240 static constexpr const char *name() noexcept { return "const string"; }
\n-
241 static constexpr bool has_null() noexcept { return false; }
\n-
242 static bool is_null(const std::string &) { return false; }
\n-
243 [[noreturn]] static const std::string null()
\n-\n-
245 static const std::string to_string(const std::string &Obj) { return Obj; }
\n-
246};
\n-
247
\n-
248template<> struct PQXX_LIBEXPORT string_traits<std::stringstream>
\n-
249{
\n-
250 static constexpr const char *name() noexcept { return "stringstream"; }
\n-
251 static constexpr bool has_null() noexcept { return false; }
\n-
252 static bool is_null(const std::stringstream &) { return false; }
\n-
253 [[noreturn]] static std::stringstream null()
\n-\n-
255 static void from_string(const char Str[], std::stringstream &Obj)
\n-
256 { Obj.clear(); Obj << Str; }
\n-
257 static std::string to_string(const std::stringstream &Obj)
\n-
258 { return Obj.str(); }
\n-
259};
\n-
260
\n-
261
\n-
262// TODO: Implement date conversions.
\n-
263
\n-
265
\n-
277template<typename T>
\n-
278 inline void from_string(const char Str[], T &Obj)
\n-
279{
\n-
280 if (Str == nullptr) throw std::runtime_error{"Attempt to read null string."};
\n-\n-
282}
\n-
283
\n-
284
\n-
286
\n-
292template<typename T> inline void from_string(const char Str[], T &Obj, size_t)
\n-
293{
\n-
294 return from_string(Str, Obj);
\n-
295}
\n-
296
\n-
297template<>
\n-
298 inline void from_string<std::string>( //[t00]
\n-
299 const char Str[],
\n-
300 std::string &Obj,
\n-
301 size_t len)
\n-
302{
\n-
303 if (Str == nullptr) throw std::runtime_error{"Attempt to read null string."};
\n-
304 Obj.assign(Str, len);
\n-
305}
\n-
306
\n-
307template<typename T>
\n-
308 inline void from_string(const std::string &Str, T &Obj) //[t45]
\n-
309 { from_string(Str.c_str(), Obj); }
\n-
310
\n-
311template<typename T>
\n-
312 inline void from_string(const std::stringstream &Str, T &Obj) //[t00]
\n-
313 { from_string(Str.str(), Obj); }
\n-
314
\n-
315template<> inline void
\n-
316from_string(const std::string &Str, std::string &Obj) //[t46]
\n-
317 { Obj = Str; }
\n-
318
\n-
319
\n-
320namespace internal
\n-
321{
\n-
323constexpr int digit_to_number(char c) noexcept { return c-'0'; }
\n-
324constexpr char number_to_digit(int i) noexcept
\n-
325 { return static_cast<char>(i+'0'); }
\n-
326} // namespace pqxx::internal
\n-
327
\n-
328
\n-
330
\n-
334template<typename T> inline std::string to_string(const T &Obj)
\n-
335 { return string_traits<T>::to_string(Obj); }
\n-
336
\n-
338
\n-
339} // namespace pqxx
\n-
340
\n-
341#endif
\n+
97 PQXX_DEPRECATED explicit basic_connection(std::nullptr_t) :
\n+\n+
99
\n+
100 using basic_connection_base<CONNECTPOLICY>::options;
\n+
101};
\n+
102
\n+
103} // namespace
\n+
104
\n+
105#include "pqxx/compiler-internal-post.hxx"
\n+
106
\n+
107#endif
\n
STL namespace.
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
void from_string(const field &F, T &Obj)
Convert a field's string contents to another type.
Definition: field.hxx:365
\n-
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
\n-
PQXX_DECLARE_TYPE_NAME(bool)
\n-
constexpr char number_to_digit(int i) noexcept
Definition: strconv.hxx:324
\n-
constexpr int digit_to_number(char c) noexcept
Compute numeric value of given textual digit (assuming that it is a digit)
Definition: strconv.hxx:323
\n-
void throw_null_conversion(const std::string &type)
Throw exception for attempt to convert null to given type.
Definition: strconv.cxx:58
\n-
Traits class for use in string conversions.
Definition: strconv.hxx:51
\n-
Give a human-readable name for a type, at compile time.
Definition: strconv.hxx:67
\n-
Helper: string traits implementation for built-in types.
Definition: strconv.hxx:103
\n-
static void from_string(const char Str[], TYPE &Obj)
\n-
static bool is_null(TYPE)
Definition: strconv.hxx:107
\n-
static std::string to_string(TYPE Obj)
\n-
static TYPE null()
Definition: strconv.hxx:108
\n-
static constexpr const char * name() noexcept
Definition: strconv.hxx:104
\n-
static constexpr bool has_null() noexcept
Definition: strconv.hxx:106
\n-
Helper class for defining enum conversions.
Definition: strconv.hxx:150
\n-
static std::string to_string(ENUM Obj)
Definition: strconv.hxx:165
\n-
static ENUM null()
Definition: strconv.hxx:155
\n-
static constexpr bool has_null() noexcept
Definition: strconv.hxx:154
\n-
static void from_string(const char Str[], ENUM &Obj)
Definition: strconv.hxx:158
\n-
typename std::underlying_type< ENUM >::type underlying_type
Definition: strconv.hxx:151
\n-
static const char * null()
Definition: strconv.hxx:198
\n-
static std::string to_string(const char *Obj)
Definition: strconv.hxx:200
\n-
static bool is_null(const char *t)
Definition: strconv.hxx:197
\n-
static constexpr const char * name() noexcept
Definition: strconv.hxx:195
\n-
static void from_string(const char Str[], const char *&Obj)
Definition: strconv.hxx:199
\n-
static constexpr bool has_null() noexcept
Definition: strconv.hxx:196
\n-
static constexpr const char * name() noexcept
Definition: strconv.hxx:206
\n-
static bool is_null(const char *t)
Definition: strconv.hxx:208
\n-
static std::string to_string(char *Obj)
Definition: strconv.hxx:214
\n-
static constexpr bool has_null() noexcept
Definition: strconv.hxx:207
\n-
static const char * null()
Definition: strconv.hxx:209
\n-
static constexpr bool has_null() noexcept
Definition: strconv.hxx:221
\n-
static constexpr const char * name() noexcept
Definition: strconv.hxx:220
\n-
static const char * null()
Definition: strconv.hxx:223
\n-
static bool is_null(const char t[])
Definition: strconv.hxx:222
\n-
static std::string to_string(const char Obj[])
Definition: strconv.hxx:224
\n-
static bool is_null(const std::string &)
Definition: strconv.hxx:231
\n-
static void from_string(const char Str[], std::string &Obj)
Definition: strconv.hxx:234
\n-
static std::string to_string(const std::string &Obj)
Definition: strconv.hxx:235
\n-
static constexpr bool has_null() noexcept
Definition: strconv.hxx:230
\n-
static constexpr const char * name() noexcept
Definition: strconv.hxx:229
\n-
static std::string null()
Definition: strconv.hxx:232
\n-
static const std::string null()
Definition: strconv.hxx:243
\n-
static constexpr const char * name() noexcept
Definition: strconv.hxx:240
\n-
static const std::string to_string(const std::string &Obj)
Definition: strconv.hxx:245
\n-
static bool is_null(const std::string &)
Definition: strconv.hxx:242
\n-
static constexpr bool has_null() noexcept
Definition: strconv.hxx:241
\n-
static constexpr bool has_null() noexcept
Definition: strconv.hxx:251
\n-
static bool is_null(const std::stringstream &)
Definition: strconv.hxx:252
\n-
static std::string to_string(const std::stringstream &Obj)
Definition: strconv.hxx:257
\n-
static void from_string(const char Str[], std::stringstream &Obj)
Definition: strconv.hxx:255
\n-
static constexpr const char * name() noexcept
Definition: strconv.hxx:250
\n-
static std::stringstream null()
Definition: strconv.hxx:253
\n+
Base-class template for all libpqxx connection types.
Definition: basic_connection.hxx:47
\n+
basic_connection_base(const std::string &opt)
Definition: basic_connection.hxx:57
\n+
const std::string & options() const noexcept
Definition: basic_connection.hxx:72
\n+
basic_connection_base(std::nullptr_t)
Definition: basic_connection.hxx:67
\n+
~basic_connection_base() noexcept
Definition: basic_connection.hxx:69
\n+
basic_connection_base(const char opt[])
See: basic_connection(const std::string &opt)
Definition: basic_connection.hxx:64
\n+
basic_connection_base()
Definition: basic_connection.hxx:49
\n+
Concrete connection type template.
Definition: basic_connection.hxx:90
\n+
basic_connection(const std::string &opt)
Definition: basic_connection.hxx:92
\n+
basic_connection(std::nullptr_t)
Definition: basic_connection.hxx:97
\n+
basic_connection(const char opt[])
Definition: basic_connection.hxx:94
\n+\n+
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n+
void init()
Definition: connection_base.cxx:99
\n+
void close() noexcept
Definition: connection_base.cxx:902
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,428 +1,134 @@\n \n \n \n \n \n libpqxx\n \n-strconv.hxx\n+basic_connection.hxx\n 1\n- 11#ifndef PQXX_H_STRINGCONV\n- 12#define PQXX_H_STRINGCONV\n- 13\n- 14#include \"pqxx/compiler-public.hxx\"\n+ 13#ifndef PQXX_H_BASIC_CONNECTION\n+ 14#define PQXX_H_BASIC_CONNECTION\n 15\n- 16#include \n- 17#include \n- 18#include \n- 19\n- 20\n- 21namespace pqxx\n- 22{\n- 23\n- 46\n- 48\n-51template struct string_traits;\n- 52\n- 53namespace internal\n- 54{\n- 56[[noreturn]] PQXX_LIBEXPORT void throw_null_conversion(\n- 57 const std::string &type);\n- 58\n- 60\n-67template struct type_name;\n- 68#define PQXX_DECLARE_TYPE_NAME(TYPE) \\\n- 69 template<> struct type_name \\\n- 70 { static constexpr const char *value = #TYPE; }\n+ 16#include \"pqxx/compiler-public.hxx\"\n+ 17#include \"pqxx/compiler-internal-pre.hxx\"\n+ 18\n+ 19#include \n+ 20#include \n+ 21#include \n+ 22\n+ 23#include \"pqxx/connection_base.hxx\"\n+ 24\n+ 25\n+ 26namespace pqxx\n+ 27{\n+ 28\n+ 30\n+45template class basic_connection_base :\n+ 46 public connection_base\n+ 47{\n+ 48public:\n+49 basic_connection_base() :\n+ 50 connection_base(m_policy),\n+ 51 m_options(std::string{}),\n+ 52 m_policy(m_options)\n+ 53 { init(); }\n+ 54\n+57 explicit basic_connection_base(const std::string &opt) :\n+ 58 connection_base(m_policy),\n+ 59 m_options(opt),\n+ 60 m_policy(m_options)\n+ 61 {init();}\n+ 62\n+64 explicit basic_connection_base(const char opt[]) :\n+ 65 basic_connection_base(opt ? std::string{opt} : std::string{}) {}\n+ 66\n+67 explicit basic_connection_base(std::nullptr_t) : basic_connection_base() {}\n+ 68\n+69 ~basic_connection_base() noexcept\n+ 70 { close(); }\n 71\n-72PQXX_DECLARE_TYPE_NAME(bool);\n-73PQXX_DECLARE_TYPE_NAME(short);\n-74PQXX_DECLARE_TYPE_NAME(unsigned short);\n-75PQXX_DECLARE_TYPE_NAME(int);\n-76PQXX_DECLARE_TYPE_NAME(unsigned int);\n-77PQXX_DECLARE_TYPE_NAME(long);\n-78PQXX_DECLARE_TYPE_NAME(unsigned long);\n-79PQXX_DECLARE_TYPE_NAME(long long);\n-80PQXX_DECLARE_TYPE_NAME(unsigned long long);\n-81PQXX_DECLARE_TYPE_NAME(float);\n-82PQXX_DECLARE_TYPE_NAME(double);\n-83PQXX_DECLARE_TYPE_NAME(long double);\n-84PQXX_DECLARE_TYPE_NAME(char *);\n-85PQXX_DECLARE_TYPE_NAME(const char *);\n-86PQXX_DECLARE_TYPE_NAME(std::string);\n- 87PQXX_DECLARE_TYPE_NAME(const std::string);\n-88PQXX_DECLARE_TYPE_NAME(std::stringstream);\n- 89#undef PQXX_DECLARE_TYPE_NAME\n- 90\n-91template struct type_name\n-92{ static constexpr const char *value = \"char[]\"; };\n- 93\n- 94\n+72 const std::string &options() const noexcept //[t01]\n+ 73 {return m_policy.options();}\n+ 74\n+ 75private:\n+ 77 std::string m_options;\n+ 79 CONNECTPOLICY m_policy;\n+ 80};\n+ 81\n+ 82\n+ 84\n+88template struct basic_connection :\n+ 89 basic_connection_base\n+ 90{\n+91 PQXX_DEPRECATED basic_connection() =default;\n+92 PQXX_DEPRECATED explicit basic_connection(const std::string &opt) :\n+ 93 basic_connection(opt) {}\n+94 PQXX_DEPRECATED explicit basic_connection(const char opt[]) :\n+ 95 basic_connection(opt) {}\n 96\n-102template struct PQXX_LIBEXPORT builtin_traits\n- 103{\n-104 static constexpr const char *name() noexcept\n- 105 { return internal::type_name::value; }\n-106 static constexpr bool has_null() noexcept { return false; }\n-107 static bool is_null(TYPE) { return false; }\n-108 [[noreturn]] static TYPE null() { throw_null_conversion(name()); }\n-109 static void from_string(const char Str[], TYPE &Obj);\n-110 static std::string to_string(TYPE Obj);\n- 111};\n- 112} // namespace pqxx::internal\n- 113\n- 114\n- 116#define PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(TYPE) \\\n- 117 template<> struct PQXX_LIBEXPORT string_traits : \\\n- 118 internal::builtin_traits {};\n- 119\n- 120PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(bool)\n- 121\n- 122PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(short)\n- 123PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned short)\n- 124PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(int)\n- 125PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned int)\n- 126PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long)\n- 127PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long)\n- 128PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long long)\n- 129PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long long)\n- 130\n- 131PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(float)\n- 132PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(double)\n- 133PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long double)\n- 134\n- 135#undef PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION\n- 136\n- 137\n- 139\n- 148template\n-149struct enum_traits\n- 150{\n-151 using underlying_type = typename std::underlying_type::type;\n-152 using underlying_traits = string_traits;\n- 153\n-154 static constexpr bool has_null() noexcept { return false; }\n-155 [[noreturn]] static ENUM null()\n- 156 { internal::throw_null_conversion(\"enum type\"); }\n- 157\n-158 static void from_string(const char Str[], ENUM &Obj)\n- 159 {\n- 160 underlying_type tmp;\n- 161 underlying_traits::from_string(Str, tmp);\n- 162 Obj = ENUM(tmp);\n- 163 }\n- 164\n-165 static std::string to_string(ENUM Obj)\n- 166 { return underlying_traits::to_string(underlying_type(Obj)); }\n- 167};\n- 168\n- 169\n- 171\n- 182#define PQXX_DECLARE_ENUM_CONVERSION(ENUM) \\\n- 183template<> \\\n- 184struct string_traits : pqxx::enum_traits \\\n- 185{ \\\n- 186 static constexpr const char *name() noexcept { return #ENUM; } \\\n- 187 [[noreturn]] static ENUM null() \\\n- 188 { internal::throw_null_conversion(name()); } \\\n- 189}\n- 190\n- 191\n-193template<> struct PQXX_LIBEXPORT string_traits\n- 194{\n-195 static constexpr const char *name() noexcept { return \"const char *\"; }\n-196 static constexpr bool has_null() noexcept { return true; }\n-197 static bool is_null(const char *t) { return t == nullptr; }\n-198 static const char *null() { return nullptr; }\n-199 static void from_string(const char Str[], const char *&Obj) { Obj = Str; }\n-200 static std::string to_string(const char *Obj) { return Obj; }\n- 201};\n- 202\n-204template<> struct PQXX_LIBEXPORT string_traits\n- 205{\n-206 static constexpr const char *name() noexcept { return \"char *\"; }\n-207 static constexpr bool has_null() noexcept { return true; }\n-208 static bool is_null(const char *t) { return t == nullptr; }\n-209 static const char *null() { return nullptr; }\n- 210\n- 211 // Don't allow this conversion since it breaks const-safety.\n- 212 // static void from_string(const char Str[], char *&Obj);\n- 213\n-214 static std::string to_string(char *Obj) { return Obj; }\n- 215};\n- 216\n-218template struct PQXX_LIBEXPORT string_traits\n- 219{\n-220 static constexpr const char *name() noexcept { return \"char[]\"; }\n-221 static constexpr bool has_null() noexcept { return true; }\n-222 static bool is_null(const char t[]) { return t == nullptr; }\n-223 static const char *null() { return nullptr; }\n-224 static std::string to_string(const char Obj[]) { return Obj; }\n- 225};\n- 226\n-227template<> struct PQXX_LIBEXPORT string_traits\n- 228{\n-229 static constexpr const char *name() noexcept { return \"string\"; }\n-230 static constexpr bool has_null() noexcept { return false; }\n-231 static bool is_null(const std::string &) { return false; }\n-232 [[noreturn]] static std::string null()\n- 233 { internal::throw_null_conversion(name()); }\n-234 static void from_string(const char Str[], std::string &Obj) { Obj=Str; }\n-235 static std::string to_string(const std::string &Obj) { return Obj; }\n- 236};\n- 237\n-238template<> struct PQXX_LIBEXPORT string_traits\n- 239{\n-240 static constexpr const char *name() noexcept { return \"const string\"; }\n-241 static constexpr bool has_null() noexcept { return false; }\n-242 static bool is_null(const std::string &) { return false; }\n-243 [[noreturn]] static const std::string null()\n- 244 { internal::throw_null_conversion(name()); }\n-245 static const std::string to_string(const std::string &Obj) { return Obj; }\n- 246};\n- 247\n-248template<> struct PQXX_LIBEXPORT string_traits\n- 249{\n-250 static constexpr const char *name() noexcept { return \"stringstream\"; }\n-251 static constexpr bool has_null() noexcept { return false; }\n-252 static bool is_null(const std::stringstream &) { return false; }\n-253 [[noreturn]] static std::stringstream null()\n- 254 { internal::throw_null_conversion(name()); }\n-255 static void from_string(const char Str[], std::stringstream &Obj)\n- 256 { Obj.clear(); Obj << Str; }\n-257 static std::string to_string(const std::stringstream &Obj)\n- 258 { return Obj.str(); }\n- 259};\n- 260\n- 261\n- 262// TODO: Implement date conversions.\n- 263\n- 265\n- 277template\n-278 inline void from_string(const char Str[], T &Obj)\n- 279{\n- 280 if (Str == nullptr) throw std::runtime_error{\"Attempt to read null\n-string.\"};\n- 281 string_traits::from_string(Str, Obj);\n- 282}\n- 283\n- 284\n- 286\n-292template inline void from_string(const char Str[], T &Obj,\n-size_t)\n- 293{\n- 294 return from_string(Str, Obj);\n- 295}\n- 296\n- 297template<>\n-298 inline void from_string( //[t00]\n- 299 const char Str[],\n- 300 std::string &Obj,\n- 301 size_t len)\n- 302{\n- 303 if (Str == nullptr) throw std::runtime_error{\"Attempt to read null\n-string.\"};\n- 304 Obj.assign(Str, len);\n- 305}\n- 306\n- 307template\n-308 inline void from_string(const std::string &Str, T &Obj) //[t45]\n- 309 { from_string(Str.c_str(), Obj); }\n- 310\n- 311template\n-312 inline void from_string(const std::stringstream &Str, T &Obj) //[t00]\n- 313 { from_string(Str.str(), Obj); }\n- 314\n- 315template<> inline void\n-316from_string(const std::string &Str, std::string &Obj) //[t46]\n- 317 { Obj = Str; }\n- 318\n- 319\n- 320namespace internal\n- 321{\n-323constexpr int digit_to_number(char c) noexcept { return c-'0'; }\n-324constexpr char number_to_digit(int i) noexcept\n- 325 { return static_cast(i+'0'); }\n- 326} // namespace pqxx::internal\n- 327\n- 328\n- 330\n-334template inline std::string to_string(const T &Obj)\n- 335 { return string_traits::to_string(Obj); }\n- 336\n- 338\n- 339} // namespace pqxx\n- 340\n- 341#endif\n+97 PQXX_DEPRECATED explicit basic_connection(std::nullptr_t) :\n+ 98 basic_connection() {}\n+ 99\n+ 100 using basic_connection_base::options;\n+ 101};\n+ 102\n+ 103} // namespace\n+ 104\n+ 105#include \"pqxx/compiler-internal-post.hxx\"\n+ 106\n+ 107#endif\n std\n STL namespace.\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::from_string\n-void from_string(const field &F, T &Obj)\n-Convert a field's string contents to another type.\n-Definition: field.hxx:365\n-pqxx::to_string\n-std::string to_string(const field &Obj)\n-Convert a field to a string.\n-Definition: result.cxx:451\n-pqxx::internal::PQXX_DECLARE_TYPE_NAME\n-PQXX_DECLARE_TYPE_NAME(bool)\n-pqxx::internal::number_to_digit\n-constexpr char number_to_digit(int i) noexcept\n-Definition: strconv.hxx:324\n-pqxx::internal::digit_to_number\n-constexpr int digit_to_number(char c) noexcept\n-Compute numeric value of given textual digit (assuming that it is a digit)\n-Definition: strconv.hxx:323\n-pqxx::internal::throw_null_conversion\n-void throw_null_conversion(const std::string &type)\n-Throw exception for attempt to convert null to given type.\n-Definition: strconv.cxx:58\n-pqxx::string_traits\n-Traits class for use in string conversions.\n-Definition: strconv.hxx:51\n-pqxx::internal::type_name\n-Give a human-readable name for a type, at compile time.\n-Definition: strconv.hxx:67\n-pqxx::internal::builtin_traits\n-Helper: string traits implementation for built-in types.\n-Definition: strconv.hxx:103\n-pqxx::internal::builtin_traits::from_string\n-static void from_string(const char Str[], TYPE &Obj)\n-pqxx::internal::builtin_traits::is_null\n-static bool is_null(TYPE)\n-Definition: strconv.hxx:107\n-pqxx::internal::builtin_traits::to_string\n-static std::string to_string(TYPE Obj)\n-pqxx::internal::builtin_traits::null\n-static TYPE null()\n-Definition: strconv.hxx:108\n-pqxx::internal::builtin_traits::name\n-static constexpr const char * name() noexcept\n-Definition: strconv.hxx:104\n-pqxx::internal::builtin_traits::has_null\n-static constexpr bool has_null() noexcept\n-Definition: strconv.hxx:106\n-pqxx::enum_traits\n-Helper class for defining enum conversions.\n-Definition: strconv.hxx:150\n-pqxx::enum_traits::to_string\n-static std::string to_string(ENUM Obj)\n-Definition: strconv.hxx:165\n-pqxx::enum_traits::null\n-static ENUM null()\n-Definition: strconv.hxx:155\n-pqxx::enum_traits::has_null\n-static constexpr bool has_null() noexcept\n-Definition: strconv.hxx:154\n-pqxx::enum_traits::from_string\n-static void from_string(const char Str[], ENUM &Obj)\n-Definition: strconv.hxx:158\n-pqxx::enum_traits::underlying_type\n-typename std::underlying_type< ENUM >::type underlying_type\n-Definition: strconv.hxx:151\n-pqxx::string_traits<_const_char_*_>::null\n-static const char * null()\n-Definition: strconv.hxx:198\n-pqxx::string_traits<_const_char_*_>::to_string\n-static std::string to_string(const char *Obj)\n-Definition: strconv.hxx:200\n-pqxx::string_traits<_const_char_*_>::is_null\n-static bool is_null(const char *t)\n-Definition: strconv.hxx:197\n-pqxx::string_traits<_const_char_*_>::name\n-static constexpr const char * name() noexcept\n-Definition: strconv.hxx:195\n-pqxx::string_traits<_const_char_*_>::from_string\n-static void from_string(const char Str[], const char *&Obj)\n-Definition: strconv.hxx:199\n-pqxx::string_traits<_const_char_*_>::has_null\n-static constexpr bool has_null() noexcept\n-Definition: strconv.hxx:196\n-pqxx::string_traits<_char_*_>::name\n-static constexpr const char * name() noexcept\n-Definition: strconv.hxx:206\n-pqxx::string_traits<_char_*_>::is_null\n-static bool is_null(const char *t)\n-Definition: strconv.hxx:208\n-pqxx::string_traits<_char_*_>::to_string\n-static std::string to_string(char *Obj)\n-Definition: strconv.hxx:214\n-pqxx::string_traits<_char_*_>::has_null\n-static constexpr bool has_null() noexcept\n-Definition: strconv.hxx:207\n-pqxx::string_traits<_char_*_>::null\n-static const char * null()\n-Definition: strconv.hxx:209\n-pqxx::string_traits<_char[N]>::has_null\n-static constexpr bool has_null() noexcept\n-Definition: strconv.hxx:221\n-pqxx::string_traits<_char[N]>::name\n-static constexpr const char * name() noexcept\n-Definition: strconv.hxx:220\n-pqxx::string_traits<_char[N]>::null\n-static const char * null()\n-Definition: strconv.hxx:223\n-pqxx::string_traits<_char[N]>::is_null\n-static bool is_null(const char t[])\n-Definition: strconv.hxx:222\n-pqxx::string_traits<_char[N]>::to_string\n-static std::string to_string(const char Obj[])\n-Definition: strconv.hxx:224\n-pqxx::string_traits<_std::string_>::is_null\n-static bool is_null(const std::string &)\n-Definition: strconv.hxx:231\n-pqxx::string_traits<_std::string_>::from_string\n-static void from_string(const char Str[], std::string &Obj)\n-Definition: strconv.hxx:234\n-pqxx::string_traits<_std::string_>::to_string\n-static std::string to_string(const std::string &Obj)\n-Definition: strconv.hxx:235\n-pqxx::string_traits<_std::string_>::has_null\n-static constexpr bool has_null() noexcept\n-Definition: strconv.hxx:230\n-pqxx::string_traits<_std::string_>::name\n-static constexpr const char * name() noexcept\n-Definition: strconv.hxx:229\n-pqxx::string_traits<_std::string_>::null\n-static std::string null()\n-Definition: strconv.hxx:232\n-pqxx::string_traits<_const_std::string_>::null\n-static const std::string null()\n-Definition: strconv.hxx:243\n-pqxx::string_traits<_const_std::string_>::name\n-static constexpr const char * name() noexcept\n-Definition: strconv.hxx:240\n-pqxx::string_traits<_const_std::string_>::to_string\n-static const std::string to_string(const std::string &Obj)\n-Definition: strconv.hxx:245\n-pqxx::string_traits<_const_std::string_>::is_null\n-static bool is_null(const std::string &)\n-Definition: strconv.hxx:242\n-pqxx::string_traits<_const_std::string_>::has_null\n-static constexpr bool has_null() noexcept\n-Definition: strconv.hxx:241\n-pqxx::string_traits<_std::stringstream_>::has_null\n-static constexpr bool has_null() noexcept\n-Definition: strconv.hxx:251\n-pqxx::string_traits<_std::stringstream_>::is_null\n-static bool is_null(const std::stringstream &)\n-Definition: strconv.hxx:252\n-pqxx::string_traits<_std::stringstream_>::to_string\n-static std::string to_string(const std::stringstream &Obj)\n-Definition: strconv.hxx:257\n-pqxx::string_traits<_std::stringstream_>::from_string\n-static void from_string(const char Str[], std::stringstream &Obj)\n-Definition: strconv.hxx:255\n-pqxx::string_traits<_std::stringstream_>::name\n-static constexpr const char * name() noexcept\n-Definition: strconv.hxx:250\n-pqxx::string_traits<_std::stringstream_>::null\n-static std::stringstream null()\n-Definition: strconv.hxx:253\n+pqxx::basic_connection_base\n+Base-class template for all libpqxx connection types.\n+Definition: basic_connection.hxx:47\n+pqxx::basic_connection_base::basic_connection_base\n+basic_connection_base(const std::string &opt)\n+Definition: basic_connection.hxx:57\n+pqxx::basic_connection_base::options\n+const std::string & options() const noexcept\n+Definition: basic_connection.hxx:72\n+pqxx::basic_connection_base::basic_connection_base\n+basic_connection_base(std::nullptr_t)\n+Definition: basic_connection.hxx:67\n+pqxx::basic_connection_base::~basic_connection_base\n+~basic_connection_base() noexcept\n+Definition: basic_connection.hxx:69\n+pqxx::basic_connection_base::basic_connection_base\n+basic_connection_base(const char opt[])\n+See: basic_connection(const std::string &opt)\n+Definition: basic_connection.hxx:64\n+pqxx::basic_connection_base::basic_connection_base\n+basic_connection_base()\n+Definition: basic_connection.hxx:49\n+pqxx::basic_connection\n+Concrete connection type template.\n+Definition: basic_connection.hxx:90\n+pqxx::basic_connection::basic_connection\n+basic_connection(const std::string &opt)\n+Definition: basic_connection.hxx:92\n+pqxx::basic_connection::basic_connection\n+basic_connection(std::nullptr_t)\n+Definition: basic_connection.hxx:97\n+pqxx::basic_connection::basic_connection\n+basic_connection(const char opt[])\n+Definition: basic_connection.hxx:94\n+pqxx::basic_connection::basic_connection\n+basic_connection()=default\n+pqxx::connection_base\n+connection_base abstract base class; represents a connection to a database.\n+Definition: connection_base.hxx:140\n+pqxx::connection_base::init\n+void init()\n+Definition: connection_base.cxx:99\n+pqxx::connection_base::close\n+void close() noexcept\n+Definition: connection_base.cxx:902\n * include\n * pqxx\n- * strconv.hxx\n+ * basic_connection.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00056_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00056_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: isolation.hxx Source File\n+libpqxx: cursor.hxx Source File\n \n \n \n \n \n \n \n@@ -55,73 +55,318 @@\n \n
\n
\n-
isolation.hxx
\n+
cursor.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_ISOLATION
\n-
14#define PQXX_H_ISOLATION
\n+
13#ifndef PQXX_H_CURSOR
\n+
14#define PQXX_H_CURSOR
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n
18
\n-
19#include "pqxx/util.hxx"
\n-
20
\n-
21namespace pqxx
\n-
22{
\n-
23
\n+
19#include <limits>
\n+
20#include <stdexcept>
\n+
21
\n+
22#include "pqxx/result.hxx"
\n+
23#include "pqxx/transaction_base.hxx"
\n+
24
\n
25
\n-\n-
57{
\n-
58 // read_uncommitted,
\n-\n-\n-\n-
62};
\n-
63
\n-
65template<isolation_level LEVEL> struct isolation_traits
\n-
66{
\n-
67 static constexpr isolation_level level() noexcept { return LEVEL; }
\n-
68 static constexpr const char *name() noexcept;
\n-
69};
\n-
70
\n+
26namespace pqxx
\n+
27{
\n+
29
\n+
40class PQXX_LIBEXPORT cursor_base
\n+
41{
\n+
42public:
\n+\n+\n+
45
\n+
47
\n+\n+
51 {
\n+\n+
55 random_access
\n+
56 };
\n+
57
\n+
59
\n+\n+
63 {
\n+\n+
67 update
\n+
68 };
\n+
69
\n
71
\n-
72template<>
\n-
73inline constexpr const char *isolation_traits<read_committed>::name() noexcept
\n-
74 { return "READ COMMITTED"; }
\n-
75
\n-
76template<>
\n-
77inline constexpr const char *isolation_traits<repeatable_read>::name() noexcept
\n-
78 { return "REPEATABLE READ"; }
\n-
79
\n-
80template<>
\n-
81inline constexpr const char *isolation_traits<serializable>::name() noexcept
\n-
82 { return "SERIALIZABLE"; }
\n-
83
\n-
84}
\n-
85
\n-
86#include "pqxx/compiler-internal-post.hxx"
\n-
87#endif
\n+\n+
90 {
\n+\n+
94 loose
\n+
95 };
\n+
96
\n+
97 cursor_base() =delete;
\n+
98 cursor_base(const cursor_base &) =delete;
\n+\n+
100
\n+
105
\n+
107
\n+
110 static difference_type all() noexcept; //[t81]
\n+
111
\n+
113
\n+
115 static difference_type next() noexcept { return 1; } //[t81]
\n+
116
\n+
118
\n+
120 static difference_type prior() noexcept { return -1; } //[t00]
\n+
121
\n+
123
\n+
125 static difference_type backward_all() noexcept; //[t00]
\n+
126
\n+
128
\n+
130
\n+
135 const std::string &name() const noexcept { return m_name; } //[t81]
\n+
136
\n+
137protected:
\n+\n+\n+
140 const std::string &Name,
\n+
141 bool embellish_name=true);
\n+
142
\n+
143 const std::string m_name;
\n+
144};
\n+
145} // namespace pqxx
\n+
146
\n+
147
\n+
148#include <pqxx/internal/sql_cursor.hxx>
\n+
149
\n+
150
\n+
151namespace pqxx
\n+
152{
\n+
154
\n+
160template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
\n+\n+
162{
\n+
163public:
\n+\n+\n+
166
\n+\n+
169 transaction_base &trans,
\n+
170 const std::string &query,
\n+
171 const std::string &cname,
\n+
172 bool hold) :
\n+
173 m_cur{trans, query, cname, cursor_base::random_access, up, op, hold}
\n+
174 {
\n+
175 }
\n+
176
\n+\n+
179 transaction_base &trans,
\n+
180 const std::string adopted_cursor) :
\n+
181 m_cur{trans, adopted_cursor, op}
\n+
182 {
\n+
183 // Put cursor in known position
\n+
184 m_cur.move(cursor_base::backward_all());
\n+
185 }
\n+
186
\n+
187 void close() noexcept { m_cur.close(); }
\n+
188
\n+
190
\n+
193 size_type size() { return internal::obtain_stateless_cursor_size(m_cur); }
\n+
194
\n+
196
\n+\n+
208 {
\n+
209 return internal::stateless_cursor_retrieve(
\n+
210 m_cur,
\n+\n+
212 begin_pos,
\n+
213 end_pos);
\n+
214 }
\n+
215
\n+
216 const std::string &name() const noexcept { return m_cur.name(); }
\n+
217
\n+
218private:
\n+
219 internal::sql_cursor m_cur;
\n+
220};
\n+
221
\n+
222
\n+
223class icursor_iterator;
\n+
224
\n+
225
\n+
226namespace internal
\n+
227{
\n+
228namespace gate
\n+
229{
\n+
230class icursor_iterator_icursorstream;
\n+
231class icursorstream_icursor_iterator;
\n+
232} // namespace internal::gate
\n+
233} // namespace internal
\n+
234
\n+
235
\n+
237
\n+
252class PQXX_LIBEXPORT icursorstream
\n+
253{
\n+
254public:
\n+\n+\n+
257
\n+
259
\n+\n+
271 transaction_base &context,
\n+
272 const std::string &query,
\n+
273 const std::string &basename,
\n+
274 difference_type sstride=1); //[t81]
\n+
275
\n+
277
\n+\n+
302 transaction_base &context,
\n+
303 const field &cname,
\n+
304 difference_type sstride=1,
\n+\n+
306
\n+
307 operator bool() const noexcept { return not m_done; }
\n+
308
\n+
310
\n+
316 icursorstream &get(result &res) { res = fetchblock(); return *this; } //[t81]
\n+
318
\n+
324 icursorstream &operator>>(result &res) { return get(res); } //[t81]
\n+
325
\n+
327
\n+
331 icursorstream &ignore(std::streamsize n=1); //[t81]
\n+
332
\n+
334
\n+
337 void set_stride(difference_type stride); //[t81]
\n+
338 difference_type stride() const noexcept { return m_stride; } //[t81]
\n+
339
\n+
340private:
\n+
341 result fetchblock();
\n+
342
\n+
343 friend class internal::gate::icursorstream_icursor_iterator;
\n+
344 size_type forward(size_type n=1);
\n+
345 void insert_iterator(icursor_iterator *) noexcept;
\n+
346 void remove_iterator(icursor_iterator *) const noexcept;
\n+
347
\n+
348 void service_iterators(difference_type);
\n+
349
\n+
350 internal::sql_cursor m_cur;
\n+
351
\n+
352 difference_type m_stride;
\n+
353 difference_type m_realpos, m_reqpos;
\n+
354
\n+
355 mutable icursor_iterator *m_iterators;
\n+
356
\n+
357 bool m_done;
\n+
358};
\n+
359
\n+
360
\n+
362
\n+
388class PQXX_LIBEXPORT icursor_iterator
\n+
389{
\n+
390public:
\n+
391 using iterator_category = std::input_iterator_tag;
\n+\n+
393 using pointer = const result *;
\n+
394 using reference = const result &;
\n+\n+\n+\n+
398
\n+
399 icursor_iterator() noexcept; //[t84]
\n+
400 explicit icursor_iterator(istream_type &) noexcept; //[t84]
\n+
401 icursor_iterator(const icursor_iterator &) noexcept; //[t84]
\n+
402 ~icursor_iterator() noexcept;
\n+
403
\n+
404 const result &operator*() const { refresh(); return m_here; } //[t84]
\n+
405 const result *operator->() const { refresh(); return &m_here; } //[t84]
\n+
406 icursor_iterator &operator++(); //[t84]
\n+
407 icursor_iterator operator++(int); //[t84]
\n+
408 icursor_iterator &operator+=(difference_type); //[t84]
\n+
409 icursor_iterator &operator=(const icursor_iterator &) noexcept; //[t84]
\n+
410
\n+
411 bool operator==(const icursor_iterator &rhs) const; //[t84]
\n+
412 bool operator!=(const icursor_iterator &rhs) const noexcept //[t84]
\n+
413 { return not operator==(rhs); }
\n+
414 bool operator<(const icursor_iterator &rhs) const; //[t84]
\n+
415 bool operator>(const icursor_iterator &rhs) const //[t84]
\n+
416 { return rhs < *this; }
\n+
417 bool operator<=(const icursor_iterator &rhs) const //[t84]
\n+
418 { return not (*this > rhs); }
\n+
419 bool operator>=(const icursor_iterator &rhs) const //[t84]
\n+
420 { return not (*this < rhs); }
\n+
421
\n+
422private:
\n+
423 void refresh() const;
\n+
424
\n+
425 friend class internal::gate::icursor_iterator_icursorstream;
\n+
426 difference_type pos() const noexcept { return m_pos; }
\n+
427 void fill(const result &);
\n+
428
\n+
429 icursorstream *m_stream = nullptr;
\n+
430 result m_here;
\n+
431 difference_type m_pos;
\n+
432 icursor_iterator *m_prev = nullptr, *m_next = nullptr;
\n+
433};
\n+
434} // namespace pqxx
\n+
435
\n+
436#include "pqxx/compiler-internal-post.hxx"
\n+
437#endif
\n+
STL namespace.
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:57
\n-
@ serializable
Definition: isolation.hxx:61
\n-
@ read_committed
Definition: isolation.hxx:59
\n-
@ repeatable_read
Definition: isolation.hxx:60
\n-
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
\n-
static constexpr const char * name() noexcept
\n-
static constexpr isolation_level level() noexcept
Definition: isolation.hxx:67
\n+
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
\n+
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
\n+
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n+
Common definitions for cursor types.
Definition: cursor.hxx:41
\n+
static difference_type prior() noexcept
Special value: read backwards, one row only.
Definition: cursor.hxx:120
\n+
static difference_type backward_all() noexcept
Special value: read backwards from current position back to origin.
Definition: cursor.cxx:35
\n+
cursor_base(const cursor_base &)=delete
\n+
accesspolicy
Cursor access-pattern policy.
Definition: cursor.hxx:51
\n+
@ forward_only
Cursor can move forward only.
Definition: cursor.hxx:53
\n+
result_size_type size_type
Definition: cursor.hxx:43
\n+
ownershippolicy
Cursor destruction policy.
Definition: cursor.hxx:90
\n+
@ owned
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:92
\n+
const std::string m_name
Definition: cursor.hxx:143
\n+
cursor_base()=delete
\n+
updatepolicy
Cursor update policy.
Definition: cursor.hxx:63
\n+
@ read_only
Cursor can be used to read data but not to write.
Definition: cursor.hxx:65
\n+
cursor_base & operator=(const cursor_base &)=delete
\n+
result_difference_type difference_type
Definition: cursor.hxx:44
\n+
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:162
\n+
const std::string & name() const noexcept
Definition: cursor.hxx:216
\n+
void close() noexcept
Definition: cursor.hxx:187
\n+
stateless_cursor(transaction_base &trans, const std::string adopted_cursor)
Adopt existing scrolling SQL cursor.
Definition: cursor.hxx:178
\n+
result_size_type size_type
Definition: cursor.hxx:164
\n+
result_difference_type difference_type
Definition: cursor.hxx:165
\n+
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:207
\n+
stateless_cursor(transaction_base &trans, const std::string &query, const std::string &cname, bool hold)
Create cursor.
Definition: cursor.hxx:168
\n+
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:193
\n+
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:253
\n+
cursor_base::size_type size_type
Definition: cursor.hxx:255
\n+
icursorstream & get(result &res)
Read new value into given result object; same as operator >>
Definition: cursor.hxx:316
\n+
difference_type stride() const noexcept
Definition: cursor.hxx:338
\n+
cursor_base::difference_type difference_type
Definition: cursor.hxx:256
\n+
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result &)
Definition: cursor.hxx:324
\n+
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:389
\n+
bool operator<=(const icursor_iterator &rhs) const
Definition: cursor.hxx:417
\n+
bool operator!=(const icursor_iterator &rhs) const noexcept
Definition: cursor.hxx:412
\n+
bool operator>(const icursor_iterator &rhs) const
Definition: cursor.hxx:415
\n+
istream_type::difference_type difference_type
Definition: cursor.hxx:397
\n+
const result * operator->() const
Definition: cursor.hxx:405
\n+
std::input_iterator_tag iterator_category
Definition: cursor.hxx:391
\n+
bool operator>=(const icursor_iterator &rhs) const
Definition: cursor.hxx:419
\n+
istream_type::size_type size_type
Definition: cursor.hxx:396
\n+
Reference to a field in a result set.
Definition: field.hxx:50
\n+
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n+
result_difference_type difference_type
Definition: result.hxx:73
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,82 +1,419 @@\n \n \n \n \n \n libpqxx\n \n-isolation.hxx\n+cursor.hxx\n 1\n- 13#ifndef PQXX_H_ISOLATION\n- 14#define PQXX_H_ISOLATION\n+ 13#ifndef PQXX_H_CURSOR\n+ 14#define PQXX_H_CURSOR\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n 18\n- 19#include \"pqxx/util.hxx\"\n- 20\n- 21namespace pqxx\n- 22{\n- 23\n+ 19#include \n+ 20#include \n+ 21\n+ 22#include \"pqxx/result.hxx\"\n+ 23#include \"pqxx/transaction_base.hxx\"\n+ 24\n 25\n-56enum isolation_level\n- 57{\n- 58 // read_uncommitted,\n-59 read_committed,\n-60 repeatable_read,\n- 61 serializable\n-62};\n- 63\n-65template struct isolation_traits\n- 66{\n-67 static constexpr isolation_level level() noexcept { return LEVEL; }\n-68 static constexpr const char *name() noexcept;\n- 69};\n- 70\n+ 26namespace pqxx\n+ 27{\n+ 29\n+40class PQXX_LIBEXPORT cursor_base\n+ 41{\n+ 42public:\n+43 using size_type = result_size_type;\n+44 using difference_type = result_difference_type;\n+ 45\n+ 47\n+50 enum accesspolicy\n+ 51 {\n+53 forward_only,\n+ 55 random_access\n+56 };\n+ 57\n+ 59\n+62 enum updatepolicy\n+ 63 {\n+65 read_only,\n+ 67 update\n+68 };\n+ 69\n 71\n- 72template<>\n-73inline constexpr const char *isolation_traits::name()\n-noexcept\n- 74 { return \"READ COMMITTED\"; }\n- 75\n- 76template<>\n-77inline constexpr const char *isolation_traits::name()\n-noexcept\n- 78 { return \"REPEATABLE READ\"; }\n- 79\n- 80template<>\n-81inline constexpr const char *isolation_traits::name() noexcept\n- 82 { return \"SERIALIZABLE\"; }\n- 83\n- 84}\n- 85\n- 86#include \"pqxx/compiler-internal-post.hxx\"\n- 87#endif\n+89 enum ownershippolicy\n+ 90 {\n+92 owned,\n+ 94 loose\n+95 };\n+ 96\n+97 cursor_base() =delete;\n+98 cursor_base(const cursor_base &) =delete;\n+99 cursor_base &operator=(const cursor_base &) =delete;\n+ 100\n+ 105\n+ 107\n+ 110 static difference_type all() noexcept; //[t81]\n+ 111\n+ 113\n+115 static difference_type next() noexcept { return 1; } //[t81]\n+ 116\n+ 118\n+120 static difference_type prior() noexcept { return -1; } //[t00]\n+ 121\n+ 123\n+ 125 static difference_type backward_all() noexcept; //[t00]\n+ 126\n+ 128\n+ 130\n+135 const std::string &name() const noexcept { return m_name; } //[t81]\n+ 136\n+ 137protected:\n+ 138 cursor_base(\n+ 139 connection_base &,\n+ 140 const std::string &Name,\n+ 141 bool embellish_name=true);\n+ 142\n+143 const std::string m_name;\n+ 144};\n+ 145} // namespace pqxx\n+ 146\n+ 147\n+ 148#include \n+ 149\n+ 150\n+ 151namespace pqxx\n+ 152{\n+ 154\n+ 160template\n+161class stateless_cursor\n+ 162{\n+ 163public:\n+164 using size_type = result_size_type;\n+165 using difference_type = result_difference_type;\n+ 166\n+168 stateless_cursor(\n+ 169 transaction_base &trans,\n+ 170 const std::string &query,\n+ 171 const std::string &cname,\n+ 172 bool hold) :\n+ 173 m_cur{trans, query, cname, cursor_base::random_access, up, op, hold}\n+ 174 {\n+ 175 }\n+ 176\n+178 stateless_cursor(\n+ 179 transaction_base &trans,\n+ 180 const std::string adopted_cursor) :\n+ 181 m_cur{trans, adopted_cursor, op}\n+ 182 {\n+ 183 // Put cursor in known position\n+ 184 m_cur.move(cursor_base::backward_all());\n+ 185 }\n+ 186\n+187 void close() noexcept { m_cur.close(); }\n+ 188\n+ 190\n+193 size_type size() { return internal::obtain_stateless_cursor_size(m_cur); }\n+ 194\n+ 196\n+207 result retrieve(difference_type begin_pos, difference_type end_pos)\n+ 208 {\n+ 209 return internal::stateless_cursor_retrieve(\n+ 210 m_cur,\n+ 211 result::difference_type(size()),\n+ 212 begin_pos,\n+ 213 end_pos);\n+ 214 }\n+ 215\n+216 const std::string &name() const noexcept { return m_cur.name(); }\n+ 217\n+ 218private:\n+ 219 internal::sql_cursor m_cur;\n+ 220};\n+ 221\n+ 222\n+ 223class icursor_iterator;\n+ 224\n+ 225\n+ 226namespace internal\n+ 227{\n+ 228namespace gate\n+ 229{\n+ 230class icursor_iterator_icursorstream;\n+ 231class icursorstream_icursor_iterator;\n+ 232} // namespace internal::gate\n+ 233} // namespace internal\n+ 234\n+ 235\n+ 237\n+252class PQXX_LIBEXPORT icursorstream\n+ 253{\n+ 254public:\n+255 using size_type = cursor_base::size_type;\n+256 using difference_type = cursor_base::difference_type;\n+ 257\n+ 259\n+ 270 icursorstream(\n+ 271 transaction_base &context,\n+ 272 const std::string &query,\n+ 273 const std::string &basename,\n+ 274 difference_type sstride=1); //[t81]\n+ 275\n+ 277\n+ 301 icursorstream(\n+ 302 transaction_base &context,\n+ 303 const field &cname,\n+ 304 difference_type sstride=1,\n+ 305 cursor_base::ownershippolicy op=cursor_base::owned); //[t84]\n+ 306\n+307 operator bool() const noexcept { return not m_done; }\n+ 308\n+ 310\n+316 icursorstream &get(result &res) { res = fetchblock(); return *this; } //\n+[t81]\n+ 318\n+324 icursorstream &operator>>(result &res) { return get(res); } //[t81]\n+ 325\n+ 327\n+ 331 icursorstream &ignore(std::streamsize n=1); //[t81]\n+ 332\n+ 334\n+ 337 void set_stride(difference_type stride); //[t81]\n+338 difference_type stride() const noexcept { return m_stride; } //[t81]\n+ 339\n+ 340private:\n+ 341 result fetchblock();\n+ 342\n+343 friend class internal::gate::icursorstream_icursor_iterator;\n+ 344 size_type forward(size_type n=1);\n+ 345 void insert_iterator(icursor_iterator *) noexcept;\n+ 346 void remove_iterator(icursor_iterator *) const noexcept;\n+ 347\n+ 348 void service_iterators(difference_type);\n+ 349\n+ 350 internal::sql_cursor m_cur;\n+ 351\n+ 352 difference_type m_stride;\n+ 353 difference_type m_realpos, m_reqpos;\n+ 354\n+ 355 mutable icursor_iterator *m_iterators;\n+ 356\n+ 357 bool m_done;\n+ 358};\n+ 359\n+ 360\n+ 362\n+388class PQXX_LIBEXPORT icursor_iterator\n+ 389{\n+ 390public:\n+391 using iterator_category = std::input_iterator_tag;\n+392 using value_type = result;\n+393 using pointer = const result *;\n+394 using reference = const result &;\n+395 using istream_type = icursorstream;\n+396 using size_type = istream_type::size_type;\n+397 using difference_type = istream_type::difference_type;\n+ 398\n+ 399 icursor_iterator() noexcept; //[t84]\n+ 400 explicit icursor_iterator(istream_type &) noexcept; //[t84]\n+ 401 icursor_iterator(const icursor_iterator &) noexcept; //[t84]\n+ 402 ~icursor_iterator() noexcept;\n+ 403\n+404 const result &operator*() const { refresh(); return m_here; } //[t84]\n+405 const result *operator->() const { refresh(); return &m_here; } //[t84]\n+ 406 icursor_iterator &operator++(); //[t84]\n+ 407 icursor_iterator operator++(int); //[t84]\n+ 408 icursor_iterator &operator+=(difference_type); //[t84]\n+ 409 icursor_iterator &operator=(const icursor_iterator &) noexcept; //[t84]\n+ 410\n+ 411 bool operator==(const icursor_iterator &rhs) const; //[t84]\n+412 bool operator!=(const icursor_iterator &rhs) const noexcept //[t84]\n+ 413 { return not operator==(rhs); }\n+ 414 bool operator<(const icursor_iterator &rhs) const; //[t84]\n+415 bool operator>(const icursor_iterator &rhs) const //[t84]\n+ 416 { return rhs < *this; }\n+417 bool operator<=(const icursor_iterator &rhs) const //[t84]\n+ 418 { return not (*this > rhs); }\n+419 bool operator>=(const icursor_iterator &rhs) const //[t84]\n+ 420 { return not (*this < rhs); }\n+ 421\n+ 422private:\n+ 423 void refresh() const;\n+ 424\n+425 friend class internal::gate::icursor_iterator_icursorstream;\n+ 426 difference_type pos() const noexcept { return m_pos; }\n+ 427 void fill(const result &);\n+ 428\n+ 429 icursorstream *m_stream = nullptr;\n+ 430 result m_here;\n+ 431 difference_type m_pos;\n+ 432 icursor_iterator *m_prev = nullptr, *m_next = nullptr;\n+ 433};\n+ 434} // namespace pqxx\n+ 435\n+ 436#include \"pqxx/compiler-internal-post.hxx\"\n+ 437#endif\n+std\n+STL namespace.\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::isolation_level\n-isolation_level\n-Transaction isolation levels.\n-Definition: isolation.hxx:57\n-pqxx::serializable\n-@ serializable\n-Definition: isolation.hxx:61\n-pqxx::read_committed\n-@ read_committed\n-Definition: isolation.hxx:59\n-pqxx::repeatable_read\n-@ repeatable_read\n-Definition: isolation.hxx:60\n-pqxx::isolation_traits\n-Traits class to describe an isolation level; primarly for libpqxx's own use.\n-Definition: isolation.hxx:66\n-pqxx::isolation_traits::name\n-static constexpr const char * name() noexcept\n-pqxx::isolation_traits::level\n-static constexpr isolation_level level() noexcept\n-Definition: isolation.hxx:67\n+pqxx::result_difference_type\n+signed long result_difference_type\n+Difference between result sizes.\n+Definition: types.hxx:21\n+pqxx::result_size_type\n+unsigned long result_size_type\n+Number of rows in a result set.\n+Definition: types.hxx:18\n+pqxx::connection_base\n+connection_base abstract base class; represents a connection to a database.\n+Definition: connection_base.hxx:140\n+pqxx::cursor_base\n+Common definitions for cursor types.\n+Definition: cursor.hxx:41\n+pqxx::cursor_base::prior\n+static difference_type prior() noexcept\n+Special value: read backwards, one row only.\n+Definition: cursor.hxx:120\n+pqxx::cursor_base::backward_all\n+static difference_type backward_all() noexcept\n+Special value: read backwards from current position back to origin.\n+Definition: cursor.cxx:35\n+pqxx::cursor_base::cursor_base\n+cursor_base(const cursor_base &)=delete\n+pqxx::cursor_base::accesspolicy\n+accesspolicy\n+Cursor access-pattern policy.\n+Definition: cursor.hxx:51\n+pqxx::cursor_base::forward_only\n+@ forward_only\n+Cursor can move forward only.\n+Definition: cursor.hxx:53\n+pqxx::cursor_base::size_type\n+result_size_type size_type\n+Definition: cursor.hxx:43\n+pqxx::cursor_base::ownershippolicy\n+ownershippolicy\n+Cursor destruction policy.\n+Definition: cursor.hxx:90\n+pqxx::cursor_base::owned\n+@ owned\n+Destroy SQL cursor when cursor object is closed at end of transaction.\n+Definition: cursor.hxx:92\n+pqxx::cursor_base::m_name\n+const std::string m_name\n+Definition: cursor.hxx:143\n+pqxx::cursor_base::cursor_base\n+cursor_base()=delete\n+pqxx::cursor_base::updatepolicy\n+updatepolicy\n+Cursor update policy.\n+Definition: cursor.hxx:63\n+pqxx::cursor_base::read_only\n+@ read_only\n+Cursor can be used to read data but not to write.\n+Definition: cursor.hxx:65\n+pqxx::cursor_base::operator=\n+cursor_base & operator=(const cursor_base &)=delete\n+pqxx::cursor_base::difference_type\n+result_difference_type difference_type\n+Definition: cursor.hxx:44\n+pqxx::stateless_cursor\n+\"Stateless cursor\" class: easy API for retrieving parts of result sets\n+Definition: cursor.hxx:162\n+pqxx::stateless_cursor::name\n+const std::string & name() const noexcept\n+Definition: cursor.hxx:216\n+pqxx::stateless_cursor::close\n+void close() noexcept\n+Definition: cursor.hxx:187\n+pqxx::stateless_cursor::stateless_cursor\n+stateless_cursor(transaction_base &trans, const std::string adopted_cursor)\n+Adopt existing scrolling SQL cursor.\n+Definition: cursor.hxx:178\n+pqxx::stateless_cursor::size_type\n+result_size_type size_type\n+Definition: cursor.hxx:164\n+pqxx::stateless_cursor::difference_type\n+result_difference_type difference_type\n+Definition: cursor.hxx:165\n+pqxx::stateless_cursor::retrieve\n+result retrieve(difference_type begin_pos, difference_type end_pos)\n+Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)\n+Definition: cursor.hxx:207\n+pqxx::stateless_cursor::stateless_cursor\n+stateless_cursor(transaction_base &trans, const std::string &query, const std::\n+string &cname, bool hold)\n+Create cursor.\n+Definition: cursor.hxx:168\n+pqxx::stateless_cursor::size\n+size_type size()\n+Number of rows in cursor's result set.\n+Definition: cursor.hxx:193\n+pqxx::icursorstream\n+Simple read-only cursor represented as a stream of results.\n+Definition: cursor.hxx:253\n+pqxx::icursorstream::size_type\n+cursor_base::size_type size_type\n+Definition: cursor.hxx:255\n+pqxx::icursorstream::get\n+icursorstream & get(result &res)\n+Read new value into given result object; same as operator >>\n+Definition: cursor.hxx:316\n+pqxx::icursorstream::stride\n+difference_type stride() const noexcept\n+Definition: cursor.hxx:338\n+pqxx::icursorstream::difference_type\n+cursor_base::difference_type difference_type\n+Definition: cursor.hxx:256\n+pqxx::icursorstream::operator>>\n+icursorstream & operator>>(result &res)\n+Read new value into given result object; same as get(result &)\n+Definition: cursor.hxx:324\n+pqxx::icursor_iterator\n+Approximate istream_iterator for icursorstream.\n+Definition: cursor.hxx:389\n+pqxx::icursor_iterator::operator<=\n+bool operator<=(const icursor_iterator &rhs) const\n+Definition: cursor.hxx:417\n+pqxx::icursor_iterator::operator!=\n+bool operator!=(const icursor_iterator &rhs) const noexcept\n+Definition: cursor.hxx:412\n+pqxx::icursor_iterator::operator>\n+bool operator>(const icursor_iterator &rhs) const\n+Definition: cursor.hxx:415\n+pqxx::icursor_iterator::difference_type\n+istream_type::difference_type difference_type\n+Definition: cursor.hxx:397\n+pqxx::icursor_iterator::operator->\n+const result * operator->() const\n+Definition: cursor.hxx:405\n+pqxx::icursor_iterator::iterator_category\n+std::input_iterator_tag iterator_category\n+Definition: cursor.hxx:391\n+pqxx::icursor_iterator::operator>=\n+bool operator>=(const icursor_iterator &rhs) const\n+Definition: cursor.hxx:419\n+pqxx::icursor_iterator::size_type\n+istream_type::size_type size_type\n+Definition: cursor.hxx:396\n+pqxx::field\n+Reference to a field in a result set.\n+Definition: field.hxx:50\n+pqxx::result\n+Result set containing data returned by a query or command.\n+Definition: result.hxx:70\n+pqxx::result::difference_type\n+result_difference_type difference_type\n+Definition: result.hxx:73\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * isolation.hxx\n+ * cursor.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00059_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00059_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: result_iterator.hxx Source File\n+libpqxx: result.hxx Source File\n \n \n \n \n \n \n \n@@ -55,249 +55,224 @@\n \n
\n
\n-
result_iterator.hxx
\n+
result.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_RESULT_ITERATOR
\n-
14#define PQXX_H_RESULT_ITERATOR
\n+
13#ifndef PQXX_H_RESULT
\n+
14#define PQXX_H_RESULT
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n
18
\n-
19#include "pqxx/row.hxx"
\n-
20
\n-
21
\n-
22/* Result iterator.
\n-
23 *
\n-
24 * Don't include this header from your own application; it is included for you
\n-
25 * by other libpqxx headers.
\n-
26 */
\n-
27
\n-
28namespace pqxx
\n-
29{
\n+
19#include <ios>
\n+
20#include <memory>
\n+
21#include <stdexcept>
\n+
22
\n+
23#include "pqxx/except.hxx"
\n+
24#include "pqxx/types.hxx"
\n+
25#include "pqxx/util.hxx"
\n+
26
\n+
27#include "pqxx/internal/encodings.hxx"
\n+
28
\n+
29
\n+
30// Methods tested in eg. test module test01 are marked with "//[t01]".
\n
31
\n-
35class PQXX_LIBEXPORT const_result_iterator : public row
\n-
36{
\n-
37public:
\n-
38 using iterator_category = std::random_access_iterator_tag;
\n-
39 using value_type = const row;
\n-
40 using pointer = const row *;
\n-
41 using reference = row;
\n-\n-\n-
44
\n-
45 const_result_iterator() noexcept : row{result(), 0} {}
\n-
46 const_result_iterator(const row &t) noexcept : row{t} {}
\n+
32namespace pqxx
\n+
33{
\n+
34namespace internal
\n+
35{
\n+
36PQXX_LIBEXPORT void clear_result(const pq::PGresult *);
\n+
37
\n+
38namespace gate
\n+
39{
\n+
40class result_connection;
\n+
41class result_creation;
\n+
42class result_row;
\n+
43class result_sql_cursor;
\n+
44} // namespace internal::gate
\n+
45} // namespace internal
\n+
46
\n
47
\n-
63 pointer operator->() const { return this; } //[t12]
\n-
64 reference operator*() const { return row{*this}; } //[t12]
\n-
66
\n-
71 const_result_iterator operator++(int); //[t12]
\n-
72 const_result_iterator &operator++() { ++m_index; return *this; } //[t01]
\n-
73 const_result_iterator operator--(int); //[t12]
\n-
74 const_result_iterator &operator--() { --m_index; return *this; } //[t12]
\n-
75
\n-\n-
77 { m_index += i; return *this; }
\n-\n-
79 { m_index -= i; return *this; }
\n-
81
\n-
86 bool operator==(const const_result_iterator &i) const //[t12]
\n-
87 {return m_index==i.m_index;}
\n-
88 bool operator!=(const const_result_iterator &i) const //[t12]
\n-
89 {return m_index!=i.m_index;}
\n-
90 bool operator<(const const_result_iterator &i) const //[t12]
\n-
91 {return m_index<i.m_index;}
\n-
92 bool operator<=(const const_result_iterator &i) const //[t12]
\n-
93 {return m_index<=i.m_index;}
\n-
94 bool operator>(const const_result_iterator &i) const //[t12]
\n-
95 {return m_index>i.m_index;}
\n-
96 bool operator>=(const const_result_iterator &i) const //[t12]
\n-
97 {return m_index>=i.m_index;}
\n-
99
\n-
104 inline const_result_iterator operator+(difference_type) const; //[t12]
\n-
105 friend const_result_iterator operator+( //[t12]
\n-
106 difference_type,
\n-\n-
108 inline const_result_iterator operator-(difference_type) const; //[t12]
\n-
109 inline difference_type operator-(const_result_iterator) const; //[t12]
\n-
111
\n-
112private:
\n-
113 friend class pqxx::result;
\n-\n-
115 row{*r, i} {}
\n-
116};
\n+
49
\n+
69class PQXX_LIBEXPORT result
\n+
70{
\n+
71public:
\n+\n+\n+
74 using reference = row;
\n+\n+\n+\n+\n+\n+
80
\n+
81 result() noexcept : //[t03]
\n+
82 m_data(make_data_pointer()),
\n+
83 m_query(),
\n+
84 m_encoding(internal::encoding_group::MONOBYTE)
\n+
85 {}
\n+
86 result(const result &rhs) noexcept =default; //[t01]
\n+
87
\n+
88 result &operator=(const result &rhs) noexcept =default; //[t10]
\n+
89
\n+
94 bool operator==(const result &) const noexcept; //[t70]
\n+
95 bool operator!=(const result &rhs) const noexcept //[t70]
\n+
96 { return not operator==(rhs); }
\n+
98
\n+
99 const_reverse_iterator rbegin() const; //[t75]
\n+
100 const_reverse_iterator crbegin() const;
\n+
101 const_reverse_iterator rend() const; //[t75]
\n+
102 const_reverse_iterator crend() const;
\n+
103
\n+
104 const_iterator begin() const noexcept; //[t01]
\n+
105 const_iterator cbegin() const noexcept;
\n+
106 inline const_iterator end() const noexcept; //[t01]
\n+
107 inline const_iterator cend() const noexcept;
\n+
108
\n+
109 reference front() const noexcept; //[t74]
\n+
110 reference back() const noexcept; //[t75]
\n+
111
\n+
112 PQXX_PURE size_type size() const noexcept; //[t02]
\n+
113 PQXX_PURE bool empty() const noexcept; //[t11]
\n+
114 size_type capacity() const noexcept { return size(); } //[t20]
\n+
115
\n+
116 void swap(result &) noexcept; //[t77]
\n
117
\n-
118
\n-
120class PQXX_LIBEXPORT const_reverse_result_iterator :
\n-\n-
122{
\n-
123public:
\n-\n-\n-\n-\n-\n-\n-\n-
131
\n-\n-\n-\n-\n-
136 const const_result_iterator &rhs) :
\n-
137 const_result_iterator{rhs} { super::operator--(); }
\n-
138
\n-
139 PQXX_PURE const_result_iterator base() const noexcept; //[t75]
\n-
140
\n-
145 using const_result_iterator::operator->; //[t75]
\n-
146 using const_result_iterator::operator*; //[t75]
\n-
148
\n-\n-\n-
155 { iterator_type::operator=(r); return *this; }
\n-\n-
157 { iterator_type::operator--(); return *this; }
\n-
158 const_reverse_result_iterator operator++(int); //[t75]
\n-\n-
160 { iterator_type::operator++(); return *this; }
\n-
161 const_reverse_result_iterator operator--(int); //[t75]
\n-\n-
163 { iterator_type::operator-=(i); return *this; }
\n-\n-
165 { iterator_type::operator+=(i); return *this; }
\n+
118 const row operator[](size_type i) const noexcept; //[t02]
\n+
119 const row at(size_type) const; //[t10]
\n+
120
\n+
121 void clear() noexcept { m_data.reset(); m_query = nullptr; } //[t20]
\n+
122
\n+
128 PQXX_PURE row_size_type columns() const noexcept; //[t11]
\n+
129
\n+
131 row_size_type column_number(const char ColName[]) const; //[t11]
\n+
132
\n+
134 row_size_type column_number(const std::string &Name) const //[t11]
\n+
135 {return column_number(Name.c_str());}
\n+
136
\n+
138 const char *column_name(row_size_type Number) const; //[t11]
\n+
139
\n+
141 oid column_type(row_size_type ColNum) const; //[t07]
\n+
143 oid column_type(int ColNum) const //[t07]
\n+
144 { return column_type(row_size_type(ColNum)); }
\n+
145
\n+
147 oid column_type(const std::string &ColName) const //[t07]
\n+
148 { return column_type(column_number(ColName)); }
\n+
149
\n+
151 oid column_type(const char ColName[]) const //[t07]
\n+
152 { return column_type(column_number(ColName)); }
\n+
153
\n+
155 oid column_table(row_size_type ColNum) const; //[t02]
\n+
156
\n+
158 oid column_table(int ColNum) const //[t02]
\n+
159 { return column_table(row_size_type(ColNum)); }
\n+
160
\n+
162 oid column_table(const std::string &ColName) const //[t02]
\n+
163 { return column_table(column_number(ColName)); }
\n+
164
\n+
166 row_size_type table_column(row_size_type ColNum) const; //[t93]
\n
167
\n-\n-
173 { return const_reverse_result_iterator(base() - i); }
\n-\n-
175 { return const_reverse_result_iterator(base() + i); }
\n-\n-
177 const const_reverse_result_iterator &rhs) const
\n-
178 { return rhs.const_result_iterator::operator-(*this); }
\n-
180
\n-
185 bool operator==( //[t75]
\n-
186 const const_reverse_result_iterator &rhs) const noexcept
\n-
187 { return iterator_type::operator==(rhs); }
\n-
188 bool operator!=( //[t75]
\n-
189 const const_reverse_result_iterator &rhs) const noexcept
\n-
190 { return not operator==(rhs); }
\n+
169 row_size_type table_column(int ColNum) const //[t93]
\n+
170 { return table_column(row_size_type(ColNum)); }
\n+
171
\n+
173 row_size_type table_column(const std::string &ColName) const //[t93]
\n+
174 { return table_column(column_number(ColName)); }
\n+
176
\n+
178 PQXX_PURE const std::string &query() const noexcept; //[t70]
\n+
179
\n+
181
\n+
184 PQXX_PURE oid inserted_oid() const; //[t13]
\n+
185
\n+
187
\n+
190 PQXX_PURE size_type affected_rows() const; //[t07]
\n
191
\n-
192 bool operator<(const const_reverse_result_iterator &rhs) const //[t75]
\n-
193 { return iterator_type::operator>(rhs); }
\n-
194 bool operator<=(const const_reverse_result_iterator &rhs) const //[t75]
\n-
195 { return iterator_type::operator>=(rhs); }
\n-
196 bool operator>(const const_reverse_result_iterator &rhs) const //[t75]
\n-
197 { return iterator_type::operator<(rhs); }
\n-
198 bool operator>=(const const_reverse_result_iterator &rhs) const //[t75]
\n-
199 { return iterator_type::operator<=(rhs); }
\n-
201};
\n-
202
\n+
192
\n+
193private:
\n+
194 using data_pointer = std::shared_ptr<const internal::pq::PGresult>;
\n+
195
\n+
197 data_pointer m_data;
\n+
198
\n+
200 static data_pointer make_data_pointer(
\n+
201 const internal::pq::PGresult *res=nullptr)
\n+
202 { return data_pointer{res, internal::clear_result}; }
\n
203
\n-
204inline const_result_iterator
\n-\n-
206{
\n-\n-\n-
209}
\n+
205 std::shared_ptr<std::string> m_query;
\n+
206
\n+
207 internal::encoding_group m_encoding;
\n+
208
\n+
209 static const std::string s_empty_string;
\n
210
\n-\n-\n-
213 { return i + o; }
\n-
214
\n-\n-\n-
217{
\n-\n-
219 &m_result,
\n-\n-
221}
\n-
222
\n-\n-\n-
225 { return result::difference_type(num() - i.num()); }
\n-
226
\n-
227inline const_result_iterator result::end() const noexcept
\n-
228 { return const_result_iterator{this, size()}; }
\n-
229
\n+
211 friend class pqxx::field;
\n+
212 PQXX_PURE const char *GetValue(size_type Row, row_size_type Col) const;
\n+
213 PQXX_PURE bool get_is_null(size_type Row, row_size_type Col) const;
\n+
214 PQXX_PURE field_size_type get_length(
\n+
215 size_type,
\n+
216 row_size_type) const noexcept;
\n+
217
\n+
218 friend class pqxx::internal::gate::result_creation;
\n+
219 result(
\n+
220 internal::pq::PGresult *rhs,
\n+
221 const std::string &Query,
\n+
222 internal::encoding_group enc);
\n+
223
\n+
224 PQXX_PRIVATE void check_status() const;
\n+
225
\n+
226 friend class pqxx::internal::gate::result_connection;
\n+
227 friend class pqxx::internal::gate::result_row;
\n+
228 bool operator!() const noexcept { return not m_data.get(); }
\n+
229 operator bool() const noexcept { return m_data.get() != nullptr; }
\n
230
\n-
231inline const_result_iterator result::cend() const noexcept
\n-
232 { return end(); }
\n-
233
\n-
234
\n-\n-\n-\n-\n-
239 { return const_reverse_result_iterator{i.base() - n}; }
\n-
240
\n-
241} // namespace pqxx
\n-
242
\n-
243#include "pqxx/compiler-internal-post.hxx"
\n-
244
\n-
245#endif
\n+
231 [[noreturn]] PQXX_PRIVATE void ThrowSQLError(
\n+
232 const std::string &Err,
\n+
233 const std::string &Query) const;
\n+
234 PQXX_PRIVATE PQXX_PURE int errorposition() const;
\n+
235 PQXX_PRIVATE std::string StatusError() const;
\n+
236
\n+
237 friend class pqxx::internal::gate::result_sql_cursor;
\n+
238 PQXX_PURE const char *cmd_status() const noexcept;
\n+
239};
\n+
240} // namespace pqxx
\n+
241#include "pqxx/compiler-internal-post.hxx"
\n+
242#endif
\n+
STL namespace.
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
const_result_iterator operator+(result::difference_type o, const_result_iterator i)
Definition: result_iterator.hxx:212
\n
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
\n+
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
\n
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
\n+
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
\n+
void clear_result(const pq::PGresult *)
C++ wrapper for libpq's PQclear.
Definition: result.cxx:30
\n+
Reference to a field in a result set.
Definition: field.hxx:50
\n
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n-
const_iterator end() const noexcept
Definition: result_iterator.hxx:227
\n+
oid column_type(const char ColName[]) const
Type of given column.
Definition: result.hxx:151
\n+
row_size_type table_column(int ColNum) const
What column in its table did this column come from?
Definition: result.hxx:169
\n+
result() noexcept
Definition: result.hxx:81
\n+
oid column_type(const std::string &ColName) const
Type of given column.
Definition: result.hxx:147
\n+
result_size_type size_type
Definition: result.hxx:72
\n+
oid column_type(int ColNum) const
Type of given column.
Definition: result.hxx:143
\n+
void clear() noexcept
Definition: result.hxx:121
\n+
oid column_table(int ColNum) const
What table did this column come from?
Definition: result.hxx:158
\n+
result & operator=(const result &rhs) noexcept=default
\n+
oid column_table(const std::string &ColName) const
What table did this column come from?
Definition: result.hxx:162
\n
result_difference_type difference_type
Definition: result.hxx:73
\n-
PQXX_PURE size_type size() const noexcept
Definition: result.cxx:94
\n-
const_iterator cend() const noexcept
Definition: result_iterator.hxx:231
\n+
result(const result &rhs) noexcept=default
\n+
row_size_type table_column(const std::string &ColName) const
What column in its table did this column come from?
Definition: result.hxx:173
\n+
bool operator!=(const result &rhs) const noexcept
Definition: result.hxx:95
\n
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
\n-
bool operator!=(const const_result_iterator &i) const
Definition: result_iterator.hxx:88
\n-
const_result_iterator & operator-=(difference_type i)
Definition: result_iterator.hxx:78
\n-
const_result_iterator & operator++()
Definition: result_iterator.hxx:72
\n-
const_result_iterator(const row &t) noexcept
Definition: result_iterator.hxx:46
\n-
const_result_iterator operator+(difference_type) const
Definition: result_iterator.hxx:205
\n-
std::random_access_iterator_tag iterator_category
Definition: result_iterator.hxx:38
\n-
const_result_iterator operator-(difference_type) const
Definition: result_iterator.hxx:216
\n-
bool operator<(const const_result_iterator &i) const
Definition: result_iterator.hxx:90
\n-
bool operator>(const const_result_iterator &i) const
Definition: result_iterator.hxx:94
\n-
bool operator==(const const_result_iterator &i) const
Definition: result_iterator.hxx:86
\n-
const_result_iterator & operator+=(difference_type i)
Definition: result_iterator.hxx:76
\n-
pointer operator->() const
Definition: result_iterator.hxx:63
\n-
bool operator<=(const const_result_iterator &i) const
Definition: result_iterator.hxx:92
\n-
result_difference_type difference_type
Definition: result_iterator.hxx:43
\n-
result_size_type size_type
Definition: result_iterator.hxx:42
\n-
bool operator>=(const const_result_iterator &i) const
Definition: result_iterator.hxx:96
\n-
reference operator*() const
Definition: result_iterator.hxx:64
\n-
const_result_iterator & operator--()
Definition: result_iterator.hxx:74
\n-
const_result_iterator() noexcept
Definition: result_iterator.hxx:45
\n
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:122
\n-
PQXX_PURE const_result_iterator base() const noexcept
Definition: result.cxx:425
\n-
bool operator>=(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:198
\n-
const_reverse_result_iterator operator+(difference_type i) const
Definition: result_iterator.hxx:172
\n-
bool operator!=(const const_reverse_result_iterator &rhs) const noexcept
Definition: result_iterator.hxx:188
\n-
const_reverse_result_iterator & operator-=(difference_type i)
Definition: result_iterator.hxx:164
\n-
const_reverse_result_iterator & operator+=(difference_type i)
Definition: result_iterator.hxx:162
\n-
bool operator==(const const_reverse_result_iterator &rhs) const noexcept
Definition: result_iterator.hxx:185
\n-
bool operator<(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:192
\n-
const_reverse_result_iterator(const const_reverse_result_iterator &rhs)
Definition: result_iterator.hxx:132
\n-
const_reverse_result_iterator operator-(difference_type i)
Definition: result_iterator.hxx:174
\n-
const_reverse_result_iterator(const const_result_iterator &rhs)
Definition: result_iterator.hxx:135
\n-
bool operator>(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:196
\n-
difference_type operator-(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:176
\n-
bool operator<=(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:194
\n-
const_reverse_result_iterator & operator--()
Definition: result_iterator.hxx:159
\n-
const_reverse_result_iterator & operator++()
Definition: result_iterator.hxx:156
\n
Reference to one row in a result.
Definition: row.hxx:41
\n-
size_t num() const
Definition: row.hxx:170
\n-
result m_result
Result set of which this is one row.
Definition: row.hxx:192
\n-
long m_index
Row number.
Definition: row.hxx:198
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,347 +1,276 @@\n \n \n \n \n \n libpqxx\n \n-result_iterator.hxx\n+result.hxx\n 1\n- 13#ifndef PQXX_H_RESULT_ITERATOR\n- 14#define PQXX_H_RESULT_ITERATOR\n+ 13#ifndef PQXX_H_RESULT\n+ 14#define PQXX_H_RESULT\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n 18\n- 19#include \"pqxx/row.hxx\"\n- 20\n- 21\n- 22/* Result iterator.\n- 23 *\n- 24 * Don't include this header from your own application; it is included for\n-you\n- 25 * by other libpqxx headers.\n- 26 */\n- 27\n- 28namespace pqxx\n- 29{\n+ 19#include \n+ 20#include \n+ 21#include \n+ 22\n+ 23#include \"pqxx/except.hxx\"\n+ 24#include \"pqxx/types.hxx\"\n+ 25#include \"pqxx/util.hxx\"\n+ 26\n+ 27#include \"pqxx/internal/encodings.hxx\"\n+ 28\n+ 29\n+ 30// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n 31\n-35class PQXX_LIBEXPORT const_result_iterator : public row\n- 36{\n- 37public:\n-38 using iterator_category = std::random_access_iterator_tag;\n-39 using value_type = const row;\n-40 using pointer = const row *;\n-41 using reference = row;\n-42 using size_type = result_size_type;\n-43 using difference_type = result_difference_type;\n- 44\n-45 const_result_iterator() noexcept : row{result(), 0} {}\n-46 const_result_iterator(const row &t) noexcept : row{t} {}\n+ 32namespace pqxx\n+ 33{\n+ 34namespace internal\n+ 35{\n+ 36PQXX_LIBEXPORT void clear_result(const pq::PGresult *);\n+ 37\n+ 38namespace gate\n+ 39{\n+ 40class result_connection;\n+ 41class result_creation;\n+ 42class result_row;\n+ 43class result_sql_cursor;\n+ 44} // namespace internal::gate\n+ 45} // namespace internal\n+ 46\n 47\n-63 pointer operator->() const { return this; } //[t12]\n-64 reference operator*() const { return row{*this}; } //[t12]\n- 66\n- 71 const_result_iterator operator++(int); //[t12]\n-72 const_result_iterator &operator++() { ++m_index; return *this; } //[t01]\n- 73 const_result_iterator operator--(int); //[t12]\n-74 const_result_iterator &operator--() { --m_index; return *this; } //[t12]\n- 75\n-76 const_result_iterator &operator+=(difference_type i) //[t12]\n- 77 { m_index += i; return *this; }\n-78 const_result_iterator &operator-=(difference_type i) //[t12]\n- 79 { m_index -= i; return *this; }\n- 81\n-86 bool operator==(const const_result_iterator &i) const //[t12]\n- 87 {return m_index==i.m_index;}\n-88 bool operator!=(const const_result_iterator &i) const //[t12]\n- 89 {return m_index!=i.m_index;}\n-90 bool operator<(const const_result_iterator &i) const //[t12]\n- 91 {return m_index(const const_result_iterator &i) const //[t12]\n- 95 {return m_index>i.m_index;}\n-96 bool operator>=(const const_result_iterator &i) const //[t12]\n- 97 {return m_index>=i.m_index;}\n- 99\n- 104 inline const_result_iterator operator+(difference_type) const; //[t12]\n- 105 friend const_result_iterator operator+( //[t12]\n- 106 difference_type,\n- 107 const_result_iterator);\n-108 inline const_result_iterator operator-(difference_type) const; //[t12]\n-109 inline difference_type operator-(const_result_iterator) const; //[t12]\n+ 49\n+69class PQXX_LIBEXPORT result\n+ 70{\n+ 71public:\n+72 using size_type = result_size_type;\n+73 using difference_type = result_difference_type;\n+74 using reference = row;\n+75 using const_iterator = const_result_iterator;\n+76 using pointer = const_iterator;\n+77 using iterator = const_iterator;\n+78 using const_reverse_iterator = const_reverse_result_iterator;\n+79 using reverse_iterator = const_reverse_iterator;\n+ 80\n+81 result() noexcept : //[t03]\n+ 82 m_data(make_data_pointer()),\n+ 83 m_query(),\n+ 84 m_encoding(internal::encoding_group::MONOBYTE)\n+ 85 {}\n+86 result(const result &rhs) noexcept =default; //[t01]\n+ 87\n+88 result &operator=(const result &rhs) noexcept =default; //[t10]\n+ 89\n+ 94 bool operator==(const result &) const noexcept; //[t70]\n+95 bool operator!=(const result &rhs) const noexcept //[t70]\n+ 96 { return not operator==(rhs); }\n+ 98\n+ 99 const_reverse_iterator rbegin() const; //[t75]\n+ 100 const_reverse_iterator crbegin() const;\n+ 101 const_reverse_iterator rend() const; //[t75]\n+ 102 const_reverse_iterator crend() const;\n+ 103\n+ 104 const_iterator begin() const noexcept; //[t01]\n+ 105 const_iterator cbegin() const noexcept;\n+ 106 inline const_iterator end() const noexcept; //[t01]\n+ 107 inline const_iterator cend() const noexcept;\n+ 108\n+ 109 reference front() const noexcept; //[t74]\n+ 110 reference back() const noexcept; //[t75]\n 111\n- 112private:\n-113 friend class pqxx::result;\n- 114 const_result_iterator(const pqxx::result *r, result_size_type i) noexcept\n-:\n- 115 row{*r, i} {}\n- 116};\n+ 112 PQXX_PURE size_type size() const noexcept; //[t02]\n+ 113 PQXX_PURE bool empty() const noexcept; //[t11]\n+114 size_type capacity() const noexcept { return size(); } //[t20]\n+ 115\n+ 116 void swap(result &) noexcept; //[t77]\n 117\n- 118\n-120class PQXX_LIBEXPORT const_reverse_result_iterator :\n- 121 private const_result_iterator\n- 122{\n- 123public:\n-124 using super = const_result_iterator;\n-125 using iterator_type = const_result_iterator;\n- 126 using iterator_type::iterator_category;\n- 127 using iterator_type::difference_type;\n- 128 using iterator_type::pointer;\n-129 using value_type = iterator_type::value_type;\n-130 using reference = iterator_type::reference;\n- 131\n-132 const_reverse_result_iterator( //[t75]\n- 133 const const_reverse_result_iterator &rhs) :\n- 134 const_result_iterator{rhs} {}\n-135 explicit const_reverse_result_iterator( //[t75]\n- 136 const const_result_iterator &rhs) :\n- 137 const_result_iterator{rhs} { super::operator--(); }\n- 138\n- 139 PQXX_PURE const_result_iterator base() const noexcept; //[t75]\n- 140\n- 145 using const_result_iterator::operator->; //[t75]\n- 146 using const_result_iterator::operator*; //[t75]\n- 148\n-153 const_reverse_result_iterator &operator=( //[t75]\n- 154 const const_reverse_result_iterator &r)\n- 155 { iterator_type::operator=(r); return *this; }\n-156 const_reverse_result_iterator &operator++() //[t75]\n- 157 { iterator_type::operator--(); return *this; }\n- 158 const_reverse_result_iterator operator++(int); //[t75]\n-159 const_reverse_result_iterator &operator--() //[t75]\n- 160 { iterator_type::operator++(); return *this; }\n- 161 const_reverse_result_iterator operator--(int); //[t75]\n-162 const_reverse_result_iterator &operator+=(difference_type i) //[t75]\n- 163 { iterator_type::operator-=(i); return *this; }\n-164 const_reverse_result_iterator &operator-=(difference_type i) //[t75]\n- 165 { iterator_type::operator+=(i); return *this; }\n+ 118 const row operator[](size_type i) const noexcept; //[t02]\n+ 119 const row at(size_type) const; //[t10]\n+ 120\n+121 void clear() noexcept { m_data.reset(); m_query = nullptr; } //[t20]\n+ 122\n+ 128 PQXX_PURE row_size_type columns() const noexcept; //[t11]\n+ 129\n+ 131 row_size_type column_number(const char ColName[]) const; //[t11]\n+ 132\n+134 row_size_type column_number(const std::string &Name) const //[t11]\n+ 135 {return column_number(Name.c_str());}\n+ 136\n+ 138 const char *column_name(row_size_type Number) const; //[t11]\n+ 139\n+ 141 oid column_type(row_size_type ColNum) const; //[t07]\n+143 oid column_type(int ColNum) const //[t07]\n+ 144 { return column_type(row_size_type(ColNum)); }\n+ 145\n+147 oid column_type(const std::string &ColName) const //[t07]\n+ 148 { return column_type(column_number(ColName)); }\n+ 149\n+151 oid column_type(const char ColName[]) const //[t07]\n+ 152 { return column_type(column_number(ColName)); }\n+ 153\n+ 155 oid column_table(row_size_type ColNum) const; //[t02]\n+ 156\n+158 oid column_table(int ColNum) const //[t02]\n+ 159 { return column_table(row_size_type(ColNum)); }\n+ 160\n+162 oid column_table(const std::string &ColName) const //[t02]\n+ 163 { return column_table(column_number(ColName)); }\n+ 164\n+ 166 row_size_type table_column(row_size_type ColNum) const; //[t93]\n 167\n-172 const_reverse_result_iterator operator+(difference_type i) const //[t75]\n- 173 { return const_reverse_result_iterator(base() - i); }\n-174 const_reverse_result_iterator operator-(difference_type i) //[t75]\n- 175 { return const_reverse_result_iterator(base() + i); }\n-176 difference_type operator-( //[t75]\n- 177 const const_reverse_result_iterator &rhs) const\n- 178 { return rhs.const_result_iterator::operator-(*this); }\n- 180\n-185 bool operator==( //[t75]\n- 186 const const_reverse_result_iterator &rhs) const noexcept\n- 187 { return iterator_type::operator==(rhs); }\n-188 bool operator!=( //[t75]\n- 189 const const_reverse_result_iterator &rhs) const noexcept\n- 190 { return not operator==(rhs); }\n+169 row_size_type table_column(int ColNum) const //[t93]\n+ 170 { return table_column(row_size_type(ColNum)); }\n+ 171\n+173 row_size_type table_column(const std::string &ColName) const //[t93]\n+ 174 { return table_column(column_number(ColName)); }\n+ 176\n+ 178 PQXX_PURE const std::string &query() const noexcept; //[t70]\n+ 179\n+ 181\n+ 184 PQXX_PURE oid inserted_oid() const; //[t13]\n+ 185\n+ 187\n+ 190 PQXX_PURE size_type affected_rows() const; //[t07]\n 191\n-192 bool operator<(const const_reverse_result_iterator &rhs) const //[t75]\n- 193 { return iterator_type::operator>(rhs); }\n-194 bool operator<=(const const_reverse_result_iterator &rhs) const //[t75]\n- 195 { return iterator_type::operator>=(rhs); }\n-196 bool operator>(const const_reverse_result_iterator &rhs) const //[t75]\n- 197 { return iterator_type::operator<(rhs); }\n-198 bool operator>=(const const_reverse_result_iterator &rhs) const //[t75]\n- 199 { return iterator_type::operator<=(rhs); }\n- 201};\n- 202\n+ 192\n+ 193private:\n+ 194 using data_pointer = std::shared_ptr;\n+ 195\n+ 197 data_pointer m_data;\n+ 198\n+ 200 static data_pointer make_data_pointer(\n+ 201 const internal::pq::PGresult *res=nullptr)\n+ 202 { return data_pointer{res, internal::clear_result}; }\n 203\n- 204inline const_result_iterator\n-205const_result_iterator::operator+(result::difference_type o) const\n- 206{\n- 207 return const_result_iterator{\n- 208 &m_result, size_type(result::difference_type(m_index) + o)};\n- 209}\n+ 205 std::shared_ptr m_query;\n+ 206\n+ 207 internal::encoding_group m_encoding;\n+ 208\n+ 209 static const std::string s_empty_string;\n 210\n- 211inline const_result_iterator\n-212operator+(result::difference_type o, const_result_iterator i)\n- 213 { return i + o; }\n- 214\n- 215inline const_result_iterator\n-216const_result_iterator::operator-(result::difference_type o) const\n- 217{\n- 218 return const_result_iterator{\n- 219 &m_result,\n- 220 result_size_type(result::difference_type(m_index) - o)};\n- 221}\n- 222\n- 223inline result::difference_type\n-224const_result_iterator::operator-(const_result_iterator i) const\n- 225 { return result::difference_type(num() - i.num()); }\n- 226\n-227inline const_result_iterator result::end() const noexcept\n- 228 { return const_result_iterator{this, size()}; }\n- 229\n+211 friend class pqxx::field;\n+ 212 PQXX_PURE const char *GetValue(size_type Row, row_size_type Col) const;\n+ 213 PQXX_PURE bool get_is_null(size_type Row, row_size_type Col) const;\n+ 214 PQXX_PURE field_size_type get_length(\n+ 215 size_type,\n+ 216 row_size_type) const noexcept;\n+ 217\n+218 friend class pqxx::internal::gate::result_creation;\n+ 219 result(\n+ 220 internal::pq::PGresult *rhs,\n+ 221 const std::string &Query,\n+ 222 internal::encoding_group enc);\n+ 223\n+ 224 PQXX_PRIVATE void check_status() const;\n+ 225\n+226 friend class pqxx::internal::gate::result_connection;\n+227 friend class pqxx::internal::gate::result_row;\n+ 228 bool operator!() const noexcept { return not m_data.get(); }\n+ 229 operator bool() const noexcept { return m_data.get() != nullptr; }\n 230\n-231inline const_result_iterator result::cend() const noexcept\n- 232 { return end(); }\n- 233\n- 234\n- 235inline const_reverse_result_iterator\n-236operator+(\n- 237 result::difference_type n,\n- 238 const const_reverse_result_iterator &i)\n- 239 { return const_reverse_result_iterator{i.base() - n}; }\n- 240\n- 241} // namespace pqxx\n- 242\n- 243#include \"pqxx/compiler-internal-post.hxx\"\n- 244\n- 245#endif\n+ 231 [[noreturn]] PQXX_PRIVATE void ThrowSQLError(\n+ 232 const std::string &Err,\n+ 233 const std::string &Query) const;\n+ 234 PQXX_PRIVATE PQXX_PURE int errorposition() const;\n+ 235 PQXX_PRIVATE std::string StatusError() const;\n+ 236\n+237 friend class pqxx::internal::gate::result_sql_cursor;\n+ 238 PQXX_PURE const char *cmd_status() const noexcept;\n+ 239};\n+ 240} // namespace pqxx\n+ 241#include \"pqxx/compiler-internal-post.hxx\"\n+ 242#endif\n+std\n+STL namespace.\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::operator+\n-const_result_iterator operator+(result::difference_type o,\n-const_result_iterator i)\n-Definition: result_iterator.hxx:212\n pqxx::result_difference_type\n signed long result_difference_type\n Difference between result sizes.\n Definition: types.hxx:21\n+pqxx::field_size_type\n+std::size_t field_size_type\n+Number of bytes in a field of database data.\n+Definition: types.hxx:30\n pqxx::result_size_type\n unsigned long result_size_type\n Number of rows in a result set.\n Definition: types.hxx:18\n+pqxx::row_size_type\n+unsigned int row_size_type\n+Number of fields in a row of database data.\n+Definition: types.hxx:24\n+pqxx::internal::clear_result\n+void clear_result(const pq::PGresult *)\n+C++ wrapper for libpq's PQclear.\n+Definition: result.cxx:30\n+pqxx::field\n+Reference to a field in a result set.\n+Definition: field.hxx:50\n pqxx::result\n Result set containing data returned by a query or command.\n Definition: result.hxx:70\n-pqxx::result::end\n-const_iterator end() const noexcept\n-Definition: result_iterator.hxx:227\n+pqxx::result::column_type\n+oid column_type(const char ColName[]) const\n+Type of given column.\n+Definition: result.hxx:151\n+pqxx::result::table_column\n+row_size_type table_column(int ColNum) const\n+What column in its table did this column come from?\n+Definition: result.hxx:169\n+pqxx::result::result\n+result() noexcept\n+Definition: result.hxx:81\n+pqxx::result::column_type\n+oid column_type(const std::string &ColName) const\n+Type of given column.\n+Definition: result.hxx:147\n+pqxx::result::size_type\n+result_size_type size_type\n+Definition: result.hxx:72\n+pqxx::result::column_type\n+oid column_type(int ColNum) const\n+Type of given column.\n+Definition: result.hxx:143\n+pqxx::result::clear\n+void clear() noexcept\n+Definition: result.hxx:121\n+pqxx::result::column_table\n+oid column_table(int ColNum) const\n+What table did this column come from?\n+Definition: result.hxx:158\n+pqxx::result::operator=\n+result & operator=(const result &rhs) noexcept=default\n+pqxx::result::column_table\n+oid column_table(const std::string &ColName) const\n+What table did this column come from?\n+Definition: result.hxx:162\n pqxx::result::difference_type\n result_difference_type difference_type\n Definition: result.hxx:73\n-pqxx::result::size\n-PQXX_PURE size_type size() const noexcept\n-Definition: result.cxx:94\n-pqxx::result::cend\n-const_iterator cend() const noexcept\n-Definition: result_iterator.hxx:231\n+pqxx::result::result\n+result(const result &rhs) noexcept=default\n+pqxx::result::table_column\n+row_size_type table_column(const std::string &ColName) const\n+What column in its table did this column come from?\n+Definition: result.hxx:173\n+pqxx::result::operator!=\n+bool operator!=(const result &rhs) const noexcept\n+Definition: result.hxx:95\n pqxx::const_result_iterator\n Iterator for rows in a result. Use as result::const_iterator.\n Definition: result_iterator.hxx:36\n-pqxx::const_result_iterator::operator!=\n-bool operator!=(const const_result_iterator &i) const\n-Definition: result_iterator.hxx:88\n-pqxx::const_result_iterator::operator-=\n-const_result_iterator & operator-=(difference_type i)\n-Definition: result_iterator.hxx:78\n-pqxx::const_result_iterator::operator++\n-const_result_iterator & operator++()\n-Definition: result_iterator.hxx:72\n-pqxx::const_result_iterator::const_result_iterator\n-const_result_iterator(const row &t) noexcept\n-Definition: result_iterator.hxx:46\n-pqxx::const_result_iterator::operator+\n-const_result_iterator operator+(difference_type) const\n-Definition: result_iterator.hxx:205\n-pqxx::const_result_iterator::iterator_category\n-std::random_access_iterator_tag iterator_category\n-Definition: result_iterator.hxx:38\n-pqxx::const_result_iterator::operator-\n-const_result_iterator operator-(difference_type) const\n-Definition: result_iterator.hxx:216\n-pqxx::const_result_iterator::operator<\n-bool operator<(const const_result_iterator &i) const\n-Definition: result_iterator.hxx:90\n-pqxx::const_result_iterator::operator>\n-bool operator>(const const_result_iterator &i) const\n-Definition: result_iterator.hxx:94\n-pqxx::const_result_iterator::operator==\n-bool operator==(const const_result_iterator &i) const\n-Definition: result_iterator.hxx:86\n-pqxx::const_result_iterator::operator+=\n-const_result_iterator & operator+=(difference_type i)\n-Definition: result_iterator.hxx:76\n-pqxx::const_result_iterator::operator->\n-pointer operator->() const\n-Definition: result_iterator.hxx:63\n-pqxx::const_result_iterator::operator<=\n-bool operator<=(const const_result_iterator &i) const\n-Definition: result_iterator.hxx:92\n-pqxx::const_result_iterator::difference_type\n-result_difference_type difference_type\n-Definition: result_iterator.hxx:43\n-pqxx::const_result_iterator::size_type\n-result_size_type size_type\n-Definition: result_iterator.hxx:42\n-pqxx::const_result_iterator::operator>=\n-bool operator>=(const const_result_iterator &i) const\n-Definition: result_iterator.hxx:96\n-pqxx::const_result_iterator::operator*\n-reference operator*() const\n-Definition: result_iterator.hxx:64\n-pqxx::const_result_iterator::operator--\n-const_result_iterator & operator--()\n-Definition: result_iterator.hxx:74\n-pqxx::const_result_iterator::const_result_iterator\n-const_result_iterator() noexcept\n-Definition: result_iterator.hxx:45\n pqxx::const_reverse_result_iterator\n Reverse iterator for result. Use as result::const_reverse_iterator.\n Definition: result_iterator.hxx:122\n-pqxx::const_reverse_result_iterator::base\n-PQXX_PURE const_result_iterator base() const noexcept\n-Definition: result.cxx:425\n-pqxx::const_reverse_result_iterator::operator>=\n-bool operator>=(const const_reverse_result_iterator &rhs) const\n-Definition: result_iterator.hxx:198\n-pqxx::const_reverse_result_iterator::operator+\n-const_reverse_result_iterator operator+(difference_type i) const\n-Definition: result_iterator.hxx:172\n-pqxx::const_reverse_result_iterator::operator!=\n-bool operator!=(const const_reverse_result_iterator &rhs) const noexcept\n-Definition: result_iterator.hxx:188\n-pqxx::const_reverse_result_iterator::operator-=\n-const_reverse_result_iterator & operator-=(difference_type i)\n-Definition: result_iterator.hxx:164\n-pqxx::const_reverse_result_iterator::operator+=\n-const_reverse_result_iterator & operator+=(difference_type i)\n-Definition: result_iterator.hxx:162\n-pqxx::const_reverse_result_iterator::operator==\n-bool operator==(const const_reverse_result_iterator &rhs) const noexcept\n-Definition: result_iterator.hxx:185\n-pqxx::const_reverse_result_iterator::operator<\n-bool operator<(const const_reverse_result_iterator &rhs) const\n-Definition: result_iterator.hxx:192\n-pqxx::const_reverse_result_iterator::const_reverse_result_iterator\n-const_reverse_result_iterator(const const_reverse_result_iterator &rhs)\n-Definition: result_iterator.hxx:132\n-pqxx::const_reverse_result_iterator::operator-\n-const_reverse_result_iterator operator-(difference_type i)\n-Definition: result_iterator.hxx:174\n-pqxx::const_reverse_result_iterator::const_reverse_result_iterator\n-const_reverse_result_iterator(const const_result_iterator &rhs)\n-Definition: result_iterator.hxx:135\n-pqxx::const_reverse_result_iterator::operator>\n-bool operator>(const const_reverse_result_iterator &rhs) const\n-Definition: result_iterator.hxx:196\n-pqxx::const_reverse_result_iterator::operator-\n-difference_type operator-(const const_reverse_result_iterator &rhs) const\n-Definition: result_iterator.hxx:176\n-pqxx::const_reverse_result_iterator::operator<=\n-bool operator<=(const const_reverse_result_iterator &rhs) const\n-Definition: result_iterator.hxx:194\n-pqxx::const_reverse_result_iterator::operator--\n-const_reverse_result_iterator & operator--()\n-Definition: result_iterator.hxx:159\n-pqxx::const_reverse_result_iterator::operator++\n-const_reverse_result_iterator & operator++()\n-Definition: result_iterator.hxx:156\n pqxx::row\n Reference to one row in a result.\n Definition: row.hxx:41\n-pqxx::row::num\n-size_t num() const\n-Definition: row.hxx:170\n-pqxx::row::m_result\n-result m_result\n-Result set of which this is one row.\n-Definition: row.hxx:192\n-pqxx::row::m_index\n-long m_index\n-Row number.\n-Definition: row.hxx:198\n * include\n * pqxx\n- * result_iterator.hxx\n+ * result.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00062_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00062_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: compiler-public.hxx Source File\n+libpqxx: row.hxx Source File\n \n \n \n \n \n \n \n@@ -55,133 +55,353 @@\n \n
\n
\n-
compiler-public.hxx
\n+
row.hxx
\n
\n
\n
1
\n-
9#ifndef PQXX_H_COMPILER_PUBLIC
\n-
10#define PQXX_H_COMPILER_PUBLIC
\n-
11
\n-
12// Workarounds & definitions that need to be included even in library's headers
\n-
13#include "pqxx/config-public-compiler.h"
\n-
14
\n-
15// Some compilers, Visual Studio in particular, don't seem to support the
\n-
16// standard's ISO-646 keywords out of the box.
\n-
17#include <ciso646>
\n+
13#ifndef PQXX_H_ROW
\n+
14#define PQXX_H_ROW
\n+
15
\n+
16#include "pqxx/compiler-public.hxx"
\n+
17#include "pqxx/compiler-internal-pre.hxx"
\n
18
\n-
19
\n-
20#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_CONST)
\n-
22#define PQXX_CONST __attribute__ ((const))
\n-
23#else
\n-
24#define PQXX_CONST
\n-
25#endif
\n-
26
\n-
27#if defined(PQXX_HAVE_DEPRECATED)
\n-
29#define PQXX_DEPRECATED [[deprecated]]
\n-
30#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_DEPRECATED)
\n-
31#define PQXX_DEPRECATED __attribute__ ((deprecated))
\n-
32#else
\n-
33#define PQXX_DEPRECATED
\n-
34#endif
\n-
35
\n-
36#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_PURE)
\n-
38#define PQXX_PURE __attribute__ ((pure))
\n-
39#else
\n-
40#define PQXX_PURE
\n-
41#endif
\n-
42
\n-
43
\n-
44// Workarounds for Windows
\n-
45#ifdef _WIN32
\n-
46
\n-
47/* For now, export DLL symbols if _DLL is defined. This is done automatically
\n-
48 * by the compiler when linking to the dynamic version of the runtime library,
\n-
49 * according to "gzh"
\n-
50 */
\n-
51#if !defined(PQXX_LIBEXPORT) && defined(PQXX_SHARED)
\n-
52#define PQXX_LIBEXPORT __declspec(dllimport)
\n-
53#endif // !PQXX_LIBEXPORT && PQXX_SHARED
\n-
54
\n-
55
\n-
56// Workarounds for Microsoft Visual C++
\n-
57#ifdef _MSC_VER
\n+
19#include "pqxx/except.hxx"
\n+
20#include "pqxx/field.hxx"
\n+
21#include "pqxx/result.hxx"
\n+
22
\n+
23
\n+
24// Methods tested in eg. test module test01 are marked with "//[t01]".
\n+
25
\n+
26namespace pqxx
\n+
27{
\n+
29
\n+
40class PQXX_LIBEXPORT row
\n+
41{
\n+
42public:
\n+\n+\n+\n+\n+\n+\n+\n+\n+
51
\n+
52 row() =default;
\n+
53
\n+
55 row(result r, size_t i) noexcept;
\n+
56
\n+
57 ~row() noexcept =default; // Yes Scott Meyers, you're absolutely right[1]
\n
58
\n-
59// Suppress vtables on abstract classes.
\n-
60#define PQXX_NOVTABLE __declspec(novtable)
\n-
61
\n-
62// Automatically link with the appropriate libpq (static or dynamic, debug or
\n-
63// release). The default is to use the release DLL. Define PQXX_PQ_STATIC to
\n-
64// link to a static version of libpq, and _DEBUG to link to a debug version.
\n-
65// The two may be combined.
\n-
66#if defined(PQXX_AUTOLINK)
\n-
67#if defined(PQXX_PQ_STATIC)
\n-
68#ifdef _DEBUG
\n-
69#pragma comment(lib, "libpqd")
\n-
70#else
\n-
71#pragma comment(lib, "libpq")
\n-
72#endif
\n-
73#else
\n-
74#ifdef _DEBUG
\n-
75#pragma comment(lib, "libpqddll")
\n-
76#else
\n-
77#pragma comment(lib, "libpqdll")
\n-
78#endif
\n-
79#endif
\n-
80#endif
\n-
81
\n-
82// If we're not compiling libpqxx itself, automatically link with the
\n-
83// appropriate libpqxx library. To link with the libpqxx DLL, define
\n-
84// PQXX_SHARED; the default is to link with the static library. A static link
\n-
85// is the recommended practice.
\n-
86//
\n-
87// The preprocessor macro PQXX_INTERNAL is used to detect whether we
\n-
88// are compiling the libpqxx library itself. When you compile the library
\n-
89// yourself using your own project file, make sure to include this macro.
\n-
90#if defined(PQXX_AUTOLINK) && !defined(PQXX_INTERNAL)
\n-
91 #ifdef PQXX_SHARED
\n-
92 #ifdef _DEBUG
\n-
93 #pragma comment(lib, "libpqxxD")
\n-
94 #else
\n-
95 #pragma comment(lib, "libpqxx")
\n-
96 #endif
\n-
97 #else // !PQXX_SHARED
\n-
98 #ifdef _DEBUG
\n-
99 #pragma comment(lib, "libpqxx_staticD")
\n-
100 #else
\n-
101 #pragma comment(lib, "libpqxx_static")
\n-
102 #endif
\n-
103 #endif
\n-
104#endif
\n-
105
\n-
106#endif // _MSC_VER
\n-
107#endif // _WIN32
\n-
108
\n+
63 PQXX_PURE bool operator==(const row &) const noexcept; //[t75]
\n+
64 bool operator!=(const row &rhs) const noexcept //[t75]
\n+
65 { return not operator==(rhs); }
\n+
67
\n+
68 const_iterator begin() const noexcept; //[t82]
\n+
69 const_iterator cbegin() const noexcept;
\n+
70 const_iterator end() const noexcept; //[t82]
\n+
71 const_iterator cend() const noexcept;
\n+
72
\n+
77 reference front() const noexcept; //[t74]
\n+
78 reference back() const noexcept; //[t75]
\n+
79
\n+
80 const_reverse_row_iterator rbegin() const; //[t82]
\n+
81 const_reverse_row_iterator crbegin() const;
\n+
82 const_reverse_row_iterator rend() const; //[t82]
\n+
83 const_reverse_row_iterator crend() const;
\n+
84
\n+
85 reference operator[](size_type) const noexcept; //[t11]
\n+
86 reference operator[](int) const noexcept; //[t02]
\n+
90 reference operator[](const char[]) const; //[t11]
\n+
94 reference operator[](const std::string &) const; //[t11]
\n+
95 reference at(size_type) const; //[t11]
\n+
96 reference at(int) const; //[t11]
\n+
100 reference at(const char[]) const; //[t11]
\n+
104 reference at(const std::string &) const; //[t11]
\n+
106
\n+
107 size_type size() const noexcept //[t11]
\n+
108 { return m_end-m_begin; }
\n
109
\n-
110#ifndef PQXX_LIBEXPORT
\n-
111#define PQXX_LIBEXPORT
\n-
112#endif
\n-
113
\n-
114#ifndef PQXX_PRIVATE
\n-
115#define PQXX_PRIVATE
\n-
116#endif
\n-
117
\n-
118#ifndef PQXX_NOVTABLE
\n-
119#define PQXX_NOVTABLE
\n-
120#endif
\n-
121
\n-
122#endif
\n+
110 void swap(row &) noexcept; //[t11]
\n+
111
\n+
113 size_t rownumber() const noexcept { return size_t(m_index); } //[t11]
\n+
114
\n+
120 size_type column_number(const std::string &ColName) const //[t30]
\n+
121 { return column_number(ColName.c_str()); }
\n+
122
\n+
124 size_type column_number(const char[]) const; //[t30]
\n+
125
\n+
127 oid column_type(size_type) const; //[t07]
\n+
128
\n+
130 oid column_type(int ColNum) const //[t07]
\n+
131 { return column_type(size_type(ColNum)); }
\n+
132
\n+
134 oid column_type(const std::string &ColName) const //[t07]
\n+
135 { return column_type(column_number(ColName)); }
\n+
136
\n+
138 oid column_type(const char ColName[]) const //[t07]
\n+
139 { return column_type(column_number(ColName)); }
\n+
140
\n+
142 oid column_table(size_type ColNum) const; //[t02]
\n+
143
\n+
145 oid column_table(int ColNum) const //[t02]
\n+
146 { return column_table(size_type(ColNum)); }
\n+
148 oid column_table(const std::string &ColName) const //[t02]
\n+
149 { return column_table(column_number(ColName)); }
\n+
150
\n+
152
\n+
159 size_type table_column(size_type) const; //[t93]
\n+
160
\n+
162 size_type table_column(int ColNum) const //[t93]
\n+
163 { return table_column(size_type(ColNum)); }
\n+
164
\n+
166 size_type table_column(const std::string &ColName) const //[t93]
\n+
167 { return table_column(column_number(ColName)); }
\n+
169
\n+
170 size_t num() const { return rownumber(); } //[t01]
\n+
171
\n+
184 row slice(size_type Begin, size_type End) const;
\n+
185
\n+
186 // Is this an empty slice?
\n+
187 PQXX_PURE bool empty() const noexcept;
\n+
188
\n+
189protected:
\n+
190 friend class field;
\n+
192 result m_result;
\n+
194
\n+
198 long m_index = 0;
\n+
200 size_type m_begin = 0;
\n+
202 size_type m_end = 0;
\n+
203};
\n+
204
\n+
205
\n+
207class PQXX_LIBEXPORT const_row_iterator : public field
\n+
208{
\n+
209public:
\n+
210 using iterator_category = std::random_access_iterator_tag;
\n+
211 using value_type = const field;
\n+
212 using pointer = const field *;
\n+\n+\n+\n+
216
\n+
217 const_row_iterator(const row &T, row_size_type C) noexcept : //[t82]
\n+
218 field{T, C} {}
\n+
219 const_row_iterator(const field &F) noexcept : field{F} {} //[t82]
\n+
220
\n+
225 pointer operator->() const { return this; } //[t82]
\n+
226 reference operator*() const { return field{*this}; } //[t82]
\n+
228
\n+
233 const_row_iterator operator++(int); //[t82]
\n+
234 const_row_iterator &operator++() { ++m_col; return *this; } //[t82]
\n+
235 const_row_iterator operator--(int); //[t82]
\n+
236 const_row_iterator &operator--() { --m_col; return *this; } //[t82]
\n+
237
\n+\n+
239 { m_col = size_type(difference_type(m_col) + i); return *this; }
\n+\n+
241 { m_col = size_type(difference_type(m_col) - i); return *this; }
\n+
243
\n+
248 bool operator==(const const_row_iterator &i) const //[t82]
\n+
249 {return col()==i.col();}
\n+
250 bool operator!=(const const_row_iterator &i) const //[t82]
\n+
251 {return col()!=i.col();}
\n+
252 bool operator<(const const_row_iterator &i) const //[t82]
\n+
253 {return col()<i.col();}
\n+
254 bool operator<=(const const_row_iterator &i) const //[t82]
\n+
255 {return col()<=i.col();}
\n+
256 bool operator>(const const_row_iterator &i) const //[t82]
\n+
257 {return col()>i.col();}
\n+
258 bool operator>=(const const_row_iterator &i) const //[t82]
\n+
259 {return col()>=i.col();}
\n+
261
\n+
266 inline const_row_iterator operator+(difference_type) const; //[t82]
\n+
267
\n+
268 friend const_row_iterator operator+( //[t82]
\n+
269 difference_type,
\n+\n+
271
\n+
272 inline const_row_iterator operator-(difference_type) const; //[t82]
\n+
273 inline difference_type operator-(const_row_iterator) const; //[t82]
\n+
275};
\n+
276
\n+
277
\n+
279class PQXX_LIBEXPORT const_reverse_row_iterator : private const_row_iterator
\n+
280{
\n+
281public:
\n+\n+\n+\n+\n+\n+\n+\n+
289
\n+\n+\n+
292 explicit
\n+
293 const_reverse_row_iterator(const super &rhs) noexcept : //[t82]
\n+
294 const_row_iterator{rhs} { super::operator--(); }
\n+
295
\n+
296 PQXX_PURE iterator_type base() const noexcept; //[t82]
\n+
297
\n+
302 using iterator_type::operator->; //[t82]
\n+
303 using iterator_type::operator*; //[t82]
\n+
305
\n+
310 const_reverse_row_iterator &
\n+
311 operator=(const const_reverse_row_iterator &r) //[t82]
\n+
312 { iterator_type::operator=(r); return *this; }
\n+\n+
314 { iterator_type::operator--(); return *this; }
\n+
315 const_reverse_row_iterator operator++(int); //[t82]
\n+\n+
317 { iterator_type::operator++(); return *this; }
\n+
318 const_reverse_row_iterator operator--(int); //[t82]
\n+\n+
320 { iterator_type::operator-=(i); return *this; }
\n+\n+
322 { iterator_type::operator+=(i); return *this; }
\n+
324
\n+\n+
330 { return const_reverse_row_iterator{base()-i}; }
\n+\n+
332 { return const_reverse_row_iterator{base()+i}; }
\n+
333 difference_type
\n+
334 operator-(const const_reverse_row_iterator &rhs) const //[t82]
\n+
335 { return rhs.const_row_iterator::operator-(*this); }
\n+
337
\n+
342 bool operator==(const const_reverse_row_iterator &rhs) const noexcept //[t82]
\n+
343 { return iterator_type::operator==(rhs); }
\n+
344 bool operator!=(const const_reverse_row_iterator &rhs) const noexcept //[t82]
\n+
345 { return !operator==(rhs); }
\n+
346
\n+
347 bool operator<(const const_reverse_row_iterator &rhs) const //[t82]
\n+
348 { return iterator_type::operator>(rhs); }
\n+
349 bool operator<=(const const_reverse_row_iterator &rhs) const //[t82]
\n+
350 { return iterator_type::operator>=(rhs); }
\n+
351 bool operator>(const const_reverse_row_iterator &rhs) const //[t82]
\n+
352 { return iterator_type::operator<(rhs); }
\n+
353 bool operator>=(const const_reverse_row_iterator &rhs) const //[t82]
\n+
354 { return iterator_type::operator<=(rhs); }
\n+
356};
\n+
357
\n+
358
\n+
359inline const_row_iterator
\n+\n+
361{
\n+
362 return const_row_iterator{
\n+
363 row(home(), idx()),
\n+
364 size_type(difference_type(col()) + o)};
\n+
365}
\n+
366
\n+\n+\n+
369 { return i + o; }
\n+
370
\n+\n+\n+
373{
\n+
374 return const_row_iterator{
\n+
375 row(home(), idx()),
\n+
376 size_type(difference_type(col()) - o)};
\n+
377}
\n+
378
\n+\n+\n+
381 { return difference_type(num() - i.num()); }
\n+
382
\n+
383
\n+
384} // namespace pqxx
\n+
385
\n+
386
\n+
387/*
\n+
388[1] Scott Meyers, in one of his essential books, "Effective C++" and "More
\n+
389Effective C++", points out that it is good style to have any class containing
\n+
390a member of pointer type define a destructor--just to show that it knows what
\n+
391it is doing with the pointer. This helps prevent nasty memory leak / double
\n+
392deletion bugs typically resulting from programmers' omission to deal with such
\n+
393issues in their destructors.
\n+
394
\n+
395The @c -Weffc++ option in gcc generates warnings for noncompliance with Scott's
\n+
396style guidelines, and hence necessitates the definition of this destructor,
\n+
397trivial as it may be.
\n+
398*/
\n+
399
\n+
400
\n+
401#include "pqxx/compiler-internal-post.hxx"
\n+
402
\n+
403#endif
\n+
STL namespace.
\n+
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n+
const_result_iterator operator+(result::difference_type o, const_result_iterator i)
Definition: result_iterator.hxx:212
\n+
signed int row_difference_type
Difference between row sizes.
Definition: types.hxx:27
\n+
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
\n+
Reference to a field in a result set.
Definition: field.hxx:50
\n+
row_size_type num() const
Definition: field.hxx:104
\n+
field_size_type size_type
Definition: field.hxx:52
\n+
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n+
Reference to one row in a result.
Definition: row.hxx:41
\n+
size_t rownumber() const noexcept
Row number, assuming this is a real row and not end()/rend().
Definition: row.hxx:113
\n+
oid column_type(const std::string &ColName) const
Type of given column.
Definition: row.hxx:134
\n+
oid column_table(const std::string &ColName) const
What table did this column come from?
Definition: row.hxx:148
\n+
row_size_type size_type
Definition: row.hxx:43
\n+
row_difference_type difference_type
Definition: row.hxx:44
\n+
row()=default
\n+
size_t num() const
Definition: row.hxx:170
\n+
size_type table_column(const std::string &ColName) const
What column number in its table did this result column come from?
Definition: row.hxx:166
\n+
size_type column_number(const std::string &ColName) const
Number of given column (throws exception if it doesn't exist)
Definition: row.hxx:120
\n+
~row() noexcept=default
\n+
oid column_table(int ColNum) const
What table did this column come from?
Definition: row.hxx:145
\n+
oid column_type(const char ColName[]) const
Type of given column.
Definition: row.hxx:138
\n+
size_type table_column(int ColNum) const
What column number in its table did this result column come from?
Definition: row.hxx:162
\n+
oid column_type(int ColNum) const
Type of given column.
Definition: row.hxx:130
\n+
Iterator for fields in a row. Use as row::const_iterator.
Definition: row.hxx:208
\n+
bool operator!=(const const_row_iterator &i) const
Definition: row.hxx:250
\n+
const_row_iterator & operator++()
Definition: row.hxx:234
\n+
const_row_iterator & operator--()
Definition: row.hxx:236
\n+
bool operator<=(const const_row_iterator &i) const
Definition: row.hxx:254
\n+
std::random_access_iterator_tag iterator_category
Definition: row.hxx:210
\n+
const_row_iterator & operator-=(difference_type i)
Definition: row.hxx:240
\n+
const_row_iterator operator-(difference_type) const
Definition: row.hxx:372
\n+
const_row_iterator operator+(difference_type) const
Definition: row.hxx:360
\n+
bool operator==(const const_row_iterator &i) const
Definition: row.hxx:248
\n+
bool operator>=(const const_row_iterator &i) const
Definition: row.hxx:258
\n+
reference operator*() const
Definition: row.hxx:226
\n+
const_row_iterator(const row &T, row_size_type C) noexcept
Definition: row.hxx:217
\n+
row_difference_type difference_type
Definition: row.hxx:214
\n+
pointer operator->() const
Definition: row.hxx:225
\n+
bool operator<(const const_row_iterator &i) const
Definition: row.hxx:252
\n+
const_row_iterator & operator+=(difference_type i)
Definition: row.hxx:238
\n+
bool operator>(const const_row_iterator &i) const
Definition: row.hxx:256
\n+
const_row_iterator(const field &F) noexcept
Definition: row.hxx:219
\n+
Reverse iterator for a row. Use as row::const_reverse_iterator.
Definition: row.hxx:280
\n+
const_reverse_row_iterator & operator+=(difference_type i)
Definition: row.hxx:319
\n+
const_reverse_row_iterator(const const_reverse_row_iterator &r)
Definition: row.hxx:290
\n+
const_reverse_row_iterator & operator-=(difference_type i)
Definition: row.hxx:321
\n+
bool operator!=(const const_reverse_row_iterator &rhs) const noexcept
Definition: row.hxx:344
\n+
const_reverse_row_iterator operator+(difference_type i) const
Definition: row.hxx:329
\n+
bool operator<(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:347
\n+
const_reverse_row_iterator operator-(difference_type i)
Definition: row.hxx:331
\n+
bool operator<=(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:349
\n+
bool operator>=(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:353
\n+
bool operator>(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:351
\n+
bool operator==(const const_reverse_row_iterator &rhs) const noexcept
Definition: row.hxx:342
\n+
const_reverse_row_iterator & operator--()
Definition: row.hxx:316
\n+
difference_type operator-(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:334
\n+
const_reverse_row_iterator operator++()
Definition: row.hxx:313
\n+
const_reverse_row_iterator(const super &rhs) noexcept
Definition: row.hxx:293
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,129 +1,477 @@\n \n \n \n \n \n libpqxx\n \n-compiler-public.hxx\n+row.hxx\n 1\n- 9#ifndef PQXX_H_COMPILER_PUBLIC\n- 10#define PQXX_H_COMPILER_PUBLIC\n- 11\n- 12// Workarounds & definitions that need to be included even in library's\n-headers\n- 13#include \"pqxx/config-public-compiler.h\"\n- 14\n- 15// Some compilers, Visual Studio in particular, don't seem to support the\n- 16// standard's ISO-646 keywords out of the box.\n- 17#include \n+ 13#ifndef PQXX_H_ROW\n+ 14#define PQXX_H_ROW\n+ 15\n+ 16#include \"pqxx/compiler-public.hxx\"\n+ 17#include \"pqxx/compiler-internal-pre.hxx\"\n 18\n- 19\n- 20#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_CONST)\n- 22#define PQXX_CONST __attribute__ ((const))\n- 23#else\n- 24#define PQXX_CONST\n- 25#endif\n- 26\n- 27#if defined(PQXX_HAVE_DEPRECATED)\n- 29#define PQXX_DEPRECATED [[deprecated]]\n- 30#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_DEPRECATED)\n- 31#define PQXX_DEPRECATED __attribute__ ((deprecated))\n- 32#else\n- 33#define PQXX_DEPRECATED\n- 34#endif\n- 35\n- 36#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_PURE)\n- 38#define PQXX_PURE __attribute__ ((pure))\n- 39#else\n- 40#define PQXX_PURE\n- 41#endif\n- 42\n- 43\n- 44// Workarounds for Windows\n- 45#ifdef _WIN32\n- 46\n- 47/* For now, export DLL symbols if _DLL is defined. This is done\n-automatically\n- 48 * by the compiler when linking to the dynamic version of the runtime\n-library,\n- 49 * according to \"gzh\"\n- 50 */\n- 51#if !defined(PQXX_LIBEXPORT) && defined(PQXX_SHARED)\n- 52#define PQXX_LIBEXPORT __declspec(dllimport)\n- 53#endif // !PQXX_LIBEXPORT && PQXX_SHARED\n- 54\n- 55\n- 56// Workarounds for Microsoft Visual C++\n- 57#ifdef _MSC_VER\n+ 19#include \"pqxx/except.hxx\"\n+ 20#include \"pqxx/field.hxx\"\n+ 21#include \"pqxx/result.hxx\"\n+ 22\n+ 23\n+ 24// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n+ 25\n+ 26namespace pqxx\n+ 27{\n+ 29\n+40class PQXX_LIBEXPORT row\n+ 41{\n+ 42public:\n+43 using size_type = row_size_type;\n+44 using difference_type = row_difference_type;\n+45 using const_iterator = const_row_iterator;\n+46 using iterator = const_iterator;\n+47 using reference = field;\n+48 using pointer = const_row_iterator;\n+49 using const_reverse_iterator = const_reverse_row_iterator;\n+50 using reverse_iterator = const_reverse_iterator;\n+ 51\n+52 row() =default;\n+ 53\n+ 55 row(result r, size_t i) noexcept;\n+ 56\n+57 ~row() noexcept =default; // Yes Scott Meyers, you're absolutely right[1]\n 58\n- 59// Suppress vtables on abstract classes.\n- 60#define PQXX_NOVTABLE __declspec(novtable)\n- 61\n- 62// Automatically link with the appropriate libpq (static or dynamic, debug\n-or\n- 63// release). The default is to use the release DLL. Define PQXX_PQ_STATIC to\n- 64// link to a static version of libpq, and _DEBUG to link to a debug version.\n- 65// The two may be combined.\n- 66#if defined(PQXX_AUTOLINK)\n- 67#if defined(PQXX_PQ_STATIC)\n- 68#ifdef _DEBUG\n- 69#pragma comment(lib, \"libpqd\")\n- 70#else\n- 71#pragma comment(lib, \"libpq\")\n- 72#endif\n- 73#else\n- 74#ifdef _DEBUG\n- 75#pragma comment(lib, \"libpqddll\")\n- 76#else\n- 77#pragma comment(lib, \"libpqdll\")\n- 78#endif\n- 79#endif\n- 80#endif\n- 81\n- 82// If we're not compiling libpqxx itself, automatically link with the\n- 83// appropriate libpqxx library. To link with the libpqxx DLL, define\n- 84// PQXX_SHARED; the default is to link with the static library. A static\n-link\n- 85// is the recommended practice.\n- 86//\n- 87// The preprocessor macro PQXX_INTERNAL is used to detect whether we\n- 88// are compiling the libpqxx library itself. When you compile the library\n- 89// yourself using your own project file, make sure to include this macro.\n- 90#if defined(PQXX_AUTOLINK) && !defined(PQXX_INTERNAL)\n- 91 #ifdef PQXX_SHARED\n- 92 #ifdef _DEBUG\n- 93 #pragma comment(lib, \"libpqxxD\")\n- 94 #else\n- 95 #pragma comment(lib, \"libpqxx\")\n- 96 #endif\n- 97 #else // !PQXX_SHARED\n- 98 #ifdef _DEBUG\n- 99 #pragma comment(lib, \"libpqxx_staticD\")\n- 100 #else\n- 101 #pragma comment(lib, \"libpqxx_static\")\n- 102 #endif\n- 103 #endif\n- 104#endif\n- 105\n- 106#endif // _MSC_VER\n- 107#endif // _WIN32\n- 108\n+ 63 PQXX_PURE bool operator==(const row &) const noexcept; //[t75]\n+64 bool operator!=(const row &rhs) const noexcept //[t75]\n+ 65 { return not operator==(rhs); }\n+ 67\n+ 68 const_iterator begin() const noexcept; //[t82]\n+ 69 const_iterator cbegin() const noexcept;\n+ 70 const_iterator end() const noexcept; //[t82]\n+ 71 const_iterator cend() const noexcept;\n+ 72\n+ 77 reference front() const noexcept; //[t74]\n+ 78 reference back() const noexcept; //[t75]\n+ 79\n+ 80 const_reverse_row_iterator rbegin() const; //[t82]\n+ 81 const_reverse_row_iterator crbegin() const;\n+ 82 const_reverse_row_iterator rend() const; //[t82]\n+ 83 const_reverse_row_iterator crend() const;\n+ 84\n+ 85 reference operator[](size_type) const noexcept; //[t11]\n+ 86 reference operator[](int) const noexcept; //[t02]\n+ 90 reference operator[](const char[]) const; //[t11]\n+ 94 reference operator[](const std::string &) const; //[t11]\n+ 95 reference at(size_type) const; //[t11]\n+ 96 reference at(int) const; //[t11]\n+ 100 reference at(const char[]) const; //[t11]\n+ 104 reference at(const std::string &) const; //[t11]\n+ 106\n+107 size_type size() const noexcept //[t11]\n+ 108 { return m_end-m_begin; }\n 109\n- 110#ifndef PQXX_LIBEXPORT\n- 111#define PQXX_LIBEXPORT\n- 112#endif\n- 113\n- 114#ifndef PQXX_PRIVATE\n- 115#define PQXX_PRIVATE\n- 116#endif\n- 117\n- 118#ifndef PQXX_NOVTABLE\n- 119#define PQXX_NOVTABLE\n- 120#endif\n- 121\n- 122#endif\n+ 110 void swap(row &) noexcept; //[t11]\n+ 111\n+113 size_t rownumber() const noexcept { return size_t(m_index); } //[t11]\n+ 114\n+120 size_type column_number(const std::string &ColName) const //[t30]\n+ 121 { return column_number(ColName.c_str()); }\n+ 122\n+ 124 size_type column_number(const char[]) const; //[t30]\n+ 125\n+ 127 oid column_type(size_type) const; //[t07]\n+ 128\n+130 oid column_type(int ColNum) const //[t07]\n+ 131 { return column_type(size_type(ColNum)); }\n+ 132\n+134 oid column_type(const std::string &ColName) const //[t07]\n+ 135 { return column_type(column_number(ColName)); }\n+ 136\n+138 oid column_type(const char ColName[]) const //[t07]\n+ 139 { return column_type(column_number(ColName)); }\n+ 140\n+ 142 oid column_table(size_type ColNum) const; //[t02]\n+ 143\n+145 oid column_table(int ColNum) const //[t02]\n+ 146 { return column_table(size_type(ColNum)); }\n+148 oid column_table(const std::string &ColName) const //[t02]\n+ 149 { return column_table(column_number(ColName)); }\n+ 150\n+ 152\n+ 159 size_type table_column(size_type) const; //[t93]\n+ 160\n+162 size_type table_column(int ColNum) const //[t93]\n+ 163 { return table_column(size_type(ColNum)); }\n+ 164\n+166 size_type table_column(const std::string &ColName) const //[t93]\n+ 167 { return table_column(column_number(ColName)); }\n+ 169\n+170 size_t num() const { return rownumber(); } //[t01]\n+ 171\n+ 184 row slice(size_type Begin, size_type End) const;\n+ 185\n+ 186 // Is this an empty slice?\n+ 187 PQXX_PURE bool empty() const noexcept;\n+ 188\n+ 189protected:\n+190 friend class field;\n+192 result m_result;\n+ 194\n+198 long m_index = 0;\n+200 size_type m_begin = 0;\n+202 size_type m_end = 0;\n+ 203};\n+ 204\n+ 205\n+207class PQXX_LIBEXPORT const_row_iterator : public field\n+ 208{\n+ 209public:\n+210 using iterator_category = std::random_access_iterator_tag;\n+211 using value_type = const field;\n+212 using pointer = const field *;\n+213 using size_type = row_size_type;\n+214 using difference_type = row_difference_type;\n+215 using reference = field;\n+ 216\n+217 const_row_iterator(const row &T, row_size_type C) noexcept : //[t82]\n+ 218 field{T, C} {}\n+219 const_row_iterator(const field &F) noexcept : field{F} {} //[t82]\n+ 220\n+225 pointer operator->() const { return this; } //[t82]\n+226 reference operator*() const { return field{*this}; } //[t82]\n+ 228\n+ 233 const_row_iterator operator++(int); //[t82]\n+234 const_row_iterator &operator++() { ++m_col; return *this; } //[t82]\n+ 235 const_row_iterator operator--(int); //[t82]\n+236 const_row_iterator &operator--() { --m_col; return *this; } //[t82]\n+ 237\n+238 const_row_iterator &operator+=(difference_type i) //[t82]\n+ 239 { m_col = size_type(difference_type(m_col) + i); return *this; }\n+240 const_row_iterator &operator-=(difference_type i) //[t82]\n+ 241 { m_col = size_type(difference_type(m_col) - i); return *this; }\n+ 243\n+248 bool operator==(const const_row_iterator &i) const //[t82]\n+ 249 {return col()==i.col();}\n+250 bool operator!=(const const_row_iterator &i) const //[t82]\n+ 251 {return col()!=i.col();}\n+252 bool operator<(const const_row_iterator &i) const //[t82]\n+ 253 {return col()(const const_row_iterator &i) const //[t82]\n+ 257 {return col()>i.col();}\n+258 bool operator>=(const const_row_iterator &i) const //[t82]\n+ 259 {return col()>=i.col();}\n+ 261\n+ 266 inline const_row_iterator operator+(difference_type) const; //[t82]\n+ 267\n+ 268 friend const_row_iterator operator+( //[t82]\n+ 269 difference_type,\n+ 270 const_row_iterator);\n+ 271\n+272 inline const_row_iterator operator-(difference_type) const; //[t82]\n+273 inline difference_type operator-(const_row_iterator) const; //[t82]\n+ 275};\n+ 276\n+ 277\n+279class PQXX_LIBEXPORT const_reverse_row_iterator : private const_row_iterator\n+ 280{\n+ 281public:\n+282 using super = const_row_iterator;\n+283 using iterator_type = const_row_iterator;\n+ 284 using iterator_type::iterator_category;\n+ 285 using iterator_type::difference_type;\n+ 286 using iterator_type::pointer;\n+287 using value_type = iterator_type::value_type;\n+288 using reference = iterator_type::reference;\n+ 289\n+290 const_reverse_row_iterator(const const_reverse_row_iterator &r) : //[t82]\n+ 291 const_row_iterator{r} {}\n+ 292 explicit\n+293 const_reverse_row_iterator(const super &rhs) noexcept : //[t82]\n+ 294 const_row_iterator{rhs} { super::operator--(); }\n+ 295\n+ 296 PQXX_PURE iterator_type base() const noexcept; //[t82]\n+ 297\n+ 302 using iterator_type::operator->; //[t82]\n+ 303 using iterator_type::operator*; //[t82]\n+ 305\n+ 310 const_reverse_row_iterator &\n+311 operator=(const const_reverse_row_iterator &r) //[t82]\n+ 312 { iterator_type::operator=(r); return *this; }\n+313 const_reverse_row_iterator operator++() //[t82]\n+ 314 { iterator_type::operator--(); return *this; }\n+ 315 const_reverse_row_iterator operator++(int); //[t82]\n+316 const_reverse_row_iterator &operator--() //[t82]\n+ 317 { iterator_type::operator++(); return *this; }\n+ 318 const_reverse_row_iterator operator--(int); //[t82]\n+319 const_reverse_row_iterator &operator+=(difference_type i) //[t82]\n+ 320 { iterator_type::operator-=(i); return *this; }\n+321 const_reverse_row_iterator &operator-=(difference_type i) //[t82]\n+ 322 { iterator_type::operator+=(i); return *this; }\n+ 324\n+329 const_reverse_row_iterator operator+(difference_type i) const //[t82]\n+ 330 { return const_reverse_row_iterator{base()-i}; }\n+331 const_reverse_row_iterator operator-(difference_type i) //[t82]\n+ 332 { return const_reverse_row_iterator{base()+i}; }\n+ 333 difference_type\n+334 operator-(const const_reverse_row_iterator &rhs) const //[t82]\n+ 335 { return rhs.const_row_iterator::operator-(*this); }\n+ 337\n+342 bool operator==(const const_reverse_row_iterator &rhs) const noexcept //\n+[t82]\n+ 343 { return iterator_type::operator==(rhs); }\n+344 bool operator!=(const const_reverse_row_iterator &rhs) const noexcept //\n+[t82]\n+ 345 { return !operator==(rhs); }\n+ 346\n+347 bool operator<(const const_reverse_row_iterator &rhs) const //[t82]\n+ 348 { return iterator_type::operator>(rhs); }\n+349 bool operator<=(const const_reverse_row_iterator &rhs) const //[t82]\n+ 350 { return iterator_type::operator>=(rhs); }\n+351 bool operator>(const const_reverse_row_iterator &rhs) const //[t82]\n+ 352 { return iterator_type::operator<(rhs); }\n+353 bool operator>=(const const_reverse_row_iterator &rhs) const //[t82]\n+ 354 { return iterator_type::operator<=(rhs); }\n+ 356};\n+ 357\n+ 358\n+ 359inline const_row_iterator\n+360const_row_iterator::operator+(difference_type o) const\n+ 361{\n+ 362 return const_row_iterator{\n+ 363 row(home(), idx()),\n+ 364 size_type(difference_type(col()) + o)};\n+ 365}\n+ 366\n+ 367inline const_row_iterator\n+368operator+(const_row_iterator::difference_type o, const_row_iterator i)\n+ 369 { return i + o; }\n+ 370\n+ 371inline const_row_iterator\n+372const_row_iterator::operator-(difference_type o) const\n+ 373{\n+ 374 return const_row_iterator{\n+ 375 row(home(), idx()),\n+ 376 size_type(difference_type(col()) - o)};\n+ 377}\n+ 378\n+ 379inline const_row_iterator::difference_type\n+380const_row_iterator::operator-(const_row_iterator i) const\n+ 381 { return difference_type(num() - i.num()); }\n+ 382\n+ 383\n+ 384} // namespace pqxx\n+ 385\n+ 386\n+ 387/*\n+ 388[1] Scott Meyers, in one of his essential books, \"Effective C++\" and \"More\n+ 389Effective C++\", points out that it is good style to have any class\n+containing\n+ 390a member of pointer type define a destructor--just to show that it knows\n+what\n+ 391it is doing with the pointer. This helps prevent nasty memory leak / double\n+ 392deletion bugs typically resulting from programmers' omission to deal with\n+such\n+ 393issues in their destructors.\n+ 394\n+ 395The @c -Weffc++ option in gcc generates warnings for noncompliance with\n+Scott's\n+ 396style guidelines, and hence necessitates the definition of this destructor,\n+ 397trivial as it may be.\n+ 398*/\n+ 399\n+ 400\n+ 401#include \"pqxx/compiler-internal-post.hxx\"\n+ 402\n+ 403#endif\n+std\n+STL namespace.\n+pqxx\n+The home of all libpqxx classes, functions, templates, etc.\n+Definition: array.hxx:26\n+pqxx::operator+\n+const_result_iterator operator+(result::difference_type o,\n+const_result_iterator i)\n+Definition: result_iterator.hxx:212\n+pqxx::row_difference_type\n+signed int row_difference_type\n+Difference between row sizes.\n+Definition: types.hxx:27\n+pqxx::row_size_type\n+unsigned int row_size_type\n+Number of fields in a row of database data.\n+Definition: types.hxx:24\n+pqxx::field\n+Reference to a field in a result set.\n+Definition: field.hxx:50\n+pqxx::field::num\n+row_size_type num() const\n+Definition: field.hxx:104\n+pqxx::field::size_type\n+field_size_type size_type\n+Definition: field.hxx:52\n+pqxx::result\n+Result set containing data returned by a query or command.\n+Definition: result.hxx:70\n+pqxx::row\n+Reference to one row in a result.\n+Definition: row.hxx:41\n+pqxx::row::rownumber\n+size_t rownumber() const noexcept\n+Row number, assuming this is a real row and not end()/rend().\n+Definition: row.hxx:113\n+pqxx::row::column_type\n+oid column_type(const std::string &ColName) const\n+Type of given column.\n+Definition: row.hxx:134\n+pqxx::row::column_table\n+oid column_table(const std::string &ColName) const\n+What table did this column come from?\n+Definition: row.hxx:148\n+pqxx::row::size_type\n+row_size_type size_type\n+Definition: row.hxx:43\n+pqxx::row::difference_type\n+row_difference_type difference_type\n+Definition: row.hxx:44\n+pqxx::row::row\n+row()=default\n+pqxx::row::num\n+size_t num() const\n+Definition: row.hxx:170\n+pqxx::row::table_column\n+size_type table_column(const std::string &ColName) const\n+What column number in its table did this result column come from?\n+Definition: row.hxx:166\n+pqxx::row::column_number\n+size_type column_number(const std::string &ColName) const\n+Number of given column (throws exception if it doesn't exist)\n+Definition: row.hxx:120\n+pqxx::row::~row\n+~row() noexcept=default\n+pqxx::row::column_table\n+oid column_table(int ColNum) const\n+What table did this column come from?\n+Definition: row.hxx:145\n+pqxx::row::column_type\n+oid column_type(const char ColName[]) const\n+Type of given column.\n+Definition: row.hxx:138\n+pqxx::row::table_column\n+size_type table_column(int ColNum) const\n+What column number in its table did this result column come from?\n+Definition: row.hxx:162\n+pqxx::row::column_type\n+oid column_type(int ColNum) const\n+Type of given column.\n+Definition: row.hxx:130\n+pqxx::const_row_iterator\n+Iterator for fields in a row. Use as row::const_iterator.\n+Definition: row.hxx:208\n+pqxx::const_row_iterator::operator!=\n+bool operator!=(const const_row_iterator &i) const\n+Definition: row.hxx:250\n+pqxx::const_row_iterator::operator++\n+const_row_iterator & operator++()\n+Definition: row.hxx:234\n+pqxx::const_row_iterator::operator--\n+const_row_iterator & operator--()\n+Definition: row.hxx:236\n+pqxx::const_row_iterator::operator<=\n+bool operator<=(const const_row_iterator &i) const\n+Definition: row.hxx:254\n+pqxx::const_row_iterator::iterator_category\n+std::random_access_iterator_tag iterator_category\n+Definition: row.hxx:210\n+pqxx::const_row_iterator::operator-=\n+const_row_iterator & operator-=(difference_type i)\n+Definition: row.hxx:240\n+pqxx::const_row_iterator::operator-\n+const_row_iterator operator-(difference_type) const\n+Definition: row.hxx:372\n+pqxx::const_row_iterator::operator+\n+const_row_iterator operator+(difference_type) const\n+Definition: row.hxx:360\n+pqxx::const_row_iterator::operator==\n+bool operator==(const const_row_iterator &i) const\n+Definition: row.hxx:248\n+pqxx::const_row_iterator::operator>=\n+bool operator>=(const const_row_iterator &i) const\n+Definition: row.hxx:258\n+pqxx::const_row_iterator::operator*\n+reference operator*() const\n+Definition: row.hxx:226\n+pqxx::const_row_iterator::const_row_iterator\n+const_row_iterator(const row &T, row_size_type C) noexcept\n+Definition: row.hxx:217\n+pqxx::const_row_iterator::difference_type\n+row_difference_type difference_type\n+Definition: row.hxx:214\n+pqxx::const_row_iterator::operator->\n+pointer operator->() const\n+Definition: row.hxx:225\n+pqxx::const_row_iterator::operator<\n+bool operator<(const const_row_iterator &i) const\n+Definition: row.hxx:252\n+pqxx::const_row_iterator::operator+=\n+const_row_iterator & operator+=(difference_type i)\n+Definition: row.hxx:238\n+pqxx::const_row_iterator::operator>\n+bool operator>(const const_row_iterator &i) const\n+Definition: row.hxx:256\n+pqxx::const_row_iterator::const_row_iterator\n+const_row_iterator(const field &F) noexcept\n+Definition: row.hxx:219\n+pqxx::const_reverse_row_iterator\n+Reverse iterator for a row. Use as row::const_reverse_iterator.\n+Definition: row.hxx:280\n+pqxx::const_reverse_row_iterator::operator+=\n+const_reverse_row_iterator & operator+=(difference_type i)\n+Definition: row.hxx:319\n+pqxx::const_reverse_row_iterator::const_reverse_row_iterator\n+const_reverse_row_iterator(const const_reverse_row_iterator &r)\n+Definition: row.hxx:290\n+pqxx::const_reverse_row_iterator::operator-=\n+const_reverse_row_iterator & operator-=(difference_type i)\n+Definition: row.hxx:321\n+pqxx::const_reverse_row_iterator::operator!=\n+bool operator!=(const const_reverse_row_iterator &rhs) const noexcept\n+Definition: row.hxx:344\n+pqxx::const_reverse_row_iterator::operator+\n+const_reverse_row_iterator operator+(difference_type i) const\n+Definition: row.hxx:329\n+pqxx::const_reverse_row_iterator::operator<\n+bool operator<(const const_reverse_row_iterator &rhs) const\n+Definition: row.hxx:347\n+pqxx::const_reverse_row_iterator::operator-\n+const_reverse_row_iterator operator-(difference_type i)\n+Definition: row.hxx:331\n+pqxx::const_reverse_row_iterator::operator<=\n+bool operator<=(const const_reverse_row_iterator &rhs) const\n+Definition: row.hxx:349\n+pqxx::const_reverse_row_iterator::operator>=\n+bool operator>=(const const_reverse_row_iterator &rhs) const\n+Definition: row.hxx:353\n+pqxx::const_reverse_row_iterator::operator>\n+bool operator>(const const_reverse_row_iterator &rhs) const\n+Definition: row.hxx:351\n+pqxx::const_reverse_row_iterator::operator==\n+bool operator==(const const_reverse_row_iterator &rhs) const noexcept\n+Definition: row.hxx:342\n+pqxx::const_reverse_row_iterator::operator--\n+const_reverse_row_iterator & operator--()\n+Definition: row.hxx:316\n+pqxx::const_reverse_row_iterator::operator-\n+difference_type operator-(const const_reverse_row_iterator &rhs) const\n+Definition: row.hxx:334\n+pqxx::const_reverse_row_iterator::operator++\n+const_reverse_row_iterator operator++()\n+Definition: row.hxx:313\n+pqxx::const_reverse_row_iterator::const_reverse_row_iterator\n+const_reverse_row_iterator(const super &rhs) noexcept\n+Definition: row.hxx:293\n * include\n * pqxx\n- * compiler-public.hxx\n+ * row.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00065_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00065_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: stream_from.hxx Source File\n+libpqxx: config.h Source File\n \n \n \n \n \n \n \n@@ -55,229 +55,130 @@\n \n
\n
\n-
stream_from.hxx
\n+
config.h
\n
\n
\n-
1
\n-
13#ifndef PQXX_H_STREAM_FROM
\n-
14#define PQXX_H_STREAM_FROM
\n+
1/* include/pqxx/config.h. Generated from config.h.in by configure. */
\n+
2/* include/pqxx/config.h.in. Generated from configure.ac by autoheader. */
\n+
3
\n+
4/* most gcc compilers know a function __attribute__((__const__)) */
\n+
5#define GCC_CONST_CALL __attribute__((__const__))
\n+
6
\n+
7/* define if the compiler supports basic C++11 syntax */
\n+
8#define HAVE_CXX11 1
\n+
9
\n+
10/* Define to 1 if you have the <dlfcn.h> header file. */
\n+
11#define HAVE_DLFCN_H 1
\n+
12
\n+
13/* Define to 1 if you have the <inttypes.h> header file. */
\n+
14#define HAVE_INTTYPES_H 1
\n
15
\n-
16#include "pqxx/compiler-public.hxx"
\n-
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18#include "pqxx/transaction_base.hxx"
\n-
19#include "pqxx/stream_base.hxx"
\n-
20#include "pqxx/internal/type_utils.hxx"
\n+
16/* Define to 1 if you have the `pq' library (-lpq). */
\n+
17#define HAVE_LIBPQ 1
\n+
18
\n+
19/* System supports poll(). */
\n+
20#define HAVE_POLL 1
\n
21
\n-
22#include <string>
\n-
23
\n+
22/* Define to 1 if you have the <stdint.h> header file. */
\n+
23#define HAVE_STDINT_H 1
\n
24
\n-
25namespace pqxx
\n-
26{
\n+
25/* Define to 1 if you have the <stdio.h> header file. */
\n+
26#define HAVE_STDIO_H 1
\n
27
\n-
29class PQXX_LIBEXPORT stream_from : public stream_base
\n-
30{
\n-
31public:
\n-\n-\n-
34 const std::string &table_name
\n-
35 );
\n-
36 template<typename Columns> stream_from(
\n-\n-
38 const std::string &table_name,
\n-
39 const Columns& columns
\n-
40 );
\n-
41 template<typename Iter> stream_from(
\n-\n-
43 const std::string &table_name,
\n-
44 Iter columns_begin,
\n-
45 Iter columns_end
\n-
46 );
\n-
47
\n-
48 ~stream_from() noexcept;
\n-
49
\n-
50 void complete() override;
\n+
28/* Define to 1 if you have the <stdlib.h> header file. */
\n+
29#define HAVE_STDLIB_H 1
\n+
30
\n+
31/* Define to 1 if you have the <strings.h> header file. */
\n+
32#define HAVE_STRINGS_H 1
\n+
33
\n+
34/* Define to 1 if you have the <string.h> header file. */
\n+
35#define HAVE_STRING_H 1
\n+
36
\n+
37/* Define to 1 if you have the <sys/select.h> header file. */
\n+
38/* #undef HAVE_SYS_SELECT_H */
\n+
39
\n+
40/* Define to 1 if you have the <sys/stat.h> header file. */
\n+
41#define HAVE_SYS_STAT_H 1
\n+
42
\n+
43/* Define to 1 if you have the <sys/time.h> header file. */
\n+
44#define HAVE_SYS_TIME_H 1
\n+
45
\n+
46/* Define to 1 if you have the <sys/types.h> header file. */
\n+
47#define HAVE_SYS_TYPES_H 1
\n+
48
\n+
49/* Define to 1 if you have the <unistd.h> header file. */
\n+
50#define HAVE_UNISTD_H 1
\n
51
\n-
52 bool get_raw_line(std::string &);
\n-
53 template<typename Tuple> stream_from & operator>>(Tuple &);
\n+
52/* Define to the sub-directory where libtool stores uninstalled libraries. */
\n+
53#define LT_OBJDIR ".libs/"
\n
54
\n-
55private:
\n-
56 internal::encoding_group m_copy_encoding;
\n-
57 std::string m_current_line;
\n-
58 bool m_retry_line;
\n-
59
\n-
60 void set_up(transaction_base &, const std::string &table_name);
\n-
61 void set_up(
\n-\n-
63 const std::string &table_name,
\n-
64 const std::string &columns
\n-
65 );
\n+
55/* Name of package */
\n+
56#define PACKAGE "libpqxx"
\n+
57
\n+
58/* Define to the address where bug reports for this package should be sent. */
\n+
59#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen"
\n+
60
\n+
61/* Define to the full name of this package. */
\n+
62#define PACKAGE_NAME "libpqxx"
\n+
63
\n+
64/* Define to the full name and version of this package. */
\n+
65#define PACKAGE_STRING "libpqxx 6.4.5"
\n
66
\n-
67 void close() override;
\n-
68
\n-
69 bool extract_field(
\n-
70 const std::string &,
\n-
71 std::string::size_type &,
\n-
72 std::string &
\n-
73 ) const;
\n-
74
\n-
75 template<typename Tuple, std::size_t I> auto tokenize_ith(
\n-
76 const std::string &,
\n-
77 Tuple &,
\n-
78 std::string::size_type,
\n-
79 std::string &
\n-
80 ) const -> typename std::enable_if<(
\n-
81 std::tuple_size<Tuple>::value > I
\n-
82 )>::type;
\n-
83 template<typename Tuple, std::size_t I> auto tokenize_ith(
\n-
84 const std::string &,
\n-
85 Tuple &,
\n-
86 std::string::size_type,
\n-
87 std::string &
\n-
88 ) const -> typename std::enable_if<(
\n-
89 std::tuple_size<Tuple>::value <= I
\n-
90 )>::type;
\n-
91
\n-
92 template<typename T> void extract_value(
\n-
93 const std::string &line,
\n-
94 T& t,
\n-
95 std::string::size_type &here,
\n-
96 std::string &workspace
\n-
97 ) const;
\n-
98};
\n+
67/* Define to the one symbol short name of this package. */
\n+
68#define PACKAGE_TARNAME "libpqxx"
\n+
69
\n+
70/* Define to the home page for this package. */
\n+
71#define PACKAGE_URL ""
\n+
72
\n+
73/* Define to the version of this package. */
\n+
74#define PACKAGE_VERSION "6.4.5"
\n+
75
\n+
76/* Define if <charconv> supports floating-point conversion. */
\n+
77/* #undef PQXX_HAVE_CHARCONV_FLOAT */
\n+
78
\n+
79/* Define if <charconv> supports integer conversion. */
\n+
80/* #undef PQXX_HAVE_CHARCONV_INT */
\n+
81
\n+
82/* Define if compiler supports [[deprecated]] attribute */
\n+
83#define PQXX_HAVE_DEPRECATED 1
\n+
84
\n+
85/* Define if the compiler supports std::experimental::optional. */
\n+
86/* #undef PQXX_HAVE_EXP_OPTIONAL */
\n+
87
\n+
88/* Define if g++ supports const attribute. */
\n+
89#define PQXX_HAVE_GCC_CONST 1
\n+
90
\n+
91/* Define if g++ supports deprecated attribute. */
\n+
92#define PQXX_HAVE_GCC_DEPRECATED 1
\n+
93
\n+
94/* Define if g++ supports pure attribute */
\n+
95#define PQXX_HAVE_GCC_PURE 1
\n+
96
\n+
97/* Define if g++ supports visibility attribute. */
\n+
98#define PQXX_HAVE_GCC_VISIBILITY 1
\n
99
\n-
100
\n-
101template<typename Columns> stream_from::stream_from(
\n-\n-
103 const std::string &table_name,
\n-
104 const Columns& columns
\n-
105) : stream_from{
\n-
106 tb,
\n-
107 table_name,
\n-
108 std::begin(columns),
\n-
109 std::end(columns)
\n-
110} {}
\n-
111
\n-
112
\n-
113template<typename Iter> stream_from::stream_from(
\n-\n-
115 const std::string &table_name,
\n-
116 Iter columns_begin,
\n-
117 Iter columns_end
\n-
118) :
\n-
119 namedclass{"stream_from", table_name},
\n-
120 stream_base{tb}
\n-
121{
\n-
122 set_up(
\n-
123 tb,
\n-
124 table_name,
\n-
125 columnlist(columns_begin, columns_end)
\n-
126 );
\n-
127}
\n-
128
\n-
129
\n-
130template<typename Tuple> stream_from & stream_from::operator>>(
\n-
131 Tuple &t
\n-
132)
\n-
133{
\n-
134 if (m_retry_line or get_raw_line(m_current_line))
\n-
135 {
\n-
136 std::string workspace;
\n-
137 try
\n-
138 {
\n-
139 tokenize_ith<Tuple, 0>(m_current_line, t, 0, workspace);
\n-
140 m_retry_line = false;
\n-
141 }
\n-
142 catch (...)
\n-
143 {
\n-
144 m_retry_line = true;
\n-
145 throw;
\n-
146 }
\n-
147 }
\n-
148 return *this;
\n-
149}
\n-
150
\n-
151
\n-
152template<typename Tuple, std::size_t I> auto stream_from::tokenize_ith(
\n-
153 const std::string &line,
\n-
154 Tuple &t,
\n-
155 std::string::size_type here,
\n-
156 std::string &workspace
\n-
157) const -> typename std::enable_if<(
\n-
158 std::tuple_size<Tuple>::value > I
\n-
159)>::type
\n-
160{
\n-
161 if (here >= line.size())
\n-
162 throw usage_error{"Too few fields to extract from stream_from line."};
\n-
163
\n-
164 extract_value(line, std::get<I>(t), here, workspace);
\n-
165 tokenize_ith<Tuple, I+1>(line, t, here, workspace);
\n-
166}
\n-
167
\n-
168
\n-
169template<typename Tuple, std::size_t I> auto stream_from::tokenize_ith(
\n-
170 const std::string &line,
\n-
171 Tuple & /* t */,
\n-
172 std::string::size_type here,
\n-
173 std::string & /* workspace */
\n-
174) const -> typename std::enable_if<(
\n-
175 std::tuple_size<Tuple>::value <= I
\n-
176)>::type
\n-
177{
\n-
178 // Zero-column line may still have a trailing newline
\n-
179 if (
\n-
180 here < line.size() and
\n-
181 not (here == line.size() - 1 and line[here] == '\\n'))
\n-
182 throw usage_error{"Not all fields extracted from stream_from line"};
\n-
183}
\n-
184
\n-
185
\n-
186template<typename T> void stream_from::extract_value(
\n-
187 const std::string &line,
\n-
188 T& t,
\n-
189 std::string::size_type &here,
\n-
190 std::string &workspace
\n-
191) const
\n-
192{
\n-
193 if (extract_field(line, here, workspace))
\n-
194 from_string<T>(workspace, t);
\n-
195 else
\n-
196 t = internal::null_value<T>();
\n-
197}
\n-
198
\n-
199template<> void stream_from::extract_value<std::nullptr_t>(
\n-
200 const std::string &line,
\n-
201 std::nullptr_t&,
\n-
202 std::string::size_type &here,
\n-
203 std::string &workspace
\n-
204) const;
\n-
205
\n-
206} // namespace pqxx
\n-
207
\n-
208
\n-
209#include "pqxx/compiler-internal-post.hxx"
\n-
210#endif
\n-
STL namespace.
\n-
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:220
\n-
Definition: stream_base.hxx:29
\n-
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
\n-
Efficiently pull data directly out of a table.
Definition: stream_from.hxx:30
\n-
stream_from & operator>>(Tuple &)
Definition: stream_from.hxx:130
\n-
stream_from(transaction_base &, const std::string &table_name)
Definition: stream_from.cxx:41
\n-
bool get_raw_line(std::string &)
Definition: stream_from.cxx:72
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
100/* Define if the compiler supports std::optional. */
\n+
101/* #undef PQXX_HAVE_OPTIONAL */
\n+
102
\n+
103/* Define to 1 if all of the C90 standard headers exist (not just the ones
\n+
104 required in a freestanding environment). This macro is provided for
\n+
105 backward compatibility; new code need not use it. */
\n+
106#define STDC_HEADERS 1
\n+
107
\n+
108/* Version number of package */
\n+
109#define VERSION "6.4.5"
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,238 +1,123 @@\n \n \n \n \n \n libpqxx\n \n-stream_from.hxx\n- 1\n- 13#ifndef PQXX_H_STREAM_FROM\n- 14#define PQXX_H_STREAM_FROM\n+config.h\n+ 1/* include/pqxx/config.h. Generated from config.h.in by configure. */\n+ 2/* include/pqxx/config.h.in. Generated from configure.ac by autoheader. */\n+ 3\n+ 4/* most gcc compilers know a function __attribute__((__const__)) */\n+ 5#define GCC_CONST_CALL __attribute__((__const__))\n+ 6\n+ 7/* define if the compiler supports basic C++11 syntax */\n+ 8#define HAVE_CXX11 1\n+ 9\n+ 10/* Define to 1 if you have the header file. */\n+ 11#define HAVE_DLFCN_H 1\n+ 12\n+ 13/* Define to 1 if you have the header file. */\n+ 14#define HAVE_INTTYPES_H 1\n 15\n- 16#include \"pqxx/compiler-public.hxx\"\n- 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18#include \"pqxx/transaction_base.hxx\"\n- 19#include \"pqxx/stream_base.hxx\"\n- 20#include \"pqxx/internal/type_utils.hxx\"\n+ 16/* Define to 1 if you have the `pq' library (-lpq). */\n+ 17#define HAVE_LIBPQ 1\n+ 18\n+ 19/* System supports poll(). */\n+ 20#define HAVE_POLL 1\n 21\n- 22#include \n- 23\n+ 22/* Define to 1 if you have the header file. */\n+ 23#define HAVE_STDINT_H 1\n 24\n- 25namespace pqxx\n- 26{\n+ 25/* Define to 1 if you have the header file. */\n+ 26#define HAVE_STDIO_H 1\n 27\n-29class PQXX_LIBEXPORT stream_from : public stream_base\n- 30{\n- 31public:\n- 32 stream_from(\n- 33 transaction_base &,\n- 34 const std::string &table_name\n- 35 );\n- 36 template stream_from(\n- 37 transaction_base &,\n- 38 const std::string &table_name,\n- 39 const Columns& columns\n- 40 );\n- 41 template stream_from(\n- 42 transaction_base &,\n- 43 const std::string &table_name,\n- 44 Iter columns_begin,\n- 45 Iter columns_end\n- 46 );\n- 47\n- 48 ~stream_from() noexcept;\n- 49\n- 50 void complete() override;\n+ 28/* Define to 1 if you have the header file. */\n+ 29#define HAVE_STDLIB_H 1\n+ 30\n+ 31/* Define to 1 if you have the header file. */\n+ 32#define HAVE_STRINGS_H 1\n+ 33\n+ 34/* Define to 1 if you have the header file. */\n+ 35#define HAVE_STRING_H 1\n+ 36\n+ 37/* Define to 1 if you have the header file. */\n+ 38/* #undef HAVE_SYS_SELECT_H */\n+ 39\n+ 40/* Define to 1 if you have the header file. */\n+ 41#define HAVE_SYS_STAT_H 1\n+ 42\n+ 43/* Define to 1 if you have the header file. */\n+ 44#define HAVE_SYS_TIME_H 1\n+ 45\n+ 46/* Define to 1 if you have the header file. */\n+ 47#define HAVE_SYS_TYPES_H 1\n+ 48\n+ 49/* Define to 1 if you have the header file. */\n+ 50#define HAVE_UNISTD_H 1\n 51\n- 52 bool get_raw_line(std::string &);\n- 53 template stream_from & operator>>(Tuple &);\n+ 52/* Define to the sub-directory where libtool stores uninstalled libraries.\n+*/\n+ 53#define LT_OBJDIR \".libs/\"\n 54\n- 55private:\n- 56 internal::encoding_group m_copy_encoding;\n- 57 std::string m_current_line;\n- 58 bool m_retry_line;\n- 59\n- 60 void set_up(transaction_base &, const std::string &table_name);\n- 61 void set_up(\n- 62 transaction_base &,\n- 63 const std::string &table_name,\n- 64 const std::string &columns\n- 65 );\n+ 55/* Name of package */\n+ 56#define PACKAGE \"libpqxx\"\n+ 57\n+ 58/* Define to the address where bug reports for this package should be sent.\n+*/\n+ 59#define PACKAGE_BUGREPORT \"Jeroen T. Vermeulen\"\n+ 60\n+ 61/* Define to the full name of this package. */\n+ 62#define PACKAGE_NAME \"libpqxx\"\n+ 63\n+ 64/* Define to the full name and version of this package. */\n+ 65#define PACKAGE_STRING \"libpqxx 6.4.5\"\n 66\n- 67 void close() override;\n- 68\n- 69 bool extract_field(\n- 70 const std::string &,\n- 71 std::string::size_type &,\n- 72 std::string &\n- 73 ) const;\n- 74\n- 75 template auto tokenize_ith(\n- 76 const std::string &,\n- 77 Tuple &,\n- 78 std::string::size_type,\n- 79 std::string &\n- 80 ) const -> typename std::enable_if<(\n- 81 std::tuple_size::value > I\n- 82 )>::type;\n- 83 template auto tokenize_ith(\n- 84 const std::string &,\n- 85 Tuple &,\n- 86 std::string::size_type,\n- 87 std::string &\n- 88 ) const -> typename std::enable_if<(\n- 89 std::tuple_size::value <= I\n- 90 )>::type;\n- 91\n- 92 template void extract_value(\n- 93 const std::string &line,\n- 94 T& t,\n- 95 std::string::size_type &here,\n- 96 std::string &workspace\n- 97 ) const;\n- 98};\n+ 67/* Define to the one symbol short name of this package. */\n+ 68#define PACKAGE_TARNAME \"libpqxx\"\n+ 69\n+ 70/* Define to the home page for this package. */\n+ 71#define PACKAGE_URL \"\"\n+ 72\n+ 73/* Define to the version of this package. */\n+ 74#define PACKAGE_VERSION \"6.4.5\"\n+ 75\n+ 76/* Define if supports floating-point conversion. */\n+ 77/* #undef PQXX_HAVE_CHARCONV_FLOAT */\n+ 78\n+ 79/* Define if supports integer conversion. */\n+ 80/* #undef PQXX_HAVE_CHARCONV_INT */\n+ 81\n+ 82/* Define if compiler supports [[deprecated]] attribute */\n+ 83#define PQXX_HAVE_DEPRECATED 1\n+ 84\n+ 85/* Define if the compiler supports std::experimental::optional. */\n+ 86/* #undef PQXX_HAVE_EXP_OPTIONAL */\n+ 87\n+ 88/* Define if g++ supports const attribute. */\n+ 89#define PQXX_HAVE_GCC_CONST 1\n+ 90\n+ 91/* Define if g++ supports deprecated attribute. */\n+ 92#define PQXX_HAVE_GCC_DEPRECATED 1\n+ 93\n+ 94/* Define if g++ supports pure attribute */\n+ 95#define PQXX_HAVE_GCC_PURE 1\n+ 96\n+ 97/* Define if g++ supports visibility attribute. */\n+ 98#define PQXX_HAVE_GCC_VISIBILITY 1\n 99\n- 100\n-101template stream_from::stream_from(\n- 102 transaction_base &tb,\n- 103 const std::string &table_name,\n- 104 const Columns& columns\n- 105) : stream_from{\n- 106 tb,\n- 107 table_name,\n- 108 std::begin(columns),\n- 109 std::end(columns)\n- 110} {}\n- 111\n- 112\n-113template stream_from::stream_from(\n- 114 transaction_base &tb,\n- 115 const std::string &table_name,\n- 116 Iter columns_begin,\n- 117 Iter columns_end\n- 118) :\n- 119 namedclass{\"stream_from\", table_name},\n- 120 stream_base{tb}\n- 121{\n- 122 set_up(\n- 123 tb,\n- 124 table_name,\n- 125 columnlist(columns_begin, columns_end)\n- 126 );\n- 127}\n- 128\n- 129\n-130template stream_from & stream_from::operator>>(\n- 131 Tuple &t\n- 132)\n- 133{\n- 134 if (m_retry_line or get_raw_line(m_current_line))\n- 135 {\n- 136 std::string workspace;\n- 137 try\n- 138 {\n- 139 tokenize_ith(m_current_line, t, 0, workspace);\n- 140 m_retry_line = false;\n- 141 }\n- 142 catch (...)\n- 143 {\n- 144 m_retry_line = true;\n- 145 throw;\n- 146 }\n- 147 }\n- 148 return *this;\n- 149}\n- 150\n- 151\n- 152template auto stream_from::tokenize_ith(\n- 153 const std::string &line,\n- 154 Tuple &t,\n- 155 std::string::size_type here,\n- 156 std::string &workspace\n- 157) const -> typename std::enable_if<(\n- 158 std::tuple_size::value > I\n- 159)>::type\n- 160{\n- 161 if (here >= line.size())\n- 162 throw usage_error{\"Too few fields to extract from stream_from line.\"};\n- 163\n- 164 extract_value(line, std::get(t), here, workspace);\n- 165 tokenize_ith(line, t, here, workspace);\n- 166}\n- 167\n- 168\n- 169template auto stream_from::tokenize_ith(\n- 170 const std::string &line,\n- 171 Tuple & /* t */,\n- 172 std::string::size_type here,\n- 173 std::string & /* workspace */\n- 174) const -> typename std::enable_if<(\n- 175 std::tuple_size::value <= I\n- 176)>::type\n- 177{\n- 178 // Zero-column line may still have a trailing newline\n- 179 if (\n- 180 here < line.size() and\n- 181 not (here == line.size() - 1 and line[here] == '\\n'))\n- 182 throw usage_error{\"Not all fields extracted from stream_from line\"};\n- 183}\n- 184\n- 185\n- 186template void stream_from::extract_value(\n- 187 const std::string &line,\n- 188 T& t,\n- 189 std::string::size_type &here,\n- 190 std::string &workspace\n- 191) const\n- 192{\n- 193 if (extract_field(line, here, workspace))\n- 194 from_string(workspace, t);\n- 195 else\n- 196 t = internal::null_value();\n- 197}\n- 198\n-199template<> void stream_from::extract_value(\n- 200 const std::string &line,\n- 201 std::nullptr_t&,\n- 202 std::string::size_type &here,\n- 203 std::string &workspace\n- 204) const;\n- 205\n- 206} // namespace pqxx\n- 207\n- 208\n- 209#include \"pqxx/compiler-internal-post.hxx\"\n- 210#endif\n-std\n-STL namespace.\n-pqxx\n-The home of all libpqxx classes, functions, templates, etc.\n-Definition: array.hxx:26\n-pqxx::usage_error\n-Error in usage of libpqxx library, similar to std::logic_error.\n-Definition: except.hxx:220\n-pqxx::stream_base\n-Definition: stream_base.hxx:29\n-pqxx::stream_base::columnlist\n-static std::string columnlist(const C &)\n-Definition: stream_base.hxx:48\n-pqxx::stream_from\n-Efficiently pull data directly out of a table.\n-Definition: stream_from.hxx:30\n-pqxx::stream_from::operator>>\n-stream_from & operator>>(Tuple &)\n-Definition: stream_from.hxx:130\n-pqxx::stream_from::stream_from\n-stream_from(transaction_base &, const std::string &table_name)\n-Definition: stream_from.cxx:41\n-pqxx::stream_from::get_raw_line\n-bool get_raw_line(std::string &)\n-Definition: stream_from.cxx:72\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n+ 100/* Define if the compiler supports std::optional. */\n+ 101/* #undef PQXX_HAVE_OPTIONAL */\n+ 102\n+ 103/* Define to 1 if all of the C90 standard headers exist (not just the ones\n+ 104 required in a freestanding environment). This macro is provided for\n+ 105 backward compatibility; new code need not use it. */\n+ 106#define STDC_HEADERS 1\n+ 107\n+ 108/* Version number of package */\n+ 109#define VERSION \"6.4.5\"\n * include\n * pqxx\n- * stream_from.hxx\n+ * config.h\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00071_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00071_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: prepared_statement.hxx Source File\n+libpqxx: field.hxx Source File\n \n \n \n \n \n \n \n@@ -55,138 +55,314 @@\n \n
\n
\n-
prepared_statement.hxx
\n+
field.hxx
\n
\n
\n
1
\n-
11#ifndef PQXX_H_PREPARED_STATEMENT
\n-
12#define PQXX_H_PREPARED_STATEMENT
\n-
13
\n-
14#include "pqxx/compiler-public.hxx"
\n-
15#include "pqxx/compiler-internal-pre.hxx"
\n-
16
\n-
17#include "pqxx/types.hxx"
\n-
18#include "pqxx/internal/statement_parameters.hxx"
\n+
13#ifndef PQXX_H_FIELD
\n+
14#define PQXX_H_FIELD
\n+
15
\n+
16#include "pqxx/compiler-public.hxx"
\n+
17#include "pqxx/compiler-internal-pre.hxx"
\n+
18#include "pqxx/internal/type_utils.hxx"
\n
19
\n-
20
\n-
21
\n-
22namespace pqxx
\n-
23{
\n-
25namespace prepare
\n-
26{
\n-
28
\n-
43template<typename IT> inline pqxx::internal::dynamic_params<IT>
\n-
44make_dynamic_params(IT begin, IT end)
\n-
45{
\n-
46 return pqxx::internal::dynamic_params<IT>(begin, end);
\n-
47}
\n-
48
\n-
49
\n-
51
\n-
65template<typename C>
\n-
66inline pqxx::internal::dynamic_params<typename C::const_iterator>
\n-
67make_dynamic_params(const C &container)
\n-
68{
\n-
69 return pqxx::internal::dynamic_params<typename C::const_iterator>(container);
\n-
70}
\n-
71} // namespace prepare
\n-
72} // namespace pqxx
\n-
73
\n-
74namespace pqxx
\n-
75{
\n-
76namespace prepare
\n-
77{
\n-
79
\n-
81class PQXX_LIBEXPORT invocation : internal::statement_parameters
\n-
82{
\n-
83public:
\n-
84 PQXX_DEPRECATED invocation(transaction_base &, const std::string &statement);
\n-
85 invocation &operator=(const invocation &) =delete;
\n-
86
\n-
88 result exec() const;
\n-
89
\n-
91 bool exists() const;
\n-
92
\n-
94 invocation &operator()() { add_param(); return *this; }
\n-
95
\n+
20#if defined(PQXX_HAVE_OPTIONAL)
\n+
21#include <optional>
\n+
22
\n+
23/* Use std::experimental::optional as a fallback for std::optional, if
\n+
24 * present.
\n+
25 *
\n+
26 * This may break compilation for some software, if using a libpqxx that was
\n+
27 * configured for a different language version. To stop libpqxx headers from
\n+
28 * using or supporting std::experimental::optional, define a macro
\n+
29 * PQXX_HIDE_EXP_OPTIONAL when building your software.
\n+
30 */
\n+
31#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)
\n+
32#include <experimental/optional>
\n+
33#endif
\n+
34
\n+
35#include "pqxx/array.hxx"
\n+
36#include "pqxx/result.hxx"
\n+
37#include "pqxx/strconv.hxx"
\n+
38#include "pqxx/types.hxx"
\n+
39
\n+
40
\n+
41// Methods tested in eg. test module test01 are marked with "//[t01]".
\n+
42
\n+
43namespace pqxx
\n+
44{
\n+
46
\n+
49class PQXX_LIBEXPORT field
\n+
50{
\n+
51public:
\n+\n+
53
\n+
55
\n+
59 field(const row &R, row_size_type C) noexcept; //[t01]
\n+
60
\n+
66
\n+
82 bool operator==(const field &) const; //[t75]
\n+
83
\n+
85
\n+
87 bool operator!=(const field &rhs) const //[t82]
\n+
88 {return not operator==(rhs);}
\n+
90
\n+
96 const char *name() const; //[t11]
\n
97
\n-
100 template<typename T> invocation &operator()(const T &v)
\n-
101 { add_param(v, true); return *this; }
\n-
102
\n-
104
\n-\n-
108 { add_binary_param(v, true); return *this; }
\n-
109
\n-
111
\n-
115 template<typename T> invocation &operator()(const T &v, bool nonnull)
\n-
116 { add_param(v, nonnull); return *this; }
\n-
117
\n-
119
\n-
123 invocation &operator()(const binarystring &v, bool nonnull)
\n-
124 { add_binary_param(v, nonnull); return *this; }
\n-
125
\n-
127
\n-
134 template<typename T> invocation &operator()(T *v, bool nonnull=true)
\n-
135 { add_param(v, nonnull); return *this; }
\n-
136
\n-
138
\n-
142 invocation &operator()(const char *v, bool nonnull=true)
\n-
143 { add_param(v, nonnull); return *this; }
\n-
144
\n-
145private:
\n-
146 transaction_base &m_home;
\n-
147 const std::string m_statement;
\n-
148
\n-
149 invocation &setparam(const std::string &, bool nonnull);
\n-
150};
\n-
151
\n+
99 oid type() const; //[t07]
\n+
100
\n+
102 oid table() const; //[t02]
\n+
103
\n+
104 row_size_type num() const { return col(); } //[t82]
\n+
105
\n+
107 row_size_type table_column() const; //[t93]
\n+
109
\n+
115
\n+
120 const char *c_str() const; //[t02]
\n+
121
\n+
123 bool is_null() const noexcept; //[t12]
\n+
124
\n+
126
\n+
129 size_type size() const noexcept; //[t11]
\n+
130
\n+
132
\n+
135 template<typename T> auto to(T &Obj) const //[t03]
\n+
136 -> typename std::enable_if<(
\n+
137 not std::is_pointer<T>::value
\n+
138 or std::is_same<T, const char*>::value
\n+
139 ), bool>::type
\n+
140 {
\n+
141 const char *const bytes = c_str();
\n+
142 if (bytes[0] == '\\0' and is_null()) return false;
\n+
143 from_string(bytes, Obj);
\n+
144 return true;
\n+
145 }
\n+
146
\n+
148 template<typename T> bool operator>>(T &Obj) const //[t07]
\n+
149 { return to(Obj); }
\n+
150
\n
152
\n-
153namespace internal
\n-
154{
\n-
156struct PQXX_LIBEXPORT prepared_def
\n-
157{
\n-
159 std::string definition;
\n-
161 bool registered = false;
\n-
162
\n-
163 prepared_def() =default;
\n-
164 explicit prepared_def(const std::string &);
\n-
165};
\n-
166
\n-
167} // namespace pqxx::prepare::internal
\n-
168} // namespace pqxx::prepare
\n-
169} // namespace pqxx
\n-
170
\n-
171#include "pqxx/compiler-internal-post.hxx"
\n-
172#endif
\n+
155 template<typename T> auto to(T &Obj, const T &Default) const //[t12]
\n+
156 -> typename std::enable_if<(
\n+
157 not std::is_pointer<T>::value
\n+
158 or std::is_same<T, const char*>::value
\n+
159 ), bool>::type
\n+
160 {
\n+
161 const bool NotNull = to(Obj);
\n+
162 if (not NotNull) Obj = Default;
\n+
163 return NotNull;
\n+
164 }
\n+
165
\n+
167
\n+
170 template<typename T> T as(const T &Default) const //[t01]
\n+
171 {
\n+
172 T Obj;
\n+
173 to(Obj, Default);
\n+
174 return Obj;
\n+
175 }
\n+
176
\n+
178
\n+
183 template<typename T> T as() const //[t45]
\n+
184 {
\n+
185 T Obj;
\n+
186 if (not to(Obj)) Obj = string_traits<T>::null();
\n+
187 return Obj;
\n+
188 }
\n+
189
\n+
191
\n+
195 template<typename T, template<typename> class O
\n+
196#if defined(PQXX_HAVE_OPTIONAL)
\n+
197 = std::optional
\n+
198#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)
\n+
199 = std::experimental::optional
\n+
200#endif
\n+
201 > constexpr O<T> get() const { return as<O<T>>(); }
\n+
202
\n+
204
\n+\n+
211 { return array_parser{c_str(), m_home.m_encoding}; }
\n+
213
\n+
214
\n+
215protected:
\n+
216 const result &home() const noexcept { return m_home; }
\n+
217 size_t idx() const noexcept { return m_row; }
\n+
218 row_size_type col() const noexcept { return row_size_type(m_col); }
\n+
219
\n+
224 long m_col;
\n+
225
\n+
226private:
\n+
227 result m_home;
\n+
228 size_t m_row;
\n+
229};
\n+
230
\n+
231
\n+
233template<>
\n+
234inline bool field::to<std::string>(std::string &Obj) const
\n+
235{
\n+
236 const char *const bytes = c_str();
\n+
237 if (bytes[0] == '\\0' and is_null()) return false;
\n+
238 Obj = std::string{bytes, size()};
\n+
239 return true;
\n+
240}
\n+
241
\n+
243
\n+
248template<>
\n+
249inline bool field::to<const char *>(const char *&Obj) const
\n+
250{
\n+
251 if (is_null()) return false;
\n+
252 Obj = c_str();
\n+
253 return true;
\n+
254}
\n+
255
\n+
256
\n+
257template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n+\n+
259 public std::basic_streambuf<CHAR, TRAITS>
\n+
260{
\n+
261public:
\n+
262 using char_type = CHAR;
\n+
263 using traits_type = TRAITS;
\n+
264 using int_type = typename traits_type::int_type;
\n+
265 using pos_type = typename traits_type::pos_type;
\n+
266 using off_type = typename traits_type::off_type;
\n+
267 using openmode = std::ios::openmode;
\n+
268 using seekdir = std::ios::seekdir;
\n+
269
\n+
270 explicit field_streambuf(const field &F) : //[t74]
\n+
271 m_field{F}
\n+
272 {
\n+
273 initialize();
\n+
274 }
\n+
275
\n+
276protected:
\n+
277 virtual int sync() override { return traits_type::eof(); }
\n+
278
\n+
279protected:
\n+\n+
281 { return traits_type::eof(); }
\n+\n+
283 {return traits_type::eof();}
\n+
284 virtual int_type overflow(int_type) override
\n+
285 { return traits_type::eof(); }
\n+
286 virtual int_type underflow() override
\n+
287 { return traits_type::eof(); }
\n+
288
\n+
289private:
\n+
290 const field &m_field;
\n+
291
\n+
292 int_type initialize()
\n+
293 {
\n+
294 char_type *G =
\n+
295 reinterpret_cast<char_type *>(const_cast<char *>(m_field.c_str()));
\n+
296 this->setg(G, G, G + m_field.size());
\n+
297 return int_type(m_field.size());
\n+
298 }
\n+
299};
\n+
300
\n+
301
\n+
303
\n+
311template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n+\n+
313 public std::basic_istream<CHAR, TRAITS>
\n+
314{
\n+
315 using super = std::basic_istream<CHAR, TRAITS>;
\n+
316
\n+
317public:
\n+
318 using char_type = CHAR;
\n+
319 using traits_type = TRAITS;
\n+
320 using int_type = typename traits_type::int_type;
\n+
321 using pos_type = typename traits_type::pos_type;
\n+
322 using off_type = typename traits_type::off_type;
\n+
323
\n+
324 basic_fieldstream(const field &F) : super{nullptr}, m_buf{F}
\n+
325 { super::init(&m_buf); }
\n+
326
\n+
327private:
\n+\n+
329};
\n+
330
\n+\n+
332
\n+
334
\n+
354template<typename CHAR>
\n+
355inline std::basic_ostream<CHAR> &operator<<(
\n+
356 std::basic_ostream<CHAR> &S, const field &F) //[t46]
\n+
357{
\n+
358 S.write(F.c_str(), std::streamsize(F.size()));
\n+
359 return S;
\n+
360}
\n+
361
\n+
362
\n+
364template<typename T>
\n+
365inline void from_string(const field &F, T &Obj) //[t46]
\n+
366 { from_string(F.c_str(), Obj, F.size()); }
\n+
367
\n+
369template<> PQXX_LIBEXPORT std::string to_string(const field &Obj); //[t74]
\n+
370
\n+
371} // namespace pqxx
\n+
372#include "pqxx/compiler-internal-post.hxx"
\n+
373#endif
\n+
STL namespace.
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
pqxx::internal::dynamic_params< IT > make_dynamic_params(IT begin, IT end)
Pass a number of statement parameters only known at runtime.
Definition: prepared_statement.hxx:44
\n-
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
\n-
Helper class for passing parameters to, and executing, prepared statements.
Definition: prepared_statement.hxx:82
\n-
invocation & operator()(const binarystring &v, bool nonnull)
Pass binary parameter value for a BYTEA field.
Definition: prepared_statement.hxx:123
\n-
invocation & operator()(const binarystring &v)
Pass binary parameter value for a BYTEA field.
Definition: prepared_statement.hxx:107
\n-
invocation & operator()(T *v, bool nonnull=true)
Pass C-style parameter string, or null if pointer is null.
Definition: prepared_statement.hxx:134
\n-
invocation & operator=(const invocation &)=delete
\n-
invocation & operator()(const char *v, bool nonnull=true)
Pass C-style string parameter, or null if pointer is null.
Definition: prepared_statement.hxx:142
\n-
invocation & operator()()
Pass null parameter.
Definition: prepared_statement.hxx:94
\n-
invocation & operator()(const T &v, bool nonnull)
Pass parameter value.
Definition: prepared_statement.hxx:115
\n-
invocation & operator()(const T &v)
Pass parameter value.
Definition: prepared_statement.hxx:100
\n-
Internal representation of a prepared statement definition.
Definition: prepared_statement.hxx:157
\n-\n-
std::string definition
Text of prepared query.
Definition: prepared_statement.hxx:159
\n+
std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const field &F)
Write a result field to any type of stream.
Definition: field.hxx:355
\n+
void from_string(const field &F, T &Obj)
Convert a field's string contents to another type.
Definition: field.hxx:365
\n+
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
\n+
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
\n+
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
\n+
Low-level array parser.
Definition: array.hxx:47
\n+
Reference to a field in a result set.
Definition: field.hxx:50
\n+
row_size_type num() const
Definition: field.hxx:104
\n+
row_size_type col() const noexcept
Definition: field.hxx:218
\n+
size_type size() const noexcept
Return number of bytes taken up by the field's value.
Definition: field.cxx:74
\n+
long m_col
Definition: field.hxx:224
\n+
T as(const T &Default) const
Return value as object of given type, or Default if null.
Definition: field.hxx:170
\n+
field_size_type size_type
Definition: field.hxx:52
\n+
bool operator>>(T &Obj) const
Read value into Obj; or leave Obj untouched and return false if null.
Definition: field.hxx:148
\n+
array_parser as_array() const
Parse the field as an SQL array.
Definition: field.hxx:210
\n+
const result & home() const noexcept
Definition: field.hxx:216
\n+
T as() const
Return value as object of given type, or throw exception if null.
Definition: field.hxx:183
\n+
auto to(T &Obj, const T &Default) const -> typename std::enable_if<(not std::is_pointer< T >::value or std::is_same< T, const char * >::value), bool >::type
Read value into Obj; or use Default & return false if null.
Definition: field.hxx:155
\n+
const char * c_str() const
Read as plain C string.
Definition: field.cxx:62
\n+
bool is_null() const noexcept
Is this field's value null?
Definition: field.cxx:68
\n+
constexpr O< T > get() const
Return value wrapped in some optional type (empty for nulls)
Definition: field.hxx:201
\n+
size_t idx() const noexcept
Definition: field.hxx:217
\n+
bool operator!=(const field &rhs) const
Byte-by-byte comparison (all nulls are considered equal)
Definition: field.hxx:87
\n+
Definition: field.hxx:260
\n+
TRAITS traits_type
Definition: field.hxx:263
\n+
typename traits_type::off_type off_type
Definition: field.hxx:266
\n+
virtual pos_type seekoff(off_type, seekdir, openmode) override
Definition: field.hxx:280
\n+
virtual pos_type seekpos(pos_type, openmode) override
Definition: field.hxx:282
\n+
std::ios::openmode openmode
Definition: field.hxx:267
\n+
virtual int_type overflow(int_type) override
Definition: field.hxx:284
\n+
field_streambuf(const field &F)
Definition: field.hxx:270
\n+
typename traits_type::pos_type pos_type
Definition: field.hxx:265
\n+
virtual int sync() override
Definition: field.hxx:277
\n+
typename traits_type::int_type int_type
Definition: field.hxx:264
\n+
virtual int_type underflow() override
Definition: field.hxx:286
\n+
CHAR char_type
Definition: field.hxx:262
\n+
std::ios::seekdir seekdir
Definition: field.hxx:268
\n+
Input stream that gets its data from a result field.
Definition: field.hxx:314
\n+
TRAITS traits_type
Definition: field.hxx:319
\n+
basic_fieldstream(const field &F)
Definition: field.hxx:324
\n+
typename traits_type::pos_type pos_type
Definition: field.hxx:321
\n+
typename traits_type::off_type off_type
Definition: field.hxx:322
\n+
typename traits_type::int_type int_type
Definition: field.hxx:320
\n+
CHAR char_type
Definition: field.hxx:318
\n
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
Reference to one row in a result.
Definition: row.hxx:41
\n+
Traits class for use in string conversions.
Definition: strconv.hxx:51
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,172 +1,418 @@\n \n \n \n \n \n libpqxx\n \n-prepared_statement.hxx\n+field.hxx\n 1\n- 11#ifndef PQXX_H_PREPARED_STATEMENT\n- 12#define PQXX_H_PREPARED_STATEMENT\n- 13\n- 14#include \"pqxx/compiler-public.hxx\"\n- 15#include \"pqxx/compiler-internal-pre.hxx\"\n- 16\n- 17#include \"pqxx/types.hxx\"\n- 18#include \"pqxx/internal/statement_parameters.hxx\"\n+ 13#ifndef PQXX_H_FIELD\n+ 14#define PQXX_H_FIELD\n+ 15\n+ 16#include \"pqxx/compiler-public.hxx\"\n+ 17#include \"pqxx/compiler-internal-pre.hxx\"\n+ 18#include \"pqxx/internal/type_utils.hxx\"\n 19\n- 20\n- 21\n- 22namespace pqxx\n- 23{\n-25namespace prepare\n- 26{\n- 28\n- 43template inline pqxx::internal::dynamic_params\n-44make_dynamic_params(IT begin, IT end)\n- 45{\n- 46 return pqxx::internal::dynamic_params(begin, end);\n- 47}\n- 48\n- 49\n- 51\n- 65template\n- 66inline pqxx::internal::dynamic_params\n-67make_dynamic_params(const C &container)\n- 68{\n- 69 return pqxx::internal::dynamic_params\n-(container);\n- 70}\n- 71} // namespace prepare\n- 72} // namespace pqxx\n- 73\n- 74namespace pqxx\n- 75{\n- 76namespace prepare\n- 77{\n- 79\n-81class PQXX_LIBEXPORT invocation : internal::statement_parameters\n- 82{\n- 83public:\n- 84 PQXX_DEPRECATED invocation(transaction_base &, const std::string\n-&statement);\n-85 invocation &operator=(const invocation &) =delete;\n- 86\n- 88 result exec() const;\n- 89\n- 91 bool exists() const;\n- 92\n-94 invocation &operator()() { add_param(); return *this; }\n- 95\n+ 20#if defined(PQXX_HAVE_OPTIONAL)\n+ 21#include \n+ 22\n+ 23/* Use std::experimental::optional as a fallback for std::optional, if\n+ 24 * present.\n+ 25 *\n+ 26 * This may break compilation for some software, if using a libpqxx that was\n+ 27 * configured for a different language version. To stop libpqxx headers from\n+ 28 * using or supporting std::experimental::optional, define a macro\n+ 29 * PQXX_HIDE_EXP_OPTIONAL when building your software.\n+ 30 */\n+ 31#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)\n+ 32#include \n+ 33#endif\n+ 34\n+ 35#include \"pqxx/array.hxx\"\n+ 36#include \"pqxx/result.hxx\"\n+ 37#include \"pqxx/strconv.hxx\"\n+ 38#include \"pqxx/types.hxx\"\n+ 39\n+ 40\n+ 41// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n+ 42\n+ 43namespace pqxx\n+ 44{\n+ 46\n+49class PQXX_LIBEXPORT field\n+ 50{\n+ 51public:\n+52 using size_type = field_size_type;\n+ 53\n+ 55\n+ 59 field(const row &R, row_size_type C) noexcept; //[t01]\n+ 60\n+ 66\n+ 82 bool operator==(const field &) const; //[t75]\n+ 83\n+ 85\n+87 bool operator!=(const field &rhs) const //[t82]\n+ 88 {return not operator==(rhs);}\n+ 90\n+ 96 const char *name() const; //[t11]\n 97\n-100 template invocation &operator()(const T &v)\n- 101 { add_param(v, true); return *this; }\n- 102\n- 104\n-107 invocation &operator()(const binarystring &v)\n- 108 { add_binary_param(v, true); return *this; }\n+ 99 oid type() const; //[t07]\n+ 100\n+ 102 oid table() const; //[t02]\n+ 103\n+104 row_size_type num() const { return col(); } //[t82]\n+ 105\n+ 107 row_size_type table_column() const; //[t93]\n 109\n- 111\n-115 template invocation &operator()(const T &v, bool nonnull)\n- 116 { add_param(v, nonnull); return *this; }\n- 117\n- 119\n-123 invocation &operator()(const binarystring &v, bool nonnull)\n- 124 { add_binary_param(v, nonnull); return *this; }\n- 125\n- 127\n-134 template invocation &operator()(T *v, bool nonnull=true)\n- 135 { add_param(v, nonnull); return *this; }\n- 136\n- 138\n-142 invocation &operator()(const char *v, bool nonnull=true)\n- 143 { add_param(v, nonnull); return *this; }\n- 144\n- 145private:\n- 146 transaction_base &m_home;\n- 147 const std::string m_statement;\n- 148\n- 149 invocation &setparam(const std::string &, bool nonnull);\n- 150};\n- 151\n+ 115\n+ 120 const char *c_str() const; //[t02]\n+ 121\n+ 123 bool is_null() const noexcept; //[t12]\n+ 124\n+ 126\n+ 129 size_type size() const noexcept; //[t11]\n+ 130\n+ 132\n+135 template auto to(T &Obj) const //[t03]\n+ 136 -> typename std::enable_if<(\n+ 137 not std::is_pointer::value\n+ 138 or std::is_same::value\n+ 139 ), bool>::type\n+ 140 {\n+ 141 const char *const bytes = c_str();\n+ 142 if (bytes[0] == '\\0' and is_null()) return false;\n+ 143 from_string(bytes, Obj);\n+ 144 return true;\n+ 145 }\n+ 146\n+148 template bool operator>>(T &Obj) const //[t07]\n+ 149 { return to(Obj); }\n+ 150\n 152\n-153namespace internal\n- 154{\n-156struct PQXX_LIBEXPORT prepared_def\n- 157{\n-159 std::string definition;\n-161 bool registered = false;\n- 162\n-163 prepared_def() =default;\n- 164 explicit prepared_def(const std::string &);\n- 165};\n- 166\n- 167} // namespace pqxx::prepare::internal\n- 168} // namespace pqxx::prepare\n- 169} // namespace pqxx\n- 170\n- 171#include \"pqxx/compiler-internal-post.hxx\"\n- 172#endif\n+155 template auto to(T &Obj, const T &Default) const //[t12]\n+ 156 -> typename std::enable_if<(\n+ 157 not std::is_pointer::value\n+ 158 or std::is_same::value\n+ 159 ), bool>::type\n+ 160 {\n+ 161 const bool NotNull = to(Obj);\n+ 162 if (not NotNull) Obj = Default;\n+ 163 return NotNull;\n+ 164 }\n+ 165\n+ 167\n+170 template T as(const T &Default) const //[t01]\n+ 171 {\n+ 172 T Obj;\n+ 173 to(Obj, Default);\n+ 174 return Obj;\n+ 175 }\n+ 176\n+ 178\n+183 template T as() const //[t45]\n+ 184 {\n+ 185 T Obj;\n+ 186 if (not to(Obj)) Obj = string_traits::null();\n+ 187 return Obj;\n+ 188 }\n+ 189\n+ 191\n+ 195 template class O\n+ 196#if defined(PQXX_HAVE_OPTIONAL)\n+ 197 = std::optional\n+ 198#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)\n+ 199 = std::experimental::optional\n+ 200#endif\n+201 > constexpr O get() const { return as>(); }\n+ 202\n+ 204\n+210 array_parser as_array() const\n+ 211 { return array_parser{c_str(), m_home.m_encoding}; }\n+ 213\n+ 214\n+ 215protected:\n+216 const result &home() const noexcept { return m_home; }\n+217 size_t idx() const noexcept { return m_row; }\n+218 row_size_type col() const noexcept { return row_size_type(m_col); }\n+ 219\n+224 long m_col;\n+ 225\n+ 226private:\n+ 227 result m_home;\n+ 228 size_t m_row;\n+ 229};\n+ 230\n+ 231\n+ 233template<>\n+234inline bool field::to(std::string &Obj) const\n+ 235{\n+ 236 const char *const bytes = c_str();\n+ 237 if (bytes[0] == '\\0' and is_null()) return false;\n+ 238 Obj = std::string{bytes, size()};\n+ 239 return true;\n+ 240}\n+ 241\n+ 243\n+ 248template<>\n+249inline bool field::to(const char *&Obj) const\n+ 250{\n+ 251 if (is_null()) return false;\n+ 252 Obj = c_str();\n+ 253 return true;\n+ 254}\n+ 255\n+ 256\n+ 257template>\n+258 class field_streambuf :\n+ 259 public std::basic_streambuf\n+ 260{\n+ 261public:\n+262 using char_type = CHAR;\n+263 using traits_type = TRAITS;\n+264 using int_type = typename traits_type::int_type;\n+265 using pos_type = typename traits_type::pos_type;\n+266 using off_type = typename traits_type::off_type;\n+267 using openmode = std::ios::openmode;\n+268 using seekdir = std::ios::seekdir;\n+ 269\n+270 explicit field_streambuf(const field &F) : //[t74]\n+ 271 m_field{F}\n+ 272 {\n+ 273 initialize();\n+ 274 }\n+ 275\n+ 276protected:\n+277 virtual int sync() override { return traits_type::eof(); }\n+ 278\n+ 279protected:\n+280 virtual pos_type seekoff(off_type, seekdir, openmode) override\n+ 281 { return traits_type::eof(); }\n+282 virtual pos_type seekpos(pos_type, openmode) override\n+ 283 {return traits_type::eof();}\n+284 virtual int_type overflow(int_type) override\n+ 285 { return traits_type::eof(); }\n+286 virtual int_type underflow() override\n+ 287 { return traits_type::eof(); }\n+ 288\n+ 289private:\n+ 290 const field &m_field;\n+ 291\n+ 292 int_type initialize()\n+ 293 {\n+ 294 char_type *G =\n+ 295 reinterpret_cast(const_cast(m_field.c_str()));\n+ 296 this->setg(G, G, G + m_field.size());\n+ 297 return int_type(m_field.size());\n+ 298 }\n+ 299};\n+ 300\n+ 301\n+ 303\n+ 311template>\n+312 class basic_fieldstream :\n+ 313 public std::basic_istream\n+ 314{\n+ 315 using super = std::basic_istream;\n+ 316\n+ 317public:\n+318 using char_type = CHAR;\n+319 using traits_type = TRAITS;\n+320 using int_type = typename traits_type::int_type;\n+321 using pos_type = typename traits_type::pos_type;\n+322 using off_type = typename traits_type::off_type;\n+ 323\n+324 basic_fieldstream(const field &F) : super{nullptr}, m_buf{F}\n+ 325 { super::init(&m_buf); }\n+ 326\n+ 327private:\n+ 328 field_streambuf m_buf;\n+ 329};\n+ 330\n+331using fieldstream = basic_fieldstream;\n+ 332\n+ 334\n+ 354template\n+ 355inline std::basic_ostream &operator<<(\n+ 356 std::basic_ostream &S, const field &F) //[t46]\n+ 357{\n+ 358 S.write(F.c_str(), std::streamsize(F.size()));\n+ 359 return S;\n+ 360}\n+ 361\n+ 362\n+ 364template\n+365inline void from_string(const field &F, T &Obj) //[t46]\n+ 366 { from_string(F.c_str(), Obj, F.size()); }\n+ 367\n+ 369template<> PQXX_LIBEXPORT std::string to_string(const field &Obj); //[t74]\n+ 370\n+ 371} // namespace pqxx\n+ 372#include \"pqxx/compiler-internal-post.hxx\"\n+ 373#endif\n+std\n+STL namespace.\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::prepare::make_dynamic_params\n-pqxx::internal::dynamic_params< IT > make_dynamic_params(IT begin, IT end)\n-Pass a number of statement parameters only known at runtime.\n-Definition: prepared_statement.hxx:44\n-pqxx::binarystring\n-Binary data corresponding to PostgreSQL's \"BYTEA\" binary-string type.\n-Definition: binarystring.hxx:54\n-pqxx::prepare::invocation\n-Helper class for passing parameters to, and executing, prepared statements.\n-Definition: prepared_statement.hxx:82\n-pqxx::prepare::invocation::operator()\n-invocation & operator()(const binarystring &v, bool nonnull)\n-Pass binary parameter value for a BYTEA field.\n-Definition: prepared_statement.hxx:123\n-pqxx::prepare::invocation::operator()\n-invocation & operator()(const binarystring &v)\n-Pass binary parameter value for a BYTEA field.\n-Definition: prepared_statement.hxx:107\n-pqxx::prepare::invocation::operator()\n-invocation & operator()(T *v, bool nonnull=true)\n-Pass C-style parameter string, or null if pointer is null.\n-Definition: prepared_statement.hxx:134\n-pqxx::prepare::invocation::operator=\n-invocation & operator=(const invocation &)=delete\n-pqxx::prepare::invocation::operator()\n-invocation & operator()(const char *v, bool nonnull=true)\n-Pass C-style string parameter, or null if pointer is null.\n-Definition: prepared_statement.hxx:142\n-pqxx::prepare::invocation::operator()\n-invocation & operator()()\n-Pass null parameter.\n-Definition: prepared_statement.hxx:94\n-pqxx::prepare::invocation::operator()\n-invocation & operator()(const T &v, bool nonnull)\n-Pass parameter value.\n-Definition: prepared_statement.hxx:115\n-pqxx::prepare::invocation::operator()\n-invocation & operator()(const T &v)\n-Pass parameter value.\n-Definition: prepared_statement.hxx:100\n-pqxx::prepare::internal::prepared_def\n-Internal representation of a prepared statement definition.\n-Definition: prepared_statement.hxx:157\n-pqxx::prepare::internal::prepared_def::prepared_def\n-prepared_def()=default\n-pqxx::prepare::internal::prepared_def::definition\n-std::string definition\n-Text of prepared query.\n-Definition: prepared_statement.hxx:159\n+pqxx::operator<<\n+std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const\n+field &F)\n+Write a result field to any type of stream.\n+Definition: field.hxx:355\n+pqxx::from_string\n+void from_string(const field &F, T &Obj)\n+Convert a field's string contents to another type.\n+Definition: field.hxx:365\n+pqxx::to_string\n+std::string to_string(const field &Obj)\n+Convert a field to a string.\n+Definition: result.cxx:451\n+pqxx::field_size_type\n+std::size_t field_size_type\n+Number of bytes in a field of database data.\n+Definition: types.hxx:30\n+pqxx::row_size_type\n+unsigned int row_size_type\n+Number of fields in a row of database data.\n+Definition: types.hxx:24\n+pqxx::array_parser\n+Low-level array parser.\n+Definition: array.hxx:47\n+pqxx::field\n+Reference to a field in a result set.\n+Definition: field.hxx:50\n+pqxx::field::num\n+row_size_type num() const\n+Definition: field.hxx:104\n+pqxx::field::col\n+row_size_type col() const noexcept\n+Definition: field.hxx:218\n+pqxx::field::size\n+size_type size() const noexcept\n+Return number of bytes taken up by the field's value.\n+Definition: field.cxx:74\n+pqxx::field::m_col\n+long m_col\n+Definition: field.hxx:224\n+pqxx::field::as\n+T as(const T &Default) const\n+Return value as object of given type, or Default if null.\n+Definition: field.hxx:170\n+pqxx::field::size_type\n+field_size_type size_type\n+Definition: field.hxx:52\n+pqxx::field::operator>>\n+bool operator>>(T &Obj) const\n+Read value into Obj; or leave Obj untouched and return false if null.\n+Definition: field.hxx:148\n+pqxx::field::as_array\n+array_parser as_array() const\n+Parse the field as an SQL array.\n+Definition: field.hxx:210\n+pqxx::field::home\n+const result & home() const noexcept\n+Definition: field.hxx:216\n+pqxx::field::as\n+T as() const\n+Return value as object of given type, or throw exception if null.\n+Definition: field.hxx:183\n+pqxx::field::to\n+auto to(T &Obj, const T &Default) const -> typename std::enable_if<(not std::\n+is_pointer< T >::value or std::is_same< T, const char * >::value), bool >::type\n+Read value into Obj; or use Default & return false if null.\n+Definition: field.hxx:155\n+pqxx::field::c_str\n+const char * c_str() const\n+Read as plain C string.\n+Definition: field.cxx:62\n+pqxx::field::is_null\n+bool is_null() const noexcept\n+Is this field's value null?\n+Definition: field.cxx:68\n+pqxx::field::get\n+constexpr O< T > get() const\n+Return value wrapped in some optional type (empty for nulls)\n+Definition: field.hxx:201\n+pqxx::field::idx\n+size_t idx() const noexcept\n+Definition: field.hxx:217\n+pqxx::field::operator!=\n+bool operator!=(const field &rhs) const\n+Byte-by-byte comparison (all nulls are considered equal)\n+Definition: field.hxx:87\n+pqxx::field_streambuf\n+Definition: field.hxx:260\n+pqxx::field_streambuf::traits_type\n+TRAITS traits_type\n+Definition: field.hxx:263\n+pqxx::field_streambuf::off_type\n+typename traits_type::off_type off_type\n+Definition: field.hxx:266\n+pqxx::field_streambuf::seekoff\n+virtual pos_type seekoff(off_type, seekdir, openmode) override\n+Definition: field.hxx:280\n+pqxx::field_streambuf::seekpos\n+virtual pos_type seekpos(pos_type, openmode) override\n+Definition: field.hxx:282\n+pqxx::field_streambuf::openmode\n+std::ios::openmode openmode\n+Definition: field.hxx:267\n+pqxx::field_streambuf::overflow\n+virtual int_type overflow(int_type) override\n+Definition: field.hxx:284\n+pqxx::field_streambuf::field_streambuf\n+field_streambuf(const field &F)\n+Definition: field.hxx:270\n+pqxx::field_streambuf::pos_type\n+typename traits_type::pos_type pos_type\n+Definition: field.hxx:265\n+pqxx::field_streambuf::sync\n+virtual int sync() override\n+Definition: field.hxx:277\n+pqxx::field_streambuf::int_type\n+typename traits_type::int_type int_type\n+Definition: field.hxx:264\n+pqxx::field_streambuf::underflow\n+virtual int_type underflow() override\n+Definition: field.hxx:286\n+pqxx::field_streambuf::char_type\n+CHAR char_type\n+Definition: field.hxx:262\n+pqxx::field_streambuf::seekdir\n+std::ios::seekdir seekdir\n+Definition: field.hxx:268\n+pqxx::basic_fieldstream\n+Input stream that gets its data from a result field.\n+Definition: field.hxx:314\n+pqxx::basic_fieldstream::traits_type\n+TRAITS traits_type\n+Definition: field.hxx:319\n+pqxx::basic_fieldstream::basic_fieldstream\n+basic_fieldstream(const field &F)\n+Definition: field.hxx:324\n+pqxx::basic_fieldstream::pos_type\n+typename traits_type::pos_type pos_type\n+Definition: field.hxx:321\n+pqxx::basic_fieldstream::off_type\n+typename traits_type::off_type off_type\n+Definition: field.hxx:322\n+pqxx::basic_fieldstream::int_type\n+typename traits_type::int_type int_type\n+Definition: field.hxx:320\n+pqxx::basic_fieldstream::char_type\n+CHAR char_type\n+Definition: field.hxx:318\n pqxx::result\n Result set containing data returned by a query or command.\n Definition: result.hxx:70\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n+pqxx::row\n+Reference to one row in a result.\n+Definition: row.hxx:41\n+pqxx::string_traits\n+Traits class for use in string conversions.\n+Definition: strconv.hxx:51\n * include\n * pqxx\n- * prepared_statement.hxx\n+ * field.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00074_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00074_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: robusttransaction.hxx Source File\n+libpqxx: tablestream.hxx Source File\n \n \n \n \n \n \n \n@@ -55,106 +55,76 @@\n \n
\n
\n-
robusttransaction.hxx
\n+
tablestream.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_ROBUSTTRANSACTION
\n-
14#define PQXX_H_ROBUSTTRANSACTION
\n+
13#ifndef PQXX_H_TABLESTREAM
\n+
14#define PQXX_H_TABLESTREAM
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18
\n-
19#include "pqxx/dbtransaction.hxx"
\n+
18#include "pqxx/transaction_base.hxx"
\n+
19
\n
20
\n-
21
\n-
22// Methods tested in eg. test module test01 are marked with "//[t01]".
\n-
23
\n-
24namespace pqxx
\n-
25{
\n-
26
\n-
27namespace internal
\n+
21namespace pqxx
\n+
22{
\n+
24
\n+
26class PQXX_LIBEXPORT PQXX_NOVTABLE tablestream :
\n+\n
28{
\n-
30class PQXX_LIBEXPORT PQXX_NOVTABLE basic_robusttransaction :
\n-
31 public dbtransaction
\n-
32{
\n-
33public:
\n-\n-
36
\n-
37 virtual ~basic_robusttransaction() =0; //[t16]
\n-
38
\n-
39protected:
\n-\n-\n-
42 const std::string &IsolationLevel,
\n-
43 const std::string &table_name=std::string{}); //[t16]
\n+
29public:
\n+
30 explicit tablestream(
\n+
31 transaction_base &Trans,
\n+
32 const std::string &Null=std::string{});
\n+
33 virtual ~tablestream() noexcept =0;
\n+
34 virtual void complete() =0;
\n+
35protected:
\n+
36 const std::string &NullStr() const { return m_null; }
\n+
37 bool is_finished() const noexcept { return m_finished; }
\n+
38 void base_close();
\n+
39 template<typename ITER>
\n+
40 static std::string columnlist(ITER colbegin, ITER colend);
\n+
41private:
\n+
42 std::string m_null;
\n+
43 bool m_finished = false;
\n
44
\n-
45private:
\n-
46 using IDType = unsigned long;
\n-
47 IDType m_record_id = 0;
\n-
48 std::string m_xid;
\n-
49 std::string m_log_table;
\n-
50 std::string m_sequence;
\n-
51 int m_backendpid = -1;
\n-
52
\n-
53 virtual void do_begin() override; //[t18]
\n-
54 virtual void do_commit() override; //[t16]
\n-
55 virtual void do_abort() override; //[t18]
\n-
56
\n-
57 PQXX_PRIVATE void CreateLogTable();
\n-
58 PQXX_PRIVATE void CreateTransactionRecord();
\n-
59 PQXX_PRIVATE std::string sql_delete() const;
\n-
60 PQXX_PRIVATE void DeleteTransactionRecord() noexcept;
\n-
61 PQXX_PRIVATE bool CheckTransactionRecord();
\n-
62};
\n-
63} // namespace internal
\n-
64
\n-
65
\n-
73
\n-
139template<isolation_level ISOLATIONLEVEL=read_committed>
\n-
140class robusttransaction : public internal::basic_robusttransaction
\n-
141{
\n-
142public:
\n-\n-
144
\n-
146
\n-\n-\n-
152 const std::string &Name=std::string{}) :
\n-
153 namedclass{fullname("robusttransaction",isolation_tag::name()), Name},
\n-
154 internal::basic_robusttransaction(C, isolation_tag::name())
\n-
155 { Begin(); }
\n-
156
\n-
157 virtual ~robusttransaction() noexcept
\n-
158 { End(); }
\n-
159};
\n-
160
\n-
165} // namespace pqxx
\n-
166
\n-
167#include "pqxx/compiler-internal-post.hxx"
\n-
168#endif
\n+
45 tablestream() =delete;
\n+
46 tablestream(const tablestream &) =delete;
\n+
47 tablestream &operator=(const tablestream &) =delete;
\n+
48};
\n+
49
\n+
50
\n+
51template<typename ITER> inline
\n+
52std::string tablestream::columnlist(ITER colbegin, ITER colend)
\n+
53{
\n+
54 return separated_list(",", colbegin, colend);
\n+
55}
\n+
56} // namespace pqxx
\n+
57
\n+
58#include "pqxx/compiler-internal-post.hxx"
\n+
59#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:57
\n-
@ read_committed
Definition: isolation.hxx:59
\n-
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
\n-
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
\n-
Helper base class for the robusttransaction class template.
Definition: robusttransaction.hxx:32
\n-
Slightly slower, better-fortified version of transaction.
Definition: robusttransaction.hxx:141
\n-
virtual ~robusttransaction() noexcept
Definition: robusttransaction.hxx:157
\n-
robusttransaction(connection_base &C, const std::string &Name=std::string{})
Constructor.
Definition: robusttransaction.hxx:150
\n+
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: util.hxx:95
\n+
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
\n+
virtual void complete()=0
\n+
const std::string & NullStr() const
Definition: tablestream.hxx:36
\n+
bool is_finished() const noexcept
Definition: tablestream.hxx:37
\n+
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
\n+
Definition: transaction_base.hxx:44
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,119 +1,85 @@\n \n \n \n \n \n libpqxx\n \n-robusttransaction.hxx\n+tablestream.hxx\n 1\n- 13#ifndef PQXX_H_ROBUSTTRANSACTION\n- 14#define PQXX_H_ROBUSTTRANSACTION\n+ 13#ifndef PQXX_H_TABLESTREAM\n+ 14#define PQXX_H_TABLESTREAM\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18\n- 19#include \"pqxx/dbtransaction.hxx\"\n+ 18#include \"pqxx/transaction_base.hxx\"\n+ 19\n 20\n- 21\n- 22// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n- 23\n- 24namespace pqxx\n- 25{\n- 26\n- 27namespace internal\n+ 21namespace pqxx\n+ 22{\n+ 24\n+26class PQXX_LIBEXPORT PQXX_NOVTABLE tablestream :\n+ 27 public internal::transactionfocus\n 28{\n-30class PQXX_LIBEXPORT PQXX_NOVTABLE basic_robusttransaction :\n- 31 public dbtransaction\n- 32{\n- 33public:\n-35 using isolation_tag = isolation_traits;\n- 36\n- 37 virtual ~basic_robusttransaction() =0; //[t16]\n- 38\n- 39protected:\n- 40 basic_robusttransaction(\n- 41 connection_base &C,\n- 42 const std::string &IsolationLevel,\n- 43 const std::string &table_name=std::string{}); //[t16]\n+ 29public:\n+ 30 explicit tablestream(\n+ 31 transaction_base &Trans,\n+ 32 const std::string &Null=std::string{});\n+ 33 virtual ~tablestream() noexcept =0;\n+34 virtual void complete() =0;\n+ 35protected:\n+36 const std::string &NullStr() const { return m_null; }\n+37 bool is_finished() const noexcept { return m_finished; }\n+ 38 void base_close();\n+ 39 template\n+ 40 static std::string columnlist(ITER colbegin, ITER colend);\n+ 41private:\n+ 42 std::string m_null;\n+ 43 bool m_finished = false;\n 44\n- 45private:\n- 46 using IDType = unsigned long;\n- 47 IDType m_record_id = 0;\n- 48 std::string m_xid;\n- 49 std::string m_log_table;\n- 50 std::string m_sequence;\n- 51 int m_backendpid = -1;\n- 52\n- 53 virtual void do_begin() override; //[t18]\n- 54 virtual void do_commit() override; //[t16]\n- 55 virtual void do_abort() override; //[t18]\n- 56\n- 57 PQXX_PRIVATE void CreateLogTable();\n- 58 PQXX_PRIVATE void CreateTransactionRecord();\n- 59 PQXX_PRIVATE std::string sql_delete() const;\n- 60 PQXX_PRIVATE void DeleteTransactionRecord() noexcept;\n- 61 PQXX_PRIVATE bool CheckTransactionRecord();\n- 62};\n- 63} // namespace internal\n- 64\n- 65\n- 73\n- 139template\n-140class robusttransaction : public internal::basic_robusttransaction\n- 141{\n- 142public:\n-143 using isolation_tag = isolation_traits;\n- 144\n- 146\n-150 explicit robusttransaction(\n- 151 connection_base &C,\n- 152 const std::string &Name=std::string{}) :\n- 153 namedclass{fullname(\"robusttransaction\",isolation_tag::name()), Name},\n- 154 internal::basic_robusttransaction(C, isolation_tag::name())\n- 155 { Begin(); }\n- 156\n-157 virtual ~robusttransaction() noexcept\n- 158 { End(); }\n- 159};\n- 160\n- 165} // namespace pqxx\n- 166\n- 167#include \"pqxx/compiler-internal-post.hxx\"\n- 168#endif\n+ 45 tablestream() =delete;\n+ 46 tablestream(const tablestream &) =delete;\n+ 47 tablestream &operator=(const tablestream &) =delete;\n+ 48};\n+ 49\n+ 50\n+ 51template inline\n+52std::string tablestream::columnlist(ITER colbegin, ITER colend)\n+ 53{\n+ 54 return separated_list(\",\", colbegin, colend);\n+ 55}\n+ 56} // namespace pqxx\n+ 57\n+ 58#include \"pqxx/compiler-internal-post.hxx\"\n+ 59#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::isolation_level\n-isolation_level\n-Transaction isolation levels.\n-Definition: isolation.hxx:57\n-pqxx::read_committed\n-@ read_committed\n-Definition: isolation.hxx:59\n-pqxx::connection_base\n-connection_base abstract base class; represents a connection to a database.\n-Definition: connection_base.hxx:140\n-pqxx::dbtransaction\n-Abstract base class responsible for bracketing a backend transaction.\n-Definition: dbtransaction.hxx:63\n-pqxx::isolation_traits\n-Traits class to describe an isolation level; primarly for libpqxx's own use.\n-Definition: isolation.hxx:66\n-pqxx::internal::basic_robusttransaction\n-Helper base class for the robusttransaction class template.\n-Definition: robusttransaction.hxx:32\n-pqxx::robusttransaction\n-Slightly slower, better-fortified version of transaction.\n-Definition: robusttransaction.hxx:141\n-pqxx::robusttransaction::~robusttransaction\n-virtual ~robusttransaction() noexcept\n-Definition: robusttransaction.hxx:157\n-pqxx::robusttransaction::robusttransaction\n-robusttransaction(connection_base &C, const std::string &Name=std::string{})\n-Constructor.\n-Definition: robusttransaction.hxx:150\n+pqxx::separated_list\n+std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS\n+access)\n+Represent sequence of values as a string, joined by a given separator.\n+Definition: util.hxx:95\n+pqxx::tablestream\n+Base class for obsolete tablereader/tablewriter classes.\n+Definition: tablestream.hxx:28\n+pqxx::tablestream::complete\n+virtual void complete()=0\n+pqxx::tablestream::NullStr\n+const std::string & NullStr() const\n+Definition: tablestream.hxx:36\n+pqxx::tablestream::is_finished\n+bool is_finished() const noexcept\n+Definition: tablestream.hxx:37\n+pqxx::tablestream::columnlist\n+static std::string columnlist(ITER colbegin, ITER colend)\n+Definition: tablestream.hxx:52\n+pqxx::internal::transactionfocus\n+Definition: transaction_base.hxx:44\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * robusttransaction.hxx\n+ * tablestream.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00077_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00077_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: notification.hxx Source File\n+libpqxx: stream_to.hxx Source File\n \n \n \n \n \n \n \n@@ -55,69 +55,162 @@\n \n
\n
\n-
notification.hxx
\n+
stream_to.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_NOTIFICATION
\n-
14#define PQXX_H_NOTIFICATION
\n+
13#ifndef PQXX_H_STREAM_TO
\n+
14#define PQXX_H_STREAM_TO
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18
\n-
19#include <string>
\n-
20
\n-
21#include "pqxx/types.hxx"
\n+
18#include "pqxx/transaction_base.hxx"
\n+
19#include "pqxx/stream_base.hxx"
\n+
20#include "pqxx/stream_from.hxx"
\n+
21#include "pqxx/internal/type_utils.hxx"
\n
22
\n-
23
\n-
24namespace pqxx
\n-
25{
\n-
27
\n-
55class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver
\n-
56{
\n-
57public:
\n-
59
\n-
63 notification_receiver(connection_base &c, const std::string &channel);
\n-\n-\n-
66 virtual ~notification_receiver();
\n-
67
\n-
69 const std::string &channel() const { return m_channel; }
\n-
70
\n-
72
\n-
79 virtual void operator()(const std::string &payload, int backend_pid) =0;
\n-
80
\n-
81protected:
\n-
82 connection_base &conn() const noexcept { return m_conn; }
\n-
83
\n-
84private:
\n-
85 connection_base &m_conn;
\n-
86 std::string m_channel;
\n-
87};
\n-
88}
\n-
89
\n-
90#include "pqxx/compiler-internal-post.hxx"
\n-
91#endif
\n+
23#include <string>
\n+
24
\n+
25
\n+
26namespace pqxx
\n+
27{
\n+
28
\n+
30
\n+
59class PQXX_LIBEXPORT stream_to : public stream_base
\n+
60{
\n+
61public:
\n+
63
\n+
70 stream_to(transaction_base &, const std::string &table_name);
\n+
71
\n+
73 template<typename Columns> stream_to(
\n+\n+
75 const std::string &table_name,
\n+
76 const Columns& columns
\n+
77 );
\n+
78
\n+
80 template<typename Iter> stream_to(
\n+\n+
82 const std::string &table_name,
\n+
83 Iter columns_begin,
\n+
84 Iter columns_end
\n+
85 );
\n+
86
\n+
87 ~stream_to() noexcept;
\n+
88
\n+
90
\n+
96 void complete() override;
\n+
97
\n+
99
\n+
106 template<typename Tuple> stream_to & operator<<(const Tuple &);
\n+
107
\n+
109
\n+\n+
114
\n+
115private:
\n+
117 void write_raw_line(const std::string &);
\n+
118
\n+
119 void set_up(transaction_base &, const std::string &table_name);
\n+
120 void set_up(
\n+\n+
122 const std::string &table_name,
\n+
123 const std::string &columns
\n+
124 );
\n+
125
\n+
126 void close() override;
\n+
127};
\n+
128
\n+
129
\n+
130template<typename Columns> inline stream_to::stream_to(
\n+\n+
132 const std::string &table_name,
\n+
133 const Columns& columns
\n+
134) : stream_to{
\n+
135 tb,
\n+
136 table_name,
\n+
137 std::begin(columns),
\n+
138 std::end(columns)
\n+
139}
\n+
140{}
\n+
141
\n+
142
\n+
143template<typename Iter> inline stream_to::stream_to(
\n+\n+
145 const std::string &table_name,
\n+
146 Iter columns_begin,
\n+
147 Iter columns_end
\n+
148) :
\n+
149 namedclass{"stream_from", table_name},
\n+
150 stream_base{tb}
\n+
151{
\n+
152 set_up(
\n+
153 tb,
\n+
154 table_name,
\n+
155 columnlist(columns_begin, columns_end)
\n+
156 );
\n+
157}
\n+
158
\n+
159
\n+
160namespace internal
\n+
161{
\n+
162
\n+
163class PQXX_LIBEXPORT TypedCopyEscaper
\n+
164{
\n+
165 static std::string escape(const std::string &);
\n+
166public:
\n+
167 template<typename T> std::string operator()(const T* t) const
\n+
168 {
\n+
169 return string_traits<T>::is_null(*t) ? "\\\\N" : escape(to_string(*t));
\n+
170 }
\n+
171};
\n+
172
\n+
173// Explicit specialization so we don't need a string_traits<> for nullptr_t
\n+
174template<> inline std::string TypedCopyEscaper::operator()<std::nullptr_t>(
\n+
175 const std::nullptr_t*
\n+
176) const
\n+
177{ return "\\\\N"; }
\n+
178
\n+
179} // namespace pqxx::internal
\n+
180
\n+
181
\n+
182template<typename Tuple> stream_to & stream_to::operator<<(const Tuple &t)
\n+
183{
\n+
184 write_raw_line(separated_list("\\t", t, internal::TypedCopyEscaper()));
\n+
185 return *this;
\n+
186}
\n+
187
\n+
188} // namespace pqxx
\n+
189
\n+
190
\n+
191#include "pqxx/compiler-internal-post.hxx"
\n+
192#endif
\n+
STL namespace.
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
Definition: notification.hxx:56
\n-
notification_receiver(const notification_receiver &)=delete
\n-
connection_base & conn() const noexcept
Definition: notification.hxx:82
\n-
const std::string & channel() const
The channel that this receiver listens on.
Definition: notification.hxx:69
\n-
virtual void operator()(const std::string &payload, int backend_pid)=0
Overridable: action to invoke when notification arrives.
\n-
notification_receiver & operator=(const notification_receiver &)=delete
\n+
std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const field &F)
Write a result field to any type of stream.
Definition: field.hxx:355
\n+
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
\n+
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: util.hxx:95
\n+
std::string escape(const std::string &s, const std::string &null)
Definition: tablewriter.cxx:131
\n+
Traits class for use in string conversions.
Definition: strconv.hxx:51
\n+
Definition: stream_base.hxx:29
\n+
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
\n+
Efficiently pull data directly out of a table.
Definition: stream_from.hxx:30
\n+
Efficiently write data directly to a database table.
Definition: stream_to.hxx:60
\n+
stream_to(transaction_base &, const std::string &table_name)
Create a stream, without specifying columns.
Definition: stream_to.cxx:18
\n+
stream_to & operator<<(const Tuple &)
Insert a row of data.
Definition: stream_to.hxx:182
\n+
Definition: stream_to.hxx:164
\n+
std::string operator()(const T *t) const
Definition: stream_to.hxx:167
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,74 +1,189 @@\n \n \n \n \n \n libpqxx\n \n-notification.hxx\n+stream_to.hxx\n 1\n- 13#ifndef PQXX_H_NOTIFICATION\n- 14#define PQXX_H_NOTIFICATION\n+ 13#ifndef PQXX_H_STREAM_TO\n+ 14#define PQXX_H_STREAM_TO\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18\n- 19#include \n- 20\n- 21#include \"pqxx/types.hxx\"\n+ 18#include \"pqxx/transaction_base.hxx\"\n+ 19#include \"pqxx/stream_base.hxx\"\n+ 20#include \"pqxx/stream_from.hxx\"\n+ 21#include \"pqxx/internal/type_utils.hxx\"\n 22\n- 23\n- 24namespace pqxx\n- 25{\n- 27\n-55class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver\n- 56{\n- 57public:\n- 59\n- 63 notification_receiver(connection_base &c, const std::string &channel);\n-64 notification_receiver(const notification_receiver &) =delete;\n-65 notification_receiver &operator=(const notification_receiver &) =delete;\n- 66 virtual ~notification_receiver();\n- 67\n-69 const std::string &channel() const { return m_channel; }\n- 70\n- 72\n-79 virtual void operator()(const std::string &payload, int backend_pid) =0;\n- 80\n- 81protected:\n-82 connection_base &conn() const noexcept { return m_conn; }\n- 83\n- 84private:\n- 85 connection_base &m_conn;\n- 86 std::string m_channel;\n- 87};\n- 88}\n- 89\n- 90#include \"pqxx/compiler-internal-post.hxx\"\n- 91#endif\n+ 23#include \n+ 24\n+ 25\n+ 26namespace pqxx\n+ 27{\n+ 28\n+ 30\n+59class PQXX_LIBEXPORT stream_to : public stream_base\n+ 60{\n+ 61public:\n+ 63\n+ 70 stream_to(transaction_base &, const std::string &table_name);\n+ 71\n+ 73 template stream_to(\n+ 74 transaction_base &,\n+ 75 const std::string &table_name,\n+ 76 const Columns& columns\n+ 77 );\n+ 78\n+ 80 template stream_to(\n+ 81 transaction_base &,\n+ 82 const std::string &table_name,\n+ 83 Iter columns_begin,\n+ 84 Iter columns_end\n+ 85 );\n+ 86\n+ 87 ~stream_to() noexcept;\n+ 88\n+ 90\n+ 96 void complete() override;\n+ 97\n+ 99\n+ 106 template stream_to & operator<<(const Tuple &);\n+ 107\n+ 109\n+ 113 stream_to &operator<<(stream_from &);\n+ 114\n+ 115private:\n+ 117 void write_raw_line(const std::string &);\n+ 118\n+ 119 void set_up(transaction_base &, const std::string &table_name);\n+ 120 void set_up(\n+ 121 transaction_base &,\n+ 122 const std::string &table_name,\n+ 123 const std::string &columns\n+ 124 );\n+ 125\n+ 126 void close() override;\n+ 127};\n+ 128\n+ 129\n+130template inline stream_to::stream_to(\n+ 131 transaction_base &tb,\n+ 132 const std::string &table_name,\n+ 133 const Columns& columns\n+ 134) : stream_to{\n+ 135 tb,\n+ 136 table_name,\n+ 137 std::begin(columns),\n+ 138 std::end(columns)\n+ 139}\n+ 140{}\n+ 141\n+ 142\n+143template inline stream_to::stream_to(\n+ 144 transaction_base &tb,\n+ 145 const std::string &table_name,\n+ 146 Iter columns_begin,\n+ 147 Iter columns_end\n+ 148) :\n+ 149 namedclass{\"stream_from\", table_name},\n+ 150 stream_base{tb}\n+ 151{\n+ 152 set_up(\n+ 153 tb,\n+ 154 table_name,\n+ 155 columnlist(columns_begin, columns_end)\n+ 156 );\n+ 157}\n+ 158\n+ 159\n+ 160namespace internal\n+ 161{\n+ 162\n+163class PQXX_LIBEXPORT TypedCopyEscaper\n+ 164{\n+ 165 static std::string escape(const std::string &);\n+ 166public:\n+167 template std::string operator()(const T* t) const\n+ 168 {\n+ 169 return string_traits::is_null(*t) ? \"\\\\N\" : escape(to_string(*t));\n+ 170 }\n+ 171};\n+ 172\n+ 173// Explicit specialization so we don't need a string_traits<> for nullptr_t\n+174template<> inline std::string TypedCopyEscaper::operator()(\n+ 175 const std::nullptr_t*\n+ 176) const\n+ 177{ return \"\\\\N\"; }\n+ 178\n+ 179} // namespace pqxx::internal\n+ 180\n+ 181\n+182template stream_to & stream_to::operator<<(const Tuple &t)\n+ 183{\n+ 184 write_raw_line(separated_list(\"\\t\", t, internal::TypedCopyEscaper()));\n+ 185 return *this;\n+ 186}\n+ 187\n+ 188} // namespace pqxx\n+ 189\n+ 190\n+ 191#include \"pqxx/compiler-internal-post.hxx\"\n+ 192#endif\n+std\n+STL namespace.\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::connection_base\n-connection_base abstract base class; represents a connection to a database.\n-Definition: connection_base.hxx:140\n-pqxx::notification_receiver\n-Definition: notification.hxx:56\n-pqxx::notification_receiver::notification_receiver\n-notification_receiver(const notification_receiver &)=delete\n-pqxx::notification_receiver::conn\n-connection_base & conn() const noexcept\n-Definition: notification.hxx:82\n-pqxx::notification_receiver::channel\n-const std::string & channel() const\n-The channel that this receiver listens on.\n-Definition: notification.hxx:69\n-pqxx::notification_receiver::operator()\n-virtual void operator()(const std::string &payload, int backend_pid)=0\n-Overridable: action to invoke when notification arrives.\n-pqxx::notification_receiver::operator=\n-notification_receiver & operator=(const notification_receiver &)=delete\n+pqxx::operator<<\n+std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const\n+field &F)\n+Write a result field to any type of stream.\n+Definition: field.hxx:355\n+pqxx::to_string\n+std::string to_string(const field &Obj)\n+Convert a field to a string.\n+Definition: result.cxx:451\n+pqxx::separated_list\n+std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS\n+access)\n+Represent sequence of values as a string, joined by a given separator.\n+Definition: util.hxx:95\n+pqxx::internal::escape\n+std::string escape(const std::string &s, const std::string &null)\n+Definition: tablewriter.cxx:131\n+pqxx::string_traits\n+Traits class for use in string conversions.\n+Definition: strconv.hxx:51\n+pqxx::stream_base\n+Definition: stream_base.hxx:29\n+pqxx::stream_base::columnlist\n+static std::string columnlist(const C &)\n+Definition: stream_base.hxx:48\n+pqxx::stream_from\n+Efficiently pull data directly out of a table.\n+Definition: stream_from.hxx:30\n+pqxx::stream_to\n+Efficiently write data directly to a database table.\n+Definition: stream_to.hxx:60\n+pqxx::stream_to::stream_to\n+stream_to(transaction_base &, const std::string &table_name)\n+Create a stream, without specifying columns.\n+Definition: stream_to.cxx:18\n+pqxx::stream_to::operator<<\n+stream_to & operator<<(const Tuple &)\n+Insert a row of data.\n+Definition: stream_to.hxx:182\n+pqxx::internal::TypedCopyEscaper\n+Definition: stream_to.hxx:164\n+pqxx::internal::TypedCopyEscaper::operator()\n+std::string operator()(const T *t) const\n+Definition: stream_to.hxx:167\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * notification.hxx\n+ * stream_to.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00080_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00080_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: connection.hxx Source File\n+libpqxx: compiler-internal-post.hxx Source File\n \n \n \n \n \n \n \n@@ -55,101 +55,32 @@\n \n
\n
\n-
connection.hxx
\n+
compiler-internal-post.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_CONNECTION
\n-
14#define PQXX_H_CONNECTION
\n+
12// NO GUARDS HERE! This code should be executed every time!
\n+
13
\n+
14#ifdef _WIN32
\n
15
\n-
16#include "pqxx/compiler-public.hxx"
\n-
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18
\n-
19#include "pqxx/connectionpolicy.hxx"
\n-
20#include "pqxx/basic_connection.hxx"
\n+
16#ifdef _MSC_VER
\n+
17#pragma warning (pop) // Restore client program's warning state
\n+
18#endif
\n+
19
\n+
20#endif
\n
21
\n-
22namespace pqxx
\n-
23{
\n-
24
\n-
77
\n-
87class PQXX_LIBEXPORT connect_direct : public connectionpolicy
\n-
88{
\n-
89public:
\n-
92 explicit connect_direct(const std::string &opts) : connectionpolicy{opts} {}
\n-
93 virtual handle do_startconnect(handle) override;
\n-
94};
\n-
95
\n-\n-
98
\n-
99
\n-
101
\n-
105class PQXX_LIBEXPORT connect_lazy : public connectionpolicy
\n-
106{
\n-
107public:
\n-
110 explicit connect_lazy(const std::string &opts) : connectionpolicy{opts} {}
\n-
111 virtual handle do_completeconnect(handle) override;
\n-
112};
\n-
113
\n-
114
\n-\n-
117
\n-
118
\n-
120
\n-
126class PQXX_LIBEXPORT connect_async : public connectionpolicy
\n-
127{
\n-
128public:
\n-
131 explicit connect_async(const std::string &opts);
\n-
132 virtual handle do_startconnect(handle) override;
\n-
133 virtual handle do_completeconnect(handle) override;
\n-
134 virtual handle do_dropconnect(handle) noexcept override;
\n-
135 virtual bool is_ready(handle) const noexcept override;
\n-
136
\n-
137private:
\n-
139 bool m_connecting;
\n-
140};
\n-
141
\n-
142
\n-\n-
145
\n-
146
\n-
148
\n-
152class PQXX_LIBEXPORT connect_null : public connectionpolicy
\n-
153{
\n-
154public:
\n-
155 explicit connect_null(const std::string &opts) : connectionpolicy{opts} {}
\n-
156};
\n-
157
\n-
158
\n-\n-
161
\n-
166}
\n-
167
\n-
168#include "pqxx/compiler-internal-post.hxx"
\n-
169
\n-
170#endif
\n-
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
Base-class template for all libpqxx connection types.
Definition: basic_connection.hxx:47
\n-
Connection policy; creates an immediate connection to a database.
Definition: connection.hxx:88
\n-
connect_direct(const std::string &opts)
Definition: connection.hxx:92
\n-
Lazy connection policy; causes connection to be deferred until first use.
Definition: connection.hxx:106
\n-
connect_lazy(const std::string &opts)
Definition: connection.hxx:110
\n-
Asynchronous connection policy; connects "in the background".
Definition: connection.hxx:127
\n-
Nonfunctional, always-down connection policy for testing/debugging purposes.
Definition: connection.hxx:153
\n-
connect_null(const std::string &opts)
Definition: connection.hxx:155
\n-
Definition: connectionpolicy.hxx:32
\n-
internal::pq::PGconn * handle
Definition: connectionpolicy.hxx:34
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,113 +1,23 @@\n \n \n \n \n \n libpqxx\n \n-connection.hxx\n+compiler-internal-post.hxx\n 1\n- 13#ifndef PQXX_H_CONNECTION\n- 14#define PQXX_H_CONNECTION\n+ 12// NO GUARDS HERE! This code should be executed every time!\n+ 13\n+ 14#ifdef _WIN32\n 15\n- 16#include \"pqxx/compiler-public.hxx\"\n- 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18\n- 19#include \"pqxx/connectionpolicy.hxx\"\n- 20#include \"pqxx/basic_connection.hxx\"\n+ 16#ifdef _MSC_VER\n+ 17#pragma warning (pop) // Restore client program's warning state\n+ 18#endif\n+ 19\n+ 20#endif\n 21\n- 22namespace pqxx\n- 23{\n- 24\n- 77\n-87class PQXX_LIBEXPORT connect_direct : public connectionpolicy\n- 88{\n- 89public:\n-92 explicit connect_direct(const std::string &opts) : connectionpolicy{opts} {}\n- 93 virtual handle do_startconnect(handle) override;\n- 94};\n- 95\n-97using connection = basic_connection_base;\n- 98\n- 99\n- 101\n-105class PQXX_LIBEXPORT connect_lazy : public connectionpolicy\n- 106{\n- 107public:\n-110 explicit connect_lazy(const std::string &opts) : connectionpolicy{opts} {}\n- 111 virtual handle do_completeconnect(handle) override;\n- 112};\n- 113\n- 114\n-116using lazyconnection = basic_connection_base;\n- 117\n- 118\n- 120\n-126class PQXX_LIBEXPORT connect_async : public connectionpolicy\n- 127{\n- 128public:\n- 131 explicit connect_async(const std::string &opts);\n- 132 virtual handle do_startconnect(handle) override;\n- 133 virtual handle do_completeconnect(handle) override;\n- 134 virtual handle do_dropconnect(handle) noexcept override;\n- 135 virtual bool is_ready(handle) const noexcept override;\n- 136\n- 137private:\n- 139 bool m_connecting;\n- 140};\n- 141\n- 142\n-144using asyncconnection = basic_connection_base;\n- 145\n- 146\n- 148\n-152class PQXX_LIBEXPORT connect_null : public connectionpolicy\n- 153{\n- 154public:\n-155 explicit connect_null(const std::string &opts) : connectionpolicy{opts} {}\n- 156};\n- 157\n- 158\n-160using nullconnection = basic_connection_base;\n- 161\n- 166}\n- 167\n- 168#include \"pqxx/compiler-internal-post.hxx\"\n- 169\n- 170#endif\n-pqxx\n-The home of all libpqxx classes, functions, templates, etc.\n-Definition: array.hxx:26\n-pqxx::basic_connection_base\n-Base-class template for all libpqxx connection types.\n-Definition: basic_connection.hxx:47\n-pqxx::connect_direct\n-Connection policy; creates an immediate connection to a database.\n-Definition: connection.hxx:88\n-pqxx::connect_direct::connect_direct\n-connect_direct(const std::string &opts)\n-Definition: connection.hxx:92\n-pqxx::connect_lazy\n-Lazy connection policy; causes connection to be deferred until first use.\n-Definition: connection.hxx:106\n-pqxx::connect_lazy::connect_lazy\n-connect_lazy(const std::string &opts)\n-Definition: connection.hxx:110\n-pqxx::connect_async\n-Asynchronous connection policy; connects \"in the background\".\n-Definition: connection.hxx:127\n-pqxx::connect_null\n-Nonfunctional, always-down connection policy for testing/debugging purposes.\n-Definition: connection.hxx:153\n-pqxx::connect_null::connect_null\n-connect_null(const std::string &opts)\n-Definition: connection.hxx:155\n-pqxx::connectionpolicy\n-Definition: connectionpolicy.hxx:32\n-pqxx::connectionpolicy::handle\n-internal::pq::PGconn * handle\n-Definition: connectionpolicy.hxx:34\n * include\n * pqxx\n- * connection.hxx\n+ * compiler-internal-post.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00083_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00083_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: transaction.hxx Source File\n+libpqxx: isolation.hxx Source File\n \n \n \n \n \n \n \n@@ -55,105 +55,73 @@\n \n
\n
\n-
transaction.hxx
\n+
isolation.hxx
\n
\n
\n
1
\n-
12#ifndef PQXX_H_TRANSACTION
\n-
13#define PQXX_H_TRANSACTION
\n-
14
\n-
15#include "pqxx/compiler-public.hxx"
\n-
16#include "pqxx/compiler-internal-pre.hxx"
\n-
17
\n-
18#include "pqxx/dbtransaction.hxx"
\n-
19
\n+
13#ifndef PQXX_H_ISOLATION
\n+
14#define PQXX_H_ISOLATION
\n+
15
\n+
16#include "pqxx/compiler-public.hxx"
\n+
17#include "pqxx/compiler-internal-pre.hxx"
\n+
18
\n+
19#include "pqxx/util.hxx"
\n
20
\n-
21/* Methods tested in eg. self-test program test1 are marked with "//[t01]"
\n-
22 */
\n+
21namespace pqxx
\n+
22{
\n
23
\n-
24
\n-
25namespace pqxx
\n-
26{
\n-
27
\n-
28namespace internal
\n-
29{
\n-
31class PQXX_LIBEXPORT basic_transaction : public dbtransaction
\n-
32{
\n-
33protected:
\n-
34 basic_transaction( //[t01]
\n-\n-
36 const std::string &IsolationLevel,
\n-\n-
38
\n-
39private:
\n-
40 virtual void do_commit() override; //[t01]
\n-
41};
\n-
42} // namespace internal
\n-
43
\n-
44
\n-
49
\n-
51
\n-
79template<
\n-
80 isolation_level ISOLATIONLEVEL=read_committed,
\n-\n-\n-
83{
\n-
84public:
\n-\n-
86
\n-
88
\n-
93 explicit transaction(connection_base &C, const std::string &TName): //[t01]
\n-
94 namedclass{fullname("transaction", isolation_tag::name()), TName},
\n-
95 internal::basic_transaction(C, isolation_tag::name(), READWRITE)
\n-
96 { Begin(); }
\n-
97
\n-
98 explicit transaction(connection_base &C) : //[t01]
\n-
99 transaction(C, "") {}
\n-
100
\n-
101 virtual ~transaction() noexcept
\n-
102 { End(); }
\n-
103};
\n-
104
\n-
105
\n-\n-
108
\n-\n-
111
\n-
113}
\n-
114
\n-
115#include "pqxx/compiler-internal-post.hxx"
\n-
116#endif
\n+
25
\n+\n+
57{
\n+
58 // read_uncommitted,
\n+\n+\n+\n+
62};
\n+
63
\n+
65template<isolation_level LEVEL> struct isolation_traits
\n+
66{
\n+
67 static constexpr isolation_level level() noexcept { return LEVEL; }
\n+
68 static constexpr const char *name() noexcept;
\n+
69};
\n+
70
\n+
71
\n+
72template<>
\n+
73inline constexpr const char *isolation_traits<read_committed>::name() noexcept
\n+
74 { return "READ COMMITTED"; }
\n+
75
\n+
76template<>
\n+
77inline constexpr const char *isolation_traits<repeatable_read>::name() noexcept
\n+
78 { return "REPEATABLE READ"; }
\n+
79
\n+
80template<>
\n+
81inline constexpr const char *isolation_traits<serializable>::name() noexcept
\n+
82 { return "SERIALIZABLE"; }
\n+
83
\n+
84}
\n+
85
\n+
86#include "pqxx/compiler-internal-post.hxx"
\n+
87#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
readwrite_policy
Definition: dbtransaction.hxx:25
\n-
@ read_write
Definition: dbtransaction.hxx:27
\n
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:57
\n+
@ serializable
Definition: isolation.hxx:61
\n
@ read_committed
Definition: isolation.hxx:59
\n-
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
\n-
static std::string fullname(const std::string &ttype, const std::string &isolation)
Definition: dbtransaction.cxx:95
\n+
@ repeatable_read
Definition: isolation.hxx:60
\n
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
\n-
Helper base class for the transaction class template.
Definition: transaction.hxx:32
\n-
basic_transaction(connection_base &C, const std::string &IsolationLevel, readwrite_policy)
Definition: transaction.cxx:20
\n-
Standard back-end transaction, templatized on isolation level.
Definition: transaction.hxx:83
\n-
transaction(connection_base &C, const std::string &TName)
Create a transaction.
Definition: transaction.hxx:93
\n-
transaction(connection_base &C)
Definition: transaction.hxx:98
\n-
virtual ~transaction() noexcept
Definition: transaction.hxx:101
\n-
void Begin()
Begin transaction (to be called by implementing class)
Definition: transaction_base.cxx:386
\n-
void End() noexcept
End transaction. To be called by implementing class' destructor.
Definition: transaction_base.cxx:408
\n-
namedclass(const std::string &Classname)
Definition: util.hxx:236
\n-
const std::string & name() const noexcept
Object name, or the empty string if no name was given.
Definition: util.hxx:249
\n+
static constexpr const char * name() noexcept
\n+
static constexpr isolation_level level() noexcept
Definition: isolation.hxx:67
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,141 +1,82 @@\n \n \n \n \n \n libpqxx\n \n-transaction.hxx\n+isolation.hxx\n 1\n- 12#ifndef PQXX_H_TRANSACTION\n- 13#define PQXX_H_TRANSACTION\n- 14\n- 15#include \"pqxx/compiler-public.hxx\"\n- 16#include \"pqxx/compiler-internal-pre.hxx\"\n- 17\n- 18#include \"pqxx/dbtransaction.hxx\"\n- 19\n+ 13#ifndef PQXX_H_ISOLATION\n+ 14#define PQXX_H_ISOLATION\n+ 15\n+ 16#include \"pqxx/compiler-public.hxx\"\n+ 17#include \"pqxx/compiler-internal-pre.hxx\"\n+ 18\n+ 19#include \"pqxx/util.hxx\"\n 20\n- 21/* Methods tested in eg. self-test program test1 are marked with \"//[t01]\"\n- 22 */\n+ 21namespace pqxx\n+ 22{\n 23\n- 24\n- 25namespace pqxx\n- 26{\n- 27\n- 28namespace internal\n- 29{\n-31class PQXX_LIBEXPORT basic_transaction : public dbtransaction\n- 32{\n- 33protected:\n- 34 basic_transaction( //[t01]\n- 35 connection_base &C,\n- 36 const std::string &IsolationLevel,\n- 37 readwrite_policy);\n- 38\n- 39private:\n- 40 virtual void do_commit() override; //[t01]\n- 41};\n- 42} // namespace internal\n- 43\n- 44\n- 49\n- 51\n- 79template<\n- 80 isolation_level ISOLATIONLEVEL=read_committed,\n- 81 readwrite_policy READWRITE=read_write>\n-82class transaction : public internal::basic_transaction\n- 83{\n- 84public:\n-85 using isolation_tag = isolation_traits;\n- 86\n- 88\n-93 explicit transaction(connection_base &C, const std::string &TName): //[t01]\n- 94 namedclass{fullname(\"transaction\", isolation_tag::name()), TName},\n- 95 internal::basic_transaction(C, isolation_tag::name(), READWRITE)\n- 96 { Begin(); }\n- 97\n-98 explicit transaction(connection_base &C) : //[t01]\n- 99 transaction(C, \"\") {}\n- 100\n-101 virtual ~transaction() noexcept\n- 102 { End(); }\n- 103};\n- 104\n- 105\n-107using work = transaction<>;\n- 108\n-110using read_transaction = transaction;\n- 111\n- 113}\n- 114\n- 115#include \"pqxx/compiler-internal-post.hxx\"\n- 116#endif\n+ 25\n+56enum isolation_level\n+ 57{\n+ 58 // read_uncommitted,\n+59 read_committed,\n+60 repeatable_read,\n+ 61 serializable\n+62};\n+ 63\n+65template struct isolation_traits\n+ 66{\n+67 static constexpr isolation_level level() noexcept { return LEVEL; }\n+68 static constexpr const char *name() noexcept;\n+ 69};\n+ 70\n+ 71\n+ 72template<>\n+73inline constexpr const char *isolation_traits::name()\n+noexcept\n+ 74 { return \"READ COMMITTED\"; }\n+ 75\n+ 76template<>\n+77inline constexpr const char *isolation_traits::name()\n+noexcept\n+ 78 { return \"REPEATABLE READ\"; }\n+ 79\n+ 80template<>\n+81inline constexpr const char *isolation_traits::name() noexcept\n+ 82 { return \"SERIALIZABLE\"; }\n+ 83\n+ 84}\n+ 85\n+ 86#include \"pqxx/compiler-internal-post.hxx\"\n+ 87#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::readwrite_policy\n-readwrite_policy\n-Definition: dbtransaction.hxx:25\n-pqxx::read_write\n-@ read_write\n-Definition: dbtransaction.hxx:27\n pqxx::isolation_level\n isolation_level\n Transaction isolation levels.\n Definition: isolation.hxx:57\n+pqxx::serializable\n+@ serializable\n+Definition: isolation.hxx:61\n pqxx::read_committed\n @ read_committed\n Definition: isolation.hxx:59\n-pqxx::connection_base\n-connection_base abstract base class; represents a connection to a database.\n-Definition: connection_base.hxx:140\n-pqxx::dbtransaction\n-Abstract base class responsible for bracketing a backend transaction.\n-Definition: dbtransaction.hxx:63\n-pqxx::dbtransaction::fullname\n-static std::string fullname(const std::string &ttype, const std::string\n-&isolation)\n-Definition: dbtransaction.cxx:95\n+pqxx::repeatable_read\n+@ repeatable_read\n+Definition: isolation.hxx:60\n pqxx::isolation_traits\n Traits class to describe an isolation level; primarly for libpqxx's own use.\n Definition: isolation.hxx:66\n-pqxx::internal::basic_transaction\n-Helper base class for the transaction class template.\n-Definition: transaction.hxx:32\n-pqxx::internal::basic_transaction::basic_transaction\n-basic_transaction(connection_base &C, const std::string &IsolationLevel,\n-readwrite_policy)\n-Definition: transaction.cxx:20\n-pqxx::transaction\n-Standard back-end transaction, templatized on isolation level.\n-Definition: transaction.hxx:83\n-pqxx::transaction::transaction\n-transaction(connection_base &C, const std::string &TName)\n-Create a transaction.\n-Definition: transaction.hxx:93\n-pqxx::transaction::transaction\n-transaction(connection_base &C)\n-Definition: transaction.hxx:98\n-pqxx::transaction::~transaction\n-virtual ~transaction() noexcept\n-Definition: transaction.hxx:101\n-pqxx::transaction_base::Begin\n-void Begin()\n-Begin transaction (to be called by implementing class)\n-Definition: transaction_base.cxx:386\n-pqxx::transaction_base::End\n-void End() noexcept\n-End transaction. To be called by implementing class' destructor.\n-Definition: transaction_base.cxx:408\n-pqxx::internal::namedclass::namedclass\n-namedclass(const std::string &Classname)\n-Definition: util.hxx:236\n-pqxx::internal::namedclass::name\n-const std::string & name() const noexcept\n-Object name, or the empty string if no name was given.\n-Definition: util.hxx:249\n+pqxx::isolation_traits::name\n+static constexpr const char * name() noexcept\n+pqxx::isolation_traits::level\n+static constexpr isolation_level level() noexcept\n+Definition: isolation.hxx:67\n * include\n * pqxx\n- * transaction.hxx\n+ * isolation.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00086_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00086_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: tablereader.hxx Source File\n+libpqxx: robusttransaction.hxx Source File\n \n \n \n \n \n \n \n@@ -55,134 +55,106 @@\n \n
\n
\n-
tablereader.hxx
\n+
robusttransaction.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_TABLEREADER
\n-
14#define PQXX_H_TABLEREADER
\n+
13#ifndef PQXX_H_ROBUSTTRANSACTION
\n+
14#define PQXX_H_ROBUSTTRANSACTION
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18#include "pqxx/result.hxx"
\n-
19#include "pqxx/tablestream.hxx"
\n+
18
\n+
19#include "pqxx/dbtransaction.hxx"
\n
20
\n
21
\n-
22namespace pqxx
\n-
23{
\n-
25
\n-
29class PQXX_LIBEXPORT tablereader : public tablestream
\n-
30{
\n-
31public:
\n-
32 PQXX_DEPRECATED tablereader(
\n-\n-
34 const std::string &Name,
\n-
35 const std::string &Null=std::string{});
\n-
36 template<typename ITER>
\n-
37 PQXX_DEPRECATED tablereader(
\n-\n-
39 const std::string &Name,
\n-
40 ITER begincolumns,
\n-
41 ITER endcolumns);
\n-
42 template<typename ITER>
\n-
43 PQXX_DEPRECATED tablereader(
\n-\n-
45 const std::string &Name,
\n-
46 ITER begincolumns,
\n-
47 ITER endcolumns,
\n-
48 const std::string &Null);
\n-
49 ~tablereader() noexcept;
\n-
50 template<typename TUPLE> tablereader &operator>>(TUPLE &);
\n-
51 operator bool() const noexcept { return not m_done; }
\n-
52 bool operator!() const noexcept { return m_done; }
\n-
53 bool get_raw_line(std::string &Line);
\n-
54 template<typename TUPLE>
\n-
55 void tokenize(std::string, TUPLE &) const;
\n-
56 virtual void complete() override;
\n-
57private:
\n-
58 void set_up(
\n-\n-
60 const std::string &RName,
\n-
61 const std::string &Columns=std::string{});
\n-
62 PQXX_PRIVATE void reader_close();
\n-
63 std::string extract_field(
\n-
64 const std::string &,
\n-
65 std::string::size_type &) const;
\n-
66 bool m_done;
\n-
67};
\n-
68
\n-
69
\n-
70template<typename ITER> inline
\n-\n-\n-
73 const std::string &Name,
\n-
74 ITER begincolumns,
\n-
75 ITER endcolumns) :
\n-
76 namedclass{Name, "tablereader"},
\n-
77 tablestream{T, std::string{}},
\n-
78 m_done{true}
\n-
79{
\n-
80 set_up(T, Name, columnlist(begincolumns, endcolumns));
\n-
81}
\n-
82
\n-
83
\n-
84template<typename ITER> inline
\n-\n-\n-
87 const std::string &Name,
\n-
88 ITER begincolumns,
\n-
89 ITER endcolumns,
\n-
90 const std::string &Null) :
\n-
91 namedclass{Name, "tablereader"},
\n-
92 tablestream{T, Null},
\n-
93 m_done{true}
\n-
94{
\n-
95 set_up(T, Name, columnlist(begincolumns, endcolumns));
\n-
96}
\n-
97
\n-
98
\n-
99template<typename TUPLE>
\n-
100inline void tablereader::tokenize(std::string Line, TUPLE &T) const
\n-
101{
\n-
102 std::back_insert_iterator<TUPLE> ins = std::back_inserter(T);
\n-
103 std::string::size_type here = 0;
\n-
104 while (here < Line.size()) *ins++ = extract_field(Line, here);
\n-
105}
\n-
106
\n-
107
\n-
108template<typename TUPLE>
\n-\n-
110{
\n-
111 std::string Line;
\n-
112 if (get_raw_line(Line)) tokenize(Line, T);
\n-
113 return *this;
\n-
114}
\n-
115} // namespace pqxx
\n-
116
\n-
117#include "pqxx/compiler-internal-post.hxx"
\n-
118#endif
\n-
STL namespace.
\n+
22// Methods tested in eg. test module test01 are marked with "//[t01]".
\n+
23
\n+
24namespace pqxx
\n+
25{
\n+
26
\n+
27namespace internal
\n+
28{
\n+
30class PQXX_LIBEXPORT PQXX_NOVTABLE basic_robusttransaction :
\n+
31 public dbtransaction
\n+
32{
\n+
33public:
\n+\n+
36
\n+
37 virtual ~basic_robusttransaction() =0; //[t16]
\n+
38
\n+
39protected:
\n+\n+\n+
42 const std::string &IsolationLevel,
\n+
43 const std::string &table_name=std::string{}); //[t16]
\n+
44
\n+
45private:
\n+
46 using IDType = unsigned long;
\n+
47 IDType m_record_id = 0;
\n+
48 std::string m_xid;
\n+
49 std::string m_log_table;
\n+
50 std::string m_sequence;
\n+
51 int m_backendpid = -1;
\n+
52
\n+
53 virtual void do_begin() override; //[t18]
\n+
54 virtual void do_commit() override; //[t16]
\n+
55 virtual void do_abort() override; //[t18]
\n+
56
\n+
57 PQXX_PRIVATE void CreateLogTable();
\n+
58 PQXX_PRIVATE void CreateTransactionRecord();
\n+
59 PQXX_PRIVATE std::string sql_delete() const;
\n+
60 PQXX_PRIVATE void DeleteTransactionRecord() noexcept;
\n+
61 PQXX_PRIVATE bool CheckTransactionRecord();
\n+
62};
\n+
63} // namespace internal
\n+
64
\n+
65
\n+
73
\n+
139template<isolation_level ISOLATIONLEVEL=read_committed>
\n+
140class robusttransaction : public internal::basic_robusttransaction
\n+
141{
\n+
142public:
\n+\n+
144
\n+
146
\n+\n+\n+
152 const std::string &Name=std::string{}) :
\n+
153 namedclass{fullname("robusttransaction",isolation_tag::name()), Name},
\n+
154 internal::basic_robusttransaction(C, isolation_tag::name())
\n+
155 { Begin(); }
\n+
156
\n+
157 virtual ~robusttransaction() noexcept
\n+
158 { End(); }
\n+
159};
\n+
160
\n+
165} // namespace pqxx
\n+
166
\n+
167#include "pqxx/compiler-internal-post.hxx"
\n+
168#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
Definition: tablereader.hxx:30
\n-
void tokenize(std::string, TUPLE &) const
Definition: tablereader.hxx:100
\n-
tablereader(transaction_base &, const std::string &Name, const std::string &Null=std::string{})
Definition: tablereader.cxx:21
\n-
bool operator!() const noexcept
Definition: tablereader.hxx:52
\n-
tablereader & operator>>(TUPLE &)
Definition: tablereader.hxx:109
\n-
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
\n-
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:57
\n+
@ read_committed
Definition: isolation.hxx:59
\n+
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n+
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
\n+
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
\n+
Helper base class for the robusttransaction class template.
Definition: robusttransaction.hxx:32
\n+
Slightly slower, better-fortified version of transaction.
Definition: robusttransaction.hxx:141
\n+
virtual ~robusttransaction() noexcept
Definition: robusttransaction.hxx:157
\n+
robusttransaction(connection_base &C, const std::string &Name=std::string{})
Constructor.
Definition: robusttransaction.hxx:150
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,144 +1,119 @@\n \n \n \n \n \n libpqxx\n \n-tablereader.hxx\n+robusttransaction.hxx\n 1\n- 13#ifndef PQXX_H_TABLEREADER\n- 14#define PQXX_H_TABLEREADER\n+ 13#ifndef PQXX_H_ROBUSTTRANSACTION\n+ 14#define PQXX_H_ROBUSTTRANSACTION\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18#include \"pqxx/result.hxx\"\n- 19#include \"pqxx/tablestream.hxx\"\n+ 18\n+ 19#include \"pqxx/dbtransaction.hxx\"\n 20\n 21\n- 22namespace pqxx\n- 23{\n- 25\n-29class PQXX_LIBEXPORT tablereader : public tablestream\n- 30{\n- 31public:\n- 32 PQXX_DEPRECATED tablereader(\n- 33 transaction_base &,\n- 34 const std::string &Name,\n- 35 const std::string &Null=std::string{});\n- 36 template\n- 37 PQXX_DEPRECATED tablereader(\n- 38 transaction_base &,\n- 39 const std::string &Name,\n- 40 ITER begincolumns,\n- 41 ITER endcolumns);\n- 42 template\n- 43 PQXX_DEPRECATED tablereader(\n- 44 transaction_base &,\n- 45 const std::string &Name,\n- 46 ITER begincolumns,\n- 47 ITER endcolumns,\n- 48 const std::string &Null);\n- 49 ~tablereader() noexcept;\n- 50 template tablereader &operator>>(TUPLE &);\n-51 operator bool() const noexcept { return not m_done; }\n-52 bool operator!() const noexcept { return m_done; }\n- 53 bool get_raw_line(std::string &Line);\n- 54 template\n- 55 void tokenize(std::string, TUPLE &) const;\n- 56 virtual void complete() override;\n- 57private:\n- 58 void set_up(\n- 59 transaction_base &T,\n- 60 const std::string &RName,\n- 61 const std::string &Columns=std::string{});\n- 62 PQXX_PRIVATE void reader_close();\n- 63 std::string extract_field(\n- 64 const std::string &,\n- 65 std::string::size_type &) const;\n- 66 bool m_done;\n- 67};\n- 68\n- 69\n- 70template inline\n-71tablereader::tablereader(\n- 72 transaction_base &T,\n- 73 const std::string &Name,\n- 74 ITER begincolumns,\n- 75 ITER endcolumns) :\n- 76 namedclass{Name, \"tablereader\"},\n- 77 tablestream{T, std::string{}},\n- 78 m_done{true}\n- 79{\n- 80 set_up(T, Name, columnlist(begincolumns, endcolumns));\n- 81}\n- 82\n- 83\n- 84template inline\n-85tablereader::tablereader(\n- 86 transaction_base &T,\n- 87 const std::string &Name,\n- 88 ITER begincolumns,\n- 89 ITER endcolumns,\n- 90 const std::string &Null) :\n- 91 namedclass{Name, \"tablereader\"},\n- 92 tablestream{T, Null},\n- 93 m_done{true}\n- 94{\n- 95 set_up(T, Name, columnlist(begincolumns, endcolumns));\n- 96}\n- 97\n- 98\n- 99template\n-100inline void tablereader::tokenize(std::string Line, TUPLE &T) const\n- 101{\n- 102 std::back_insert_iterator ins = std::back_inserter(T);\n- 103 std::string::size_type here = 0;\n- 104 while (here < Line.size()) *ins++ = extract_field(Line, here);\n- 105}\n- 106\n- 107\n- 108template\n-109inline tablereader &pqxx::tablereader::operator>>(TUPLE &T)\n- 110{\n- 111 std::string Line;\n- 112 if (get_raw_line(Line)) tokenize(Line, T);\n- 113 return *this;\n- 114}\n- 115} // namespace pqxx\n- 116\n- 117#include \"pqxx/compiler-internal-post.hxx\"\n- 118#endif\n-std\n-STL namespace.\n+ 22// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n+ 23\n+ 24namespace pqxx\n+ 25{\n+ 26\n+ 27namespace internal\n+ 28{\n+30class PQXX_LIBEXPORT PQXX_NOVTABLE basic_robusttransaction :\n+ 31 public dbtransaction\n+ 32{\n+ 33public:\n+35 using isolation_tag = isolation_traits;\n+ 36\n+ 37 virtual ~basic_robusttransaction() =0; //[t16]\n+ 38\n+ 39protected:\n+ 40 basic_robusttransaction(\n+ 41 connection_base &C,\n+ 42 const std::string &IsolationLevel,\n+ 43 const std::string &table_name=std::string{}); //[t16]\n+ 44\n+ 45private:\n+ 46 using IDType = unsigned long;\n+ 47 IDType m_record_id = 0;\n+ 48 std::string m_xid;\n+ 49 std::string m_log_table;\n+ 50 std::string m_sequence;\n+ 51 int m_backendpid = -1;\n+ 52\n+ 53 virtual void do_begin() override; //[t18]\n+ 54 virtual void do_commit() override; //[t16]\n+ 55 virtual void do_abort() override; //[t18]\n+ 56\n+ 57 PQXX_PRIVATE void CreateLogTable();\n+ 58 PQXX_PRIVATE void CreateTransactionRecord();\n+ 59 PQXX_PRIVATE std::string sql_delete() const;\n+ 60 PQXX_PRIVATE void DeleteTransactionRecord() noexcept;\n+ 61 PQXX_PRIVATE bool CheckTransactionRecord();\n+ 62};\n+ 63} // namespace internal\n+ 64\n+ 65\n+ 73\n+ 139template\n+140class robusttransaction : public internal::basic_robusttransaction\n+ 141{\n+ 142public:\n+143 using isolation_tag = isolation_traits;\n+ 144\n+ 146\n+150 explicit robusttransaction(\n+ 151 connection_base &C,\n+ 152 const std::string &Name=std::string{}) :\n+ 153 namedclass{fullname(\"robusttransaction\",isolation_tag::name()), Name},\n+ 154 internal::basic_robusttransaction(C, isolation_tag::name())\n+ 155 { Begin(); }\n+ 156\n+157 virtual ~robusttransaction() noexcept\n+ 158 { End(); }\n+ 159};\n+ 160\n+ 165} // namespace pqxx\n+ 166\n+ 167#include \"pqxx/compiler-internal-post.hxx\"\n+ 168#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::tablereader\n-Definition: tablereader.hxx:30\n-pqxx::tablereader::tokenize\n-void tokenize(std::string, TUPLE &) const\n-Definition: tablereader.hxx:100\n-pqxx::tablereader::tablereader\n-tablereader(transaction_base &, const std::string &Name, const std::string\n-&Null=std::string{})\n-Definition: tablereader.cxx:21\n-pqxx::tablereader::operator!\n-bool operator!() const noexcept\n-Definition: tablereader.hxx:52\n-pqxx::tablereader::operator>>\n-tablereader & operator>>(TUPLE &)\n-Definition: tablereader.hxx:109\n-pqxx::tablestream\n-Base class for obsolete tablereader/tablewriter classes.\n-Definition: tablestream.hxx:28\n-pqxx::tablestream::columnlist\n-static std::string columnlist(ITER colbegin, ITER colend)\n-Definition: tablestream.hxx:52\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n+pqxx::isolation_level\n+isolation_level\n+Transaction isolation levels.\n+Definition: isolation.hxx:57\n+pqxx::read_committed\n+@ read_committed\n+Definition: isolation.hxx:59\n+pqxx::connection_base\n+connection_base abstract base class; represents a connection to a database.\n+Definition: connection_base.hxx:140\n+pqxx::dbtransaction\n+Abstract base class responsible for bracketing a backend transaction.\n+Definition: dbtransaction.hxx:63\n+pqxx::isolation_traits\n+Traits class to describe an isolation level; primarly for libpqxx's own use.\n+Definition: isolation.hxx:66\n+pqxx::internal::basic_robusttransaction\n+Helper base class for the robusttransaction class template.\n+Definition: robusttransaction.hxx:32\n+pqxx::robusttransaction\n+Slightly slower, better-fortified version of transaction.\n+Definition: robusttransaction.hxx:141\n+pqxx::robusttransaction::~robusttransaction\n+virtual ~robusttransaction() noexcept\n+Definition: robusttransaction.hxx:157\n+pqxx::robusttransaction::robusttransaction\n+robusttransaction(connection_base &C, const std::string &Name=std::string{})\n+Constructor.\n+Definition: robusttransaction.hxx:150\n * include\n * pqxx\n- * tablereader.hxx\n+ * robusttransaction.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00089_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00089_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: except.hxx Source File\n+libpqxx: tablewriter.hxx Source File\n \n \n \n \n \n \n \n@@ -55,500 +55,245 @@\n \n
\n
\n-
except.hxx
\n+
tablewriter.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_EXCEPT
\n-
14#define PQXX_H_EXCEPT
\n+
13#ifndef PQXX_H_TABLEWRITER
\n+
14#define PQXX_H_TABLEWRITER
\n
15
\n-
16#include "pqxx/compiler-public.hxx"
\n-
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18
\n-
19#include <stdexcept>
\n+
16#include <iterator>
\n+
17
\n+
18#include "pqxx/compiler-public.hxx"
\n+
19#include "pqxx/compiler-internal-pre.hxx"
\n
20
\n-
21#include "pqxx/util.hxx"
\n+
21#include "pqxx/tablestream.hxx"
\n
22
\n
23
\n
24namespace pqxx
\n
25{
\n-
26
\n-
44
\n-
55class PQXX_LIBEXPORT PQXX_NOVTABLE pqxx_exception
\n-
56{
\n-
57public:
\n-
59 virtual ~pqxx_exception() noexcept =0;
\n-
60
\n-
62
\n-
84 PQXX_CONST virtual const std::exception &base() const noexcept =0; //[t00]
\n-
85};
\n-
86
\n-
87
\n-
89class PQXX_LIBEXPORT failure :
\n-
90 public pqxx_exception, public std::runtime_error
\n-
91{
\n-
92 virtual const std::exception &base() const noexcept override
\n-
93 { return *this; }
\n-
94public:
\n-
95 explicit failure(const std::string &);
\n-
96};
\n+
27
\n+
31class PQXX_LIBEXPORT tablewriter : public tablestream
\n+
32{
\n+
33public:
\n+
34 PQXX_DEPRECATED tablewriter(
\n+\n+
36 const std::string &WName,
\n+
37 const std::string &Null=std::string{});
\n+
38 template<typename ITER>
\n+
39 PQXX_DEPRECATED tablewriter(
\n+\n+
41 const std::string &WName,
\n+
42 ITER begincolumns,
\n+
43 ITER endcolumns);
\n+
44 template<typename ITER>
\n+
45 PQXX_DEPRECATED tablewriter(
\n+\n+
47 const std::string &WName,
\n+
48 ITER begincolumns,
\n+
49 ITER endcolumns,
\n+
50 const std::string &Null);
\n+
51 ~tablewriter() noexcept;
\n+
52 template<typename IT> void insert(IT Begin, IT End);
\n+
53 template<typename TUPLE> void insert(const TUPLE &);
\n+
54 template<typename IT> void push_back(IT Begin, IT End);
\n+
55 template<typename TUPLE> void push_back(const TUPLE &);
\n+
56 template<typename SIZE> void reserve(SIZE) {}
\n+
57 template<typename TUPLE> tablewriter &operator<<(const TUPLE &);
\n+\n+
59 template<typename IT> std::string generate(IT Begin, IT End) const;
\n+
60 template<typename TUPLE> std::string generate(const TUPLE &) const;
\n+
61 virtual void complete() override;
\n+
62 void write_raw_line(const std::string &);
\n+
63private:
\n+
64 void set_up(
\n+\n+
66 const std::string &WName,
\n+
67 const std::string &Columns = std::string{});
\n+
68 PQXX_PRIVATE void writer_close();
\n+
69};
\n+
70} // namespace pqxx
\n+
71
\n+
72
\n+
73namespace std
\n+
74{
\n+
75template<>
\n+
76 class back_insert_iterator<pqxx::tablewriter>
\n+
77{
\n+
78public:
\n+
79 using iterator_category = output_iterator_tag;
\n+
80
\n+\n+
82 m_writer{&W} {}
\n+
83
\n+
84 back_insert_iterator &
\n+
85 operator=(const back_insert_iterator &rhs) noexcept
\n+
86 {
\n+
87 m_writer = rhs.m_writer;
\n+
88 return *this;
\n+
89 }
\n+
90
\n+
91 template<typename TUPLE>
\n+
92 back_insert_iterator &operator=(const TUPLE &T)
\n+
93 {
\n+
94 m_writer->insert(T);
\n+
95 return *this;
\n+
96 }
\n
97
\n-
98
\n-
100
\n-
118class PQXX_LIBEXPORT broken_connection : public failure
\n-
119{
\n-
120public:
\n-\n-
122 explicit broken_connection(const std::string &);
\n-
123};
\n-
124
\n-
125
\n-
127
\n-
130class PQXX_LIBEXPORT sql_error : public failure
\n-
131{
\n-
133 const std::string m_query;
\n-
135 const std::string m_sqlstate;
\n-
136
\n-
137public:
\n-
138 explicit sql_error(
\n-
139 const std::string &msg="",
\n-
140 const std::string &Q="",
\n-
141 const char sqlstate[]=nullptr);
\n-
142 virtual ~sql_error() noexcept;
\n-
143
\n-
145 PQXX_PURE const std::string &query() const noexcept; //[t56]
\n-
146
\n-
148 PQXX_PURE const std::string &sqlstate() const noexcept;
\n-
149};
\n+
98 back_insert_iterator &operator++() { return *this; }
\n+
99 back_insert_iterator &operator++(int) { return *this; }
\n+
100 back_insert_iterator &operator*() { return *this; }
\n+
101
\n+
102private:
\n+
103 pqxx::tablewriter *m_writer;
\n+
104};
\n+
105} // namespace std
\n+
106
\n+
107
\n+
108namespace pqxx
\n+
109{
\n+
110template<typename ITER> inline tablewriter::tablewriter(
\n+\n+
112 const std::string &WName,
\n+
113 ITER begincolumns,
\n+
114 ITER endcolumns) :
\n+
115 namedclass{"tablewriter", WName},
\n+
116 tablestream{T, std::string{}}
\n+
117{
\n+
118 set_up(T, WName, columnlist(begincolumns, endcolumns));
\n+
119}
\n+
120
\n+
121
\n+
122template<typename ITER> inline tablewriter::tablewriter(
\n+\n+
124 const std::string &WName,
\n+
125 ITER begincolumns,
\n+
126 ITER endcolumns,
\n+
127 const std::string &Null) :
\n+
128 namedclass{"tablewriter", WName},
\n+
129 tablestream{T, Null}
\n+
130{
\n+
131 set_up(T, WName, columnlist(begincolumns, endcolumns));
\n+
132}
\n+
133
\n+
134
\n+
135namespace internal
\n+
136{
\n+
137PQXX_LIBEXPORT std::string escape(
\n+
138 const std::string &s,
\n+
139 const std::string &null);
\n+
140
\n+
141inline std::string escape_any(
\n+
142 const std::string &s,
\n+
143 const std::string &null)
\n+
144{ return escape(s, null); }
\n+
145
\n+
146inline std::string escape_any(
\n+
147 const char s[],
\n+
148 const std::string &null)
\n+
149{ return s ? escape(std::string{s}, null) : "\\\\N"; }
\n
150
\n-
151
\n-
153
\n-
159class PQXX_LIBEXPORT in_doubt_error : public failure
\n-
160{
\n-
161public:
\n-
162 explicit in_doubt_error(const std::string &);
\n+
151template<typename T> inline std::string escape_any(
\n+
152 const T &t,
\n+
153 const std::string &null)
\n+
154{ return escape(to_string(t), null); }
\n+
155
\n+
156
\n+
157template<typename IT> class Escaper
\n+
158{
\n+
159 const std::string &m_null;
\n+
160public:
\n+
161 explicit Escaper(const std::string &null) : m_null{null} {}
\n+
162 std::string operator()(IT i) const { return escape_any(*i, m_null); }
\n
163};
\n-
164
\n+
164}
\n
165
\n-
167class PQXX_LIBEXPORT transaction_rollback : public failure
\n-
168{
\n-
169public:
\n-
170 explicit transaction_rollback(const std::string &);
\n-
171};
\n-
172
\n-
173
\n-
175
\n-
183class PQXX_LIBEXPORT serialization_failure : public transaction_rollback
\n+
166
\n+
167template<typename IT>
\n+
168inline std::string tablewriter::generate(IT Begin, IT End) const
\n+
169{
\n+
170 return separated_list("\\t", Begin, End, internal::Escaper<IT>{NullStr()});
\n+
171}
\n+
172template<typename TUPLE>
\n+
173inline std::string tablewriter::generate(const TUPLE &T) const
\n+
174{
\n+
175 return generate(std::begin(T), std::end(T));
\n+
176}
\n+
177
\n+
178template<typename IT> inline void tablewriter::insert(IT Begin, IT End)
\n+
179{
\n+
180 write_raw_line(generate(Begin, End));
\n+
181}
\n+
182
\n+
183template<typename TUPLE> inline void tablewriter::insert(const TUPLE &T)
\n
184{
\n-
185public:
\n-
186 explicit serialization_failure(const std::string &);
\n-
187};
\n-
188
\n-
189
\n-\n-
192{
\n-
193public:
\n-
194 explicit statement_completion_unknown(const std::string &);
\n-
195};
\n-
196
\n-
197
\n-
199class PQXX_LIBEXPORT deadlock_detected : public transaction_rollback
\n-
200{
\n-
201public:
\n-
202 explicit deadlock_detected(const std::string &);
\n-
203};
\n-
204
\n-
205
\n-
207class PQXX_LIBEXPORT internal_error :
\n-
208 public pqxx_exception, public std::logic_error
\n-
209{
\n-
210 virtual const std::exception &base() const noexcept override
\n-
211 { return *this; }
\n-
212public:
\n-
213 explicit internal_error(const std::string &);
\n-
214};
\n-
215
\n-
216
\n-
218class PQXX_LIBEXPORT usage_error :
\n-
219 public pqxx_exception, public std::logic_error
\n-
220{
\n-
221 virtual const std::exception &base() const noexcept override
\n-
222 { return *this; }
\n-
223public:
\n-
224 explicit usage_error(const std::string &);
\n-
225};
\n-
226
\n-
227
\n-
229class PQXX_LIBEXPORT argument_error :
\n-
230 public pqxx_exception, public std::invalid_argument
\n-
231{
\n-
232 virtual const std::exception &base() const noexcept override
\n-
233 { return *this; }
\n-
234public:
\n-
235 explicit argument_error(const std::string &);
\n-
236};
\n-
237
\n-
238
\n-
240class PQXX_LIBEXPORT conversion_error :
\n-
241 public pqxx_exception, public std::domain_error
\n-
242{
\n-
243 virtual const std::exception &base() const noexcept override
\n-
244 { return *this; }
\n-
245public:
\n-
246 explicit conversion_error(const std::string &);
\n-
247};
\n-
248
\n-
249
\n-
251class PQXX_LIBEXPORT range_error :
\n-
252 public pqxx_exception, public std::out_of_range
\n-
253{
\n-
254 virtual const std::exception &base() const noexcept override
\n-
255 { return *this; }
\n-
256public:
\n-
257 explicit range_error(const std::string &);
\n-
258};
\n-
259
\n-
260
\n-
262class PQXX_LIBEXPORT unexpected_rows : public range_error
\n-
263{
\n-
264 virtual const std::exception &base() const noexcept override
\n-
265 { return *this; }
\n-
266public:
\n-
267 explicit unexpected_rows(const std::string &msg) : range_error{msg} {}
\n-
268};
\n-
269
\n-
270
\n-
272class PQXX_LIBEXPORT feature_not_supported : public sql_error
\n-
273{
\n-
274public:
\n-\n-
276 const std::string &err,
\n-
277 const std::string &Q="",
\n-
278 const char sqlstate[]=nullptr) :
\n-
279 sql_error{err, Q, sqlstate} {}
\n-
280};
\n-
281
\n-
283class PQXX_LIBEXPORT data_exception : public sql_error
\n-
284{
\n-
285public:
\n-\n-
287 const std::string &err,
\n-
288 const std::string &Q="",
\n-
289 const char sqlstate[]=nullptr) :
\n-
290 sql_error{err, Q, sqlstate} {}
\n-
291};
\n-
292
\n-
293class PQXX_LIBEXPORT integrity_constraint_violation : public sql_error
\n-
294{
\n-
295public:
\n-\n-
297 const std::string &err,
\n-
298 const std::string &Q="",
\n-
299 const char sqlstate[]=nullptr) :
\n-
300 sql_error{err, Q, sqlstate} {}
\n-
301};
\n-
302
\n-
303class PQXX_LIBEXPORT restrict_violation :
\n-\n-
305{
\n-
306public:
\n-\n-
308 const std::string &err,
\n-
309 const std::string &Q="",
\n-
310 const char sqlstate[]=nullptr) :
\n-
311 integrity_constraint_violation{err, Q, sqlstate} {}
\n-
312};
\n-
313
\n-
314class PQXX_LIBEXPORT not_null_violation :
\n-\n-
316{
\n-
317public:
\n-\n-
319 const std::string &err,
\n-
320 const std::string &Q="",
\n-
321 const char sqlstate[]=nullptr) :
\n-
322 integrity_constraint_violation{err, Q, sqlstate} {}
\n-
323};
\n-
324
\n-
325class PQXX_LIBEXPORT foreign_key_violation :
\n-\n-
327{
\n-
328public:
\n-\n-
330 const std::string &err,
\n-
331 const std::string &Q="",
\n-
332 const char sqlstate[]=nullptr) :
\n-
333 integrity_constraint_violation{err, Q, sqlstate} {}
\n-
334};
\n-
335
\n-
336class PQXX_LIBEXPORT unique_violation :
\n-\n-
338{
\n-
339public:
\n-\n-
341 const std::string &err,
\n-
342 const std::string &Q="",
\n-
343 const char sqlstate[]=nullptr) :
\n-
344 integrity_constraint_violation{err, Q, sqlstate} {}
\n-
345};
\n-
346
\n-
347class PQXX_LIBEXPORT check_violation :
\n-\n-
349{
\n-
350public:
\n-\n-
352 const std::string &err,
\n-
353 const std::string &Q="",
\n-
354 const char sqlstate[]=nullptr) :
\n-
355 integrity_constraint_violation{err, Q, sqlstate} {}
\n-
356};
\n-
357
\n-
358class PQXX_LIBEXPORT invalid_cursor_state : public sql_error
\n-
359{
\n-
360public:
\n-\n-
362 const std::string &err,
\n-
363 const std::string &Q="",
\n-
364 const char sqlstate[]=nullptr) :
\n-
365 sql_error{err, Q, sqlstate} {}
\n-
366};
\n-
367
\n-
368class PQXX_LIBEXPORT invalid_sql_statement_name : public sql_error
\n-
369{
\n-
370public:
\n-\n-
372 const std::string &err,
\n-
373 const std::string &Q="",
\n-
374 const char sqlstate[]=nullptr) :
\n-
375 sql_error{err, Q, sqlstate} {}
\n-
376};
\n-
377
\n-
378class PQXX_LIBEXPORT invalid_cursor_name : public sql_error
\n-
379{
\n-
380public:
\n-\n-
382 const std::string &err,
\n-
383 const std::string &Q="",
\n-
384 const char sqlstate[]=nullptr) :
\n-
385 sql_error{err, Q, sqlstate} {}
\n-
386};
\n-
387
\n-
388class PQXX_LIBEXPORT syntax_error : public sql_error
\n-
389{
\n-
390public:
\n-
392 const int error_position;
\n-
393
\n-
394 explicit syntax_error(
\n-
395 const std::string &err,
\n-
396 const std::string &Q="",
\n-
397 const char sqlstate[]=nullptr,
\n-
398 int pos=-1) :
\n-
399 sql_error{err, Q, sqlstate}, error_position{pos} {}
\n-
400};
\n-
401
\n-
402class PQXX_LIBEXPORT undefined_column : public syntax_error
\n-
403{
\n-
404public:
\n-\n-
406 const std::string &err,
\n-
407 const std::string &Q="",
\n-
408 const char sqlstate[]=nullptr) :
\n-
409 syntax_error{err, Q, sqlstate} {}
\n-
410};
\n-
411
\n-
412class PQXX_LIBEXPORT undefined_function : public syntax_error
\n-
413{
\n-
414public:
\n-\n-
416 const std::string &err,
\n-
417 const std::string &Q="",
\n-
418 const char sqlstate[]=nullptr) :
\n-
419 syntax_error{err, Q, sqlstate} {}
\n-
420};
\n-
421
\n-
422class PQXX_LIBEXPORT undefined_table : public syntax_error
\n-
423{
\n-
424public:
\n-\n-
426 const std::string &err,
\n-
427 const std::string &Q="",
\n-
428 const char sqlstate[]=nullptr) :
\n-
429 syntax_error{err, Q, sqlstate} {}
\n-
430};
\n-
431
\n-
432class PQXX_LIBEXPORT insufficient_privilege : public sql_error
\n-
433{
\n-
434public:
\n-\n-
436 const std::string &err,
\n-
437 const std::string &Q="",
\n-
438 const char sqlstate[]=nullptr) :
\n-
439 sql_error{err, Q, sqlstate} {}
\n-
440};
\n-
441
\n-
443class PQXX_LIBEXPORT insufficient_resources : public sql_error
\n-
444{
\n-
445public:
\n-\n-
447 const std::string &err,
\n-
448 const std::string &Q="",
\n-
449 const char sqlstate[]=nullptr) :
\n-
450 sql_error{err,Q, sqlstate} {}
\n-
451};
\n-
452
\n-
453class PQXX_LIBEXPORT disk_full : public insufficient_resources
\n-
454{
\n-
455public:
\n-
456 explicit disk_full(
\n-
457 const std::string &err,
\n-
458 const std::string &Q="",
\n-
459 const char sqlstate[]=nullptr) :
\n-
460 insufficient_resources{err, Q, sqlstate} {}
\n-
461};
\n-
462
\n-
463class PQXX_LIBEXPORT out_of_memory : public insufficient_resources
\n-
464{
\n-
465public:
\n-\n-
467 const std::string &err,
\n-
468 const std::string &Q="",
\n-
469 const char sqlstate[]=nullptr) :
\n-
470 insufficient_resources{err, Q, sqlstate} {}
\n-
471};
\n-
472
\n-
473class PQXX_LIBEXPORT too_many_connections : public broken_connection
\n-
474{
\n-
475public:
\n-
476 explicit too_many_connections(const std::string &err) :
\n-
477 broken_connection{err} {}
\n-
478};
\n-
479
\n-
481
\n-
483class PQXX_LIBEXPORT plpgsql_error : public sql_error
\n-
484{
\n-
485public:
\n-\n-
487 const std::string &err,
\n-
488 const std::string &Q="",
\n-
489 const char sqlstate[]=nullptr) :
\n-
490 sql_error{err, Q, sqlstate} {}
\n-
491};
\n-
492
\n-
494class PQXX_LIBEXPORT plpgsql_raise : public plpgsql_error
\n-
495{
\n-
496public:
\n-\n-
498 const std::string &err,
\n-
499 const std::string &Q="",
\n-
500 const char sqlstate[]=nullptr) :
\n-
501 plpgsql_error{err, Q, sqlstate} {}
\n-
502};
\n-
503
\n-
504class PQXX_LIBEXPORT plpgsql_no_data_found : public plpgsql_error
\n-
505{
\n-
506public:
\n-\n-
508 const std::string &err,
\n-
509 const std::string &Q="",
\n-
510 const char sqlstate[]=nullptr) :
\n-
511 plpgsql_error{err, Q, sqlstate} {}
\n-
512};
\n-
513
\n-
514class PQXX_LIBEXPORT plpgsql_too_many_rows : public plpgsql_error
\n-
515{
\n-
516public:
\n-\n-
518 const std::string &err,
\n-
519 const std::string &Q="",
\n-
520 const char sqlstate[]=nullptr) :
\n-
521 plpgsql_error{err, Q, sqlstate} {}
\n-
522};
\n-
523
\n-
528}
\n-
529
\n-
530#include "pqxx/compiler-internal-post.hxx"
\n-
531
\n-
532#endif
\n+
185 insert(std::begin(T), std::end(T));
\n+
186}
\n+
187
\n+
188template<typename IT>
\n+
189inline void tablewriter::push_back(IT Begin, IT End)
\n+
190{
\n+
191 insert(Begin, End);
\n+
192}
\n+
193
\n+
194template<typename TUPLE>
\n+
195inline void tablewriter::push_back(const TUPLE &T)
\n+
196{
\n+
197 insert(std::begin(T), std::end(T));
\n+
198}
\n+
199
\n+
200template<typename TUPLE>
\n+\n+
202{
\n+
203 insert(T);
\n+
204 return *this;
\n+
205}
\n+
206
\n+
207} // namespace pqxx
\n+
208#include "pqxx/compiler-internal-post.hxx"
\n+
209#endif
\n
STL namespace.
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
Mixin base class to identify libpqxx-specific exception types.
Definition: except.hxx:56
\n-
virtual PQXX_CONST const std::exception & base() const noexcept=0
Return std::exception base-class object.
\n-
Run-time failure encountered by libpqxx, similar to std::runtime_error.
Definition: except.hxx:91
\n-
Exception class for lost or failed backend connection.
Definition: except.hxx:119
\n-
Exception class for failed queries.
Definition: except.hxx:131
\n-
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:160
\n-
The backend saw itself forced to roll back the ongoing transaction.
Definition: except.hxx:168
\n-
Transaction failed to serialize. Please retry it.
Definition: except.hxx:184
\n-
We can't tell whether our last statement succeeded.
Definition: except.hxx:192
\n-
The ongoing transaction has deadlocked. Retrying it may help.
Definition: except.hxx:200
\n-
Internal error in libpqxx library.
Definition: except.hxx:209
\n-
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:220
\n-
Invalid argument passed to libpqxx, similar to std::invalid_argument.
Definition: except.hxx:231
\n-
Value conversion failed, e.g. when converting "Hello" to int.
Definition: except.hxx:242
\n-
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:253
\n-
Query returned an unexpected number of rows.
Definition: except.hxx:263
\n-
unexpected_rows(const std::string &msg)
Definition: except.hxx:267
\n-
Database feature not supported in current setup.
Definition: except.hxx:273
\n-
feature_not_supported(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:275
\n-
Error in data provided to SQL statement.
Definition: except.hxx:284
\n-
data_exception(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:286
\n-
Definition: except.hxx:294
\n-
integrity_constraint_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:296
\n-
Definition: except.hxx:305
\n-
restrict_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:307
\n-
Definition: except.hxx:316
\n-
not_null_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:318
\n-
Definition: except.hxx:327
\n-
foreign_key_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:329
\n-
Definition: except.hxx:338
\n-
unique_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:340
\n-
Definition: except.hxx:349
\n-
check_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:351
\n-
Definition: except.hxx:359
\n-
invalid_cursor_state(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:361
\n-
Definition: except.hxx:369
\n-
invalid_sql_statement_name(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:371
\n-
Definition: except.hxx:379
\n-
invalid_cursor_name(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:381
\n-
Definition: except.hxx:389
\n-
const int error_position
Approximate position in string where error occurred, or -1 if unknown.
Definition: except.hxx:392
\n-
syntax_error(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr, int pos=-1)
Definition: except.hxx:394
\n-
Definition: except.hxx:403
\n-
undefined_column(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:405
\n-
Definition: except.hxx:413
\n-
undefined_function(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:415
\n-
Definition: except.hxx:423
\n-
undefined_table(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:425
\n-
Definition: except.hxx:433
\n-
insufficient_privilege(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:435
\n-
Resource shortage on the server.
Definition: except.hxx:444
\n-
insufficient_resources(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:446
\n-
Definition: except.hxx:454
\n-
disk_full(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:456
\n-
Definition: except.hxx:464
\n-
out_of_memory(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:466
\n-
Definition: except.hxx:474
\n-
too_many_connections(const std::string &err)
Definition: except.hxx:476
\n-
PL/pgSQL error.
Definition: except.hxx:484
\n-
plpgsql_error(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:486
\n-
Exception raised in PL/pgSQL procedure.
Definition: except.hxx:495
\n-
plpgsql_raise(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:497
\n-
Definition: except.hxx:505
\n-
plpgsql_no_data_found(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:507
\n-
Definition: except.hxx:515
\n-
plpgsql_too_many_rows(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:517
\n+
std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const field &F)
Write a result field to any type of stream.
Definition: field.hxx:355
\n+
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
\n+
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: util.hxx:95
\n+
std::string escape(const std::string &s, const std::string &null)
Definition: tablewriter.cxx:131
\n+
std::string escape_any(const std::string &s, const std::string &null)
Definition: tablewriter.hxx:141
\n+
Definition: tablereader.hxx:30
\n+
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
\n+
const std::string & NullStr() const
Definition: tablestream.hxx:36
\n+
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
\n+
Definition: tablewriter.hxx:32
\n+
tablewriter(transaction_base &, const std::string &WName, const std::string &Null=std::string{})
Definition: tablewriter.cxx:22
\n+
void reserve(SIZE)
Definition: tablewriter.hxx:56
\n+
void insert(IT Begin, IT End)
Definition: tablewriter.hxx:178
\n+
std::string generate(IT Begin, IT End) const
Definition: tablewriter.hxx:168
\n+
void push_back(IT Begin, IT End)
Definition: tablewriter.hxx:189
\n+
tablewriter & operator<<(const TUPLE &)
Definition: tablewriter.hxx:201
\n+
void write_raw_line(const std::string &)
Definition: tablewriter.cxx:65
\n+
back_insert_iterator & operator*()
Definition: tablewriter.hxx:100
\n+
back_insert_iterator(pqxx::tablewriter &W) noexcept
Definition: tablewriter.hxx:81
\n+
back_insert_iterator & operator=(const back_insert_iterator &rhs) noexcept
Definition: tablewriter.hxx:85
\n+
back_insert_iterator & operator=(const TUPLE &T)
Definition: tablewriter.hxx:92
\n+
back_insert_iterator & operator++()
Definition: tablewriter.hxx:98
\n+
back_insert_iterator & operator++(int)
Definition: tablewriter.hxx:99
\n+
output_iterator_tag iterator_category
Definition: tablewriter.hxx:79
\n+
Definition: tablewriter.hxx:158
\n+
std::string operator()(IT i) const
Definition: tablewriter.hxx:162
\n+
Escaper(const std::string &null)
Definition: tablewriter.hxx:161
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,632 +1,298 @@\n \n \n \n \n \n libpqxx\n \n-except.hxx\n+tablewriter.hxx\n 1\n- 13#ifndef PQXX_H_EXCEPT\n- 14#define PQXX_H_EXCEPT\n+ 13#ifndef PQXX_H_TABLEWRITER\n+ 14#define PQXX_H_TABLEWRITER\n 15\n- 16#include \"pqxx/compiler-public.hxx\"\n- 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18\n- 19#include \n+ 16#include \n+ 17\n+ 18#include \"pqxx/compiler-public.hxx\"\n+ 19#include \"pqxx/compiler-internal-pre.hxx\"\n 20\n- 21#include \"pqxx/util.hxx\"\n+ 21#include \"pqxx/tablestream.hxx\"\n 22\n 23\n 24namespace pqxx\n 25{\n- 26\n- 44\n-55class PQXX_LIBEXPORT PQXX_NOVTABLE pqxx_exception\n- 56{\n- 57public:\n- 59 virtual ~pqxx_exception() noexcept =0;\n- 60\n- 62\n-84 PQXX_CONST virtual const std::exception &base() const noexcept =0; //[t00]\n- 85};\n- 86\n- 87\n-89class PQXX_LIBEXPORT failure :\n- 90 public pqxx_exception, public std::runtime_error\n- 91{\n- 92 virtual const std::exception &base() const noexcept override\n- 93 { return *this; }\n- 94public:\n- 95 explicit failure(const std::string &);\n- 96};\n+ 27\n+31class PQXX_LIBEXPORT tablewriter : public tablestream\n+ 32{\n+ 33public:\n+ 34 PQXX_DEPRECATED tablewriter(\n+ 35 transaction_base &,\n+ 36 const std::string &WName,\n+ 37 const std::string &Null=std::string{});\n+ 38 template\n+ 39 PQXX_DEPRECATED tablewriter(\n+ 40 transaction_base &,\n+ 41 const std::string &WName,\n+ 42 ITER begincolumns,\n+ 43 ITER endcolumns);\n+ 44 template\n+ 45 PQXX_DEPRECATED tablewriter(\n+ 46 transaction_base &T,\n+ 47 const std::string &WName,\n+ 48 ITER begincolumns,\n+ 49 ITER endcolumns,\n+ 50 const std::string &Null);\n+ 51 ~tablewriter() noexcept;\n+ 52 template void insert(IT Begin, IT End);\n+ 53 template void insert(const TUPLE &);\n+ 54 template void push_back(IT Begin, IT End);\n+ 55 template void push_back(const TUPLE &);\n+56 template void reserve(SIZE) {}\n+ 57 template tablewriter &operator<<(const TUPLE &);\n+ 58 tablewriter &operator<<(tablereader &);\n+ 59 template std::string generate(IT Begin, IT End) const;\n+ 60 template std::string generate(const TUPLE &) const;\n+ 61 virtual void complete() override;\n+ 62 void write_raw_line(const std::string &);\n+ 63private:\n+ 64 void set_up(\n+ 65 transaction_base &,\n+ 66 const std::string &WName,\n+ 67 const std::string &Columns = std::string{});\n+ 68 PQXX_PRIVATE void writer_close();\n+ 69};\n+ 70} // namespace pqxx\n+ 71\n+ 72\n+ 73namespace std\n+ 74{\n+ 75template<>\n+76 class back_insert_iterator\n+ 77{\n+ 78public:\n+79 using iterator_category = output_iterator_tag;\n+ 80\n+81 explicit back_insert_iterator(pqxx::tablewriter &W) noexcept :\n+ 82 m_writer{&W} {}\n+ 83\n+ 84 back_insert_iterator &\n+85 operator=(const back_insert_iterator &rhs) noexcept\n+ 86 {\n+ 87 m_writer = rhs.m_writer;\n+ 88 return *this;\n+ 89 }\n+ 90\n+ 91 template\n+92 back_insert_iterator &operator=(const TUPLE &T)\n+ 93 {\n+ 94 m_writer->insert(T);\n+ 95 return *this;\n+ 96 }\n 97\n- 98\n- 100\n-118class PQXX_LIBEXPORT broken_connection : public failure\n- 119{\n- 120public:\n- 121 broken_connection();\n- 122 explicit broken_connection(const std::string &);\n- 123};\n- 124\n- 125\n- 127\n-130class PQXX_LIBEXPORT sql_error : public failure\n- 131{\n- 133 const std::string m_query;\n- 135 const std::string m_sqlstate;\n- 136\n- 137public:\n- 138 explicit sql_error(\n- 139 const std::string &msg=\"\",\n- 140 const std::string &Q=\"\",\n- 141 const char sqlstate[]=nullptr);\n- 142 virtual ~sql_error() noexcept;\n- 143\n- 145 PQXX_PURE const std::string &query() const noexcept; //[t56]\n- 146\n- 148 PQXX_PURE const std::string &sqlstate() const noexcept;\n- 149};\n+98 back_insert_iterator &operator++() { return *this; }\n+99 back_insert_iterator &operator++(int) { return *this; }\n+100 back_insert_iterator &operator*() { return *this; }\n+ 101\n+ 102private:\n+ 103 pqxx::tablewriter *m_writer;\n+ 104};\n+ 105} // namespace std\n+ 106\n+ 107\n+ 108namespace pqxx\n+ 109{\n+110template inline tablewriter::tablewriter(\n+ 111 transaction_base &T,\n+ 112 const std::string &WName,\n+ 113 ITER begincolumns,\n+ 114 ITER endcolumns) :\n+ 115 namedclass{\"tablewriter\", WName},\n+ 116 tablestream{T, std::string{}}\n+ 117{\n+ 118 set_up(T, WName, columnlist(begincolumns, endcolumns));\n+ 119}\n+ 120\n+ 121\n+122template inline tablewriter::tablewriter(\n+ 123 transaction_base &T,\n+ 124 const std::string &WName,\n+ 125 ITER begincolumns,\n+ 126 ITER endcolumns,\n+ 127 const std::string &Null) :\n+ 128 namedclass{\"tablewriter\", WName},\n+ 129 tablestream{T, Null}\n+ 130{\n+ 131 set_up(T, WName, columnlist(begincolumns, endcolumns));\n+ 132}\n+ 133\n+ 134\n+ 135namespace internal\n+ 136{\n+ 137PQXX_LIBEXPORT std::string escape(\n+ 138 const std::string &s,\n+ 139 const std::string &null);\n+ 140\n+141inline std::string escape_any(\n+ 142 const std::string &s,\n+ 143 const std::string &null)\n+ 144{ return escape(s, null); }\n+ 145\n+146inline std::string escape_any(\n+ 147 const char s[],\n+ 148 const std::string &null)\n+ 149{ return s ? escape(std::string{s}, null) : \"\\\\N\"; }\n 150\n- 151\n- 153\n-159class PQXX_LIBEXPORT in_doubt_error : public failure\n- 160{\n- 161public:\n- 162 explicit in_doubt_error(const std::string &);\n+151template inline std::string escape_any(\n+ 152 const T &t,\n+ 153 const std::string &null)\n+ 154{ return escape(to_string(t), null); }\n+ 155\n+ 156\n+157template class Escaper\n+ 158{\n+ 159 const std::string &m_null;\n+ 160public:\n+161 explicit Escaper(const std::string &null) : m_null{null} {}\n+162 std::string operator()(IT i) const { return escape_any(*i, m_null); }\n 163};\n- 164\n+ 164}\n 165\n-167class PQXX_LIBEXPORT transaction_rollback : public failure\n- 168{\n- 169public:\n- 170 explicit transaction_rollback(const std::string &);\n- 171};\n- 172\n- 173\n- 175\n-183class PQXX_LIBEXPORT serialization_failure : public transaction_rollback\n+ 166\n+ 167template\n+168inline std::string tablewriter::generate(IT Begin, IT End) const\n+ 169{\n+ 170 return separated_list(\"\\t\", Begin, End, internal::Escaper{NullStr()});\n+ 171}\n+ 172template\n+173inline std::string tablewriter::generate(const TUPLE &T) const\n+ 174{\n+ 175 return generate(std::begin(T), std::end(T));\n+ 176}\n+ 177\n+178template inline void tablewriter::insert(IT Begin, IT End)\n+ 179{\n+ 180 write_raw_line(generate(Begin, End));\n+ 181}\n+ 182\n+183template inline void tablewriter::insert(const TUPLE &T)\n 184{\n- 185public:\n- 186 explicit serialization_failure(const std::string &);\n- 187};\n- 188\n- 189\n-191class PQXX_LIBEXPORT statement_completion_unknown : public\n-transaction_rollback\n- 192{\n- 193public:\n- 194 explicit statement_completion_unknown(const std::string &);\n- 195};\n- 196\n- 197\n-199class PQXX_LIBEXPORT deadlock_detected : public transaction_rollback\n- 200{\n- 201public:\n- 202 explicit deadlock_detected(const std::string &);\n- 203};\n- 204\n- 205\n-207class PQXX_LIBEXPORT internal_error :\n- 208 public pqxx_exception, public std::logic_error\n- 209{\n- 210 virtual const std::exception &base() const noexcept override\n- 211 { return *this; }\n- 212public:\n- 213 explicit internal_error(const std::string &);\n- 214};\n- 215\n- 216\n-218class PQXX_LIBEXPORT usage_error :\n- 219 public pqxx_exception, public std::logic_error\n- 220{\n- 221 virtual const std::exception &base() const noexcept override\n- 222 { return *this; }\n- 223public:\n- 224 explicit usage_error(const std::string &);\n- 225};\n- 226\n- 227\n-229class PQXX_LIBEXPORT argument_error :\n- 230 public pqxx_exception, public std::invalid_argument\n- 231{\n- 232 virtual const std::exception &base() const noexcept override\n- 233 { return *this; }\n- 234public:\n- 235 explicit argument_error(const std::string &);\n- 236};\n- 237\n- 238\n-240class PQXX_LIBEXPORT conversion_error :\n- 241 public pqxx_exception, public std::domain_error\n- 242{\n- 243 virtual const std::exception &base() const noexcept override\n- 244 { return *this; }\n- 245public:\n- 246 explicit conversion_error(const std::string &);\n- 247};\n- 248\n- 249\n-251class PQXX_LIBEXPORT range_error :\n- 252 public pqxx_exception, public std::out_of_range\n- 253{\n- 254 virtual const std::exception &base() const noexcept override\n- 255 { return *this; }\n- 256public:\n- 257 explicit range_error(const std::string &);\n- 258};\n- 259\n- 260\n-262class PQXX_LIBEXPORT unexpected_rows : public range_error\n- 263{\n- 264 virtual const std::exception &base() const noexcept override\n- 265 { return *this; }\n- 266public:\n-267 explicit unexpected_rows(const std::string &msg) : range_error{msg} {}\n- 268};\n- 269\n- 270\n-272class PQXX_LIBEXPORT feature_not_supported : public sql_error\n- 273{\n- 274public:\n-275 explicit feature_not_supported(\n- 276 const std::string &err,\n- 277 const std::string &Q=\"\",\n- 278 const char sqlstate[]=nullptr) :\n- 279 sql_error{err, Q, sqlstate} {}\n- 280};\n- 281\n-283class PQXX_LIBEXPORT data_exception : public sql_error\n- 284{\n- 285public:\n-286 explicit data_exception(\n- 287 const std::string &err,\n- 288 const std::string &Q=\"\",\n- 289 const char sqlstate[]=nullptr) :\n- 290 sql_error{err, Q, sqlstate} {}\n- 291};\n- 292\n-293class PQXX_LIBEXPORT integrity_constraint_violation : public sql_error\n- 294{\n- 295public:\n-296 explicit integrity_constraint_violation(\n- 297 const std::string &err,\n- 298 const std::string &Q=\"\",\n- 299 const char sqlstate[]=nullptr) :\n- 300 sql_error{err, Q, sqlstate} {}\n- 301};\n- 302\n-303class PQXX_LIBEXPORT restrict_violation :\n- 304 public integrity_constraint_violation\n- 305{\n- 306public:\n-307 explicit restrict_violation(\n- 308 const std::string &err,\n- 309 const std::string &Q=\"\",\n- 310 const char sqlstate[]=nullptr) :\n- 311 integrity_constraint_violation{err, Q, sqlstate} {}\n- 312};\n- 313\n-314class PQXX_LIBEXPORT not_null_violation :\n- 315 public integrity_constraint_violation\n- 316{\n- 317public:\n-318 explicit not_null_violation(\n- 319 const std::string &err,\n- 320 const std::string &Q=\"\",\n- 321 const char sqlstate[]=nullptr) :\n- 322 integrity_constraint_violation{err, Q, sqlstate} {}\n- 323};\n- 324\n-325class PQXX_LIBEXPORT foreign_key_violation :\n- 326 public integrity_constraint_violation\n- 327{\n- 328public:\n-329 explicit foreign_key_violation(\n- 330 const std::string &err,\n- 331 const std::string &Q=\"\",\n- 332 const char sqlstate[]=nullptr) :\n- 333 integrity_constraint_violation{err, Q, sqlstate} {}\n- 334};\n- 335\n-336class PQXX_LIBEXPORT unique_violation :\n- 337 public integrity_constraint_violation\n- 338{\n- 339public:\n-340 explicit unique_violation(\n- 341 const std::string &err,\n- 342 const std::string &Q=\"\",\n- 343 const char sqlstate[]=nullptr) :\n- 344 integrity_constraint_violation{err, Q, sqlstate} {}\n- 345};\n- 346\n-347class PQXX_LIBEXPORT check_violation :\n- 348 public integrity_constraint_violation\n- 349{\n- 350public:\n-351 explicit check_violation(\n- 352 const std::string &err,\n- 353 const std::string &Q=\"\",\n- 354 const char sqlstate[]=nullptr) :\n- 355 integrity_constraint_violation{err, Q, sqlstate} {}\n- 356};\n- 357\n-358class PQXX_LIBEXPORT invalid_cursor_state : public sql_error\n- 359{\n- 360public:\n-361 explicit invalid_cursor_state(\n- 362 const std::string &err,\n- 363 const std::string &Q=\"\",\n- 364 const char sqlstate[]=nullptr) :\n- 365 sql_error{err, Q, sqlstate} {}\n- 366};\n- 367\n-368class PQXX_LIBEXPORT invalid_sql_statement_name : public sql_error\n- 369{\n- 370public:\n-371 explicit invalid_sql_statement_name(\n- 372 const std::string &err,\n- 373 const std::string &Q=\"\",\n- 374 const char sqlstate[]=nullptr) :\n- 375 sql_error{err, Q, sqlstate} {}\n- 376};\n- 377\n-378class PQXX_LIBEXPORT invalid_cursor_name : public sql_error\n- 379{\n- 380public:\n-381 explicit invalid_cursor_name(\n- 382 const std::string &err,\n- 383 const std::string &Q=\"\",\n- 384 const char sqlstate[]=nullptr) :\n- 385 sql_error{err, Q, sqlstate} {}\n- 386};\n- 387\n-388class PQXX_LIBEXPORT syntax_error : public sql_error\n- 389{\n- 390public:\n-392 const int error_position;\n- 393\n-394 explicit syntax_error(\n- 395 const std::string &err,\n- 396 const std::string &Q=\"\",\n- 397 const char sqlstate[]=nullptr,\n- 398 int pos=-1) :\n- 399 sql_error{err, Q, sqlstate}, error_position{pos} {}\n- 400};\n- 401\n-402class PQXX_LIBEXPORT undefined_column : public syntax_error\n- 403{\n- 404public:\n-405 explicit undefined_column(\n- 406 const std::string &err,\n- 407 const std::string &Q=\"\",\n- 408 const char sqlstate[]=nullptr) :\n- 409 syntax_error{err, Q, sqlstate} {}\n- 410};\n- 411\n-412class PQXX_LIBEXPORT undefined_function : public syntax_error\n- 413{\n- 414public:\n-415 explicit undefined_function(\n- 416 const std::string &err,\n- 417 const std::string &Q=\"\",\n- 418 const char sqlstate[]=nullptr) :\n- 419 syntax_error{err, Q, sqlstate} {}\n- 420};\n- 421\n-422class PQXX_LIBEXPORT undefined_table : public syntax_error\n- 423{\n- 424public:\n-425 explicit undefined_table(\n- 426 const std::string &err,\n- 427 const std::string &Q=\"\",\n- 428 const char sqlstate[]=nullptr) :\n- 429 syntax_error{err, Q, sqlstate} {}\n- 430};\n- 431\n-432class PQXX_LIBEXPORT insufficient_privilege : public sql_error\n- 433{\n- 434public:\n-435 explicit insufficient_privilege(\n- 436 const std::string &err,\n- 437 const std::string &Q=\"\",\n- 438 const char sqlstate[]=nullptr) :\n- 439 sql_error{err, Q, sqlstate} {}\n- 440};\n- 441\n-443class PQXX_LIBEXPORT insufficient_resources : public sql_error\n- 444{\n- 445public:\n-446 explicit insufficient_resources(\n- 447 const std::string &err,\n- 448 const std::string &Q=\"\",\n- 449 const char sqlstate[]=nullptr) :\n- 450 sql_error{err,Q, sqlstate} {}\n- 451};\n- 452\n-453class PQXX_LIBEXPORT disk_full : public insufficient_resources\n- 454{\n- 455public:\n-456 explicit disk_full(\n- 457 const std::string &err,\n- 458 const std::string &Q=\"\",\n- 459 const char sqlstate[]=nullptr) :\n- 460 insufficient_resources{err, Q, sqlstate} {}\n- 461};\n- 462\n-463class PQXX_LIBEXPORT out_of_memory : public insufficient_resources\n- 464{\n- 465public:\n-466 explicit out_of_memory(\n- 467 const std::string &err,\n- 468 const std::string &Q=\"\",\n- 469 const char sqlstate[]=nullptr) :\n- 470 insufficient_resources{err, Q, sqlstate} {}\n- 471};\n- 472\n-473class PQXX_LIBEXPORT too_many_connections : public broken_connection\n- 474{\n- 475public:\n-476 explicit too_many_connections(const std::string &err) :\n- 477 broken_connection{err} {}\n- 478};\n- 479\n- 481\n-483class PQXX_LIBEXPORT plpgsql_error : public sql_error\n- 484{\n- 485public:\n-486 explicit plpgsql_error(\n- 487 const std::string &err,\n- 488 const std::string &Q=\"\",\n- 489 const char sqlstate[]=nullptr) :\n- 490 sql_error{err, Q, sqlstate} {}\n- 491};\n- 492\n-494class PQXX_LIBEXPORT plpgsql_raise : public plpgsql_error\n- 495{\n- 496public:\n-497 explicit plpgsql_raise(\n- 498 const std::string &err,\n- 499 const std::string &Q=\"\",\n- 500 const char sqlstate[]=nullptr) :\n- 501 plpgsql_error{err, Q, sqlstate} {}\n- 502};\n- 503\n-504class PQXX_LIBEXPORT plpgsql_no_data_found : public plpgsql_error\n- 505{\n- 506public:\n-507 explicit plpgsql_no_data_found(\n- 508 const std::string &err,\n- 509 const std::string &Q=\"\",\n- 510 const char sqlstate[]=nullptr) :\n- 511 plpgsql_error{err, Q, sqlstate} {}\n- 512};\n- 513\n-514class PQXX_LIBEXPORT plpgsql_too_many_rows : public plpgsql_error\n- 515{\n- 516public:\n-517 explicit plpgsql_too_many_rows(\n- 518 const std::string &err,\n- 519 const std::string &Q=\"\",\n- 520 const char sqlstate[]=nullptr) :\n- 521 plpgsql_error{err, Q, sqlstate} {}\n- 522};\n- 523\n- 528}\n- 529\n- 530#include \"pqxx/compiler-internal-post.hxx\"\n- 531\n- 532#endif\n+ 185 insert(std::begin(T), std::end(T));\n+ 186}\n+ 187\n+ 188template\n+189inline void tablewriter::push_back(IT Begin, IT End)\n+ 190{\n+ 191 insert(Begin, End);\n+ 192}\n+ 193\n+ 194template\n+195inline void tablewriter::push_back(const TUPLE &T)\n+ 196{\n+ 197 insert(std::begin(T), std::end(T));\n+ 198}\n+ 199\n+ 200template\n+201inline tablewriter &tablewriter::operator<<(const TUPLE &T)\n+ 202{\n+ 203 insert(T);\n+ 204 return *this;\n+ 205}\n+ 206\n+ 207} // namespace pqxx\n+ 208#include \"pqxx/compiler-internal-post.hxx\"\n+ 209#endif\n std\n STL namespace.\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::pqxx_exception\n-Mixin base class to identify libpqxx-specific exception types.\n-Definition: except.hxx:56\n-pqxx::pqxx_exception::base\n-virtual PQXX_CONST const std::exception & base() const noexcept=0\n-Return std::exception base-class object.\n-pqxx::failure\n-Run-time failure encountered by libpqxx, similar to std::runtime_error.\n-Definition: except.hxx:91\n-pqxx::broken_connection\n-Exception class for lost or failed backend connection.\n-Definition: except.hxx:119\n-pqxx::sql_error\n-Exception class for failed queries.\n-Definition: except.hxx:131\n-pqxx::in_doubt_error\n-\"Help, I don't know whether transaction was committed successfully!\"\n-Definition: except.hxx:160\n-pqxx::transaction_rollback\n-The backend saw itself forced to roll back the ongoing transaction.\n-Definition: except.hxx:168\n-pqxx::serialization_failure\n-Transaction failed to serialize. Please retry it.\n-Definition: except.hxx:184\n-pqxx::statement_completion_unknown\n-We can't tell whether our last statement succeeded.\n-Definition: except.hxx:192\n-pqxx::deadlock_detected\n-The ongoing transaction has deadlocked. Retrying it may help.\n-Definition: except.hxx:200\n-pqxx::internal_error\n-Internal error in libpqxx library.\n-Definition: except.hxx:209\n-pqxx::usage_error\n-Error in usage of libpqxx library, similar to std::logic_error.\n-Definition: except.hxx:220\n-pqxx::argument_error\n-Invalid argument passed to libpqxx, similar to std::invalid_argument.\n-Definition: except.hxx:231\n-pqxx::conversion_error\n-Value conversion failed, e.g. when converting \"Hello\" to int.\n-Definition: except.hxx:242\n-pqxx::range_error\n-Something is out of range, similar to std::out_of_range.\n-Definition: except.hxx:253\n-pqxx::unexpected_rows\n-Query returned an unexpected number of rows.\n-Definition: except.hxx:263\n-pqxx::unexpected_rows::unexpected_rows\n-unexpected_rows(const std::string &msg)\n-Definition: except.hxx:267\n-pqxx::feature_not_supported\n-Database feature not supported in current setup.\n-Definition: except.hxx:273\n-pqxx::feature_not_supported::feature_not_supported\n-feature_not_supported(const std::string &err, const std::string &Q=\"\", const\n-char sqlstate[]=nullptr)\n-Definition: except.hxx:275\n-pqxx::data_exception\n-Error in data provided to SQL statement.\n-Definition: except.hxx:284\n-pqxx::data_exception::data_exception\n-data_exception(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:286\n-pqxx::integrity_constraint_violation\n-Definition: except.hxx:294\n-pqxx::integrity_constraint_violation::integrity_constraint_violation\n-integrity_constraint_violation(const std::string &err, const std::string &Q=\"\",\n-const char sqlstate[]=nullptr)\n-Definition: except.hxx:296\n-pqxx::restrict_violation\n-Definition: except.hxx:305\n-pqxx::restrict_violation::restrict_violation\n-restrict_violation(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:307\n-pqxx::not_null_violation\n-Definition: except.hxx:316\n-pqxx::not_null_violation::not_null_violation\n-not_null_violation(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:318\n-pqxx::foreign_key_violation\n-Definition: except.hxx:327\n-pqxx::foreign_key_violation::foreign_key_violation\n-foreign_key_violation(const std::string &err, const std::string &Q=\"\", const\n-char sqlstate[]=nullptr)\n-Definition: except.hxx:329\n-pqxx::unique_violation\n-Definition: except.hxx:338\n-pqxx::unique_violation::unique_violation\n-unique_violation(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:340\n-pqxx::check_violation\n-Definition: except.hxx:349\n-pqxx::check_violation::check_violation\n-check_violation(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:351\n-pqxx::invalid_cursor_state\n-Definition: except.hxx:359\n-pqxx::invalid_cursor_state::invalid_cursor_state\n-invalid_cursor_state(const std::string &err, const std::string &Q=\"\", const\n-char sqlstate[]=nullptr)\n-Definition: except.hxx:361\n-pqxx::invalid_sql_statement_name\n-Definition: except.hxx:369\n-pqxx::invalid_sql_statement_name::invalid_sql_statement_name\n-invalid_sql_statement_name(const std::string &err, const std::string &Q=\"\",\n-const char sqlstate[]=nullptr)\n-Definition: except.hxx:371\n-pqxx::invalid_cursor_name\n-Definition: except.hxx:379\n-pqxx::invalid_cursor_name::invalid_cursor_name\n-invalid_cursor_name(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:381\n-pqxx::syntax_error\n-Definition: except.hxx:389\n-pqxx::syntax_error::error_position\n-const int error_position\n-Approximate position in string where error occurred, or -1 if unknown.\n-Definition: except.hxx:392\n-pqxx::syntax_error::syntax_error\n-syntax_error(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr, int pos=-1)\n-Definition: except.hxx:394\n-pqxx::undefined_column\n-Definition: except.hxx:403\n-pqxx::undefined_column::undefined_column\n-undefined_column(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:405\n-pqxx::undefined_function\n-Definition: except.hxx:413\n-pqxx::undefined_function::undefined_function\n-undefined_function(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:415\n-pqxx::undefined_table\n-Definition: except.hxx:423\n-pqxx::undefined_table::undefined_table\n-undefined_table(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:425\n-pqxx::insufficient_privilege\n-Definition: except.hxx:433\n-pqxx::insufficient_privilege::insufficient_privilege\n-insufficient_privilege(const std::string &err, const std::string &Q=\"\", const\n-char sqlstate[]=nullptr)\n-Definition: except.hxx:435\n-pqxx::insufficient_resources\n-Resource shortage on the server.\n-Definition: except.hxx:444\n-pqxx::insufficient_resources::insufficient_resources\n-insufficient_resources(const std::string &err, const std::string &Q=\"\", const\n-char sqlstate[]=nullptr)\n-Definition: except.hxx:446\n-pqxx::disk_full\n-Definition: except.hxx:454\n-pqxx::disk_full::disk_full\n-disk_full(const std::string &err, const std::string &Q=\"\", const char sqlstate\n-[]=nullptr)\n-Definition: except.hxx:456\n-pqxx::out_of_memory\n-Definition: except.hxx:464\n-pqxx::out_of_memory::out_of_memory\n-out_of_memory(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:466\n-pqxx::too_many_connections\n-Definition: except.hxx:474\n-pqxx::too_many_connections::too_many_connections\n-too_many_connections(const std::string &err)\n-Definition: except.hxx:476\n-pqxx::plpgsql_error\n-PL/pgSQL error.\n-Definition: except.hxx:484\n-pqxx::plpgsql_error::plpgsql_error\n-plpgsql_error(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:486\n-pqxx::plpgsql_raise\n-Exception raised in PL/pgSQL procedure.\n-Definition: except.hxx:495\n-pqxx::plpgsql_raise::plpgsql_raise\n-plpgsql_raise(const std::string &err, const std::string &Q=\"\", const char\n-sqlstate[]=nullptr)\n-Definition: except.hxx:497\n-pqxx::plpgsql_no_data_found\n-Definition: except.hxx:505\n-pqxx::plpgsql_no_data_found::plpgsql_no_data_found\n-plpgsql_no_data_found(const std::string &err, const std::string &Q=\"\", const\n-char sqlstate[]=nullptr)\n-Definition: except.hxx:507\n-pqxx::plpgsql_too_many_rows\n-Definition: except.hxx:515\n-pqxx::plpgsql_too_many_rows::plpgsql_too_many_rows\n-plpgsql_too_many_rows(const std::string &err, const std::string &Q=\"\", const\n-char sqlstate[]=nullptr)\n-Definition: except.hxx:517\n+pqxx::operator<<\n+std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const\n+field &F)\n+Write a result field to any type of stream.\n+Definition: field.hxx:355\n+pqxx::to_string\n+std::string to_string(const field &Obj)\n+Convert a field to a string.\n+Definition: result.cxx:451\n+pqxx::separated_list\n+std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS\n+access)\n+Represent sequence of values as a string, joined by a given separator.\n+Definition: util.hxx:95\n+pqxx::internal::escape\n+std::string escape(const std::string &s, const std::string &null)\n+Definition: tablewriter.cxx:131\n+pqxx::internal::escape_any\n+std::string escape_any(const std::string &s, const std::string &null)\n+Definition: tablewriter.hxx:141\n+pqxx::tablereader\n+Definition: tablereader.hxx:30\n+pqxx::tablestream\n+Base class for obsolete tablereader/tablewriter classes.\n+Definition: tablestream.hxx:28\n+pqxx::tablestream::NullStr\n+const std::string & NullStr() const\n+Definition: tablestream.hxx:36\n+pqxx::tablestream::columnlist\n+static std::string columnlist(ITER colbegin, ITER colend)\n+Definition: tablestream.hxx:52\n+pqxx::tablewriter\n+Definition: tablewriter.hxx:32\n+pqxx::tablewriter::tablewriter\n+tablewriter(transaction_base &, const std::string &WName, const std::string\n+&Null=std::string{})\n+Definition: tablewriter.cxx:22\n+pqxx::tablewriter::reserve\n+void reserve(SIZE)\n+Definition: tablewriter.hxx:56\n+pqxx::tablewriter::insert\n+void insert(IT Begin, IT End)\n+Definition: tablewriter.hxx:178\n+pqxx::tablewriter::generate\n+std::string generate(IT Begin, IT End) const\n+Definition: tablewriter.hxx:168\n+pqxx::tablewriter::push_back\n+void push_back(IT Begin, IT End)\n+Definition: tablewriter.hxx:189\n+pqxx::tablewriter::operator<<\n+tablewriter & operator<<(const TUPLE &)\n+Definition: tablewriter.hxx:201\n+pqxx::tablewriter::write_raw_line\n+void write_raw_line(const std::string &)\n+Definition: tablewriter.cxx:65\n+std::back_insert_iterator<_pqxx::tablewriter_>::operator*\n+back_insert_iterator & operator*()\n+Definition: tablewriter.hxx:100\n+std::back_insert_iterator<_pqxx::tablewriter_>::back_insert_iterator\n+back_insert_iterator(pqxx::tablewriter &W) noexcept\n+Definition: tablewriter.hxx:81\n+std::back_insert_iterator<_pqxx::tablewriter_>::operator=\n+back_insert_iterator & operator=(const back_insert_iterator &rhs) noexcept\n+Definition: tablewriter.hxx:85\n+std::back_insert_iterator<_pqxx::tablewriter_>::operator=\n+back_insert_iterator & operator=(const TUPLE &T)\n+Definition: tablewriter.hxx:92\n+std::back_insert_iterator<_pqxx::tablewriter_>::operator++\n+back_insert_iterator & operator++()\n+Definition: tablewriter.hxx:98\n+std::back_insert_iterator<_pqxx::tablewriter_>::operator++\n+back_insert_iterator & operator++(int)\n+Definition: tablewriter.hxx:99\n+std::back_insert_iterator<_pqxx::tablewriter_>::iterator_category\n+output_iterator_tag iterator_category\n+Definition: tablewriter.hxx:79\n+pqxx::internal::Escaper\n+Definition: tablewriter.hxx:158\n+pqxx::internal::Escaper::operator()\n+std::string operator()(IT i) const\n+Definition: tablewriter.hxx:162\n+pqxx::internal::Escaper::Escaper\n+Escaper(const std::string &null)\n+Definition: tablewriter.hxx:161\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * except.hxx\n+ * tablewriter.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00092_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00092_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: transactor.hxx Source File\n+libpqxx: stream_from.hxx Source File\n \n \n \n \n \n \n \n@@ -55,190 +55,229 @@\n \n
\n
\n-
transactor.hxx
\n+
stream_from.hxx
\n
\n
\n-
1/* Transactor framework, a wrapper for safely retryable transactions.
\n-
2 *
\n-
3 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transactor instead.
\n-
4 *
\n-
5 * Copyright (c) 2000-2019, Jeroen T. Vermeulen.
\n-
6 *
\n-
7 * See COPYING for copyright license. If you did not receive a file called
\n-
8 * COPYING with this source code, please notify the distributor of this mistake,
\n-
9 * or contact the author.
\n-
10 */
\n-
11#ifndef PQXX_H_TRANSACTOR
\n-
12#define PQXX_H_TRANSACTOR
\n-
13
\n-
14#include "pqxx/compiler-public.hxx"
\n-
15#include "pqxx/compiler-internal-pre.hxx"
\n-
16
\n-
17#include "pqxx/connection_base.hxx"
\n-
18#include "pqxx/transaction.hxx"
\n-
19
\n-
20
\n-
21// Methods tested in eg. test module test01 are marked with "//[t01]".
\n-
22
\n-
23namespace pqxx
\n-
24{
\n-
67
\n-
69
\n-
98template<typename TRANSACTION_CALLBACK>
\n-
99inline auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3)
\n-
100 -> decltype(callback())
\n-
101{
\n-
102 if (attempts <= 0)
\n-
103 throw std::invalid_argument{
\n-
104 "Zero or negative number of attempts passed to pqxx::perform()."};
\n-
105
\n-
106 for (; attempts > 0; --attempts)
\n-
107 {
\n-
108 try
\n-
109 {
\n-
110 return callback();
\n-
111 }
\n-
112 catch (const in_doubt_error &)
\n-
113 {
\n-
114 // Not sure whether transaction went through or not. The last thing in
\n-
115 // the world that we should do now is try again!
\n-
116 throw;
\n-
117 }
\n-
118 catch (const statement_completion_unknown &)
\n-
119 {
\n-
120 // Not sure whether our last statement succeeded. Don't risk running it
\n-
121 // again.
\n-
122 throw;
\n-
123 }
\n-
124 catch (const broken_connection &)
\n-
125 {
\n-
126 // Connection failed. Definitely worth retrying.
\n-
127 if (attempts <= 1) throw;
\n-
128 continue;
\n-
129 }
\n-
130 catch (const transaction_rollback &)
\n-
131 {
\n-
132 // Some error that may well be transient, such as serialization failure
\n-
133 // or deadlock. Worth retrying.
\n-
134 if (attempts <= 1) throw;
\n-
135 continue;
\n-
136 }
\n-
137 }
\n-
138 throw pqxx::internal_error{"No outcome reached on perform()."};
\n-
139}
\n-
140
\n-
142
\n-
156template<typename TRANSACTION=transaction<read_committed>> class transactor
\n-
157{
\n-
158public:
\n-
159 using argument_type = TRANSACTION;
\n-
160 PQXX_DEPRECATED explicit transactor( //[t04]
\n-
161 const std::string &TName="transactor") :
\n-
162 m_name{TName} { }
\n+
1
\n+
13#ifndef PQXX_H_STREAM_FROM
\n+
14#define PQXX_H_STREAM_FROM
\n+
15
\n+
16#include "pqxx/compiler-public.hxx"
\n+
17#include "pqxx/compiler-internal-pre.hxx"
\n+
18#include "pqxx/transaction_base.hxx"
\n+
19#include "pqxx/stream_base.hxx"
\n+
20#include "pqxx/internal/type_utils.hxx"
\n+
21
\n+
22#include <string>
\n+
23
\n+
24
\n+
25namespace pqxx
\n+
26{
\n+
27
\n+
29class PQXX_LIBEXPORT stream_from : public stream_base
\n+
30{
\n+
31public:
\n+\n+\n+
34 const std::string &table_name
\n+
35 );
\n+
36 template<typename Columns> stream_from(
\n+\n+
38 const std::string &table_name,
\n+
39 const Columns& columns
\n+
40 );
\n+
41 template<typename Iter> stream_from(
\n+\n+
43 const std::string &table_name,
\n+
44 Iter columns_begin,
\n+
45 Iter columns_end
\n+
46 );
\n+
47
\n+
48 ~stream_from() noexcept;
\n+
49
\n+
50 void complete() override;
\n+
51
\n+
52 bool get_raw_line(std::string &);
\n+
53 template<typename Tuple> stream_from & operator>>(Tuple &);
\n+
54
\n+
55private:
\n+
56 internal::encoding_group m_copy_encoding;
\n+
57 std::string m_current_line;
\n+
58 bool m_retry_line;
\n+
59
\n+
60 void set_up(transaction_base &, const std::string &table_name);
\n+
61 void set_up(
\n+\n+
63 const std::string &table_name,
\n+
64 const std::string &columns
\n+
65 );
\n+
66
\n+
67 void close() override;
\n+
68
\n+
69 bool extract_field(
\n+
70 const std::string &,
\n+
71 std::string::size_type &,
\n+
72 std::string &
\n+
73 ) const;
\n+
74
\n+
75 template<typename Tuple, std::size_t I> auto tokenize_ith(
\n+
76 const std::string &,
\n+
77 Tuple &,
\n+
78 std::string::size_type,
\n+
79 std::string &
\n+
80 ) const -> typename std::enable_if<(
\n+
81 std::tuple_size<Tuple>::value > I
\n+
82 )>::type;
\n+
83 template<typename Tuple, std::size_t I> auto tokenize_ith(
\n+
84 const std::string &,
\n+
85 Tuple &,
\n+
86 std::string::size_type,
\n+
87 std::string &
\n+
88 ) const -> typename std::enable_if<(
\n+
89 std::tuple_size<Tuple>::value <= I
\n+
90 )>::type;
\n+
91
\n+
92 template<typename T> void extract_value(
\n+
93 const std::string &line,
\n+
94 T& t,
\n+
95 std::string::size_type &here,
\n+
96 std::string &workspace
\n+
97 ) const;
\n+
98};
\n+
99
\n+
100
\n+
101template<typename Columns> stream_from::stream_from(
\n+\n+
103 const std::string &table_name,
\n+
104 const Columns& columns
\n+
105) : stream_from{
\n+
106 tb,
\n+
107 table_name,
\n+
108 std::begin(columns),
\n+
109 std::end(columns)
\n+
110} {}
\n+
111
\n+
112
\n+
113template<typename Iter> stream_from::stream_from(
\n+\n+
115 const std::string &table_name,
\n+
116 Iter columns_begin,
\n+
117 Iter columns_end
\n+
118) :
\n+
119 namedclass{"stream_from", table_name},
\n+
120 stream_base{tb}
\n+
121{
\n+
122 set_up(
\n+
123 tb,
\n+
124 table_name,
\n+
125 columnlist(columns_begin, columns_end)
\n+
126 );
\n+
127}
\n+
128
\n+
129
\n+
130template<typename Tuple> stream_from & stream_from::operator>>(
\n+
131 Tuple &t
\n+
132)
\n+
133{
\n+
134 if (m_retry_line or get_raw_line(m_current_line))
\n+
135 {
\n+
136 std::string workspace;
\n+
137 try
\n+
138 {
\n+
139 tokenize_ith<Tuple, 0>(m_current_line, t, 0, workspace);
\n+
140 m_retry_line = false;
\n+
141 }
\n+
142 catch (...)
\n+
143 {
\n+
144 m_retry_line = true;
\n+
145 throw;
\n+
146 }
\n+
147 }
\n+
148 return *this;
\n+
149}
\n+
150
\n+
151
\n+
152template<typename Tuple, std::size_t I> auto stream_from::tokenize_ith(
\n+
153 const std::string &line,
\n+
154 Tuple &t,
\n+
155 std::string::size_type here,
\n+
156 std::string &workspace
\n+
157) const -> typename std::enable_if<(
\n+
158 std::tuple_size<Tuple>::value > I
\n+
159)>::type
\n+
160{
\n+
161 if (here >= line.size())
\n+
162 throw usage_error{"Too few fields to extract from stream_from line."};
\n
163
\n-
165
\n-
176 void operator()(TRANSACTION &T); //[t04]
\n-
177
\n-
178 // Overridable member functions, called by connection_base::perform() if an
\n-
179 // attempt to run transaction fails/succeeds, respectively, or if the
\n-
180 // connection is lost at just the wrong moment, goes into an indeterminate
\n-
181 // state. Use these to patch up runtime state to match events, if needed, or
\n-
182 // to report failure conditions.
\n-
183
\n+
164 extract_value(line, std::get<I>(t), here, workspace);
\n+
165 tokenize_ith<Tuple, I+1>(line, t, here, workspace);
\n+
166}
\n+
167
\n+
168
\n+
169template<typename Tuple, std::size_t I> auto stream_from::tokenize_ith(
\n+
170 const std::string &line,
\n+
171 Tuple & /* t */,
\n+
172 std::string::size_type here,
\n+
173 std::string & /* workspace */
\n+
174) const -> typename std::enable_if<(
\n+
175 std::tuple_size<Tuple>::value <= I
\n+
176)>::type
\n+
177{
\n+
178 // Zero-column line may still have a trailing newline
\n+
179 if (
\n+
180 here < line.size() and
\n+
181 not (here == line.size() - 1 and line[here] == '\\n'))
\n+
182 throw usage_error{"Not all fields extracted from stream_from line"};
\n+
183}
\n+
184
\n
185
\n-
193 void on_abort(const char[]) noexcept {} //[t13]
\n-
194
\n-
196
\n-
200 void on_commit() {} //[t07]
\n-
201
\n-
203
\n-
214 void on_doubt() noexcept {} //[t13]
\n-
215
\n-
217 std::string name() const { return m_name; } //[t13]
\n-
218
\n-
219private:
\n-
220 std::string m_name;
\n-
221};
\n-
222
\n-
223
\n-
224template<typename TRANSACTOR>
\n-\n-
226 const TRANSACTOR &T,
\n-
227 int Attempts)
\n-
228{
\n-
229 if (Attempts <= 0) return;
\n-
230
\n-
231 bool Done = false;
\n-
232
\n-
233 // Make attempts to perform T
\n-
234 do
\n-
235 {
\n-
236 --Attempts;
\n-
237
\n-
238 // Work on a copy of T2 so we can restore the starting situation if need be
\n-
239 TRANSACTOR T2{T};
\n-
240 try
\n-
241 {
\n-
242 typename TRANSACTOR::argument_type X{*this, T2.name()};
\n-
243 T2(X);
\n-
244 X.commit();
\n-
245 Done = true;
\n-
246 }
\n-
247 catch (const in_doubt_error &)
\n-
248 {
\n-
249 // Not sure whether transaction went through or not. The last thing in
\n-
250 // the world that we should do now is retry.
\n-
251 T2.on_doubt();
\n-
252 throw;
\n-
253 }
\n-
254 catch (const std::exception &e)
\n-
255 {
\n-
256 // Could be any kind of error.
\n-
257 T2.on_abort(e.what());
\n-
258 if (Attempts <= 0) throw;
\n-
259 continue;
\n-
260 }
\n-
261 catch (...)
\n-
262 {
\n-
263 // Don't try to forge ahead if we don't even know what happened
\n-
264 T2.on_abort("Unknown exception");
\n-
265 throw;
\n-
266 }
\n-
267
\n-
268 T2.on_commit();
\n-
269 } while (not Done);
\n-
270}
\n-
271} // namespace pqxx
\n-
273#include "pqxx/compiler-internal-post.hxx"
\n-
274#endif
\n+
186template<typename T> void stream_from::extract_value(
\n+
187 const std::string &line,
\n+
188 T& t,
\n+
189 std::string::size_type &here,
\n+
190 std::string &workspace
\n+
191) const
\n+
192{
\n+
193 if (extract_field(line, here, workspace))
\n+
194 from_string<T>(workspace, t);
\n+
195 else
\n+
196 t = internal::null_value<T>();
\n+
197}
\n+
198
\n+
199template<> void stream_from::extract_value<std::nullptr_t>(
\n+
200 const std::string &line,
\n+
201 std::nullptr_t&,
\n+
202 std::string::size_type &here,
\n+
203 std::string &workspace
\n+
204) const;
\n+
205
\n+
206} // namespace pqxx
\n+
207
\n+
208
\n+
209#include "pqxx/compiler-internal-post.hxx"
\n+
210#endif
\n+
STL namespace.
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype(callback())
Simple way to execute a transaction with automatic retry.
Definition: transactor.hxx:99
\n-
void perform(const TRANSACTOR &T, int Attempts)
Definition: transactor.hxx:225
\n-
Exception class for lost or failed backend connection.
Definition: except.hxx:119
\n-
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:160
\n-
The backend saw itself forced to roll back the ongoing transaction.
Definition: except.hxx:168
\n-
We can't tell whether our last statement succeeded.
Definition: except.hxx:192
\n-
Internal error in libpqxx library.
Definition: except.hxx:209
\n-
Definition: transactor.hxx:157
\n-
void on_doubt() noexcept
Overridable function to be called when "in doubt" about outcome.
Definition: transactor.hxx:214
\n-
transactor(const std::string &TName="transactor")
Definition: transactor.hxx:160
\n-
void on_commit()
Optional overridable function to be called after successful commit.
Definition: transactor.hxx:200
\n-
void operator()(TRANSACTION &T)
Overridable transaction definition; insert your database code here.
\n-
void on_abort(const char[]) noexcept
Optional overridable function to be called if transaction is aborted.
Definition: transactor.hxx:193
\n-
TRANSACTION argument_type
Definition: transactor.hxx:159
\n-
std::string name() const
The transactor's name.
Definition: transactor.hxx:217
\n+
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:220
\n+
Definition: stream_base.hxx:29
\n+
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
\n+
Efficiently pull data directly out of a table.
Definition: stream_from.hxx:30
\n+
stream_from & operator>>(Tuple &)
Definition: stream_from.hxx:130
\n+
stream_from(transaction_base &, const std::string &table_name)
Definition: stream_from.cxx:41
\n+
bool get_raw_line(std::string &)
Definition: stream_from.cxx:72
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,222 +1,238 @@\n \n \n \n \n \n libpqxx\n \n-transactor.hxx\n- 1/* Transactor framework, a wrapper for safely retryable transactions.\n- 2 *\n- 3 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transactor instead.\n- 4 *\n- 5 * Copyright (c) 2000-2019, Jeroen T. Vermeulen.\n- 6 *\n- 7 * See COPYING for copyright license. If you did not receive a file called\n- 8 * COPYING with this source code, please notify the distributor of this\n-mistake,\n- 9 * or contact the author.\n- 10 */\n- 11#ifndef PQXX_H_TRANSACTOR\n- 12#define PQXX_H_TRANSACTOR\n- 13\n- 14#include \"pqxx/compiler-public.hxx\"\n- 15#include \"pqxx/compiler-internal-pre.hxx\"\n- 16\n- 17#include \"pqxx/connection_base.hxx\"\n- 18#include \"pqxx/transaction.hxx\"\n- 19\n- 20\n- 21// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n- 22\n- 23namespace pqxx\n- 24{\n- 67\n- 69\n- 98template\n-99inline auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3)\n- 100 -> decltype(callback())\n- 101{\n- 102 if (attempts <= 0)\n- 103 throw std::invalid_argument{\n- 104 \"Zero or negative number of attempts passed to pqxx::perform().\"};\n- 105\n- 106 for (; attempts > 0; --attempts)\n- 107 {\n- 108 try\n- 109 {\n- 110 return callback();\n- 111 }\n- 112 catch (const in_doubt_error &)\n- 113 {\n- 114 // Not sure whether transaction went through or not. The last thing in\n- 115 // the world that we should do now is try again!\n- 116 throw;\n- 117 }\n- 118 catch (const statement_completion_unknown &)\n- 119 {\n- 120 // Not sure whether our last statement succeeded. Don't risk running it\n- 121 // again.\n- 122 throw;\n- 123 }\n- 124 catch (const broken_connection &)\n- 125 {\n- 126 // Connection failed. Definitely worth retrying.\n- 127 if (attempts <= 1) throw;\n- 128 continue;\n- 129 }\n- 130 catch (const transaction_rollback &)\n- 131 {\n- 132 // Some error that may well be transient, such as serialization failure\n- 133 // or deadlock. Worth retrying.\n- 134 if (attempts <= 1) throw;\n- 135 continue;\n- 136 }\n- 137 }\n- 138 throw pqxx::internal_error{\"No outcome reached on perform().\"};\n- 139}\n- 140\n- 142\n-156template> class transactor\n- 157{\n- 158public:\n-159 using argument_type = TRANSACTION;\n-160 PQXX_DEPRECATED explicit transactor( //[t04]\n- 161 const std::string &TName=\"transactor\") :\n- 162 m_name{TName} { }\n+stream_from.hxx\n+ 1\n+ 13#ifndef PQXX_H_STREAM_FROM\n+ 14#define PQXX_H_STREAM_FROM\n+ 15\n+ 16#include \"pqxx/compiler-public.hxx\"\n+ 17#include \"pqxx/compiler-internal-pre.hxx\"\n+ 18#include \"pqxx/transaction_base.hxx\"\n+ 19#include \"pqxx/stream_base.hxx\"\n+ 20#include \"pqxx/internal/type_utils.hxx\"\n+ 21\n+ 22#include \n+ 23\n+ 24\n+ 25namespace pqxx\n+ 26{\n+ 27\n+29class PQXX_LIBEXPORT stream_from : public stream_base\n+ 30{\n+ 31public:\n+ 32 stream_from(\n+ 33 transaction_base &,\n+ 34 const std::string &table_name\n+ 35 );\n+ 36 template stream_from(\n+ 37 transaction_base &,\n+ 38 const std::string &table_name,\n+ 39 const Columns& columns\n+ 40 );\n+ 41 template stream_from(\n+ 42 transaction_base &,\n+ 43 const std::string &table_name,\n+ 44 Iter columns_begin,\n+ 45 Iter columns_end\n+ 46 );\n+ 47\n+ 48 ~stream_from() noexcept;\n+ 49\n+ 50 void complete() override;\n+ 51\n+ 52 bool get_raw_line(std::string &);\n+ 53 template stream_from & operator>>(Tuple &);\n+ 54\n+ 55private:\n+ 56 internal::encoding_group m_copy_encoding;\n+ 57 std::string m_current_line;\n+ 58 bool m_retry_line;\n+ 59\n+ 60 void set_up(transaction_base &, const std::string &table_name);\n+ 61 void set_up(\n+ 62 transaction_base &,\n+ 63 const std::string &table_name,\n+ 64 const std::string &columns\n+ 65 );\n+ 66\n+ 67 void close() override;\n+ 68\n+ 69 bool extract_field(\n+ 70 const std::string &,\n+ 71 std::string::size_type &,\n+ 72 std::string &\n+ 73 ) const;\n+ 74\n+ 75 template auto tokenize_ith(\n+ 76 const std::string &,\n+ 77 Tuple &,\n+ 78 std::string::size_type,\n+ 79 std::string &\n+ 80 ) const -> typename std::enable_if<(\n+ 81 std::tuple_size::value > I\n+ 82 )>::type;\n+ 83 template auto tokenize_ith(\n+ 84 const std::string &,\n+ 85 Tuple &,\n+ 86 std::string::size_type,\n+ 87 std::string &\n+ 88 ) const -> typename std::enable_if<(\n+ 89 std::tuple_size::value <= I\n+ 90 )>::type;\n+ 91\n+ 92 template void extract_value(\n+ 93 const std::string &line,\n+ 94 T& t,\n+ 95 std::string::size_type &here,\n+ 96 std::string &workspace\n+ 97 ) const;\n+ 98};\n+ 99\n+ 100\n+101template stream_from::stream_from(\n+ 102 transaction_base &tb,\n+ 103 const std::string &table_name,\n+ 104 const Columns& columns\n+ 105) : stream_from{\n+ 106 tb,\n+ 107 table_name,\n+ 108 std::begin(columns),\n+ 109 std::end(columns)\n+ 110} {}\n+ 111\n+ 112\n+113template stream_from::stream_from(\n+ 114 transaction_base &tb,\n+ 115 const std::string &table_name,\n+ 116 Iter columns_begin,\n+ 117 Iter columns_end\n+ 118) :\n+ 119 namedclass{\"stream_from\", table_name},\n+ 120 stream_base{tb}\n+ 121{\n+ 122 set_up(\n+ 123 tb,\n+ 124 table_name,\n+ 125 columnlist(columns_begin, columns_end)\n+ 126 );\n+ 127}\n+ 128\n+ 129\n+130template stream_from & stream_from::operator>>(\n+ 131 Tuple &t\n+ 132)\n+ 133{\n+ 134 if (m_retry_line or get_raw_line(m_current_line))\n+ 135 {\n+ 136 std::string workspace;\n+ 137 try\n+ 138 {\n+ 139 tokenize_ith(m_current_line, t, 0, workspace);\n+ 140 m_retry_line = false;\n+ 141 }\n+ 142 catch (...)\n+ 143 {\n+ 144 m_retry_line = true;\n+ 145 throw;\n+ 146 }\n+ 147 }\n+ 148 return *this;\n+ 149}\n+ 150\n+ 151\n+ 152template auto stream_from::tokenize_ith(\n+ 153 const std::string &line,\n+ 154 Tuple &t,\n+ 155 std::string::size_type here,\n+ 156 std::string &workspace\n+ 157) const -> typename std::enable_if<(\n+ 158 std::tuple_size::value > I\n+ 159)>::type\n+ 160{\n+ 161 if (here >= line.size())\n+ 162 throw usage_error{\"Too few fields to extract from stream_from line.\"};\n 163\n- 165\n-176 void operator()(TRANSACTION &T); //[t04]\n- 177\n- 178 // Overridable member functions, called by connection_base::perform() if\n-an\n- 179 // attempt to run transaction fails/succeeds, respectively, or if the\n- 180 // connection is lost at just the wrong moment, goes into an indeterminate\n- 181 // state. Use these to patch up runtime state to match events, if needed,\n-or\n- 182 // to report failure conditions.\n- 183\n+ 164 extract_value(line, std::get(t), here, workspace);\n+ 165 tokenize_ith(line, t, here, workspace);\n+ 166}\n+ 167\n+ 168\n+ 169template auto stream_from::tokenize_ith(\n+ 170 const std::string &line,\n+ 171 Tuple & /* t */,\n+ 172 std::string::size_type here,\n+ 173 std::string & /* workspace */\n+ 174) const -> typename std::enable_if<(\n+ 175 std::tuple_size::value <= I\n+ 176)>::type\n+ 177{\n+ 178 // Zero-column line may still have a trailing newline\n+ 179 if (\n+ 180 here < line.size() and\n+ 181 not (here == line.size() - 1 and line[here] == '\\n'))\n+ 182 throw usage_error{\"Not all fields extracted from stream_from line\"};\n+ 183}\n+ 184\n 185\n-193 void on_abort(const char[]) noexcept {} //[t13]\n- 194\n- 196\n-200 void on_commit() {} //[t07]\n- 201\n- 203\n-214 void on_doubt() noexcept {} //[t13]\n- 215\n-217 std::string name() const { return m_name; } //[t13]\n- 218\n- 219private:\n- 220 std::string m_name;\n- 221};\n- 222\n- 223\n- 224template\n-225inline void connection_base::perform(\n- 226 const TRANSACTOR &T,\n- 227 int Attempts)\n- 228{\n- 229 if (Attempts <= 0) return;\n- 230\n- 231 bool Done = false;\n- 232\n- 233 // Make attempts to perform T\n- 234 do\n- 235 {\n- 236 --Attempts;\n- 237\n- 238 // Work on a copy of T2 so we can restore the starting situation if need\n-be\n- 239 TRANSACTOR T2{T};\n- 240 try\n- 241 {\n- 242 typename TRANSACTOR::argument_type X{*this, T2.name()};\n- 243 T2(X);\n- 244 X.commit();\n- 245 Done = true;\n- 246 }\n- 247 catch (const in_doubt_error &)\n- 248 {\n- 249 // Not sure whether transaction went through or not. The last thing in\n- 250 // the world that we should do now is retry.\n- 251 T2.on_doubt();\n- 252 throw;\n- 253 }\n- 254 catch (const std::exception &e)\n- 255 {\n- 256 // Could be any kind of error.\n- 257 T2.on_abort(e.what());\n- 258 if (Attempts <= 0) throw;\n- 259 continue;\n- 260 }\n- 261 catch (...)\n- 262 {\n- 263 // Don't try to forge ahead if we don't even know what happened\n- 264 T2.on_abort(\"Unknown exception\");\n- 265 throw;\n- 266 }\n- 267\n- 268 T2.on_commit();\n- 269 } while (not Done);\n- 270}\n- 271} // namespace pqxx\n- 273#include \"pqxx/compiler-internal-post.hxx\"\n- 274#endif\n+ 186template void stream_from::extract_value(\n+ 187 const std::string &line,\n+ 188 T& t,\n+ 189 std::string::size_type &here,\n+ 190 std::string &workspace\n+ 191) const\n+ 192{\n+ 193 if (extract_field(line, here, workspace))\n+ 194 from_string(workspace, t);\n+ 195 else\n+ 196 t = internal::null_value();\n+ 197}\n+ 198\n+199template<> void stream_from::extract_value(\n+ 200 const std::string &line,\n+ 201 std::nullptr_t&,\n+ 202 std::string::size_type &here,\n+ 203 std::string &workspace\n+ 204) const;\n+ 205\n+ 206} // namespace pqxx\n+ 207\n+ 208\n+ 209#include \"pqxx/compiler-internal-post.hxx\"\n+ 210#endif\n+std\n+STL namespace.\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::perform\n-auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype\n-(callback())\n-Simple way to execute a transaction with automatic retry.\n-Definition: transactor.hxx:99\n-pqxx::connection_base::perform\n-void perform(const TRANSACTOR &T, int Attempts)\n-Definition: transactor.hxx:225\n-pqxx::broken_connection\n-Exception class for lost or failed backend connection.\n-Definition: except.hxx:119\n-pqxx::in_doubt_error\n-\"Help, I don't know whether transaction was committed successfully!\"\n-Definition: except.hxx:160\n-pqxx::transaction_rollback\n-The backend saw itself forced to roll back the ongoing transaction.\n-Definition: except.hxx:168\n-pqxx::statement_completion_unknown\n-We can't tell whether our last statement succeeded.\n-Definition: except.hxx:192\n-pqxx::internal_error\n-Internal error in libpqxx library.\n-Definition: except.hxx:209\n-pqxx::transactor\n-Definition: transactor.hxx:157\n-pqxx::transactor::on_doubt\n-void on_doubt() noexcept\n-Overridable function to be called when \"in doubt\" about outcome.\n-Definition: transactor.hxx:214\n-pqxx::transactor::transactor\n-transactor(const std::string &TName=\"transactor\")\n-Definition: transactor.hxx:160\n-pqxx::transactor::on_commit\n-void on_commit()\n-Optional overridable function to be called after successful commit.\n-Definition: transactor.hxx:200\n-pqxx::transactor::operator()\n-void operator()(TRANSACTION &T)\n-Overridable transaction definition; insert your database code here.\n-pqxx::transactor::on_abort\n-void on_abort(const char[]) noexcept\n-Optional overridable function to be called if transaction is aborted.\n-Definition: transactor.hxx:193\n-pqxx::transactor::argument_type\n-TRANSACTION argument_type\n-Definition: transactor.hxx:159\n-pqxx::transactor::name\n-std::string name() const\n-The transactor's name.\n-Definition: transactor.hxx:217\n+pqxx::usage_error\n+Error in usage of libpqxx library, similar to std::logic_error.\n+Definition: except.hxx:220\n+pqxx::stream_base\n+Definition: stream_base.hxx:29\n+pqxx::stream_base::columnlist\n+static std::string columnlist(const C &)\n+Definition: stream_base.hxx:48\n+pqxx::stream_from\n+Efficiently pull data directly out of a table.\n+Definition: stream_from.hxx:30\n+pqxx::stream_from::operator>>\n+stream_from & operator>>(Tuple &)\n+Definition: stream_from.hxx:130\n+pqxx::stream_from::stream_from\n+stream_from(transaction_base &, const std::string &table_name)\n+Definition: stream_from.cxx:41\n+pqxx::stream_from::get_raw_line\n+bool get_raw_line(std::string &)\n+Definition: stream_from.cxx:72\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * transactor.hxx\n+ * stream_from.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00095_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00095_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: tablewriter.hxx Source File\n+libpqxx: prepared_statement.hxx Source File\n \n \n \n \n \n \n \n@@ -55,245 +55,138 @@\n \n
\n
\n-
tablewriter.hxx
\n+
prepared_statement.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_TABLEWRITER
\n-
14#define PQXX_H_TABLEWRITER
\n-
15
\n-
16#include <iterator>
\n-
17
\n-
18#include "pqxx/compiler-public.hxx"
\n-
19#include "pqxx/compiler-internal-pre.hxx"
\n+
11#ifndef PQXX_H_PREPARED_STATEMENT
\n+
12#define PQXX_H_PREPARED_STATEMENT
\n+
13
\n+
14#include "pqxx/compiler-public.hxx"
\n+
15#include "pqxx/compiler-internal-pre.hxx"
\n+
16
\n+
17#include "pqxx/types.hxx"
\n+
18#include "pqxx/internal/statement_parameters.hxx"
\n+
19
\n
20
\n-
21#include "pqxx/tablestream.hxx"
\n-
22
\n-
23
\n-
24namespace pqxx
\n-
25{
\n-
27
\n-
31class PQXX_LIBEXPORT tablewriter : public tablestream
\n-
32{
\n-
33public:
\n-
34 PQXX_DEPRECATED tablewriter(
\n-\n-
36 const std::string &WName,
\n-
37 const std::string &Null=std::string{});
\n-
38 template<typename ITER>
\n-
39 PQXX_DEPRECATED tablewriter(
\n-\n-
41 const std::string &WName,
\n-
42 ITER begincolumns,
\n-
43 ITER endcolumns);
\n-
44 template<typename ITER>
\n-
45 PQXX_DEPRECATED tablewriter(
\n-\n-
47 const std::string &WName,
\n-
48 ITER begincolumns,
\n-
49 ITER endcolumns,
\n-
50 const std::string &Null);
\n-
51 ~tablewriter() noexcept;
\n-
52 template<typename IT> void insert(IT Begin, IT End);
\n-
53 template<typename TUPLE> void insert(const TUPLE &);
\n-
54 template<typename IT> void push_back(IT Begin, IT End);
\n-
55 template<typename TUPLE> void push_back(const TUPLE &);
\n-
56 template<typename SIZE> void reserve(SIZE) {}
\n-
57 template<typename TUPLE> tablewriter &operator<<(const TUPLE &);
\n-\n-
59 template<typename IT> std::string generate(IT Begin, IT End) const;
\n-
60 template<typename TUPLE> std::string generate(const TUPLE &) const;
\n-
61 virtual void complete() override;
\n-
62 void write_raw_line(const std::string &);
\n-
63private:
\n-
64 void set_up(
\n-\n-
66 const std::string &WName,
\n-
67 const std::string &Columns = std::string{});
\n-
68 PQXX_PRIVATE void writer_close();
\n-
69};
\n-
70} // namespace pqxx
\n-
71
\n-
72
\n-
73namespace std
\n-
74{
\n-
75template<>
\n-
76 class back_insert_iterator<pqxx::tablewriter>
\n+
21
\n+
22namespace pqxx
\n+
23{
\n+
25namespace prepare
\n+
26{
\n+
28
\n+
43template<typename IT> inline pqxx::internal::dynamic_params<IT>
\n+
44make_dynamic_params(IT begin, IT end)
\n+
45{
\n+
46 return pqxx::internal::dynamic_params<IT>(begin, end);
\n+
47}
\n+
48
\n+
49
\n+
51
\n+
65template<typename C>
\n+
66inline pqxx::internal::dynamic_params<typename C::const_iterator>
\n+
67make_dynamic_params(const C &container)
\n+
68{
\n+
69 return pqxx::internal::dynamic_params<typename C::const_iterator>(container);
\n+
70}
\n+
71} // namespace prepare
\n+
72} // namespace pqxx
\n+
73
\n+
74namespace pqxx
\n+
75{
\n+
76namespace prepare
\n
77{
\n-
78public:
\n-
79 using iterator_category = output_iterator_tag;
\n-
80
\n-\n-
82 m_writer{&W} {}
\n-
83
\n-
84 back_insert_iterator &
\n-
85 operator=(const back_insert_iterator &rhs) noexcept
\n-
86 {
\n-
87 m_writer = rhs.m_writer;
\n-
88 return *this;
\n-
89 }
\n-
90
\n-
91 template<typename TUPLE>
\n-
92 back_insert_iterator &operator=(const TUPLE &T)
\n-
93 {
\n-
94 m_writer->insert(T);
\n-
95 return *this;
\n-
96 }
\n+
79
\n+
81class PQXX_LIBEXPORT invocation : internal::statement_parameters
\n+
82{
\n+
83public:
\n+
84 PQXX_DEPRECATED invocation(transaction_base &, const std::string &statement);
\n+
85 invocation &operator=(const invocation &) =delete;
\n+
86
\n+
88 result exec() const;
\n+
89
\n+
91 bool exists() const;
\n+
92
\n+
94 invocation &operator()() { add_param(); return *this; }
\n+
95
\n
97
\n-
98 back_insert_iterator &operator++() { return *this; }
\n-
99 back_insert_iterator &operator++(int) { return *this; }
\n-
100 back_insert_iterator &operator*() { return *this; }
\n-
101
\n-
102private:
\n-
103 pqxx::tablewriter *m_writer;
\n-
104};
\n-
105} // namespace std
\n-
106
\n-
107
\n-
108namespace pqxx
\n-
109{
\n-
110template<typename ITER> inline tablewriter::tablewriter(
\n-\n-
112 const std::string &WName,
\n-
113 ITER begincolumns,
\n-
114 ITER endcolumns) :
\n-
115 namedclass{"tablewriter", WName},
\n-
116 tablestream{T, std::string{}}
\n-
117{
\n-
118 set_up(T, WName, columnlist(begincolumns, endcolumns));
\n-
119}
\n-
120
\n-
121
\n-
122template<typename ITER> inline tablewriter::tablewriter(
\n-\n-
124 const std::string &WName,
\n-
125 ITER begincolumns,
\n-
126 ITER endcolumns,
\n-
127 const std::string &Null) :
\n-
128 namedclass{"tablewriter", WName},
\n-
129 tablestream{T, Null}
\n-
130{
\n-
131 set_up(T, WName, columnlist(begincolumns, endcolumns));
\n-
132}
\n-
133
\n-
134
\n-
135namespace internal
\n-
136{
\n-
137PQXX_LIBEXPORT std::string escape(
\n-
138 const std::string &s,
\n-
139 const std::string &null);
\n-
140
\n-
141inline std::string escape_any(
\n-
142 const std::string &s,
\n-
143 const std::string &null)
\n-
144{ return escape(s, null); }
\n-
145
\n-
146inline std::string escape_any(
\n-
147 const char s[],
\n-
148 const std::string &null)
\n-
149{ return s ? escape(std::string{s}, null) : "\\\\N"; }
\n-
150
\n-
151template<typename T> inline std::string escape_any(
\n-
152 const T &t,
\n-
153 const std::string &null)
\n-
154{ return escape(to_string(t), null); }
\n-
155
\n-
156
\n-
157template<typename IT> class Escaper
\n-
158{
\n-
159 const std::string &m_null;
\n-
160public:
\n-
161 explicit Escaper(const std::string &null) : m_null{null} {}
\n-
162 std::string operator()(IT i) const { return escape_any(*i, m_null); }
\n-
163};
\n-
164}
\n-
165
\n+
100 template<typename T> invocation &operator()(const T &v)
\n+
101 { add_param(v, true); return *this; }
\n+
102
\n+
104
\n+\n+
108 { add_binary_param(v, true); return *this; }
\n+
109
\n+
111
\n+
115 template<typename T> invocation &operator()(const T &v, bool nonnull)
\n+
116 { add_param(v, nonnull); return *this; }
\n+
117
\n+
119
\n+
123 invocation &operator()(const binarystring &v, bool nonnull)
\n+
124 { add_binary_param(v, nonnull); return *this; }
\n+
125
\n+
127
\n+
134 template<typename T> invocation &operator()(T *v, bool nonnull=true)
\n+
135 { add_param(v, nonnull); return *this; }
\n+
136
\n+
138
\n+
142 invocation &operator()(const char *v, bool nonnull=true)
\n+
143 { add_param(v, nonnull); return *this; }
\n+
144
\n+
145private:
\n+
146 transaction_base &m_home;
\n+
147 const std::string m_statement;
\n+
148
\n+
149 invocation &setparam(const std::string &, bool nonnull);
\n+
150};
\n+
151
\n+
152
\n+
153namespace internal
\n+
154{
\n+
156struct PQXX_LIBEXPORT prepared_def
\n+
157{
\n+
159 std::string definition;
\n+
161 bool registered = false;
\n+
162
\n+
163 prepared_def() =default;
\n+
164 explicit prepared_def(const std::string &);
\n+
165};
\n
166
\n-
167template<typename IT>
\n-
168inline std::string tablewriter::generate(IT Begin, IT End) const
\n-
169{
\n-
170 return separated_list("\\t", Begin, End, internal::Escaper<IT>{NullStr()});
\n-
171}
\n-
172template<typename TUPLE>
\n-
173inline std::string tablewriter::generate(const TUPLE &T) const
\n-
174{
\n-
175 return generate(std::begin(T), std::end(T));
\n-
176}
\n-
177
\n-
178template<typename IT> inline void tablewriter::insert(IT Begin, IT End)
\n-
179{
\n-
180 write_raw_line(generate(Begin, End));
\n-
181}
\n-
182
\n-
183template<typename TUPLE> inline void tablewriter::insert(const TUPLE &T)
\n-
184{
\n-
185 insert(std::begin(T), std::end(T));
\n-
186}
\n-
187
\n-
188template<typename IT>
\n-
189inline void tablewriter::push_back(IT Begin, IT End)
\n-
190{
\n-
191 insert(Begin, End);
\n-
192}
\n-
193
\n-
194template<typename TUPLE>
\n-
195inline void tablewriter::push_back(const TUPLE &T)
\n-
196{
\n-
197 insert(std::begin(T), std::end(T));
\n-
198}
\n-
199
\n-
200template<typename TUPLE>
\n-\n-
202{
\n-
203 insert(T);
\n-
204 return *this;
\n-
205}
\n-
206
\n-
207} // namespace pqxx
\n-
208#include "pqxx/compiler-internal-post.hxx"
\n-
209#endif
\n-
STL namespace.
\n+
167} // namespace pqxx::prepare::internal
\n+
168} // namespace pqxx::prepare
\n+
169} // namespace pqxx
\n+
170
\n+
171#include "pqxx/compiler-internal-post.hxx"
\n+
172#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const field &F)
Write a result field to any type of stream.
Definition: field.hxx:355
\n-
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
\n-
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: util.hxx:95
\n-
std::string escape(const std::string &s, const std::string &null)
Definition: tablewriter.cxx:131
\n-
std::string escape_any(const std::string &s, const std::string &null)
Definition: tablewriter.hxx:141
\n-
Definition: tablereader.hxx:30
\n-
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
\n-
const std::string & NullStr() const
Definition: tablestream.hxx:36
\n-
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
\n-
Definition: tablewriter.hxx:32
\n-
tablewriter(transaction_base &, const std::string &WName, const std::string &Null=std::string{})
Definition: tablewriter.cxx:22
\n-
void reserve(SIZE)
Definition: tablewriter.hxx:56
\n-
void insert(IT Begin, IT End)
Definition: tablewriter.hxx:178
\n-
std::string generate(IT Begin, IT End) const
Definition: tablewriter.hxx:168
\n-
void push_back(IT Begin, IT End)
Definition: tablewriter.hxx:189
\n-
tablewriter & operator<<(const TUPLE &)
Definition: tablewriter.hxx:201
\n-
void write_raw_line(const std::string &)
Definition: tablewriter.cxx:65
\n-
back_insert_iterator & operator*()
Definition: tablewriter.hxx:100
\n-
back_insert_iterator(pqxx::tablewriter &W) noexcept
Definition: tablewriter.hxx:81
\n-
back_insert_iterator & operator=(const back_insert_iterator &rhs) noexcept
Definition: tablewriter.hxx:85
\n-
back_insert_iterator & operator=(const TUPLE &T)
Definition: tablewriter.hxx:92
\n-
back_insert_iterator & operator++()
Definition: tablewriter.hxx:98
\n-
back_insert_iterator & operator++(int)
Definition: tablewriter.hxx:99
\n-
output_iterator_tag iterator_category
Definition: tablewriter.hxx:79
\n-
Definition: tablewriter.hxx:158
\n-
std::string operator()(IT i) const
Definition: tablewriter.hxx:162
\n-
Escaper(const std::string &null)
Definition: tablewriter.hxx:161
\n+
pqxx::internal::dynamic_params< IT > make_dynamic_params(IT begin, IT end)
Pass a number of statement parameters only known at runtime.
Definition: prepared_statement.hxx:44
\n+
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
\n+
Helper class for passing parameters to, and executing, prepared statements.
Definition: prepared_statement.hxx:82
\n+
invocation & operator()(const binarystring &v, bool nonnull)
Pass binary parameter value for a BYTEA field.
Definition: prepared_statement.hxx:123
\n+
invocation & operator()(const binarystring &v)
Pass binary parameter value for a BYTEA field.
Definition: prepared_statement.hxx:107
\n+
invocation & operator()(T *v, bool nonnull=true)
Pass C-style parameter string, or null if pointer is null.
Definition: prepared_statement.hxx:134
\n+
invocation & operator=(const invocation &)=delete
\n+
invocation & operator()(const char *v, bool nonnull=true)
Pass C-style string parameter, or null if pointer is null.
Definition: prepared_statement.hxx:142
\n+
invocation & operator()()
Pass null parameter.
Definition: prepared_statement.hxx:94
\n+
invocation & operator()(const T &v, bool nonnull)
Pass parameter value.
Definition: prepared_statement.hxx:115
\n+
invocation & operator()(const T &v)
Pass parameter value.
Definition: prepared_statement.hxx:100
\n+
Internal representation of a prepared statement definition.
Definition: prepared_statement.hxx:157
\n+\n+
std::string definition
Text of prepared query.
Definition: prepared_statement.hxx:159
\n+
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,298 +1,172 @@\n \n \n \n \n \n libpqxx\n \n-tablewriter.hxx\n+prepared_statement.hxx\n 1\n- 13#ifndef PQXX_H_TABLEWRITER\n- 14#define PQXX_H_TABLEWRITER\n- 15\n- 16#include \n- 17\n- 18#include \"pqxx/compiler-public.hxx\"\n- 19#include \"pqxx/compiler-internal-pre.hxx\"\n+ 11#ifndef PQXX_H_PREPARED_STATEMENT\n+ 12#define PQXX_H_PREPARED_STATEMENT\n+ 13\n+ 14#include \"pqxx/compiler-public.hxx\"\n+ 15#include \"pqxx/compiler-internal-pre.hxx\"\n+ 16\n+ 17#include \"pqxx/types.hxx\"\n+ 18#include \"pqxx/internal/statement_parameters.hxx\"\n+ 19\n 20\n- 21#include \"pqxx/tablestream.hxx\"\n- 22\n- 23\n- 24namespace pqxx\n- 25{\n- 27\n-31class PQXX_LIBEXPORT tablewriter : public tablestream\n- 32{\n- 33public:\n- 34 PQXX_DEPRECATED tablewriter(\n- 35 transaction_base &,\n- 36 const std::string &WName,\n- 37 const std::string &Null=std::string{});\n- 38 template\n- 39 PQXX_DEPRECATED tablewriter(\n- 40 transaction_base &,\n- 41 const std::string &WName,\n- 42 ITER begincolumns,\n- 43 ITER endcolumns);\n- 44 template\n- 45 PQXX_DEPRECATED tablewriter(\n- 46 transaction_base &T,\n- 47 const std::string &WName,\n- 48 ITER begincolumns,\n- 49 ITER endcolumns,\n- 50 const std::string &Null);\n- 51 ~tablewriter() noexcept;\n- 52 template void insert(IT Begin, IT End);\n- 53 template void insert(const TUPLE &);\n- 54 template void push_back(IT Begin, IT End);\n- 55 template void push_back(const TUPLE &);\n-56 template void reserve(SIZE) {}\n- 57 template tablewriter &operator<<(const TUPLE &);\n- 58 tablewriter &operator<<(tablereader &);\n- 59 template std::string generate(IT Begin, IT End) const;\n- 60 template std::string generate(const TUPLE &) const;\n- 61 virtual void complete() override;\n- 62 void write_raw_line(const std::string &);\n- 63private:\n- 64 void set_up(\n- 65 transaction_base &,\n- 66 const std::string &WName,\n- 67 const std::string &Columns = std::string{});\n- 68 PQXX_PRIVATE void writer_close();\n- 69};\n- 70} // namespace pqxx\n- 71\n- 72\n- 73namespace std\n- 74{\n- 75template<>\n-76 class back_insert_iterator\n+ 21\n+ 22namespace pqxx\n+ 23{\n+25namespace prepare\n+ 26{\n+ 28\n+ 43template inline pqxx::internal::dynamic_params\n+44make_dynamic_params(IT begin, IT end)\n+ 45{\n+ 46 return pqxx::internal::dynamic_params(begin, end);\n+ 47}\n+ 48\n+ 49\n+ 51\n+ 65template\n+ 66inline pqxx::internal::dynamic_params\n+67make_dynamic_params(const C &container)\n+ 68{\n+ 69 return pqxx::internal::dynamic_params\n+(container);\n+ 70}\n+ 71} // namespace prepare\n+ 72} // namespace pqxx\n+ 73\n+ 74namespace pqxx\n+ 75{\n+ 76namespace prepare\n 77{\n- 78public:\n-79 using iterator_category = output_iterator_tag;\n- 80\n-81 explicit back_insert_iterator(pqxx::tablewriter &W) noexcept :\n- 82 m_writer{&W} {}\n- 83\n- 84 back_insert_iterator &\n-85 operator=(const back_insert_iterator &rhs) noexcept\n- 86 {\n- 87 m_writer = rhs.m_writer;\n- 88 return *this;\n- 89 }\n- 90\n- 91 template\n-92 back_insert_iterator &operator=(const TUPLE &T)\n- 93 {\n- 94 m_writer->insert(T);\n- 95 return *this;\n- 96 }\n+ 79\n+81class PQXX_LIBEXPORT invocation : internal::statement_parameters\n+ 82{\n+ 83public:\n+ 84 PQXX_DEPRECATED invocation(transaction_base &, const std::string\n+&statement);\n+85 invocation &operator=(const invocation &) =delete;\n+ 86\n+ 88 result exec() const;\n+ 89\n+ 91 bool exists() const;\n+ 92\n+94 invocation &operator()() { add_param(); return *this; }\n+ 95\n 97\n-98 back_insert_iterator &operator++() { return *this; }\n-99 back_insert_iterator &operator++(int) { return *this; }\n-100 back_insert_iterator &operator*() { return *this; }\n- 101\n- 102private:\n- 103 pqxx::tablewriter *m_writer;\n- 104};\n- 105} // namespace std\n- 106\n- 107\n- 108namespace pqxx\n- 109{\n-110template inline tablewriter::tablewriter(\n- 111 transaction_base &T,\n- 112 const std::string &WName,\n- 113 ITER begincolumns,\n- 114 ITER endcolumns) :\n- 115 namedclass{\"tablewriter\", WName},\n- 116 tablestream{T, std::string{}}\n- 117{\n- 118 set_up(T, WName, columnlist(begincolumns, endcolumns));\n- 119}\n- 120\n- 121\n-122template inline tablewriter::tablewriter(\n- 123 transaction_base &T,\n- 124 const std::string &WName,\n- 125 ITER begincolumns,\n- 126 ITER endcolumns,\n- 127 const std::string &Null) :\n- 128 namedclass{\"tablewriter\", WName},\n- 129 tablestream{T, Null}\n- 130{\n- 131 set_up(T, WName, columnlist(begincolumns, endcolumns));\n- 132}\n- 133\n- 134\n- 135namespace internal\n- 136{\n- 137PQXX_LIBEXPORT std::string escape(\n- 138 const std::string &s,\n- 139 const std::string &null);\n- 140\n-141inline std::string escape_any(\n- 142 const std::string &s,\n- 143 const std::string &null)\n- 144{ return escape(s, null); }\n- 145\n-146inline std::string escape_any(\n- 147 const char s[],\n- 148 const std::string &null)\n- 149{ return s ? escape(std::string{s}, null) : \"\\\\N\"; }\n- 150\n-151template inline std::string escape_any(\n- 152 const T &t,\n- 153 const std::string &null)\n- 154{ return escape(to_string(t), null); }\n- 155\n- 156\n-157template class Escaper\n- 158{\n- 159 const std::string &m_null;\n- 160public:\n-161 explicit Escaper(const std::string &null) : m_null{null} {}\n-162 std::string operator()(IT i) const { return escape_any(*i, m_null); }\n- 163};\n- 164}\n- 165\n+100 template invocation &operator()(const T &v)\n+ 101 { add_param(v, true); return *this; }\n+ 102\n+ 104\n+107 invocation &operator()(const binarystring &v)\n+ 108 { add_binary_param(v, true); return *this; }\n+ 109\n+ 111\n+115 template invocation &operator()(const T &v, bool nonnull)\n+ 116 { add_param(v, nonnull); return *this; }\n+ 117\n+ 119\n+123 invocation &operator()(const binarystring &v, bool nonnull)\n+ 124 { add_binary_param(v, nonnull); return *this; }\n+ 125\n+ 127\n+134 template invocation &operator()(T *v, bool nonnull=true)\n+ 135 { add_param(v, nonnull); return *this; }\n+ 136\n+ 138\n+142 invocation &operator()(const char *v, bool nonnull=true)\n+ 143 { add_param(v, nonnull); return *this; }\n+ 144\n+ 145private:\n+ 146 transaction_base &m_home;\n+ 147 const std::string m_statement;\n+ 148\n+ 149 invocation &setparam(const std::string &, bool nonnull);\n+ 150};\n+ 151\n+ 152\n+153namespace internal\n+ 154{\n+156struct PQXX_LIBEXPORT prepared_def\n+ 157{\n+159 std::string definition;\n+161 bool registered = false;\n+ 162\n+163 prepared_def() =default;\n+ 164 explicit prepared_def(const std::string &);\n+ 165};\n 166\n- 167template\n-168inline std::string tablewriter::generate(IT Begin, IT End) const\n- 169{\n- 170 return separated_list(\"\\t\", Begin, End, internal::Escaper{NullStr()});\n- 171}\n- 172template\n-173inline std::string tablewriter::generate(const TUPLE &T) const\n- 174{\n- 175 return generate(std::begin(T), std::end(T));\n- 176}\n- 177\n-178template inline void tablewriter::insert(IT Begin, IT End)\n- 179{\n- 180 write_raw_line(generate(Begin, End));\n- 181}\n- 182\n-183template inline void tablewriter::insert(const TUPLE &T)\n- 184{\n- 185 insert(std::begin(T), std::end(T));\n- 186}\n- 187\n- 188template\n-189inline void tablewriter::push_back(IT Begin, IT End)\n- 190{\n- 191 insert(Begin, End);\n- 192}\n- 193\n- 194template\n-195inline void tablewriter::push_back(const TUPLE &T)\n- 196{\n- 197 insert(std::begin(T), std::end(T));\n- 198}\n- 199\n- 200template\n-201inline tablewriter &tablewriter::operator<<(const TUPLE &T)\n- 202{\n- 203 insert(T);\n- 204 return *this;\n- 205}\n- 206\n- 207} // namespace pqxx\n- 208#include \"pqxx/compiler-internal-post.hxx\"\n- 209#endif\n-std\n-STL namespace.\n+ 167} // namespace pqxx::prepare::internal\n+ 168} // namespace pqxx::prepare\n+ 169} // namespace pqxx\n+ 170\n+ 171#include \"pqxx/compiler-internal-post.hxx\"\n+ 172#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::operator<<\n-std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const\n-field &F)\n-Write a result field to any type of stream.\n-Definition: field.hxx:355\n-pqxx::to_string\n-std::string to_string(const field &Obj)\n-Convert a field to a string.\n-Definition: result.cxx:451\n-pqxx::separated_list\n-std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS\n-access)\n-Represent sequence of values as a string, joined by a given separator.\n-Definition: util.hxx:95\n-pqxx::internal::escape\n-std::string escape(const std::string &s, const std::string &null)\n-Definition: tablewriter.cxx:131\n-pqxx::internal::escape_any\n-std::string escape_any(const std::string &s, const std::string &null)\n-Definition: tablewriter.hxx:141\n-pqxx::tablereader\n-Definition: tablereader.hxx:30\n-pqxx::tablestream\n-Base class for obsolete tablereader/tablewriter classes.\n-Definition: tablestream.hxx:28\n-pqxx::tablestream::NullStr\n-const std::string & NullStr() const\n-Definition: tablestream.hxx:36\n-pqxx::tablestream::columnlist\n-static std::string columnlist(ITER colbegin, ITER colend)\n-Definition: tablestream.hxx:52\n-pqxx::tablewriter\n-Definition: tablewriter.hxx:32\n-pqxx::tablewriter::tablewriter\n-tablewriter(transaction_base &, const std::string &WName, const std::string\n-&Null=std::string{})\n-Definition: tablewriter.cxx:22\n-pqxx::tablewriter::reserve\n-void reserve(SIZE)\n-Definition: tablewriter.hxx:56\n-pqxx::tablewriter::insert\n-void insert(IT Begin, IT End)\n-Definition: tablewriter.hxx:178\n-pqxx::tablewriter::generate\n-std::string generate(IT Begin, IT End) const\n-Definition: tablewriter.hxx:168\n-pqxx::tablewriter::push_back\n-void push_back(IT Begin, IT End)\n-Definition: tablewriter.hxx:189\n-pqxx::tablewriter::operator<<\n-tablewriter & operator<<(const TUPLE &)\n-Definition: tablewriter.hxx:201\n-pqxx::tablewriter::write_raw_line\n-void write_raw_line(const std::string &)\n-Definition: tablewriter.cxx:65\n-std::back_insert_iterator<_pqxx::tablewriter_>::operator*\n-back_insert_iterator & operator*()\n-Definition: tablewriter.hxx:100\n-std::back_insert_iterator<_pqxx::tablewriter_>::back_insert_iterator\n-back_insert_iterator(pqxx::tablewriter &W) noexcept\n-Definition: tablewriter.hxx:81\n-std::back_insert_iterator<_pqxx::tablewriter_>::operator=\n-back_insert_iterator & operator=(const back_insert_iterator &rhs) noexcept\n-Definition: tablewriter.hxx:85\n-std::back_insert_iterator<_pqxx::tablewriter_>::operator=\n-back_insert_iterator & operator=(const TUPLE &T)\n-Definition: tablewriter.hxx:92\n-std::back_insert_iterator<_pqxx::tablewriter_>::operator++\n-back_insert_iterator & operator++()\n-Definition: tablewriter.hxx:98\n-std::back_insert_iterator<_pqxx::tablewriter_>::operator++\n-back_insert_iterator & operator++(int)\n-Definition: tablewriter.hxx:99\n-std::back_insert_iterator<_pqxx::tablewriter_>::iterator_category\n-output_iterator_tag iterator_category\n-Definition: tablewriter.hxx:79\n-pqxx::internal::Escaper\n-Definition: tablewriter.hxx:158\n-pqxx::internal::Escaper::operator()\n-std::string operator()(IT i) const\n-Definition: tablewriter.hxx:162\n-pqxx::internal::Escaper::Escaper\n-Escaper(const std::string &null)\n-Definition: tablewriter.hxx:161\n+pqxx::prepare::make_dynamic_params\n+pqxx::internal::dynamic_params< IT > make_dynamic_params(IT begin, IT end)\n+Pass a number of statement parameters only known at runtime.\n+Definition: prepared_statement.hxx:44\n+pqxx::binarystring\n+Binary data corresponding to PostgreSQL's \"BYTEA\" binary-string type.\n+Definition: binarystring.hxx:54\n+pqxx::prepare::invocation\n+Helper class for passing parameters to, and executing, prepared statements.\n+Definition: prepared_statement.hxx:82\n+pqxx::prepare::invocation::operator()\n+invocation & operator()(const binarystring &v, bool nonnull)\n+Pass binary parameter value for a BYTEA field.\n+Definition: prepared_statement.hxx:123\n+pqxx::prepare::invocation::operator()\n+invocation & operator()(const binarystring &v)\n+Pass binary parameter value for a BYTEA field.\n+Definition: prepared_statement.hxx:107\n+pqxx::prepare::invocation::operator()\n+invocation & operator()(T *v, bool nonnull=true)\n+Pass C-style parameter string, or null if pointer is null.\n+Definition: prepared_statement.hxx:134\n+pqxx::prepare::invocation::operator=\n+invocation & operator=(const invocation &)=delete\n+pqxx::prepare::invocation::operator()\n+invocation & operator()(const char *v, bool nonnull=true)\n+Pass C-style string parameter, or null if pointer is null.\n+Definition: prepared_statement.hxx:142\n+pqxx::prepare::invocation::operator()\n+invocation & operator()()\n+Pass null parameter.\n+Definition: prepared_statement.hxx:94\n+pqxx::prepare::invocation::operator()\n+invocation & operator()(const T &v, bool nonnull)\n+Pass parameter value.\n+Definition: prepared_statement.hxx:115\n+pqxx::prepare::invocation::operator()\n+invocation & operator()(const T &v)\n+Pass parameter value.\n+Definition: prepared_statement.hxx:100\n+pqxx::prepare::internal::prepared_def\n+Internal representation of a prepared statement definition.\n+Definition: prepared_statement.hxx:157\n+pqxx::prepare::internal::prepared_def::prepared_def\n+prepared_def()=default\n+pqxx::prepare::internal::prepared_def::definition\n+std::string definition\n+Text of prepared query.\n+Definition: prepared_statement.hxx:159\n+pqxx::result\n+Result set containing data returned by a query or command.\n+Definition: result.hxx:70\n pqxx::transaction_base\n Interface definition (and common code) for \"transaction\" classes.\n Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * tablewriter.hxx\n+ * prepared_statement.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00098_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00098_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: dbtransaction.hxx Source File\n+libpqxx: result_iterator.hxx Source File\n \n \n \n \n \n \n \n@@ -55,88 +55,249 @@\n \n
\n
\n-
dbtransaction.hxx
\n+
result_iterator.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_DBTRANSACTION
\n-
14#define PQXX_H_DBTRANSACTION
\n+
13#ifndef PQXX_H_RESULT_ITERATOR
\n+
14#define PQXX_H_RESULT_ITERATOR
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n
18
\n-
19#include "pqxx/transaction_base.hxx"
\n+
19#include "pqxx/row.hxx"
\n
20
\n-
21namespace pqxx
\n-
22{
\n-
23
\n-\n-
25{
\n-\n-\n-
28};
\n-
29
\n-
30
\n-
32
\n-
62class PQXX_LIBEXPORT PQXX_NOVTABLE dbtransaction : public transaction_base
\n-
63{
\n-
64public:
\n-
65 virtual ~dbtransaction();
\n-
66
\n-
67protected:
\n-\n-\n-
70 const std::string &IsolationString,
\n-\n-
72
\n-
73 explicit dbtransaction(
\n-\n-
75 bool direct=true,
\n-\n-
77
\n-
78
\n-\n+
21
\n+
22/* Result iterator.
\n+
23 *
\n+
24 * Don't include this header from your own application; it is included for you
\n+
25 * by other libpqxx headers.
\n+
26 */
\n+
27
\n+
28namespace pqxx
\n+
29{
\n+
31
\n+
35class PQXX_LIBEXPORT const_result_iterator : public row
\n+
36{
\n+
37public:
\n+
38 using iterator_category = std::random_access_iterator_tag;
\n+
39 using value_type = const row;
\n+
40 using pointer = const row *;
\n+
41 using reference = row;
\n+\n+\n+
44
\n+
45 const_result_iterator() noexcept : row{result(), 0} {}
\n+
46 const_result_iterator(const row &t) noexcept : row{t} {}
\n+
47
\n+
63 pointer operator->() const { return this; } //[t12]
\n+
64 reference operator*() const { return row{*this}; } //[t12]
\n+
66
\n+
71 const_result_iterator operator++(int); //[t12]
\n+
72 const_result_iterator &operator++() { ++m_index; return *this; } //[t01]
\n+
73 const_result_iterator operator--(int); //[t12]
\n+
74 const_result_iterator &operator--() { --m_index; return *this; } //[t12]
\n+
75
\n+\n+
77 { m_index += i; return *this; }
\n+\n+
79 { m_index -= i; return *this; }
\n
81
\n-
83 virtual void do_begin() override; //[t01]
\n-
85 virtual result do_exec(const char Query[]) override;
\n-
87 virtual void do_commit() override =0;
\n-
89
\n-
95 virtual void do_abort() override; //[t13]
\n-
96
\n-
97 static std::string fullname(const std::string &ttype,
\n-
98 const std::string &isolation);
\n+
86 bool operator==(const const_result_iterator &i) const //[t12]
\n+
87 {return m_index==i.m_index;}
\n+
88 bool operator!=(const const_result_iterator &i) const //[t12]
\n+
89 {return m_index!=i.m_index;}
\n+
90 bool operator<(const const_result_iterator &i) const //[t12]
\n+
91 {return m_index<i.m_index;}
\n+
92 bool operator<=(const const_result_iterator &i) const //[t12]
\n+
93 {return m_index<=i.m_index;}
\n+
94 bool operator>(const const_result_iterator &i) const //[t12]
\n+
95 {return m_index>i.m_index;}
\n+
96 bool operator>=(const const_result_iterator &i) const //[t12]
\n+
97 {return m_index>=i.m_index;}
\n
99
\n-
100private:
\n-
102 std::string m_start_cmd;
\n-
103};
\n-
104
\n-
105} // namespace pqxx
\n-
106
\n-
107#include "pqxx/compiler-internal-post.hxx"
\n-
108
\n-
109#endif
\n+
104 inline const_result_iterator operator+(difference_type) const; //[t12]
\n+
105 friend const_result_iterator operator+( //[t12]
\n+
106 difference_type,
\n+\n+
108 inline const_result_iterator operator-(difference_type) const; //[t12]
\n+
109 inline difference_type operator-(const_result_iterator) const; //[t12]
\n+
111
\n+
112private:
\n+
113 friend class pqxx::result;
\n+\n+
115 row{*r, i} {}
\n+
116};
\n+
117
\n+
118
\n+
120class PQXX_LIBEXPORT const_reverse_result_iterator :
\n+\n+
122{
\n+
123public:
\n+\n+\n+\n+\n+\n+\n+\n+
131
\n+\n+\n+\n+\n+
136 const const_result_iterator &rhs) :
\n+
137 const_result_iterator{rhs} { super::operator--(); }
\n+
138
\n+
139 PQXX_PURE const_result_iterator base() const noexcept; //[t75]
\n+
140
\n+
145 using const_result_iterator::operator->; //[t75]
\n+
146 using const_result_iterator::operator*; //[t75]
\n+
148
\n+\n+\n+
155 { iterator_type::operator=(r); return *this; }
\n+\n+
157 { iterator_type::operator--(); return *this; }
\n+
158 const_reverse_result_iterator operator++(int); //[t75]
\n+\n+
160 { iterator_type::operator++(); return *this; }
\n+
161 const_reverse_result_iterator operator--(int); //[t75]
\n+\n+
163 { iterator_type::operator-=(i); return *this; }
\n+\n+
165 { iterator_type::operator+=(i); return *this; }
\n+
167
\n+\n+
173 { return const_reverse_result_iterator(base() - i); }
\n+\n+
175 { return const_reverse_result_iterator(base() + i); }
\n+\n+
177 const const_reverse_result_iterator &rhs) const
\n+
178 { return rhs.const_result_iterator::operator-(*this); }
\n+
180
\n+
185 bool operator==( //[t75]
\n+
186 const const_reverse_result_iterator &rhs) const noexcept
\n+
187 { return iterator_type::operator==(rhs); }
\n+
188 bool operator!=( //[t75]
\n+
189 const const_reverse_result_iterator &rhs) const noexcept
\n+
190 { return not operator==(rhs); }
\n+
191
\n+
192 bool operator<(const const_reverse_result_iterator &rhs) const //[t75]
\n+
193 { return iterator_type::operator>(rhs); }
\n+
194 bool operator<=(const const_reverse_result_iterator &rhs) const //[t75]
\n+
195 { return iterator_type::operator>=(rhs); }
\n+
196 bool operator>(const const_reverse_result_iterator &rhs) const //[t75]
\n+
197 { return iterator_type::operator<(rhs); }
\n+
198 bool operator>=(const const_reverse_result_iterator &rhs) const //[t75]
\n+
199 { return iterator_type::operator<=(rhs); }
\n+
201};
\n+
202
\n+
203
\n+
204inline const_result_iterator
\n+\n+
206{
\n+\n+\n+
209}
\n+
210
\n+\n+\n+
213 { return i + o; }
\n+
214
\n+\n+\n+
217{
\n+\n+
219 &m_result,
\n+\n+
221}
\n+
222
\n+\n+\n+
225 { return result::difference_type(num() - i.num()); }
\n+
226
\n+
227inline const_result_iterator result::end() const noexcept
\n+
228 { return const_result_iterator{this, size()}; }
\n+
229
\n+
230
\n+
231inline const_result_iterator result::cend() const noexcept
\n+
232 { return end(); }
\n+
233
\n+
234
\n+\n+\n+\n+\n+
239 { return const_reverse_result_iterator{i.base() - n}; }
\n+
240
\n+
241} // namespace pqxx
\n+
242
\n+
243#include "pqxx/compiler-internal-post.hxx"
\n+
244
\n+
245#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
readwrite_policy
Definition: dbtransaction.hxx:25
\n-
@ read_only
Definition: dbtransaction.hxx:26
\n-
@ read_write
Definition: dbtransaction.hxx:27
\n-
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
\n-
void start_backend_transaction()
Start a transaction on the backend and set desired isolation level.
\n-
virtual void do_commit() override=0
To be implemented by derived class: commit backend transaction.
\n+
const_result_iterator operator+(result::difference_type o, const_result_iterator i)
Definition: result_iterator.hxx:212
\n+
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
\n+
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
\n
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
const_iterator end() const noexcept
Definition: result_iterator.hxx:227
\n+
result_difference_type difference_type
Definition: result.hxx:73
\n+
PQXX_PURE size_type size() const noexcept
Definition: result.cxx:94
\n+
const_iterator cend() const noexcept
Definition: result_iterator.hxx:231
\n+
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
\n+
bool operator!=(const const_result_iterator &i) const
Definition: result_iterator.hxx:88
\n+
const_result_iterator & operator-=(difference_type i)
Definition: result_iterator.hxx:78
\n+
const_result_iterator & operator++()
Definition: result_iterator.hxx:72
\n+
const_result_iterator(const row &t) noexcept
Definition: result_iterator.hxx:46
\n+
const_result_iterator operator+(difference_type) const
Definition: result_iterator.hxx:205
\n+
std::random_access_iterator_tag iterator_category
Definition: result_iterator.hxx:38
\n+
const_result_iterator operator-(difference_type) const
Definition: result_iterator.hxx:216
\n+
bool operator<(const const_result_iterator &i) const
Definition: result_iterator.hxx:90
\n+
bool operator>(const const_result_iterator &i) const
Definition: result_iterator.hxx:94
\n+
bool operator==(const const_result_iterator &i) const
Definition: result_iterator.hxx:86
\n+
const_result_iterator & operator+=(difference_type i)
Definition: result_iterator.hxx:76
\n+
pointer operator->() const
Definition: result_iterator.hxx:63
\n+
bool operator<=(const const_result_iterator &i) const
Definition: result_iterator.hxx:92
\n+
result_difference_type difference_type
Definition: result_iterator.hxx:43
\n+
result_size_type size_type
Definition: result_iterator.hxx:42
\n+
bool operator>=(const const_result_iterator &i) const
Definition: result_iterator.hxx:96
\n+
reference operator*() const
Definition: result_iterator.hxx:64
\n+
const_result_iterator & operator--()
Definition: result_iterator.hxx:74
\n+
const_result_iterator() noexcept
Definition: result_iterator.hxx:45
\n+
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:122
\n+
PQXX_PURE const_result_iterator base() const noexcept
Definition: result.cxx:425
\n+
bool operator>=(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:198
\n+
const_reverse_result_iterator operator+(difference_type i) const
Definition: result_iterator.hxx:172
\n+
bool operator!=(const const_reverse_result_iterator &rhs) const noexcept
Definition: result_iterator.hxx:188
\n+
const_reverse_result_iterator & operator-=(difference_type i)
Definition: result_iterator.hxx:164
\n+
const_reverse_result_iterator & operator+=(difference_type i)
Definition: result_iterator.hxx:162
\n+
bool operator==(const const_reverse_result_iterator &rhs) const noexcept
Definition: result_iterator.hxx:185
\n+
bool operator<(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:192
\n+
const_reverse_result_iterator(const const_reverse_result_iterator &rhs)
Definition: result_iterator.hxx:132
\n+
const_reverse_result_iterator operator-(difference_type i)
Definition: result_iterator.hxx:174
\n+
const_reverse_result_iterator(const const_result_iterator &rhs)
Definition: result_iterator.hxx:135
\n+
bool operator>(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:196
\n+
difference_type operator-(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:176
\n+
bool operator<=(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:194
\n+
const_reverse_result_iterator & operator--()
Definition: result_iterator.hxx:159
\n+
const_reverse_result_iterator & operator++()
Definition: result_iterator.hxx:156
\n+
Reference to one row in a result.
Definition: row.hxx:41
\n+
size_t num() const
Definition: row.hxx:170
\n+
result m_result
Result set of which this is one row.
Definition: row.hxx:192
\n+
long m_index
Row number.
Definition: row.hxx:198
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,99 +1,347 @@\n \n \n \n \n \n libpqxx\n \n-dbtransaction.hxx\n+result_iterator.hxx\n 1\n- 13#ifndef PQXX_H_DBTRANSACTION\n- 14#define PQXX_H_DBTRANSACTION\n+ 13#ifndef PQXX_H_RESULT_ITERATOR\n+ 14#define PQXX_H_RESULT_ITERATOR\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n 18\n- 19#include \"pqxx/transaction_base.hxx\"\n+ 19#include \"pqxx/row.hxx\"\n 20\n- 21namespace pqxx\n- 22{\n- 23\n-24enum readwrite_policy\n- 25{\n-26 read_only,\n- 27 read_write\n-28};\n- 29\n- 30\n- 32\n-62class PQXX_LIBEXPORT PQXX_NOVTABLE dbtransaction : public transaction_base\n- 63{\n- 64public:\n- 65 virtual ~dbtransaction();\n+ 21\n+ 22/* Result iterator.\n+ 23 *\n+ 24 * Don't include this header from your own application; it is included for\n+you\n+ 25 * by other libpqxx headers.\n+ 26 */\n+ 27\n+ 28namespace pqxx\n+ 29{\n+ 31\n+35class PQXX_LIBEXPORT const_result_iterator : public row\n+ 36{\n+ 37public:\n+38 using iterator_category = std::random_access_iterator_tag;\n+39 using value_type = const row;\n+40 using pointer = const row *;\n+41 using reference = row;\n+42 using size_type = result_size_type;\n+43 using difference_type = result_difference_type;\n+ 44\n+45 const_result_iterator() noexcept : row{result(), 0} {}\n+46 const_result_iterator(const row &t) noexcept : row{t} {}\n+ 47\n+63 pointer operator->() const { return this; } //[t12]\n+64 reference operator*() const { return row{*this}; } //[t12]\n 66\n- 67protected:\n- 68 dbtransaction(\n- 69 connection_base &,\n- 70 const std::string &IsolationString,\n- 71 readwrite_policy rw=read_write);\n- 72\n- 73 explicit dbtransaction(\n- 74 connection_base &,\n- 75 bool direct=true,\n- 76 readwrite_policy rw=read_write);\n- 77\n- 78\n-80 void start_backend_transaction();\n+ 71 const_result_iterator operator++(int); //[t12]\n+72 const_result_iterator &operator++() { ++m_index; return *this; } //[t01]\n+ 73 const_result_iterator operator--(int); //[t12]\n+74 const_result_iterator &operator--() { --m_index; return *this; } //[t12]\n+ 75\n+76 const_result_iterator &operator+=(difference_type i) //[t12]\n+ 77 { m_index += i; return *this; }\n+78 const_result_iterator &operator-=(difference_type i) //[t12]\n+ 79 { m_index -= i; return *this; }\n 81\n- 83 virtual void do_begin() override; //[t01]\n- 85 virtual result do_exec(const char Query[]) override;\n-87 virtual void do_commit() override =0;\n- 89\n- 95 virtual void do_abort() override; //[t13]\n- 96\n- 97 static std::string fullname(const std::string &ttype,\n- 98 const std::string &isolation);\n+86 bool operator==(const const_result_iterator &i) const //[t12]\n+ 87 {return m_index==i.m_index;}\n+88 bool operator!=(const const_result_iterator &i) const //[t12]\n+ 89 {return m_index!=i.m_index;}\n+90 bool operator<(const const_result_iterator &i) const //[t12]\n+ 91 {return m_index(const const_result_iterator &i) const //[t12]\n+ 95 {return m_index>i.m_index;}\n+96 bool operator>=(const const_result_iterator &i) const //[t12]\n+ 97 {return m_index>=i.m_index;}\n 99\n- 100private:\n- 102 std::string m_start_cmd;\n- 103};\n- 104\n- 105} // namespace pqxx\n- 106\n- 107#include \"pqxx/compiler-internal-post.hxx\"\n- 108\n- 109#endif\n+ 104 inline const_result_iterator operator+(difference_type) const; //[t12]\n+ 105 friend const_result_iterator operator+( //[t12]\n+ 106 difference_type,\n+ 107 const_result_iterator);\n+108 inline const_result_iterator operator-(difference_type) const; //[t12]\n+109 inline difference_type operator-(const_result_iterator) const; //[t12]\n+ 111\n+ 112private:\n+113 friend class pqxx::result;\n+ 114 const_result_iterator(const pqxx::result *r, result_size_type i) noexcept\n+:\n+ 115 row{*r, i} {}\n+ 116};\n+ 117\n+ 118\n+120class PQXX_LIBEXPORT const_reverse_result_iterator :\n+ 121 private const_result_iterator\n+ 122{\n+ 123public:\n+124 using super = const_result_iterator;\n+125 using iterator_type = const_result_iterator;\n+ 126 using iterator_type::iterator_category;\n+ 127 using iterator_type::difference_type;\n+ 128 using iterator_type::pointer;\n+129 using value_type = iterator_type::value_type;\n+130 using reference = iterator_type::reference;\n+ 131\n+132 const_reverse_result_iterator( //[t75]\n+ 133 const const_reverse_result_iterator &rhs) :\n+ 134 const_result_iterator{rhs} {}\n+135 explicit const_reverse_result_iterator( //[t75]\n+ 136 const const_result_iterator &rhs) :\n+ 137 const_result_iterator{rhs} { super::operator--(); }\n+ 138\n+ 139 PQXX_PURE const_result_iterator base() const noexcept; //[t75]\n+ 140\n+ 145 using const_result_iterator::operator->; //[t75]\n+ 146 using const_result_iterator::operator*; //[t75]\n+ 148\n+153 const_reverse_result_iterator &operator=( //[t75]\n+ 154 const const_reverse_result_iterator &r)\n+ 155 { iterator_type::operator=(r); return *this; }\n+156 const_reverse_result_iterator &operator++() //[t75]\n+ 157 { iterator_type::operator--(); return *this; }\n+ 158 const_reverse_result_iterator operator++(int); //[t75]\n+159 const_reverse_result_iterator &operator--() //[t75]\n+ 160 { iterator_type::operator++(); return *this; }\n+ 161 const_reverse_result_iterator operator--(int); //[t75]\n+162 const_reverse_result_iterator &operator+=(difference_type i) //[t75]\n+ 163 { iterator_type::operator-=(i); return *this; }\n+164 const_reverse_result_iterator &operator-=(difference_type i) //[t75]\n+ 165 { iterator_type::operator+=(i); return *this; }\n+ 167\n+172 const_reverse_result_iterator operator+(difference_type i) const //[t75]\n+ 173 { return const_reverse_result_iterator(base() - i); }\n+174 const_reverse_result_iterator operator-(difference_type i) //[t75]\n+ 175 { return const_reverse_result_iterator(base() + i); }\n+176 difference_type operator-( //[t75]\n+ 177 const const_reverse_result_iterator &rhs) const\n+ 178 { return rhs.const_result_iterator::operator-(*this); }\n+ 180\n+185 bool operator==( //[t75]\n+ 186 const const_reverse_result_iterator &rhs) const noexcept\n+ 187 { return iterator_type::operator==(rhs); }\n+188 bool operator!=( //[t75]\n+ 189 const const_reverse_result_iterator &rhs) const noexcept\n+ 190 { return not operator==(rhs); }\n+ 191\n+192 bool operator<(const const_reverse_result_iterator &rhs) const //[t75]\n+ 193 { return iterator_type::operator>(rhs); }\n+194 bool operator<=(const const_reverse_result_iterator &rhs) const //[t75]\n+ 195 { return iterator_type::operator>=(rhs); }\n+196 bool operator>(const const_reverse_result_iterator &rhs) const //[t75]\n+ 197 { return iterator_type::operator<(rhs); }\n+198 bool operator>=(const const_reverse_result_iterator &rhs) const //[t75]\n+ 199 { return iterator_type::operator<=(rhs); }\n+ 201};\n+ 202\n+ 203\n+ 204inline const_result_iterator\n+205const_result_iterator::operator+(result::difference_type o) const\n+ 206{\n+ 207 return const_result_iterator{\n+ 208 &m_result, size_type(result::difference_type(m_index) + o)};\n+ 209}\n+ 210\n+ 211inline const_result_iterator\n+212operator+(result::difference_type o, const_result_iterator i)\n+ 213 { return i + o; }\n+ 214\n+ 215inline const_result_iterator\n+216const_result_iterator::operator-(result::difference_type o) const\n+ 217{\n+ 218 return const_result_iterator{\n+ 219 &m_result,\n+ 220 result_size_type(result::difference_type(m_index) - o)};\n+ 221}\n+ 222\n+ 223inline result::difference_type\n+224const_result_iterator::operator-(const_result_iterator i) const\n+ 225 { return result::difference_type(num() - i.num()); }\n+ 226\n+227inline const_result_iterator result::end() const noexcept\n+ 228 { return const_result_iterator{this, size()}; }\n+ 229\n+ 230\n+231inline const_result_iterator result::cend() const noexcept\n+ 232 { return end(); }\n+ 233\n+ 234\n+ 235inline const_reverse_result_iterator\n+236operator+(\n+ 237 result::difference_type n,\n+ 238 const const_reverse_result_iterator &i)\n+ 239 { return const_reverse_result_iterator{i.base() - n}; }\n+ 240\n+ 241} // namespace pqxx\n+ 242\n+ 243#include \"pqxx/compiler-internal-post.hxx\"\n+ 244\n+ 245#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::readwrite_policy\n-readwrite_policy\n-Definition: dbtransaction.hxx:25\n-pqxx::read_only\n-@ read_only\n-Definition: dbtransaction.hxx:26\n-pqxx::read_write\n-@ read_write\n-Definition: dbtransaction.hxx:27\n-pqxx::connection_base\n-connection_base abstract base class; represents a connection to a database.\n-Definition: connection_base.hxx:140\n-pqxx::dbtransaction\n-Abstract base class responsible for bracketing a backend transaction.\n-Definition: dbtransaction.hxx:63\n-pqxx::dbtransaction::start_backend_transaction\n-void start_backend_transaction()\n-Start a transaction on the backend and set desired isolation level.\n-pqxx::dbtransaction::do_commit\n-virtual void do_commit() override=0\n-To be implemented by derived class: commit backend transaction.\n+pqxx::operator+\n+const_result_iterator operator+(result::difference_type o,\n+const_result_iterator i)\n+Definition: result_iterator.hxx:212\n+pqxx::result_difference_type\n+signed long result_difference_type\n+Difference between result sizes.\n+Definition: types.hxx:21\n+pqxx::result_size_type\n+unsigned long result_size_type\n+Number of rows in a result set.\n+Definition: types.hxx:18\n pqxx::result\n Result set containing data returned by a query or command.\n Definition: result.hxx:70\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n+pqxx::result::end\n+const_iterator end() const noexcept\n+Definition: result_iterator.hxx:227\n+pqxx::result::difference_type\n+result_difference_type difference_type\n+Definition: result.hxx:73\n+pqxx::result::size\n+PQXX_PURE size_type size() const noexcept\n+Definition: result.cxx:94\n+pqxx::result::cend\n+const_iterator cend() const noexcept\n+Definition: result_iterator.hxx:231\n+pqxx::const_result_iterator\n+Iterator for rows in a result. Use as result::const_iterator.\n+Definition: result_iterator.hxx:36\n+pqxx::const_result_iterator::operator!=\n+bool operator!=(const const_result_iterator &i) const\n+Definition: result_iterator.hxx:88\n+pqxx::const_result_iterator::operator-=\n+const_result_iterator & operator-=(difference_type i)\n+Definition: result_iterator.hxx:78\n+pqxx::const_result_iterator::operator++\n+const_result_iterator & operator++()\n+Definition: result_iterator.hxx:72\n+pqxx::const_result_iterator::const_result_iterator\n+const_result_iterator(const row &t) noexcept\n+Definition: result_iterator.hxx:46\n+pqxx::const_result_iterator::operator+\n+const_result_iterator operator+(difference_type) const\n+Definition: result_iterator.hxx:205\n+pqxx::const_result_iterator::iterator_category\n+std::random_access_iterator_tag iterator_category\n+Definition: result_iterator.hxx:38\n+pqxx::const_result_iterator::operator-\n+const_result_iterator operator-(difference_type) const\n+Definition: result_iterator.hxx:216\n+pqxx::const_result_iterator::operator<\n+bool operator<(const const_result_iterator &i) const\n+Definition: result_iterator.hxx:90\n+pqxx::const_result_iterator::operator>\n+bool operator>(const const_result_iterator &i) const\n+Definition: result_iterator.hxx:94\n+pqxx::const_result_iterator::operator==\n+bool operator==(const const_result_iterator &i) const\n+Definition: result_iterator.hxx:86\n+pqxx::const_result_iterator::operator+=\n+const_result_iterator & operator+=(difference_type i)\n+Definition: result_iterator.hxx:76\n+pqxx::const_result_iterator::operator->\n+pointer operator->() const\n+Definition: result_iterator.hxx:63\n+pqxx::const_result_iterator::operator<=\n+bool operator<=(const const_result_iterator &i) const\n+Definition: result_iterator.hxx:92\n+pqxx::const_result_iterator::difference_type\n+result_difference_type difference_type\n+Definition: result_iterator.hxx:43\n+pqxx::const_result_iterator::size_type\n+result_size_type size_type\n+Definition: result_iterator.hxx:42\n+pqxx::const_result_iterator::operator>=\n+bool operator>=(const const_result_iterator &i) const\n+Definition: result_iterator.hxx:96\n+pqxx::const_result_iterator::operator*\n+reference operator*() const\n+Definition: result_iterator.hxx:64\n+pqxx::const_result_iterator::operator--\n+const_result_iterator & operator--()\n+Definition: result_iterator.hxx:74\n+pqxx::const_result_iterator::const_result_iterator\n+const_result_iterator() noexcept\n+Definition: result_iterator.hxx:45\n+pqxx::const_reverse_result_iterator\n+Reverse iterator for result. Use as result::const_reverse_iterator.\n+Definition: result_iterator.hxx:122\n+pqxx::const_reverse_result_iterator::base\n+PQXX_PURE const_result_iterator base() const noexcept\n+Definition: result.cxx:425\n+pqxx::const_reverse_result_iterator::operator>=\n+bool operator>=(const const_reverse_result_iterator &rhs) const\n+Definition: result_iterator.hxx:198\n+pqxx::const_reverse_result_iterator::operator+\n+const_reverse_result_iterator operator+(difference_type i) const\n+Definition: result_iterator.hxx:172\n+pqxx::const_reverse_result_iterator::operator!=\n+bool operator!=(const const_reverse_result_iterator &rhs) const noexcept\n+Definition: result_iterator.hxx:188\n+pqxx::const_reverse_result_iterator::operator-=\n+const_reverse_result_iterator & operator-=(difference_type i)\n+Definition: result_iterator.hxx:164\n+pqxx::const_reverse_result_iterator::operator+=\n+const_reverse_result_iterator & operator+=(difference_type i)\n+Definition: result_iterator.hxx:162\n+pqxx::const_reverse_result_iterator::operator==\n+bool operator==(const const_reverse_result_iterator &rhs) const noexcept\n+Definition: result_iterator.hxx:185\n+pqxx::const_reverse_result_iterator::operator<\n+bool operator<(const const_reverse_result_iterator &rhs) const\n+Definition: result_iterator.hxx:192\n+pqxx::const_reverse_result_iterator::const_reverse_result_iterator\n+const_reverse_result_iterator(const const_reverse_result_iterator &rhs)\n+Definition: result_iterator.hxx:132\n+pqxx::const_reverse_result_iterator::operator-\n+const_reverse_result_iterator operator-(difference_type i)\n+Definition: result_iterator.hxx:174\n+pqxx::const_reverse_result_iterator::const_reverse_result_iterator\n+const_reverse_result_iterator(const const_result_iterator &rhs)\n+Definition: result_iterator.hxx:135\n+pqxx::const_reverse_result_iterator::operator>\n+bool operator>(const const_reverse_result_iterator &rhs) const\n+Definition: result_iterator.hxx:196\n+pqxx::const_reverse_result_iterator::operator-\n+difference_type operator-(const const_reverse_result_iterator &rhs) const\n+Definition: result_iterator.hxx:176\n+pqxx::const_reverse_result_iterator::operator<=\n+bool operator<=(const const_reverse_result_iterator &rhs) const\n+Definition: result_iterator.hxx:194\n+pqxx::const_reverse_result_iterator::operator--\n+const_reverse_result_iterator & operator--()\n+Definition: result_iterator.hxx:159\n+pqxx::const_reverse_result_iterator::operator++\n+const_reverse_result_iterator & operator++()\n+Definition: result_iterator.hxx:156\n+pqxx::row\n+Reference to one row in a result.\n+Definition: row.hxx:41\n+pqxx::row::num\n+size_t num() const\n+Definition: row.hxx:170\n+pqxx::row::m_result\n+result m_result\n+Result set of which this is one row.\n+Definition: row.hxx:192\n+pqxx::row::m_index\n+long m_index\n+Row number.\n+Definition: row.hxx:198\n * include\n * pqxx\n- * dbtransaction.hxx\n+ * result_iterator.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00101_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00101_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: array.hxx Source File\n+libpqxx: version.hxx Source File\n \n \n \n \n \n \n \n@@ -55,90 +55,45 @@\n \n
\n
\n-
array.hxx
\n+
version.hxx
\n
\n
\n
1
\n-
11#ifndef PQXX_H_ARRAY
\n-
12#define PQXX_H_ARRAY
\n-
13
\n-
14#include "pqxx/compiler-public.hxx"
\n-
15#include "pqxx/compiler-internal-pre.hxx"
\n-
16
\n-
17#include "pqxx/internal/encoding_group.hxx"
\n-
18#include "pqxx/internal/encodings.hxx"
\n-
19
\n-
20#include <stdexcept>
\n-
21#include <string>
\n-
22#include <utility>
\n-
23
\n-
24
\n-
25namespace pqxx
\n-
26{
\n-
28
\n-
46class PQXX_LIBEXPORT array_parser
\n-
47{
\n-
48public:
\n-\n-
51 {
\n-\n-\n-\n-\n-\n-
62 };
\n-
63
\n-
64// XXX: Actually _pass_ encoding group!
\n-
66 explicit array_parser(
\n-
67 const char input[],
\n-
68 internal::encoding_group=internal::encoding_group::MONOBYTE);
\n-
69
\n-
71
\n-
76 std::pair<juncture, std::string> get_next();
\n-
77
\n-
78private:
\n-
79 const char *const m_input;
\n-
80 const std::string::size_type m_end;
\n-
81 internal::glyph_scanner_func *const m_scan;
\n-
82
\n-
84 std::string::size_type m_pos;
\n-
85
\n-
86 std::string::size_type scan_single_quoted_string() const;
\n-
87 std::string parse_single_quoted_string(std::string::size_type end) const;
\n-
88 std::string::size_type scan_double_quoted_string() const;
\n-
89 std::string parse_double_quoted_string(std::string::size_type end) const;
\n-
90 std::string::size_type scan_unquoted_string() const;
\n-
91 std::string parse_unquoted_string(std::string::size_type end) const;
\n-
92
\n-
93 std::string::size_type scan_glyph(std::string::size_type pos) const;
\n-
94 std::string::size_type scan_glyph(
\n-
95 std::string::size_type pos,
\n-
96 std::string::size_type end) const;
\n-
97};
\n-
98} // namespace pqxx
\n-
99
\n-
100#include "pqxx/compiler-internal-post.hxx"
\n-
101#endif
\n+
11#ifndef PQXX_H_VERSION
\n+
12
\n+
13#include "pqxx/compiler-public.hxx"
\n+
14#include "pqxx/compiler-internal-pre.hxx"
\n+
15
\n+
17#define PQXX_VERSION "6.4.4"
\n+
19#define PQXX_ABI "6.4"
\n+
20
\n+
22#define PQXX_VERSION_MAJOR 6
\n+
24#define PQXX_VERSION_MINOR 4
\n+
25
\n+
26namespace pqxx
\n+
27{
\n+
28namespace internal
\n+
29{
\n+
31
\n+
53template<int, int> PQXX_LIBEXPORT int check_library_version() noexcept;
\n+
54}
\n+
55}
\n+
56#include "pqxx/compiler-internal-post.hxx"
\n+
57#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
Low-level array parser.
Definition: array.hxx:47
\n-
juncture
What's the latest thing found in the array?
Definition: array.hxx:51
\n-
@ string_value
Found a string value.
Definition: array.hxx:59
\n-
@ row_end
Ending the current row.
Definition: array.hxx:55
\n-
@ done
Parsing has completed.
Definition: array.hxx:61
\n-
@ row_start
Starting a new row.
Definition: array.hxx:53
\n-
@ null_value
Found a NULL value.
Definition: array.hxx:57
\n+
int check_library_version() noexcept
Library version check stub.
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,103 +1,40 @@\n \n \n \n \n \n libpqxx\n \n-array.hxx\n+version.hxx\n 1\n- 11#ifndef PQXX_H_ARRAY\n- 12#define PQXX_H_ARRAY\n- 13\n- 14#include \"pqxx/compiler-public.hxx\"\n- 15#include \"pqxx/compiler-internal-pre.hxx\"\n- 16\n- 17#include \"pqxx/internal/encoding_group.hxx\"\n- 18#include \"pqxx/internal/encodings.hxx\"\n- 19\n- 20#include \n- 21#include \n- 22#include \n- 23\n- 24\n-25namespace pqxx\n- 26{\n- 28\n-46class PQXX_LIBEXPORT array_parser\n- 47{\n- 48public:\n-50 enum juncture\n- 51 {\n-53 row_start,\n-55 row_end,\n-57 null_value,\n-59 string_value,\n-61 done,\n- 62 };\n- 63\n- 64// XXX: Actually _pass_ encoding group!\n- 66 explicit array_parser(\n- 67 const char input[],\n- 68 internal::encoding_group=internal::encoding_group::MONOBYTE);\n- 69\n- 71\n- 76 std::pair get_next();\n- 77\n- 78private:\n- 79 const char *const m_input;\n- 80 const std::string::size_type m_end;\n- 81 internal::glyph_scanner_func *const m_scan;\n- 82\n- 84 std::string::size_type m_pos;\n- 85\n- 86 std::string::size_type scan_single_quoted_string() const;\n- 87 std::string parse_single_quoted_string(std::string::size_type end) const;\n- 88 std::string::size_type scan_double_quoted_string() const;\n- 89 std::string parse_double_quoted_string(std::string::size_type end) const;\n- 90 std::string::size_type scan_unquoted_string() const;\n- 91 std::string parse_unquoted_string(std::string::size_type end) const;\n- 92\n- 93 std::string::size_type scan_glyph(std::string::size_type pos) const;\n- 94 std::string::size_type scan_glyph(\n- 95 std::string::size_type pos,\n- 96 std::string::size_type end) const;\n- 97};\n- 98} // namespace pqxx\n- 99\n- 100#include \"pqxx/compiler-internal-post.hxx\"\n- 101#endif\n+ 11#ifndef PQXX_H_VERSION\n+ 12\n+ 13#include \"pqxx/compiler-public.hxx\"\n+ 14#include \"pqxx/compiler-internal-pre.hxx\"\n+ 15\n+ 17#define PQXX_VERSION \"6.4.4\"\n+ 19#define PQXX_ABI \"6.4\"\n+ 20\n+ 22#define PQXX_VERSION_MAJOR 6\n+ 24#define PQXX_VERSION_MINOR 4\n+ 25\n+ 26namespace pqxx\n+ 27{\n+ 28namespace internal\n+ 29{\n+ 31\n+53template PQXX_LIBEXPORT int check_library_version() noexcept;\n+ 54}\n+ 55}\n+ 56#include \"pqxx/compiler-internal-post.hxx\"\n+ 57#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::array_parser\n-Low-level array parser.\n-Definition: array.hxx:47\n-pqxx::array_parser::juncture\n-juncture\n-What's the latest thing found in the array?\n-Definition: array.hxx:51\n-pqxx::array_parser::string_value\n-@ string_value\n-Found a string value.\n-Definition: array.hxx:59\n-pqxx::array_parser::row_end\n-@ row_end\n-Ending the current row.\n-Definition: array.hxx:55\n-pqxx::array_parser::done\n-@ done\n-Parsing has completed.\n-Definition: array.hxx:61\n-pqxx::array_parser::row_start\n-@ row_start\n-Starting a new row.\n-Definition: array.hxx:53\n-pqxx::array_parser::null_value\n-@ null_value\n-Found a NULL value.\n-Definition: array.hxx:57\n+pqxx::internal::check_library_version\n+int check_library_version() noexcept\n+Library version check stub.\n * include\n * pqxx\n- * array.hxx\n+ * version.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00104_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00104_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: binarystring.hxx Source File\n+libpqxx: subtransaction.hxx Source File\n \n \n \n \n \n \n \n@@ -55,148 +55,69 @@\n \n
\n
\n-
binarystring.hxx
\n+
subtransaction.hxx
\n
\n
\n
1
\n-
11#ifndef PQXX_H_BINARYSTRING
\n-
12#define PQXX_H_BINARYSTRING
\n-
13
\n-
14#include "pqxx/compiler-public.hxx"
\n-
15#include "pqxx/compiler-internal-pre.hxx"
\n-
16
\n-
17#include <memory>
\n-
18#include <string>
\n-
19
\n-
20#include "pqxx/result.hxx"
\n+
13#ifndef PQXX_H_SUBTRANSACTION
\n+
14#define PQXX_H_SUBTRANSACTION
\n+
15
\n+
16#include "pqxx/compiler-public.hxx"
\n+
17#include "pqxx/compiler-internal-pre.hxx"
\n+
18
\n+
19#include "pqxx/dbtransaction.hxx"
\n+
20
\n
21
\n-
22
\n-
23namespace pqxx
\n-
24{
\n+
22/* Methods tested in eg. self-test program test1 are marked with "//[t01]"
\n+
23 */
\n+
24
\n
25
\n-
27
\n-
53class PQXX_LIBEXPORT binarystring
\n-
54{
\n-
55public:
\n-
56 using char_type = unsigned char;
\n-
57 using value_type = std::char_traits<char_type>::char_type;
\n-
58 using size_type = size_t;
\n-
59 using difference_type = long;
\n-
60 using const_reference = const value_type &;
\n-
61 using const_pointer = const value_type *;
\n-\n-
63 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
\n-
64
\n-
65 binarystring(const binarystring &) =default;
\n-
66
\n-
68
\n-
71 explicit binarystring(const field &); //[t62]
\n-
72
\n-
74 explicit binarystring(const std::string &);
\n-
75
\n-
77 binarystring(const void *, size_t);
\n-
78
\n-
80 size_type size() const noexcept { return m_size; } //[t62]
\n-
82 size_type length() const noexcept { return size(); } //[t62]
\n-
83 bool empty() const noexcept { return size()==0; } //[t62]
\n-
84
\n-
85 const_iterator begin() const noexcept { return data(); } //[t62]
\n-
86 const_iterator cbegin() const noexcept { return begin(); }
\n-
87 const_iterator end() const noexcept { return data()+m_size; } //[t62]
\n-
88 const_iterator cend() const noexcept { return end(); }
\n-
89
\n-
90 const_reference front() const noexcept { return *begin(); } //[t62]
\n-
91 const_reference back() const noexcept //[t62]
\n-
92 { return *(data()+m_size-1); }
\n-
93
\n-\n-
95 { return const_reverse_iterator{end()}; }
\n-
96 const_reverse_iterator crbegin() const { return rbegin(); }
\n-\n-
98 { return const_reverse_iterator{begin()}; }
\n-
99 const_reverse_iterator crend() const { return rend(); }
\n-
100
\n-
102 const value_type *data() const noexcept {return m_buf.get();} //[t62]
\n+
26namespace pqxx
\n+
27{
\n+
28
\n+
33
\n+
79class PQXX_LIBEXPORT subtransaction :
\n+\n+
81 public dbtransaction
\n+
82{
\n+
83public:
\n+
85 explicit subtransaction( //[t88]
\n+
86 dbtransaction &T, const std::string &Name=std::string{});
\n+
87
\n+
89 explicit subtransaction(
\n+
90 subtransaction &T, const std::string &Name=std::string{});
\n+
91
\n+
92 virtual ~subtransaction() noexcept
\n+
93 { End(); }
\n+
94
\n+
95private:
\n+
96 virtual void do_begin() override; //[t88]
\n+
97 virtual void do_commit() override; //[t88]
\n+
98 virtual void do_abort() override; //[t88]
\n+
99
\n+
100 dbtransaction &m_parent;
\n+
101};
\n+
102}
\n
103
\n-
104 const_reference operator[](size_type i) const noexcept //[t62]
\n-
105 { return data()[i]; }
\n-
106
\n-
107 PQXX_PURE bool operator==(const binarystring &) const noexcept; //[t62]
\n-
108 bool operator!=(const binarystring &rhs) const noexcept //[t62]
\n-
109 { return not operator==(rhs); }
\n-
110
\n-
111 binarystring &operator=(const binarystring &);
\n-
112
\n-
114 const_reference at(size_type) const; //[t62]
\n-
115
\n-
117 void swap(binarystring &); //[t62]
\n-
118
\n-
120
\n-
123 const char *get() const noexcept //[t62]
\n-
124 { return reinterpret_cast<const char *>(m_buf.get()); }
\n-
125
\n-
127
\n-
133 std::string str() const; //[t62]
\n-
134
\n-
135private:
\n-
136 using smart_pointer_type = std::shared_ptr<value_type>;
\n-
137
\n-
139 static smart_pointer_type make_smart_pointer(unsigned char *buf=nullptr)
\n-
140 {
\n-
141 return smart_pointer_type{
\n-
142 buf,
\n-
143 internal::freemallocmem_templated<unsigned char>};
\n-
144 }
\n-
145
\n-
146 smart_pointer_type m_buf;
\n-
147 size_type m_size;
\n-
148};
\n-
149}
\n-
150
\n-
151#include "pqxx/compiler-internal-post.hxx"
\n-
152
\n-
153#endif
\n+
104#include "pqxx/compiler-internal-post.hxx"
\n+
105#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
\n-
const_reverse_iterator crend() const
Definition: binarystring.hxx:99
\n-
const_reverse_iterator rbegin() const
Definition: binarystring.hxx:94
\n-
const_pointer const_iterator
Definition: binarystring.hxx:62
\n-
const value_type & const_reference
Definition: binarystring.hxx:60
\n-
const value_type * const_pointer
Definition: binarystring.hxx:61
\n-
const_iterator end() const noexcept
Definition: binarystring.hxx:87
\n-
const_iterator begin() const noexcept
Definition: binarystring.hxx:85
\n-
std::char_traits< char_type >::char_type value_type
Definition: binarystring.hxx:57
\n-
long difference_type
Definition: binarystring.hxx:59
\n-
const_reverse_iterator crbegin() const
Definition: binarystring.hxx:96
\n-
const_reference front() const noexcept
Definition: binarystring.hxx:90
\n-
const_reference back() const noexcept
Definition: binarystring.hxx:91
\n-
bool operator!=(const binarystring &rhs) const noexcept
Definition: binarystring.hxx:108
\n-
bool empty() const noexcept
Definition: binarystring.hxx:83
\n-
binarystring(const binarystring &)=default
\n-
const_reference operator[](size_type i) const noexcept
Definition: binarystring.hxx:104
\n-
const_iterator cend() const noexcept
Definition: binarystring.hxx:88
\n-
const_reverse_iterator rend() const
Definition: binarystring.hxx:97
\n-
size_type length() const noexcept
Size of converted string in bytes.
Definition: binarystring.hxx:82
\n-
unsigned char char_type
Definition: binarystring.hxx:56
\n-
size_t size_type
Definition: binarystring.hxx:58
\n-
const value_type * data() const noexcept
Unescaped field contents.
Definition: binarystring.hxx:102
\n-
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: binarystring.hxx:63
\n-
const_iterator cbegin() const noexcept
Definition: binarystring.hxx:86
\n-
const char * get() const noexcept
Raw character buffer (no terminating zero is added)
Definition: binarystring.hxx:123
\n-
size_type size() const noexcept
Size of converted string in bytes.
Definition: binarystring.hxx:80
\n-
Reference to a field in a result set.
Definition: field.hxx:50
\n+
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
\n+
"Transaction" nested within another transaction
Definition: subtransaction.hxx:82
\n+
virtual ~subtransaction() noexcept
Definition: subtransaction.hxx:92
\n+
Definition: transaction_base.hxx:44
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,200 +1,69 @@\n \n \n \n \n \n libpqxx\n \n-binarystring.hxx\n+subtransaction.hxx\n 1\n- 11#ifndef PQXX_H_BINARYSTRING\n- 12#define PQXX_H_BINARYSTRING\n- 13\n- 14#include \"pqxx/compiler-public.hxx\"\n- 15#include \"pqxx/compiler-internal-pre.hxx\"\n- 16\n- 17#include \n- 18#include \n- 19\n- 20#include \"pqxx/result.hxx\"\n+ 13#ifndef PQXX_H_SUBTRANSACTION\n+ 14#define PQXX_H_SUBTRANSACTION\n+ 15\n+ 16#include \"pqxx/compiler-public.hxx\"\n+ 17#include \"pqxx/compiler-internal-pre.hxx\"\n+ 18\n+ 19#include \"pqxx/dbtransaction.hxx\"\n+ 20\n 21\n- 22\n- 23namespace pqxx\n- 24{\n+ 22/* Methods tested in eg. self-test program test1 are marked with \"//[t01]\"\n+ 23 */\n+ 24\n 25\n- 27\n-53class PQXX_LIBEXPORT binarystring\n- 54{\n- 55public:\n-56 using char_type = unsigned char;\n-57 using value_type = std::char_traits::char_type;\n-58 using size_type = size_t;\n-59 using difference_type = long;\n-60 using const_reference = const value_type &;\n-61 using const_pointer = const value_type *;\n-62 using const_iterator = const_pointer;\n-63 using const_reverse_iterator = std::reverse_iterator;\n- 64\n-65 binarystring(const binarystring &) =default;\n- 66\n- 68\n- 71 explicit binarystring(const field &); //[t62]\n- 72\n- 74 explicit binarystring(const std::string &);\n- 75\n- 77 binarystring(const void *, size_t);\n- 78\n-80 size_type size() const noexcept { return m_size; } //[t62]\n-82 size_type length() const noexcept { return size(); } //[t62]\n-83 bool empty() const noexcept { return size()==0; } //[t62]\n- 84\n-85 const_iterator begin() const noexcept { return data(); } //[t62]\n-86 const_iterator cbegin() const noexcept { return begin(); }\n-87 const_iterator end() const noexcept { return data()+m_size; } //[t62]\n-88 const_iterator cend() const noexcept { return end(); }\n- 89\n-90 const_reference front() const noexcept { return *begin(); } //[t62]\n-91 const_reference back() const noexcept //[t62]\n- 92 { return *(data()+m_size-1); }\n- 93\n-94 const_reverse_iterator rbegin() const //[t62]\n- 95 { return const_reverse_iterator{end()}; }\n-96 const_reverse_iterator crbegin() const { return rbegin(); }\n-97 const_reverse_iterator rend() const //[t62]\n- 98 { return const_reverse_iterator{begin()}; }\n-99 const_reverse_iterator crend() const { return rend(); }\n- 100\n-102 const value_type *data() const noexcept {return m_buf.get();} //[t62]\n+ 26namespace pqxx\n+ 27{\n+ 28\n+ 33\n+79class PQXX_LIBEXPORT subtransaction :\n+ 80 public internal::transactionfocus,\n+ 81 public dbtransaction\n+ 82{\n+ 83public:\n+ 85 explicit subtransaction( //[t88]\n+ 86 dbtransaction &T, const std::string &Name=std::string{});\n+ 87\n+ 89 explicit subtransaction(\n+ 90 subtransaction &T, const std::string &Name=std::string{});\n+ 91\n+92 virtual ~subtransaction() noexcept\n+ 93 { End(); }\n+ 94\n+ 95private:\n+ 96 virtual void do_begin() override; //[t88]\n+ 97 virtual void do_commit() override; //[t88]\n+ 98 virtual void do_abort() override; //[t88]\n+ 99\n+ 100 dbtransaction &m_parent;\n+ 101};\n+ 102}\n 103\n-104 const_reference operator[](size_type i) const noexcept //[t62]\n- 105 { return data()[i]; }\n- 106\n- 107 PQXX_PURE bool operator==(const binarystring &) const noexcept; //[t62]\n-108 bool operator!=(const binarystring &rhs) const noexcept //[t62]\n- 109 { return not operator==(rhs); }\n- 110\n- 111 binarystring &operator=(const binarystring &);\n- 112\n- 114 const_reference at(size_type) const; //[t62]\n- 115\n- 117 void swap(binarystring &); //[t62]\n- 118\n- 120\n-123 const char *get() const noexcept //[t62]\n- 124 { return reinterpret_cast(m_buf.get()); }\n- 125\n- 127\n- 133 std::string str() const; //[t62]\n- 134\n- 135private:\n- 136 using smart_pointer_type = std::shared_ptr;\n- 137\n- 139 static smart_pointer_type make_smart_pointer(unsigned char *buf=nullptr)\n- 140 {\n- 141 return smart_pointer_type{\n- 142 buf,\n- 143 internal::freemallocmem_templated};\n- 144 }\n- 145\n- 146 smart_pointer_type m_buf;\n- 147 size_type m_size;\n- 148};\n- 149}\n- 150\n- 151#include \"pqxx/compiler-internal-post.hxx\"\n- 152\n- 153#endif\n+ 104#include \"pqxx/compiler-internal-post.hxx\"\n+ 105#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::binarystring\n-Binary data corresponding to PostgreSQL's \"BYTEA\" binary-string type.\n-Definition: binarystring.hxx:54\n-pqxx::binarystring::crend\n-const_reverse_iterator crend() const\n-Definition: binarystring.hxx:99\n-pqxx::binarystring::rbegin\n-const_reverse_iterator rbegin() const\n-Definition: binarystring.hxx:94\n-pqxx::binarystring::const_iterator\n-const_pointer const_iterator\n-Definition: binarystring.hxx:62\n-pqxx::binarystring::const_reference\n-const value_type & const_reference\n-Definition: binarystring.hxx:60\n-pqxx::binarystring::const_pointer\n-const value_type * const_pointer\n-Definition: binarystring.hxx:61\n-pqxx::binarystring::end\n-const_iterator end() const noexcept\n-Definition: binarystring.hxx:87\n-pqxx::binarystring::begin\n-const_iterator begin() const noexcept\n-Definition: binarystring.hxx:85\n-pqxx::binarystring::value_type\n-std::char_traits< char_type >::char_type value_type\n-Definition: binarystring.hxx:57\n-pqxx::binarystring::difference_type\n-long difference_type\n-Definition: binarystring.hxx:59\n-pqxx::binarystring::crbegin\n-const_reverse_iterator crbegin() const\n-Definition: binarystring.hxx:96\n-pqxx::binarystring::front\n-const_reference front() const noexcept\n-Definition: binarystring.hxx:90\n-pqxx::binarystring::back\n-const_reference back() const noexcept\n-Definition: binarystring.hxx:91\n-pqxx::binarystring::operator!=\n-bool operator!=(const binarystring &rhs) const noexcept\n-Definition: binarystring.hxx:108\n-pqxx::binarystring::empty\n-bool empty() const noexcept\n-Definition: binarystring.hxx:83\n-pqxx::binarystring::binarystring\n-binarystring(const binarystring &)=default\n-pqxx::binarystring::operator[]\n-const_reference operator[](size_type i) const noexcept\n-Definition: binarystring.hxx:104\n-pqxx::binarystring::cend\n-const_iterator cend() const noexcept\n-Definition: binarystring.hxx:88\n-pqxx::binarystring::rend\n-const_reverse_iterator rend() const\n-Definition: binarystring.hxx:97\n-pqxx::binarystring::length\n-size_type length() const noexcept\n-Size of converted string in bytes.\n-Definition: binarystring.hxx:82\n-pqxx::binarystring::char_type\n-unsigned char char_type\n-Definition: binarystring.hxx:56\n-pqxx::binarystring::size_type\n-size_t size_type\n-Definition: binarystring.hxx:58\n-pqxx::binarystring::data\n-const value_type * data() const noexcept\n-Unescaped field contents.\n-Definition: binarystring.hxx:102\n-pqxx::binarystring::const_reverse_iterator\n-std::reverse_iterator< const_iterator > const_reverse_iterator\n-Definition: binarystring.hxx:63\n-pqxx::binarystring::cbegin\n-const_iterator cbegin() const noexcept\n-Definition: binarystring.hxx:86\n-pqxx::binarystring::get\n-const char * get() const noexcept\n-Raw character buffer (no terminating zero is added)\n-Definition: binarystring.hxx:123\n-pqxx::binarystring::size\n-size_type size() const noexcept\n-Size of converted string in bytes.\n-Definition: binarystring.hxx:80\n-pqxx::field\n-Reference to a field in a result set.\n-Definition: field.hxx:50\n+pqxx::dbtransaction\n+Abstract base class responsible for bracketing a backend transaction.\n+Definition: dbtransaction.hxx:63\n+pqxx::subtransaction\n+\"Transaction\" nested within another transaction\n+Definition: subtransaction.hxx:82\n+pqxx::subtransaction::~subtransaction\n+virtual ~subtransaction() noexcept\n+Definition: subtransaction.hxx:92\n+pqxx::internal::transactionfocus\n+Definition: transaction_base.hxx:44\n * include\n * pqxx\n- * binarystring.hxx\n+ * subtransaction.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00107_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00107_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: transaction_base.hxx Source File\n+libpqxx: array.hxx Source File\n \n \n \n \n \n \n \n@@ -55,461 +55,90 @@\n \n
\n
\n-
transaction_base.hxx
\n+
array.hxx
\n
\n
\n
1
\n-
14#ifndef PQXX_H_TRANSACTION_BASE
\n-
15#define PQXX_H_TRANSACTION_BASE
\n+
11#ifndef PQXX_H_ARRAY
\n+
12#define PQXX_H_ARRAY
\n+
13
\n+
14#include "pqxx/compiler-public.hxx"
\n+
15#include "pqxx/compiler-internal-pre.hxx"
\n
16
\n-
17#include "pqxx/compiler-public.hxx"
\n-
18#include "pqxx/compiler-internal-pre.hxx"
\n+
17#include "pqxx/internal/encoding_group.hxx"
\n+
18#include "pqxx/internal/encodings.hxx"
\n
19
\n-
20/* End-user programs need not include this file, unless they define their own
\n-
21 * transaction classes. This is not something the typical program should want
\n-
22 * to do.
\n-
23 *
\n-
24 * However, reading this file is worthwhile because it defines the public
\n-
25 * interface for the available transaction classes such as transaction and
\n-
26 * nontransaction.
\n-
27 */
\n+
20#include <stdexcept>
\n+
21#include <string>
\n+
22#include <utility>
\n+
23
\n+
24
\n+
25namespace pqxx
\n+
26{
\n
28
\n-
29#include "pqxx/connection_base.hxx"
\n-
30#include "pqxx/internal/encoding_group.hxx"
\n-
31#include "pqxx/isolation.hxx"
\n-
32#include "pqxx/result.hxx"
\n-
33#include "pqxx/row.hxx"
\n-
34
\n-
35// Methods tested in eg. test module test01 are marked with "//[t01]".
\n-
36
\n-
37namespace pqxx
\n-
38{
\n-
39namespace internal
\n-
40{
\n-
41class sql_cursor;
\n-
42
\n-
43class PQXX_LIBEXPORT transactionfocus : public virtual namedclass
\n-
44{
\n-
45public:
\n-\n-
47 namedclass{"transactionfocus"},
\n-
48 m_trans{t},
\n-
49 m_registered{false}
\n-
50 {
\n-
51 }
\n-
52
\n-\n-\n-\n-
56
\n-
57protected:
\n-
58 void register_me();
\n-
59 void unregister_me() noexcept;
\n-
60 void reg_pending_error(const std::string &) noexcept;
\n-
61 bool registered() const noexcept { return m_registered; }
\n-
62
\n-\n-
64
\n-
65private:
\n-
66 bool m_registered;
\n-
67};
\n-
68
\n+
46class PQXX_LIBEXPORT array_parser
\n+
47{
\n+
48public:
\n+\n+
51 {
\n+\n+\n+\n+\n+\n+
62 };
\n+
63
\n+
64// XXX: Actually _pass_ encoding group!
\n+
66 explicit array_parser(
\n+
67 const char input[],
\n+
68 internal::encoding_group=internal::encoding_group::MONOBYTE);
\n
69
\n
71
\n-
73class PQXX_LIBEXPORT parameterized_invocation : statement_parameters
\n-
74{
\n-
75public:
\n-
76 PQXX_DEPRECATED parameterized_invocation(
\n-
77 connection_base &, const std::string &query);
\n-
78
\n-
79 parameterized_invocation &operator()() { add_param(); return *this; }
\n-\n-
81 { add_binary_param(v, true); return *this; }
\n-
82 template<typename T> parameterized_invocation &operator()(const T &v)
\n-
83 { add_param(v, true); return *this; }
\n-\n-
85 { add_binary_param(v, nonnull); return *this; }
\n-
86 template<typename T>
\n-
87 parameterized_invocation &operator()(const T &v, bool nonnull)
\n-
88 { add_param(v, nonnull); return *this; }
\n-
89
\n-
90 result exec();
\n-
91
\n-
92private:
\n-\n-
95 =delete;
\n-
96
\n-
97 connection_base &m_home;
\n-
98 const std::string m_query;
\n-
99};
\n-
100} // namespace internal
\n-
101
\n-
102
\n-
103namespace internal
\n-
104{
\n-
105namespace gate
\n-
106{
\n-
107class transaction_subtransaction;
\n-
108class transaction_tablereader;
\n-
109class transaction_sql_cursor;
\n-
110class transaction_stream_from;
\n-
111class transaction_tablewriter;
\n-
112class transaction_stream_to;
\n-
113class transaction_transactionfocus;
\n-
114} // namespace internal::gate
\n-
115} // namespace internal
\n-
116
\n-
117
\n-
131
\n-
136class PQXX_LIBEXPORT PQXX_NOVTABLE transaction_base :
\n-
137 public virtual internal::namedclass
\n-
138{
\n-
139public:
\n-\n-
142
\n-\n-\n-\n-
146
\n-
147 virtual ~transaction_base() =0; //[t01]
\n-
148
\n-
150
\n-
162 void commit(); //[t01]
\n-
163
\n-
165
\n-
168 void abort(); //[t10]
\n-
169
\n-
175 std::string esc(const char str[]) const { return conn().esc(str); }
\n-
177 std::string esc(const char str[], size_t maxlen) const
\n-
178 { return conn().esc(str, maxlen); }
\n-
180 std::string esc(const std::string &str) const { return conn().esc(str); }
\n-
181
\n-
183
\n-
194 std::string esc_raw(const unsigned char data[], size_t len) const //[t62]
\n-
195 { return conn().esc_raw(data, len); }
\n-
197 std::string esc_raw(const std::string &) const; //[t62]
\n-
198
\n-
200
\n-
203 std::string unesc_raw(const std::string &text) const
\n-
204 { return conn().unesc_raw(text); }
\n-
205
\n-
207
\n-
210 std::string unesc_raw(const char *text) const
\n-
211 { return conn().unesc_raw(text); }
\n-
212
\n-
214
\n-
215 template<typename T> std::string quote(const T &t) const
\n-
216 { return conn().quote(t); }
\n-
217
\n-
219 std::string quote_raw(const unsigned char str[], size_t len) const
\n-
220 { return conn().quote_raw(str, len); }
\n-
221
\n-
222 std::string quote_raw(const std::string &str) const;
\n-
223
\n-
225 std::string quote_name(const std::string &identifier) const
\n-
226 { return conn().quote_name(identifier); }
\n-
227
\n-
229 std::string esc_like(const std::string &str, char escape_char='\\\\') const
\n-
230 { return conn().esc_like(str, escape_char); }
\n-
232
\n-
234
\n-
249 result exec(
\n-
250 const std::string &Query,
\n-
251 const std::string &Desc=std::string{}); //[t01]
\n-
252
\n-\n-
254 const std::stringstream &Query,
\n-
255 const std::string &Desc=std::string{})
\n-
256 { return exec(Query.str(), Desc); }
\n-
257
\n-
259
\n-\n-
265 const std::string &Query,
\n-
266 const std::string &Desc=std::string{})
\n-
267 { return exec_n(0, Query, Desc); }
\n-
268
\n-
270
\n-
276 row exec1(const std::string &Query, const std::string &Desc=std::string{})
\n-
277 { return exec_n(1, Query, Desc).front(); }
\n-
278
\n-
280
\n-
285 result exec_n(
\n-
286 size_t rows,
\n-
287 const std::string &Query,
\n-
288 const std::string &Desc=std::string{});
\n-
289
\n-
320 template<typename ...Args>
\n-
321 result exec_params(const std::string &query, Args &&...args)
\n-
322 {
\n-
323 return internal_exec_params(
\n-
324 query, internal::params(std::forward<Args>(args)...));
\n-
325 }
\n-
326
\n-
327 // Execute parameterised statement, expect a single-row result.
\n-
330 template<typename ...Args>
\n-
331 row exec_params1(const std::string &query, Args&&... args)
\n-
332 {
\n-
333 return exec_params_n(1, query, std::forward<Args>(args)...).front();
\n-
334 }
\n-
335
\n-
336 // Execute parameterised statement, expect a result with zero rows.
\n-
339 template<typename ...Args>
\n-
340 result exec_params0(const std::string &query, Args &&...args)
\n-
341 {
\n-
342 return exec_params_n(0, query, std::forward<Args>(args)...);
\n-
343 }
\n-
344
\n-
345 // Execute parameterised statement, expect exactly a given number of rows.
\n-
348 template<typename ...Args>
\n-
349 result exec_params_n(size_t rows, const std::string &query, Args &&...args)
\n-
350 {
\n-
351 const auto r = exec_params(query, std::forward<Args>(args)...);
\n-
352 check_rowcount_params(rows, r.size());
\n-
353 return r;
\n-
354 }
\n-
355
\n-
357 /* Use this to build up a parameterized statement invocation, then invoke it
\n-
358 * using @c exec()
\n-
359 *
\n-
360 * Example: @c trans.parameterized("SELECT $1 + 1")(1).exec();
\n-
361 *
\n-
362 * This is the old, pre-C++11 way of handling parameterised statements. As
\n-
363 * of libpqxx 6.0, it's made much easier using variadic templates.
\n-
364 */
\n-\n-
366 parameterized(const std::string &query);
\n-
368
\n-
393
\n-
395 template<typename ...Args>
\n-
396 result exec_prepared(const std::string &statement, Args&&... args)
\n-
397 {
\n-
398 return internal_exec_prepared(
\n-
399 statement, internal::params(std::forward<Args>(args)...));
\n-
400 }
\n-
401
\n-
403
\n-
405 template<typename ...Args>
\n-
406 row exec_prepared1(const std::string &statement, Args&&... args)
\n-
407 {
\n-
408 return exec_prepared_n(1, statement, std::forward<Args>(args)...).front();
\n-
409 }
\n-
410
\n-
412
\n-
414 template<typename ...Args>
\n-
415 result exec_prepared0(const std::string &statement, Args&&... args)
\n-
416 {
\n-
417 return exec_prepared_n(0, statement, std::forward<Args>(args)...);
\n-
418 }
\n-
419
\n-
421
\n-
424 template<typename ...Args>
\n-\n-
426 size_t rows,
\n-
427 const std::string &statement,
\n-
428 Args&&... args)
\n-
429 {
\n-
430 const auto r = exec_prepared(statement, std::forward<Args>(args)...);
\n-
431 check_rowcount_prepared(statement, rows, r.size());
\n-
432 return r;
\n-
433 }
\n-
434
\n-
436
\n-
474 PQXX_DEPRECATED prepare::invocation
\n-
475 prepared(const std::string &statement=std::string{});
\n-
476
\n-
478
\n-
484 void process_notice(const char Msg[]) const //[t14]
\n-
485 { m_conn.process_notice(Msg); }
\n-
487 void process_notice(const std::string &Msg) const //[t14]
\n-
488 { m_conn.process_notice(Msg); }
\n-
490
\n-
492 connection_base &conn() const { return m_conn; } //[t04]
\n-
493
\n-
495
\n-
502 void set_variable(const std::string &Var, const std::string &Val); //[t61]
\n-
503
\n-
505
\n-
514 std::string get_variable(const std::string &); //[t61]
\n-
515
\n-
516protected:
\n-
518
\n-
524 explicit transaction_base(connection_base &c, bool direct=true);
\n-
525
\n-
527
\n-
529 void Begin();
\n-
530
\n-
532 void End() noexcept;
\n-
533
\n-
535 virtual void do_begin() =0;
\n-
537 virtual result do_exec(const char Query[]) =0;
\n-
539 virtual void do_commit() =0;
\n-
541 virtual void do_abort() =0;
\n-
542
\n-
543 // For use by implementing class:
\n-
544
\n-
546
\n-
554 result direct_exec(const char C[], int Retries=0);
\n-
555
\n-
557 void reactivation_avoidance_clear() noexcept
\n-
558 {m_reactivation_avoidance.clear();}
\n-
559
\n-
560protected:
\n-
562
\n-\n-
565
\n-
566private:
\n-
567 /* A transaction goes through the following stages in its lifecycle:
\n-
568 * <ul>
\n-
569 * <li> nascent: the transaction hasn't actually begun yet. If our connection
\n-
570 * fails at this stage, it may recover and the transaction can attempt to
\n-
571 * establish itself again.
\n-
572 * <li> active: the transaction has begun. Since no commit command has been
\n-
573 * issued, abortion is implicit if the connection fails now.
\n-
574 * <li> aborted: an abort has been issued; the transaction is terminated and
\n-
575 * its changes to the database rolled back. It will accept no further
\n-
576 * commands.
\n-
577 * <li> committed: the transaction has completed successfully, meaning that a
\n-
578 * commit has been issued. No further commands are accepted.
\n-
579 * <li> in_doubt: the connection was lost at the exact wrong time, and there
\n-
580 * is no way of telling whether the transaction was committed or aborted.
\n-
581 * </ul>
\n-
582 *
\n-
583 * Checking and maintaining state machine logic is the responsibility of the
\n-
584 * base class (ie., this one).
\n-
585 */
\n-
586 enum Status
\n-
587 {
\n-
588 st_nascent,
\n-
589 st_active,
\n-
590 st_aborted,
\n-
591 st_committed,
\n-
592 st_in_doubt
\n-
593 };
\n-
594
\n-
596 PQXX_PRIVATE void activate();
\n-
597
\n-
598 PQXX_PRIVATE void CheckPendingError();
\n-
599
\n-
600 template<typename T> bool parm_is_null(T *p) const noexcept
\n-
601 { return p == nullptr; }
\n-
602 template<typename T> bool parm_is_null(T) const noexcept
\n-
603 { return false; }
\n-
604
\n-
605 result internal_exec_prepared(
\n-
606 const std::string &statement,
\n-
607 const internal::params &args);
\n-
608
\n-
609 result internal_exec_params(
\n-
610 const std::string &query,
\n-
611 const internal::params &args);
\n-
612
\n-
614 void check_rowcount_prepared(
\n-
615 const std::string &statement,
\n-
616 size_t expected_rows,
\n-
617 size_t actual_rows);
\n-
618
\n-
620 void check_rowcount_params(
\n-
621 size_t expected_rows, size_t actual_rows);
\n-
622
\n-
623 friend class pqxx::internal::gate::transaction_transactionfocus;
\n-
624 PQXX_PRIVATE void register_focus(internal::transactionfocus *);
\n-
625 PQXX_PRIVATE void unregister_focus(internal::transactionfocus *) noexcept;
\n-
626 PQXX_PRIVATE void register_pending_error(const std::string &) noexcept;
\n-
627
\n-
628 friend class pqxx::internal::gate::transaction_tablereader;
\n-
629 friend class pqxx::internal::gate::transaction_stream_from;
\n-
630 PQXX_PRIVATE void BeginCopyRead(const std::string &, const std::string &);
\n-
631 bool read_copy_line(std::string &);
\n-
632
\n-
633 friend class pqxx::internal::gate::transaction_tablewriter;
\n-
634 friend class pqxx::internal::gate::transaction_stream_to;
\n-
635 PQXX_PRIVATE void BeginCopyWrite(
\n-
636 const std::string &Table,
\n-
637 const std::string &Columns);
\n-
638 void write_copy_line(const std::string &);
\n-
639 void end_copy_write();
\n-
640
\n-
641 friend class pqxx::internal::gate::transaction_subtransaction;
\n-
642
\n-
643 connection_base &m_conn;
\n-
644
\n-\n-
646 Status m_status = st_nascent;
\n-
647 bool m_registered = false;
\n-
648 std::map<std::string, std::string> m_vars;
\n-
649 std::string m_pending_error;
\n-
650};
\n-
651
\n-
652} // namespace pqxx
\n-
653
\n-
654#include "pqxx/compiler-internal-post.hxx"
\n-
655#endif
\n-
std::string esc(const char str[]) const
Escape string for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:175
\n-
STL namespace.
\n+
76 std::pair<juncture, std::string> get_next();
\n+
77
\n+
78private:
\n+
79 const char *const m_input;
\n+
80 const std::string::size_type m_end;
\n+
81 internal::glyph_scanner_func *const m_scan;
\n+
82
\n+
84 std::string::size_type m_pos;
\n+
85
\n+
86 std::string::size_type scan_single_quoted_string() const;
\n+
87 std::string parse_single_quoted_string(std::string::size_type end) const;
\n+
88 std::string::size_type scan_double_quoted_string() const;
\n+
89 std::string parse_double_quoted_string(std::string::size_type end) const;
\n+
90 std::string::size_type scan_unquoted_string() const;
\n+
91 std::string parse_unquoted_string(std::string::size_type end) const;
\n+
92
\n+
93 std::string::size_type scan_glyph(std::string::size_type pos) const;
\n+
94 std::string::size_type scan_glyph(
\n+
95 std::string::size_type pos,
\n+
96 std::string::size_type end) const;
\n+
97};
\n+
98} // namespace pqxx
\n+
99
\n+
100#include "pqxx/compiler-internal-post.hxx"
\n+
101#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
\n-
Definition: connection_base.hxx:49
\n-
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
\n-
Helper class for passing parameters to, and executing, prepared statements.
Definition: prepared_statement.hxx:82
\n-
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n-
void clear() noexcept
Definition: result.hxx:121
\n-
Reference to one row in a result.
Definition: row.hxx:41
\n-
reference front() const noexcept
Definition: row.cxx:59
\n-
Definition: transaction_base.hxx:44
\n-\n-
transactionfocus(const transactionfocus &)=delete
\n-
transactionfocus & operator=(const transactionfocus &)=delete
\n-
transactionfocus(transaction_base &t)
Definition: transaction_base.hxx:46
\n-
transaction_base & m_trans
Definition: transaction_base.hxx:63
\n-
Helper class to construct an invocation of a parameterised statement.
Definition: transaction_base.hxx:74
\n-
parameterized_invocation & operator()(const binarystring &v, bool nonnull)
Definition: transaction_base.hxx:84
\n-
parameterized_invocation & operator()(const binarystring &v)
Definition: transaction_base.hxx:80
\n-
parameterized_invocation & operator()(const T &v)
Definition: transaction_base.hxx:82
\n-
parameterized_invocation & operator()()
Definition: transaction_base.hxx:79
\n-
parameterized_invocation & operator()(const T &v, bool nonnull)
Definition: transaction_base.hxx:87
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n-
result exec_params(const std::string &query, Args &&...args)
Execute an SQL statement with parameters.
Definition: transaction_base.hxx:321
\n-
std::string quote_raw(const unsigned char str[], size_t len) const
Binary-escape and quote a binarystring for use as an SQL constant.
Definition: transaction_base.hxx:219
\n-
result exec_params_n(size_t rows, const std::string &query, Args &&...args)
Definition: transaction_base.hxx:349
\n-
std::string esc(const char str[], size_t maxlen) const
Escape string for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:177
\n-
result exec(const std::stringstream &Query, const std::string &Desc=std::string{})
Definition: transaction_base.hxx:253
\n-
std::string quote(const T &t) const
Represent object as SQL string, including quoting & escaping.
Definition: transaction_base.hxx:215
\n-
transaction_base(const transaction_base &)=delete
\n-
result exec_prepared0(const std::string &statement, Args &&... args)
Execute a prepared statement, and expect a result with zero rows.
Definition: transaction_base.hxx:415
\n-
result exec_prepared(const std::string &statement, Args &&... args)
Execute a prepared statement, with optional arguments.
Definition: transaction_base.hxx:396
\n-
std::string esc_raw(const unsigned char data[], size_t len) const
Escape binary data for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:194
\n-
result exec0(const std::string &Query, const std::string &Desc=std::string{})
Execute query, which should zero rows of data.
Definition: transaction_base.hxx:264
\n-
transaction_base & operator=(const transaction_base &)=delete
\n-
result exec_prepared_n(size_t rows, const std::string &statement, Args &&... args)
Execute a prepared statement, expect a result with given number of rows.
Definition: transaction_base.hxx:425
\n-
connection_base & conn() const
Connection this transaction is running in.
Definition: transaction_base.hxx:492
\n-
void process_notice(const std::string &Msg) const
Have connection process warning message.
Definition: transaction_base.hxx:487
\n-
void process_notice(const char Msg[]) const
Have connection process warning message.
Definition: transaction_base.hxx:484
\n-
row exec_params1(const std::string &query, Args &&... args)
Definition: transaction_base.hxx:331
\n-\n-
std::string unesc_raw(const std::string &text) const
Unescape binary data, e.g. from a table field or notification payload.
Definition: transaction_base.hxx:203
\n-
result exec_params0(const std::string &query, Args &&...args)
Definition: transaction_base.hxx:340
\n-
std::string esc(const std::string &str) const
Escape string for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:180
\n-
std::string quote_name(const std::string &identifier) const
Escape an SQL identifier for use in a query.
Definition: transaction_base.hxx:225
\n-
row exec_prepared1(const std::string &statement, Args &&... args)
Execute a prepared statement, and expect a single-row result.
Definition: transaction_base.hxx:406
\n-
std::string unesc_raw(const char *text) const
Unescape binary data, e.g. from a table field or notification payload.
Definition: transaction_base.hxx:210
\n-
row exec1(const std::string &Query, const std::string &Desc=std::string{})
Execute query returning a single row of data.
Definition: transaction_base.hxx:276
\n-
internal::reactivation_avoidance_counter m_reactivation_avoidance
Resources allocated in this transaction that make reactivation impossible.
Definition: transaction_base.hxx:564
\n-
std::string esc_like(const std::string &str, char escape_char='\\\\') const
Escape string for literal LIKE match.
Definition: transaction_base.hxx:229
\n-
Helper base class: object descriptions for error messages and such.
Definition: util.hxx:234
\n-
Ensure proper opening/closing of GUEST objects related to a "host" object.
Definition: util.hxx:275
\n+
Low-level array parser.
Definition: array.hxx:47
\n+
juncture
What's the latest thing found in the array?
Definition: array.hxx:51
\n+
@ string_value
Found a string value.
Definition: array.hxx:59
\n+
@ row_end
Ending the current row.
Definition: array.hxx:55
\n+
@ done
Parsing has completed.
Definition: array.hxx:61
\n+
@ row_start
Starting a new row.
Definition: array.hxx:53
\n+
@ null_value
Found a NULL value.
Definition: array.hxx:57
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,582 +1,103 @@\n \n \n \n \n \n libpqxx\n \n-transaction_base.hxx\n+array.hxx\n 1\n- 14#ifndef PQXX_H_TRANSACTION_BASE\n- 15#define PQXX_H_TRANSACTION_BASE\n+ 11#ifndef PQXX_H_ARRAY\n+ 12#define PQXX_H_ARRAY\n+ 13\n+ 14#include \"pqxx/compiler-public.hxx\"\n+ 15#include \"pqxx/compiler-internal-pre.hxx\"\n 16\n- 17#include \"pqxx/compiler-public.hxx\"\n- 18#include \"pqxx/compiler-internal-pre.hxx\"\n+ 17#include \"pqxx/internal/encoding_group.hxx\"\n+ 18#include \"pqxx/internal/encodings.hxx\"\n 19\n- 20/* End-user programs need not include this file, unless they define their\n-own\n- 21 * transaction classes. This is not something the typical program should\n-want\n- 22 * to do.\n- 23 *\n- 24 * However, reading this file is worthwhile because it defines the public\n- 25 * interface for the available transaction classes such as transaction and\n- 26 * nontransaction.\n- 27 */\n+ 20#include \n+ 21#include \n+ 22#include \n+ 23\n+ 24\n+25namespace pqxx\n+ 26{\n 28\n- 29#include \"pqxx/connection_base.hxx\"\n- 30#include \"pqxx/internal/encoding_group.hxx\"\n- 31#include \"pqxx/isolation.hxx\"\n- 32#include \"pqxx/result.hxx\"\n- 33#include \"pqxx/row.hxx\"\n- 34\n- 35// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n- 36\n- 37namespace pqxx\n- 38{\n- 39namespace internal\n- 40{\n- 41class sql_cursor;\n- 42\n-43class PQXX_LIBEXPORT transactionfocus : public virtual namedclass\n- 44{\n- 45public:\n-46 explicit transactionfocus(transaction_base &t) :\n- 47 namedclass{\"transactionfocus\"},\n- 48 m_trans{t},\n- 49 m_registered{false}\n- 50 {\n- 51 }\n- 52\n-53 transactionfocus() =delete;\n-54 transactionfocus(const transactionfocus &) =delete;\n-55 transactionfocus &operator=(const transactionfocus &) =delete;\n- 56\n- 57protected:\n- 58 void register_me();\n- 59 void unregister_me() noexcept;\n- 60 void reg_pending_error(const std::string &) noexcept;\n-61 bool registered() const noexcept { return m_registered; }\n- 62\n-63 transaction_base &m_trans;\n- 64\n- 65private:\n- 66 bool m_registered;\n- 67};\n- 68\n+46class PQXX_LIBEXPORT array_parser\n+ 47{\n+ 48public:\n+50 enum juncture\n+ 51 {\n+53 row_start,\n+55 row_end,\n+57 null_value,\n+59 string_value,\n+61 done,\n+ 62 };\n+ 63\n+ 64// XXX: Actually _pass_ encoding group!\n+ 66 explicit array_parser(\n+ 67 const char input[],\n+ 68 internal::encoding_group=internal::encoding_group::MONOBYTE);\n 69\n 71\n-73class PQXX_LIBEXPORT parameterized_invocation : statement_parameters\n- 74{\n- 75public:\n- 76 PQXX_DEPRECATED parameterized_invocation(\n- 77 connection_base &, const std::string &query);\n- 78\n-79 parameterized_invocation &operator()() { add_param(); return *this; }\n-80 parameterized_invocation &operator()(const binarystring &v)\n- 81 { add_binary_param(v, true); return *this; }\n-82 template parameterized_invocation &operator()(const T &v)\n- 83 { add_param(v, true); return *this; }\n-84 parameterized_invocation &operator()(const binarystring &v, bool nonnull)\n- 85 { add_binary_param(v, nonnull); return *this; }\n- 86 template\n-87 parameterized_invocation &operator()(const T &v, bool nonnull)\n- 88 { add_param(v, nonnull); return *this; }\n- 89\n- 90 result exec();\n- 91\n- 92private:\n- 94 parameterized_invocation &operator=(const parameterized_invocation &)\n- 95 =delete;\n- 96\n- 97 connection_base &m_home;\n- 98 const std::string m_query;\n- 99};\n- 100} // namespace internal\n- 101\n- 102\n- 103namespace internal\n- 104{\n- 105namespace gate\n- 106{\n- 107class transaction_subtransaction;\n- 108class transaction_tablereader;\n- 109class transaction_sql_cursor;\n- 110class transaction_stream_from;\n- 111class transaction_tablewriter;\n- 112class transaction_stream_to;\n- 113class transaction_transactionfocus;\n- 114} // namespace internal::gate\n- 115} // namespace internal\n- 116\n- 117\n- 131\n-136class PQXX_LIBEXPORT PQXX_NOVTABLE transaction_base :\n- 137 public virtual internal::namedclass\n- 138{\n- 139public:\n-141 using isolation_tag = isolation_traits;\n- 142\n-143 transaction_base() =delete;\n-144 transaction_base(const transaction_base &) =delete;\n-145 transaction_base &operator=(const transaction_base &) =delete;\n- 146\n- 147 virtual ~transaction_base() =0; //[t01]\n- 148\n- 150\n- 162 void commit(); //[t01]\n- 163\n- 165\n- 168 void abort(); //[t10]\n- 169\n-175 std::string esc(const char str[]) const { return conn().esc(str); }\n-177 std::string esc(const char str[], size_t maxlen) const\n- 178 { return conn().esc(str, maxlen); }\n-180 std::string esc(const std::string &str) const { return conn().esc(str); }\n- 181\n- 183\n-194 std::string esc_raw(const unsigned char data[], size_t len) const //[t62]\n- 195 { return conn().esc_raw(data, len); }\n- 197 std::string esc_raw(const std::string &) const; //[t62]\n- 198\n- 200\n-203 std::string unesc_raw(const std::string &text) const\n- 204 { return conn().unesc_raw(text); }\n- 205\n- 207\n-210 std::string unesc_raw(const char *text) const\n- 211 { return conn().unesc_raw(text); }\n- 212\n- 214\n-215 template std::string quote(const T &t) const\n- 216 { return conn().quote(t); }\n- 217\n-219 std::string quote_raw(const unsigned char str[], size_t len) const\n- 220 { return conn().quote_raw(str, len); }\n- 221\n- 222 std::string quote_raw(const std::string &str) const;\n- 223\n-225 std::string quote_name(const std::string &identifier) const\n- 226 { return conn().quote_name(identifier); }\n- 227\n-229 std::string esc_like(const std::string &str, char escape_char='\\\\') const\n- 230 { return conn().esc_like(str, escape_char); }\n- 232\n- 234\n- 249 result exec(\n- 250 const std::string &Query,\n- 251 const std::string &Desc=std::string{}); //[t01]\n- 252\n-253 result exec(\n- 254 const std::stringstream &Query,\n- 255 const std::string &Desc=std::string{})\n- 256 { return exec(Query.str(), Desc); }\n- 257\n- 259\n-264 result exec0(\n- 265 const std::string &Query,\n- 266 const std::string &Desc=std::string{})\n- 267 { return exec_n(0, Query, Desc); }\n- 268\n- 270\n-276 row exec1(const std::string &Query, const std::string &Desc=std::string{})\n- 277 { return exec_n(1, Query, Desc).front(); }\n- 278\n- 280\n- 285 result exec_n(\n- 286 size_t rows,\n- 287 const std::string &Query,\n- 288 const std::string &Desc=std::string{});\n- 289\n- 320 template\n-321 result exec_params(const std::string &query, Args &&...args)\n- 322 {\n- 323 return internal_exec_params(\n- 324 query, internal::params(std::forward(args)...));\n- 325 }\n- 326\n- 327 // Execute parameterised statement, expect a single-row result.\n- 330 template\n-331 row exec_params1(const std::string &query, Args&&... args)\n- 332 {\n- 333 return exec_params_n(1, query, std::forward(args)...).front();\n- 334 }\n- 335\n- 336 // Execute parameterised statement, expect a result with zero rows.\n- 339 template\n-340 result exec_params0(const std::string &query, Args &&...args)\n- 341 {\n- 342 return exec_params_n(0, query, std::forward(args)...);\n- 343 }\n- 344\n- 345 // Execute parameterised statement, expect exactly a given number of rows.\n- 348 template\n-349 result exec_params_n(size_t rows, const std::string &query, Args &&...args)\n- 350 {\n- 351 const auto r = exec_params(query, std::forward(args)...);\n- 352 check_rowcount_params(rows, r.size());\n- 353 return r;\n- 354 }\n- 355\n- 357 /* Use this to build up a parameterized statement invocation, then invoke\n-it\n- 358 * using @c exec()\n- 359 *\n- 360 * Example: @c trans.parameterized(\"SELECT $1 + 1\")(1).exec();\n- 361 *\n- 362 * This is the old, pre-C++11 way of handling parameterised statements. As\n- 363 * of libpqxx 6.0, it's made much easier using variadic templates.\n- 364 */\n- 365 PQXX_DEPRECATED internal::parameterized_invocation\n- 366 parameterized(const std::string &query);\n- 368\n- 393\n- 395 template\n-396 result exec_prepared(const std::string &statement, Args&&... args)\n- 397 {\n- 398 return internal_exec_prepared(\n- 399 statement, internal::params(std::forward(args)...));\n- 400 }\n- 401\n- 403\n- 405 template\n-406 row exec_prepared1(const std::string &statement, Args&&... args)\n- 407 {\n- 408 return exec_prepared_n(1, statement, std::forward(args)...).front();\n- 409 }\n- 410\n- 412\n- 414 template\n-415 result exec_prepared0(const std::string &statement, Args&&... args)\n- 416 {\n- 417 return exec_prepared_n(0, statement, std::forward(args)...);\n- 418 }\n- 419\n- 421\n- 424 template\n-425 result exec_prepared_n(\n- 426 size_t rows,\n- 427 const std::string &statement,\n- 428 Args&&... args)\n- 429 {\n- 430 const auto r = exec_prepared(statement, std::forward(args)...);\n- 431 check_rowcount_prepared(statement, rows, r.size());\n- 432 return r;\n- 433 }\n- 434\n- 436\n- 474 PQXX_DEPRECATED prepare::invocation\n- 475 prepared(const std::string &statement=std::string{});\n- 476\n- 478\n-484 void process_notice(const char Msg[]) const //[t14]\n- 485 { m_conn.process_notice(Msg); }\n-487 void process_notice(const std::string &Msg) const //[t14]\n- 488 { m_conn.process_notice(Msg); }\n- 490\n-492 connection_base &conn() const { return m_conn; } //[t04]\n- 493\n- 495\n- 502 void set_variable(const std::string &Var, const std::string &Val); //[t61]\n- 503\n- 505\n- 514 std::string get_variable(const std::string &); //[t61]\n- 515\n- 516protected:\n- 518\n- 524 explicit transaction_base(connection_base &c, bool direct=true);\n- 525\n- 527\n- 529 void Begin();\n- 530\n- 532 void End() noexcept;\n- 533\n-535 virtual void do_begin() =0;\n-537 virtual result do_exec(const char Query[]) =0;\n-539 virtual void do_commit() =0;\n-541 virtual void do_abort() =0;\n- 542\n- 543 // For use by implementing class:\n- 544\n- 546\n- 554 result direct_exec(const char C[], int Retries=0);\n- 555\n-557 void reactivation_avoidance_clear() noexcept\n- 558 {m_reactivation_avoidance.clear();}\n- 559\n- 560protected:\n- 562\n-564 internal::reactivation_avoidance_counter m_reactivation_avoidance;\n- 565\n- 566private:\n- 567 /* A transaction goes through the following stages in its lifecycle:\n- 568 *
    \n- 569 *
  • nascent: the transaction hasn't actually begun yet. If our\n-connection\n- 570 * fails at this stage, it may recover and the transaction can attempt to\n- 571 * establish itself again.\n- 572 *
  • active: the transaction has begun. Since no commit command has been\n- 573 * issued, abortion is implicit if the connection fails now.\n- 574 *
  • aborted: an abort has been issued; the transaction is terminated\n-and\n- 575 * its changes to the database rolled back. It will accept no further\n- 576 * commands.\n- 577 *
  • committed: the transaction has completed successfully, meaning that\n-a\n- 578 * commit has been issued. No further commands are accepted.\n- 579 *
  • in_doubt: the connection was lost at the exact wrong time, and\n-there\n- 580 * is no way of telling whether the transaction was committed or aborted.\n- 581 *
\n- 582 *\n- 583 * Checking and maintaining state machine logic is the responsibility of\n-the\n- 584 * base class (ie., this one).\n- 585 */\n- 586 enum Status\n- 587 {\n- 588 st_nascent,\n- 589 st_active,\n- 590 st_aborted,\n- 591 st_committed,\n- 592 st_in_doubt\n- 593 };\n- 594\n- 596 PQXX_PRIVATE void activate();\n- 597\n- 598 PQXX_PRIVATE void CheckPendingError();\n- 599\n- 600 template bool parm_is_null(T *p) const noexcept\n- 601 { return p == nullptr; }\n- 602 template bool parm_is_null(T) const noexcept\n- 603 { return false; }\n- 604\n- 605 result internal_exec_prepared(\n- 606 const std::string &statement,\n- 607 const internal::params &args);\n- 608\n- 609 result internal_exec_params(\n- 610 const std::string &query,\n- 611 const internal::params &args);\n- 612\n- 614 void check_rowcount_prepared(\n- 615 const std::string &statement,\n- 616 size_t expected_rows,\n- 617 size_t actual_rows);\n- 618\n- 620 void check_rowcount_params(\n- 621 size_t expected_rows, size_t actual_rows);\n- 622\n-623 friend class pqxx::internal::gate::transaction_transactionfocus;\n- 624 PQXX_PRIVATE void register_focus(internal::transactionfocus *);\n- 625 PQXX_PRIVATE void unregister_focus(internal::transactionfocus *) noexcept;\n- 626 PQXX_PRIVATE void register_pending_error(const std::string &) noexcept;\n- 627\n-628 friend class pqxx::internal::gate::transaction_tablereader;\n-629 friend class pqxx::internal::gate::transaction_stream_from;\n- 630 PQXX_PRIVATE void BeginCopyRead(const std::string &, const std::string &);\n- 631 bool read_copy_line(std::string &);\n- 632\n-633 friend class pqxx::internal::gate::transaction_tablewriter;\n-634 friend class pqxx::internal::gate::transaction_stream_to;\n- 635 PQXX_PRIVATE void BeginCopyWrite(\n- 636 const std::string &Table,\n- 637 const std::string &Columns);\n- 638 void write_copy_line(const std::string &);\n- 639 void end_copy_write();\n- 640\n-641 friend class pqxx::internal::gate::transaction_subtransaction;\n- 642\n- 643 connection_base &m_conn;\n- 644\n- 645 internal::unique m_focus;\n- 646 Status m_status = st_nascent;\n- 647 bool m_registered = false;\n- 648 std::map m_vars;\n- 649 std::string m_pending_error;\n- 650};\n- 651\n- 652} // namespace pqxx\n- 653\n- 654#include \"pqxx/compiler-internal-post.hxx\"\n- 655#endif\n-pqxx::transaction_base::esc\n-std::string esc(const char str[]) const\n-Escape string for use as SQL string literal in this transaction.\n-Definition: transaction_base.hxx:175\n-std\n-STL namespace.\n+ 76 std::pair get_next();\n+ 77\n+ 78private:\n+ 79 const char *const m_input;\n+ 80 const std::string::size_type m_end;\n+ 81 internal::glyph_scanner_func *const m_scan;\n+ 82\n+ 84 std::string::size_type m_pos;\n+ 85\n+ 86 std::string::size_type scan_single_quoted_string() const;\n+ 87 std::string parse_single_quoted_string(std::string::size_type end) const;\n+ 88 std::string::size_type scan_double_quoted_string() const;\n+ 89 std::string parse_double_quoted_string(std::string::size_type end) const;\n+ 90 std::string::size_type scan_unquoted_string() const;\n+ 91 std::string parse_unquoted_string(std::string::size_type end) const;\n+ 92\n+ 93 std::string::size_type scan_glyph(std::string::size_type pos) const;\n+ 94 std::string::size_type scan_glyph(\n+ 95 std::string::size_type pos,\n+ 96 std::string::size_type end) const;\n+ 97};\n+ 98} // namespace pqxx\n+ 99\n+ 100#include \"pqxx/compiler-internal-post.hxx\"\n+ 101#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::binarystring\n-Binary data corresponding to PostgreSQL's \"BYTEA\" binary-string type.\n-Definition: binarystring.hxx:54\n-pqxx::internal::reactivation_avoidance_counter\n-Definition: connection_base.hxx:49\n-pqxx::connection_base\n-connection_base abstract base class; represents a connection to a database.\n-Definition: connection_base.hxx:140\n-pqxx::isolation_traits\n-Traits class to describe an isolation level; primarly for libpqxx's own use.\n-Definition: isolation.hxx:66\n-pqxx::prepare::invocation\n-Helper class for passing parameters to, and executing, prepared statements.\n-Definition: prepared_statement.hxx:82\n-pqxx::result\n-Result set containing data returned by a query or command.\n-Definition: result.hxx:70\n-pqxx::result::clear\n-void clear() noexcept\n-Definition: result.hxx:121\n-pqxx::row\n-Reference to one row in a result.\n-Definition: row.hxx:41\n-pqxx::row::front\n-reference front() const noexcept\n-Definition: row.cxx:59\n-pqxx::internal::transactionfocus\n-Definition: transaction_base.hxx:44\n-pqxx::internal::transactionfocus::transactionfocus\n-transactionfocus()=delete\n-pqxx::internal::transactionfocus::transactionfocus\n-transactionfocus(const transactionfocus &)=delete\n-pqxx::internal::transactionfocus::operator=\n-transactionfocus & operator=(const transactionfocus &)=delete\n-pqxx::internal::transactionfocus::transactionfocus\n-transactionfocus(transaction_base &t)\n-Definition: transaction_base.hxx:46\n-pqxx::internal::transactionfocus::m_trans\n-transaction_base & m_trans\n-Definition: transaction_base.hxx:63\n-pqxx::internal::parameterized_invocation\n-Helper class to construct an invocation of a parameterised statement.\n-Definition: transaction_base.hxx:74\n-pqxx::internal::parameterized_invocation::operator()\n-parameterized_invocation & operator()(const binarystring &v, bool nonnull)\n-Definition: transaction_base.hxx:84\n-pqxx::internal::parameterized_invocation::operator()\n-parameterized_invocation & operator()(const binarystring &v)\n-Definition: transaction_base.hxx:80\n-pqxx::internal::parameterized_invocation::operator()\n-parameterized_invocation & operator()(const T &v)\n-Definition: transaction_base.hxx:82\n-pqxx::internal::parameterized_invocation::operator()\n-parameterized_invocation & operator()()\n-Definition: transaction_base.hxx:79\n-pqxx::internal::parameterized_invocation::operator()\n-parameterized_invocation & operator()(const T &v, bool nonnull)\n-Definition: transaction_base.hxx:87\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n-pqxx::transaction_base::exec_params\n-result exec_params(const std::string &query, Args &&...args)\n-Execute an SQL statement with parameters.\n-Definition: transaction_base.hxx:321\n-pqxx::transaction_base::quote_raw\n-std::string quote_raw(const unsigned char str[], size_t len) const\n-Binary-escape and quote a binarystring for use as an SQL constant.\n-Definition: transaction_base.hxx:219\n-pqxx::transaction_base::exec_params_n\n-result exec_params_n(size_t rows, const std::string &query, Args &&...args)\n-Definition: transaction_base.hxx:349\n-pqxx::transaction_base::esc\n-std::string esc(const char str[], size_t maxlen) const\n-Escape string for use as SQL string literal in this transaction.\n-Definition: transaction_base.hxx:177\n-pqxx::transaction_base::exec\n-result exec(const std::stringstream &Query, const std::string &Desc=std::string\n-{})\n-Definition: transaction_base.hxx:253\n-pqxx::transaction_base::quote\n-std::string quote(const T &t) const\n-Represent object as SQL string, including quoting & escaping.\n-Definition: transaction_base.hxx:215\n-pqxx::transaction_base::transaction_base\n-transaction_base(const transaction_base &)=delete\n-pqxx::transaction_base::exec_prepared0\n-result exec_prepared0(const std::string &statement, Args &&... args)\n-Execute a prepared statement, and expect a result with zero rows.\n-Definition: transaction_base.hxx:415\n-pqxx::transaction_base::exec_prepared\n-result exec_prepared(const std::string &statement, Args &&... args)\n-Execute a prepared statement, with optional arguments.\n-Definition: transaction_base.hxx:396\n-pqxx::transaction_base::esc_raw\n-std::string esc_raw(const unsigned char data[], size_t len) const\n-Escape binary data for use as SQL string literal in this transaction.\n-Definition: transaction_base.hxx:194\n-pqxx::transaction_base::exec0\n-result exec0(const std::string &Query, const std::string &Desc=std::string{})\n-Execute query, which should zero rows of data.\n-Definition: transaction_base.hxx:264\n-pqxx::transaction_base::operator=\n-transaction_base & operator=(const transaction_base &)=delete\n-pqxx::transaction_base::exec_prepared_n\n-result exec_prepared_n(size_t rows, const std::string &statement, Args &&...\n-args)\n-Execute a prepared statement, expect a result with given number of rows.\n-Definition: transaction_base.hxx:425\n-pqxx::transaction_base::conn\n-connection_base & conn() const\n-Connection this transaction is running in.\n-Definition: transaction_base.hxx:492\n-pqxx::transaction_base::process_notice\n-void process_notice(const std::string &Msg) const\n-Have connection process warning message.\n-Definition: transaction_base.hxx:487\n-pqxx::transaction_base::process_notice\n-void process_notice(const char Msg[]) const\n-Have connection process warning message.\n-Definition: transaction_base.hxx:484\n-pqxx::transaction_base::exec_params1\n-row exec_params1(const std::string &query, Args &&... args)\n-Definition: transaction_base.hxx:331\n-pqxx::transaction_base::transaction_base\n-transaction_base()=delete\n-pqxx::transaction_base::unesc_raw\n-std::string unesc_raw(const std::string &text) const\n-Unescape binary data, e.g. from a table field or notification payload.\n-Definition: transaction_base.hxx:203\n-pqxx::transaction_base::exec_params0\n-result exec_params0(const std::string &query, Args &&...args)\n-Definition: transaction_base.hxx:340\n-pqxx::transaction_base::esc\n-std::string esc(const std::string &str) const\n-Escape string for use as SQL string literal in this transaction.\n-Definition: transaction_base.hxx:180\n-pqxx::transaction_base::quote_name\n-std::string quote_name(const std::string &identifier) const\n-Escape an SQL identifier for use in a query.\n-Definition: transaction_base.hxx:225\n-pqxx::transaction_base::exec_prepared1\n-row exec_prepared1(const std::string &statement, Args &&... args)\n-Execute a prepared statement, and expect a single-row result.\n-Definition: transaction_base.hxx:406\n-pqxx::transaction_base::unesc_raw\n-std::string unesc_raw(const char *text) const\n-Unescape binary data, e.g. from a table field or notification payload.\n-Definition: transaction_base.hxx:210\n-pqxx::transaction_base::exec1\n-row exec1(const std::string &Query, const std::string &Desc=std::string{})\n-Execute query returning a single row of data.\n-Definition: transaction_base.hxx:276\n-pqxx::transaction_base::m_reactivation_avoidance\n-internal::reactivation_avoidance_counter m_reactivation_avoidance\n-Resources allocated in this transaction that make reactivation impossible.\n-Definition: transaction_base.hxx:564\n-pqxx::transaction_base::esc_like\n-std::string esc_like(const std::string &str, char escape_char='\\\\') const\n-Escape string for literal LIKE match.\n-Definition: transaction_base.hxx:229\n-pqxx::internal::namedclass\n-Helper base class: object descriptions for error messages and such.\n-Definition: util.hxx:234\n-pqxx::internal::unique\n-Ensure proper opening/closing of GUEST objects related to a \"host\" object.\n-Definition: util.hxx:275\n+pqxx::array_parser\n+Low-level array parser.\n+Definition: array.hxx:47\n+pqxx::array_parser::juncture\n+juncture\n+What's the latest thing found in the array?\n+Definition: array.hxx:51\n+pqxx::array_parser::string_value\n+@ string_value\n+Found a string value.\n+Definition: array.hxx:59\n+pqxx::array_parser::row_end\n+@ row_end\n+Ending the current row.\n+Definition: array.hxx:55\n+pqxx::array_parser::done\n+@ done\n+Parsing has completed.\n+Definition: array.hxx:61\n+pqxx::array_parser::row_start\n+@ row_start\n+Starting a new row.\n+Definition: array.hxx:53\n+pqxx::array_parser::null_value\n+@ null_value\n+Found a NULL value.\n+Definition: array.hxx:57\n * include\n * pqxx\n- * transaction_base.hxx\n+ * array.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00110_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00110_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: connection_base.hxx Source File\n+libpqxx: compiler-public.hxx Source File\n \n \n \n \n \n \n \n@@ -55,485 +55,133 @@\n \n
\n
\n-
connection_base.hxx
\n+
compiler-public.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_CONNECTION_BASE
\n-
14#define PQXX_H_CONNECTION_BASE
\n-
15
\n-
16#include "pqxx/compiler-public.hxx"
\n-
17#include "pqxx/compiler-internal-pre.hxx"
\n+
9#ifndef PQXX_H_COMPILER_PUBLIC
\n+
10#define PQXX_H_COMPILER_PUBLIC
\n+
11
\n+
12// Workarounds & definitions that need to be included even in library's headers
\n+
13#include "pqxx/config-public-compiler.h"
\n+
14
\n+
15// Some compilers, Visual Studio in particular, don't seem to support the
\n+
16// standard's ISO-646 keywords out of the box.
\n+
17#include <ciso646>
\n
18
\n-
19#include <bitset>
\n-
20#include <list>
\n-
21#include <map>
\n-
22#include <memory>
\n-
23
\n-
24#include "pqxx/errorhandler.hxx"
\n-
25#include "pqxx/except.hxx"
\n-
26#include "pqxx/prepared_statement.hxx"
\n-
27#include "pqxx/strconv.hxx"
\n-
28#include "pqxx/util.hxx"
\n-
29#include "pqxx/version.hxx"
\n-
30
\n-
31
\n-
32/* Use of the libpqxx library starts here.
\n-
33 *
\n-
34 * Everything that can be done with a database through libpqxx must go through
\n-
35 * a connection object derived from connection_base.
\n-
36 */
\n-
37
\n-
38/* Methods tested in eg. self-test program test1 are marked with "//[t01]"
\n-
39 */
\n-
40
\n-
41namespace pqxx
\n-
42{
\n-
43namespace internal
\n-
44{
\n-\n-
46class sql_cursor;
\n-
47
\n-\n-
49{
\n-
50public:
\n-\n-
52
\n-
53 void add(int n) noexcept { m_counter += n; }
\n-
54 void clear() noexcept { m_counter = 0; }
\n-
55 int get() const noexcept { return m_counter; }
\n-
56
\n-
57private:
\n-
58 int m_counter = 0;
\n-
59};
\n-
60
\n-
61}
\n-
62
\n-
63
\n-
65
\n-
81std::string PQXX_LIBEXPORT encrypt_password( //[t00]
\n-
82 const std::string &user,
\n-
83 const std::string &password);
\n-
84
\n-
85
\n-
86namespace internal
\n-
87{
\n-
88namespace gate
\n-
89{
\n-
90class connection_dbtransaction;
\n-
91class connection_errorhandler;
\n-
92class connection_largeobject;
\n-
93class connection_notification_receiver;
\n-
94class connection_parameterized_invocation;
\n-
95class connection_pipeline;
\n-
96class connection_prepare_invocation;
\n-
97class connection_reactivation_avoidance_exemption;
\n-
98class connection_sql_cursor;
\n-
99class connection_transaction;
\n-
100class const_connection_largeobject;
\n-
101} // namespace pqxx::internal::gate
\n-
102} // namespace pqxx::internal
\n-
103
\n-
104
\n-
106
\n-
139class PQXX_LIBEXPORT connection_base
\n-
140{
\n-
141public:
\n-
143 void disconnect() noexcept; //[t02]
\n-
144
\n-
146
\n-
150 bool PQXX_PURE is_open() const noexcept; //[t01]
\n-
151
\n-
168
\n-
178 PQXX_DEPRECATED void activate(); //[t12]
\n-
179
\n-
181
\n-
189 PQXX_DEPRECATED void deactivate(); //[t12]
\n-
190
\n-
192
\n-
236 PQXX_DEPRECATED void inhibit_reactivation(bool inhibit) //[t86]
\n-
237 { m_inhibit_reactivation=inhibit; }
\n-
238
\n-
240
\n-
245 void simulate_failure(); //[t94]
\n-
247
\n-
249 void process_notice(const char[]) noexcept; //[t14]
\n-
251 void process_notice(const std::string &) noexcept; //[t14]
\n-
252
\n-
254 void trace(std::FILE *) noexcept; //[t03]
\n-
255
\n-
265
\n-
268 const char *dbname(); //[t01]
\n-
269
\n-
271
\n-
274 const char *username(); //[t01]
\n-
275
\n-
277
\n-
280 const char *hostname(); //[t01]
\n-
281
\n-
283
\n-
286 const char *port(); //[t01]
\n-
287
\n-
289
\n-
298 int PQXX_PURE backendpid() const noexcept; //[t01]
\n-
299
\n-
301
\n-
316 int PQXX_PURE sock() const noexcept; //[t87]
\n-
317
\n-
326
\n-
328
\n-\n-
332 {
\n-\n-
335 };
\n-
336
\n-
337
\n-
339
\n-
355 bool supports(capability c) const noexcept //[t88]
\n-
356 { return m_caps.test(c); }
\n-
357
\n-
359
\n-
367 int PQXX_PURE protocol_version() const noexcept; //[t01]
\n-
368
\n-
370
\n-
382 int PQXX_PURE server_version() const noexcept; //[t01]
\n-
384
\n-
386
\n-
407 std::string get_client_encoding() const;
\n-
408
\n-
410
\n-
413 void set_client_encoding(const std::string &encoding); //[t07]
\n-
414
\n-
416
\n-
419 void set_client_encoding(const char encoding[]); //[t07]
\n-
420
\n-
422 int PQXX_PRIVATE encoding_id() const;
\n-
423
\n-
425
\n-
427
\n-
443 void set_variable( //[t60]
\n-
444 const std::string &Var,
\n-
445 const std::string &Value);
\n-
446
\n-
448
\n-
455 std::string get_variable(const std::string &); //[t60]
\n-
457
\n-
458
\n-
464
\n-
476 int get_notifs(); //[t04]
\n-
477
\n-
478
\n-
480
\n-
486 int await_notification(); //[t78]
\n-
487
\n-
489
\n-
495 int await_notification(long seconds, long microseconds); //[t79]
\n-
497
\n-
498
\n-
524
\n-
557 void prepare(const std::string &name, const std::string &definition);
\n-
558
\n-
560
\n-
566 void prepare(const std::string &definition);
\n-
567
\n-
569 void unprepare(const std::string &name);
\n-
570
\n-
572
\n-
582 void prepare_now(const std::string &name);
\n-
583
\n-
589
\n-
600 template<typename TRANSACTOR>
\n-
601 PQXX_DEPRECATED void perform(const TRANSACTOR &T, int Attempts); //[t04]
\n-
602
\n-
604
\n-
610 template<typename TRANSACTOR>
\n-
611 PQXX_DEPRECATED void perform(const TRANSACTOR &T)
\n-
612 {
\n-
613#include "pqxx/internal/ignore-deprecated-pre.hxx"
\n-
614 perform(T, 3);
\n-
615#include "pqxx/internal/ignore-deprecated-post.hxx"
\n-
616 }
\n-
617
\n-
619
\n-
622 std::string adorn_name(const std::string &); //[90]
\n-
623
\n-
629 std::string esc(const char str[]);
\n-
630
\n-
632 std::string esc(const char str[], size_t maxlen);
\n-
633
\n-
635 std::string esc(const std::string &str);
\n-
636
\n-
638 std::string esc_raw(const unsigned char str[], size_t len);
\n-
639
\n-
641
\n-
644 std::string unesc_raw(const std::string &text)
\n-
645 { return unesc_raw(text.c_str()); }
\n-
646
\n-
648
\n-
651 std::string unesc_raw(const char *text);
\n-
652
\n-
654 std::string quote_raw(const unsigned char str[], size_t len);
\n-
655
\n-
657 std::string quote_name(const std::string &identifier);
\n-
658
\n-
660
\n-
661 template<typename T>
\n-
662 std::string quote(const T &t)
\n-
663 {
\n-
664 if (string_traits<T>::is_null(t)) return "NULL";
\n-
665 return "'" + this->esc(to_string(t)) + "'";
\n-
666 }
\n-
667
\n-
668 std::string quote(const binarystring &);
\n-
669
\n-
671
\n-
694 std::string esc_like(const std::string &str, char escape_char='\\\\') const;
\n-
696
\n-
698 void cancel_query();
\n-
699
\n-\n-
702 {
\n-
703 // These values must match those in libpq's PGVerbosity enum.
\n-
704 terse=0,
\n-
705 normal=1,
\n-
706 verbose=2
\n-
707 };
\n-
708
\n-
710
\n-
718 void set_verbosity(error_verbosity verbosity) noexcept;
\n-
720 error_verbosity get_verbosity() const noexcept {return m_verbosity;}
\n-
721
\n-
723
\n-
735 std::vector<errorhandler *> get_errorhandlers() const;
\n-
736
\n-
737protected:
\n-\n-
739 m_policy{pol}
\n-
740 {
\n-
741 // Check library version. The check_library_version template is declared
\n-
742 // for any library version, but only actually defined for the version of
\n-
743 // the libpqxx binary against which the code is linked.
\n-
744 //
\n-
745 // If the library binary is a different version than the one declared in
\n-
746 // these headers, then this call will fail to link: there will be no
\n-
747 // definition for the function with these exact template parameter values.
\n-
748 // There will be a definition, but the version in the parameter values will
\n-
749 // be different.
\n-
750 //
\n-
751 // There is no particular reason to do this here in this constructor, except
\n-
752 // to ensure that every meaningful libpqxx client will execute it. The call
\n-
753 // must be in the execution path somewhere or the compiler won't try to link
\n-
754 // it. We can't use it to initialise a global or class-static variable,
\n-
755 // because a smart compiler might resolve it at compile time.
\n-
756 //
\n-
757 // On the other hand, we don't want to make a useless function call too
\n-
758 // often for performance reasons. A local static variable is initialised
\n-
759 // only on the definition's first execution. Compilers will be well
\n-
760 // optimised for this behaviour, so there's a minimal one-time cost.
\n-
761 static const auto version_ok =
\n-\n-
763 ignore_unused(version_ok);
\n-
764
\n-
765 clearcaps();
\n-
766 }
\n-
767 void init();
\n-
768
\n-
769 void close() noexcept;
\n-
770 void wait_read() const;
\n-
771 void wait_read(long seconds, long microseconds) const;
\n-
772 void wait_write() const;
\n-
773
\n-
774private:
\n-
775
\n-
776 result make_result(internal::pq::PGresult *rhs, const std::string &query);
\n-
777
\n-
778 void clearcaps() noexcept;
\n-
779 void PQXX_PRIVATE set_up_state();
\n-
780 void PQXX_PRIVATE check_result(const result &);
\n-
781
\n-
782 void PQXX_PRIVATE internal_set_trace() noexcept;
\n-
783 int PQXX_PRIVATE PQXX_PURE status() const noexcept;
\n-
784
\n-
785 friend class internal::gate::const_connection_largeobject;
\n-
786 const char * PQXX_PURE err_msg() const noexcept;
\n-
787
\n-
788 void PQXX_PRIVATE reset();
\n-
789 std::string PQXX_PRIVATE raw_get_var(const std::string &);
\n-
790 void PQXX_PRIVATE process_notice_raw(const char msg[]) noexcept;
\n-
791
\n-
792 void read_capabilities();
\n-
793
\n-
794 prepare::internal::prepared_def &find_prepared(const std::string &);
\n-
795
\n-
796 prepare::internal::prepared_def &register_prepared(const std::string &);
\n-
797
\n-
798 friend class internal::gate::connection_prepare_invocation;
\n-
800 PQXX_DEPRECATED result prepared_exec(
\n-
801 const std::string &,
\n-
802 const char *const[],
\n-
803 const int[],
\n-
804 const int[],
\n-
805 int);
\n-
806 result exec_prepared(const std::string &statement, const internal::params &);
\n-
807 bool prepared_exists(const std::string &) const;
\n-
808
\n-
810 internal::pq::PGconn *m_conn = nullptr;
\n-
811
\n-
812 connectionpolicy &m_policy;
\n-
813
\n-
815 internal::unique<transaction_base> m_trans;
\n-
816
\n-
818 void set_notice_processor();
\n-
820 void clear_notice_processor();
\n-
821 std::list<errorhandler *> m_errorhandlers;
\n-
822
\n-
824 std::FILE *m_trace = nullptr;
\n-
825
\n-
826 using receiver_list =
\n-
827 std::multimap<std::string, pqxx::notification_receiver *>;
\n-
829 receiver_list m_receivers;
\n-
830
\n-
832 std::map<std::string, std::string> m_vars;
\n-
833
\n-
834 using PSMap = std::map<std::string, prepare::internal::prepared_def>;
\n-
836 PSMap m_prepared;
\n-
837
\n-
839 int m_serverversion = 0;
\n-
840
\n-
842 internal::reactivation_avoidance_counter m_reactivation_avoidance;
\n-
843
\n-
845 int m_unique_id = 0;
\n-
846
\n-
848 bool m_completed = false;
\n-
849
\n-
851 bool m_inhibit_reactivation = false;
\n-
852
\n-
854 std::bitset<cap_end> m_caps;
\n-
855
\n-
857 error_verbosity m_verbosity = normal;
\n-
858
\n-
859 friend class internal::gate::connection_errorhandler;
\n-
860 void PQXX_PRIVATE register_errorhandler(errorhandler *);
\n-
861 void PQXX_PRIVATE unregister_errorhandler(errorhandler *) noexcept;
\n-
862
\n-
863 friend class internal::gate::connection_transaction;
\n-
864 result PQXX_PRIVATE exec(const char[], int Retries);
\n-
865 void PQXX_PRIVATE register_transaction(transaction_base *);
\n-
866 void PQXX_PRIVATE unregister_transaction(transaction_base *) noexcept;
\n-
867 bool PQXX_PRIVATE read_copy_line(std::string &);
\n-
868 void PQXX_PRIVATE write_copy_line(const std::string &);
\n-
869 void PQXX_PRIVATE end_copy_write();
\n-
870 void PQXX_PRIVATE raw_set_var(const std::string &, const std::string &);
\n-
871 void PQXX_PRIVATE add_variables(const std::map<std::string, std::string> &);
\n-
872
\n-
873 friend class internal::gate::connection_largeobject;
\n-
874 internal::pq::PGconn *raw_connection() const { return m_conn; }
\n-
875
\n-
876 friend class internal::gate::connection_notification_receiver;
\n-
877 void add_receiver(notification_receiver *);
\n-
878 void remove_receiver(notification_receiver *) noexcept;
\n-
879
\n-
880 friend class internal::gate::connection_pipeline;
\n-
881 void PQXX_PRIVATE start_exec(const std::string &);
\n-
882 bool PQXX_PRIVATE consume_input() noexcept;
\n-
883 bool PQXX_PRIVATE is_busy() const noexcept;
\n-
884 internal::pq::PGresult *get_result();
\n-
885
\n-
886 friend class internal::gate::connection_dbtransaction;
\n-
887
\n-
888 friend class internal::gate::connection_sql_cursor;
\n-
889 void add_reactivation_avoidance_count(int);
\n-
890
\n-
891 friend class internal::gate::connection_reactivation_avoidance_exemption;
\n-
892
\n-
893 friend class internal::gate::connection_parameterized_invocation;
\n-
895 PQXX_DEPRECATED result parameterized_exec(
\n-
896 const std::string &query,
\n-
897 const char *const params[],
\n-
898 const int paramlengths[],
\n-
899 const int binaries[],
\n-
900 int nparams);
\n-
901
\n-
902 result exec_params(
\n-
903 const std::string &query,
\n-
904 const internal::params &args);
\n-
905
\n-
906 connection_base(const connection_base &) =delete;
\n-
907 connection_base &operator=(const connection_base &) =delete;
\n-
908};
\n-
909
\n-
910
\n-
911namespace internal
\n-
912{
\n-
913
\n-\n-
916{
\n-
917public:
\n-\n-\n-
920
\n-
921 void close_connection() noexcept { m_open = false; }
\n-
922
\n-
923private:
\n-
924 connection_base &m_home;
\n-
925 int m_count;
\n-
926 bool m_open;
\n-
927};
\n-
928
\n-
929
\n-
930void wait_read(const internal::pq::PGconn *);
\n-
931void wait_read(const internal::pq::PGconn *, long seconds, long microseconds);
\n-
932void wait_write(const internal::pq::PGconn *);
\n-
933} // namespace pqxx::internal
\n-
934
\n-
935} // namespace pqxx
\n-
936
\n-
937#include "pqxx/compiler-internal-post.hxx"
\n-
938
\n-
939#endif
\n-
STL namespace.
\n-
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
\n-
auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype(callback())
Simple way to execute a transaction with automatic retry.
Definition: transactor.hxx:99
\n-
void ignore_unused(T)
Suppress compiler warning about an unused item.
Definition: util.hxx:38
\n-
std::string encrypt_password(const std::string &user, const std::string &password)
Encrypt password for given user.
Definition: connection_base.cxx:89
\n-
int check_library_version< PQXX_VERSION_MAJOR, PQXX_VERSION_MINOR >() noexcept
Definition: version.cxx:13
\n-
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
\n-
Definition: connection_base.hxx:49
\n-
int get() const noexcept
Definition: connection_base.hxx:55
\n-
void clear() noexcept
Definition: connection_base.hxx:54
\n-\n-
void add(int n) noexcept
Definition: connection_base.hxx:53
\n-
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
connection_base(connectionpolicy &pol)
Definition: connection_base.hxx:738
\n-
std::string unesc_raw(const std::string &text)
Unescape binary data, e.g. from a table field or notification payload.
Definition: connection_base.hxx:644
\n-
capability
Session capabilities.
Definition: connection_base.hxx:332
\n-
@ cap_end
Not a capability value; end-of-enumeration marker.
Definition: connection_base.hxx:334
\n-
error_verbosity get_verbosity() const noexcept
Retrieve current error verbosity.
Definition: connection_base.hxx:720
\n-
std::string quote(const T &t)
Represent object as SQL string, including quoting & escaping.
Definition: connection_base.hxx:662
\n-
error_verbosity
Error verbosity levels.
Definition: connection_base.hxx:702
\n-
void inhibit_reactivation(bool inhibit)
Definition: connection_base.hxx:236
\n-
bool supports(capability c) const noexcept
Does this connection seem to support the given capability?
Definition: connection_base.hxx:355
\n-
Scoped exemption to reactivation avoidance.
Definition: connection_base.hxx:916
\n-
void close_connection() noexcept
Definition: connection_base.hxx:921
\n-
Definition: connectionpolicy.hxx:32
\n-
Base class for error-handler callbacks.
Definition: errorhandler.hxx:55
\n-
Definition: notification.hxx:56
\n-
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n-
Traits class for use in string conversions.
Definition: strconv.hxx:51
\n-
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
19
\n+
20#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_CONST)
\n+
22#define PQXX_CONST __attribute__ ((const))
\n+
23#else
\n+
24#define PQXX_CONST
\n+
25#endif
\n+
26
\n+
27#if defined(PQXX_HAVE_DEPRECATED)
\n+
29#define PQXX_DEPRECATED [[deprecated]]
\n+
30#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_DEPRECATED)
\n+
31#define PQXX_DEPRECATED __attribute__ ((deprecated))
\n+
32#else
\n+
33#define PQXX_DEPRECATED
\n+
34#endif
\n+
35
\n+
36#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_PURE)
\n+
38#define PQXX_PURE __attribute__ ((pure))
\n+
39#else
\n+
40#define PQXX_PURE
\n+
41#endif
\n+
42
\n+
43
\n+
44// Workarounds for Windows
\n+
45#ifdef _WIN32
\n+
46
\n+
47/* For now, export DLL symbols if _DLL is defined. This is done automatically
\n+
48 * by the compiler when linking to the dynamic version of the runtime library,
\n+
49 * according to "gzh"
\n+
50 */
\n+
51#if !defined(PQXX_LIBEXPORT) && defined(PQXX_SHARED)
\n+
52#define PQXX_LIBEXPORT __declspec(dllimport)
\n+
53#endif // !PQXX_LIBEXPORT && PQXX_SHARED
\n+
54
\n+
55
\n+
56// Workarounds for Microsoft Visual C++
\n+
57#ifdef _MSC_VER
\n+
58
\n+
59// Suppress vtables on abstract classes.
\n+
60#define PQXX_NOVTABLE __declspec(novtable)
\n+
61
\n+
62// Automatically link with the appropriate libpq (static or dynamic, debug or
\n+
63// release). The default is to use the release DLL. Define PQXX_PQ_STATIC to
\n+
64// link to a static version of libpq, and _DEBUG to link to a debug version.
\n+
65// The two may be combined.
\n+
66#if defined(PQXX_AUTOLINK)
\n+
67#if defined(PQXX_PQ_STATIC)
\n+
68#ifdef _DEBUG
\n+
69#pragma comment(lib, "libpqd")
\n+
70#else
\n+
71#pragma comment(lib, "libpq")
\n+
72#endif
\n+
73#else
\n+
74#ifdef _DEBUG
\n+
75#pragma comment(lib, "libpqddll")
\n+
76#else
\n+
77#pragma comment(lib, "libpqdll")
\n+
78#endif
\n+
79#endif
\n+
80#endif
\n+
81
\n+
82// If we're not compiling libpqxx itself, automatically link with the
\n+
83// appropriate libpqxx library. To link with the libpqxx DLL, define
\n+
84// PQXX_SHARED; the default is to link with the static library. A static link
\n+
85// is the recommended practice.
\n+
86//
\n+
87// The preprocessor macro PQXX_INTERNAL is used to detect whether we
\n+
88// are compiling the libpqxx library itself. When you compile the library
\n+
89// yourself using your own project file, make sure to include this macro.
\n+
90#if defined(PQXX_AUTOLINK) && !defined(PQXX_INTERNAL)
\n+
91 #ifdef PQXX_SHARED
\n+
92 #ifdef _DEBUG
\n+
93 #pragma comment(lib, "libpqxxD")
\n+
94 #else
\n+
95 #pragma comment(lib, "libpqxx")
\n+
96 #endif
\n+
97 #else // !PQXX_SHARED
\n+
98 #ifdef _DEBUG
\n+
99 #pragma comment(lib, "libpqxx_staticD")
\n+
100 #else
\n+
101 #pragma comment(lib, "libpqxx_static")
\n+
102 #endif
\n+
103 #endif
\n+
104#endif
\n+
105
\n+
106#endif // _MSC_VER
\n+
107#endif // _WIN32
\n+
108
\n+
109
\n+
110#ifndef PQXX_LIBEXPORT
\n+
111#define PQXX_LIBEXPORT
\n+
112#endif
\n+
113
\n+
114#ifndef PQXX_PRIVATE
\n+
115#define PQXX_PRIVATE
\n+
116#endif
\n+
117
\n+
118#ifndef PQXX_NOVTABLE
\n+
119#define PQXX_NOVTABLE
\n+
120#endif
\n+
121
\n+
122#endif
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,554 +1,129 @@\n \n \n \n \n \n libpqxx\n \n-connection_base.hxx\n+compiler-public.hxx\n 1\n- 13#ifndef PQXX_H_CONNECTION_BASE\n- 14#define PQXX_H_CONNECTION_BASE\n- 15\n- 16#include \"pqxx/compiler-public.hxx\"\n- 17#include \"pqxx/compiler-internal-pre.hxx\"\n+ 9#ifndef PQXX_H_COMPILER_PUBLIC\n+ 10#define PQXX_H_COMPILER_PUBLIC\n+ 11\n+ 12// Workarounds & definitions that need to be included even in library's\n+headers\n+ 13#include \"pqxx/config-public-compiler.h\"\n+ 14\n+ 15// Some compilers, Visual Studio in particular, don't seem to support the\n+ 16// standard's ISO-646 keywords out of the box.\n+ 17#include \n 18\n- 19#include \n- 20#include \n- 21#include \n- 22#include \n- 23\n- 24#include \"pqxx/errorhandler.hxx\"\n- 25#include \"pqxx/except.hxx\"\n- 26#include \"pqxx/prepared_statement.hxx\"\n- 27#include \"pqxx/strconv.hxx\"\n- 28#include \"pqxx/util.hxx\"\n- 29#include \"pqxx/version.hxx\"\n- 30\n- 31\n- 32/* Use of the libpqxx library starts here.\n- 33 *\n- 34 * Everything that can be done with a database through libpqxx must go\n-through\n- 35 * a connection object derived from connection_base.\n- 36 */\n- 37\n- 38/* Methods tested in eg. self-test program test1 are marked with \"//[t01]\"\n- 39 */\n- 40\n- 41namespace pqxx\n- 42{\n-43namespace internal\n- 44{\n- 45class reactivation_avoidance_exemption;\n- 46class sql_cursor;\n- 47\n-48class reactivation_avoidance_counter\n- 49{\n- 50public:\n-51 reactivation_avoidance_counter() =default;\n- 52\n-53 void add(int n) noexcept { m_counter += n; }\n-54 void clear() noexcept { m_counter = 0; }\n-55 int get() const noexcept { return m_counter; }\n- 56\n- 57private:\n- 58 int m_counter = 0;\n- 59};\n- 60\n- 61}\n- 62\n- 63\n- 65\n- 81std::string PQXX_LIBEXPORT encrypt_password( //[t00]\n- 82 const std::string &user,\n- 83 const std::string &password);\n- 84\n- 85\n- 86namespace internal\n- 87{\n-88namespace gate\n- 89{\n- 90class connection_dbtransaction;\n- 91class connection_errorhandler;\n- 92class connection_largeobject;\n- 93class connection_notification_receiver;\n- 94class connection_parameterized_invocation;\n- 95class connection_pipeline;\n- 96class connection_prepare_invocation;\n- 97class connection_reactivation_avoidance_exemption;\n- 98class connection_sql_cursor;\n- 99class connection_transaction;\n- 100class const_connection_largeobject;\n- 101} // namespace pqxx::internal::gate\n- 102} // namespace pqxx::internal\n- 103\n- 104\n- 106\n-139class PQXX_LIBEXPORT connection_base\n- 140{\n- 141public:\n- 143 void disconnect() noexcept; //[t02]\n- 144\n- 146\n- 150 bool PQXX_PURE is_open() const noexcept; //[t01]\n- 151\n- 168\n- 178 PQXX_DEPRECATED void activate(); //[t12]\n- 179\n- 181\n- 189 PQXX_DEPRECATED void deactivate(); //[t12]\n- 190\n- 192\n-236 PQXX_DEPRECATED void inhibit_reactivation(bool inhibit) //[t86]\n- 237 { m_inhibit_reactivation=inhibit; }\n- 238\n- 240\n- 245 void simulate_failure(); //[t94]\n- 247\n- 249 void process_notice(const char[]) noexcept; //[t14]\n- 251 void process_notice(const std::string &) noexcept; //[t14]\n- 252\n- 254 void trace(std::FILE *) noexcept; //[t03]\n- 255\n- 265\n- 268 const char *dbname(); //[t01]\n- 269\n- 271\n- 274 const char *username(); //[t01]\n- 275\n- 277\n- 280 const char *hostname(); //[t01]\n- 281\n- 283\n- 286 const char *port(); //[t01]\n- 287\n- 289\n- 298 int PQXX_PURE backendpid() const noexcept; //[t01]\n- 299\n- 301\n- 316 int PQXX_PURE sock() const noexcept; //[t87]\n- 317\n- 326\n- 328\n-331 enum capability\n- 332 {\n-334 cap_end,\n- 335 };\n- 336\n- 337\n- 339\n-355 bool supports(capability c) const noexcept //[t88]\n- 356 { return m_caps.test(c); }\n- 357\n- 359\n- 367 int PQXX_PURE protocol_version() const noexcept; //[t01]\n- 368\n- 370\n- 382 int PQXX_PURE server_version() const noexcept; //[t01]\n- 384\n- 386\n- 407 std::string get_client_encoding() const;\n- 408\n- 410\n- 413 void set_client_encoding(const std::string &encoding); //[t07]\n- 414\n- 416\n- 419 void set_client_encoding(const char encoding[]); //[t07]\n- 420\n- 422 int PQXX_PRIVATE encoding_id() const;\n- 423\n- 425\n- 427\n- 443 void set_variable( //[t60]\n- 444 const std::string &Var,\n- 445 const std::string &Value);\n- 446\n- 448\n- 455 std::string get_variable(const std::string &); //[t60]\n- 457\n- 458\n- 464\n- 476 int get_notifs(); //[t04]\n- 477\n- 478\n- 480\n- 486 int await_notification(); //[t78]\n- 487\n- 489\n- 495 int await_notification(long seconds, long microseconds); //[t79]\n- 497\n- 498\n- 524\n- 557 void prepare(const std::string &name, const std::string &definition);\n- 558\n- 560\n- 566 void prepare(const std::string &definition);\n- 567\n- 569 void unprepare(const std::string &name);\n- 570\n- 572\n- 582 void prepare_now(const std::string &name);\n- 583\n- 589\n- 600 template\n- 601 PQXX_DEPRECATED void perform(const TRANSACTOR &T, int Attempts); //[t04]\n- 602\n- 604\n- 610 template\n-611 PQXX_DEPRECATED void perform(const TRANSACTOR &T)\n- 612 {\n- 613#include \"pqxx/internal/ignore-deprecated-pre.hxx\"\n- 614 perform(T, 3);\n- 615#include \"pqxx/internal/ignore-deprecated-post.hxx\"\n- 616 }\n- 617\n- 619\n- 622 std::string adorn_name(const std::string &); //[90]\n- 623\n- 629 std::string esc(const char str[]);\n- 630\n- 632 std::string esc(const char str[], size_t maxlen);\n- 633\n- 635 std::string esc(const std::string &str);\n- 636\n- 638 std::string esc_raw(const unsigned char str[], size_t len);\n- 639\n- 641\n-644 std::string unesc_raw(const std::string &text)\n- 645 { return unesc_raw(text.c_str()); }\n- 646\n- 648\n- 651 std::string unesc_raw(const char *text);\n- 652\n- 654 std::string quote_raw(const unsigned char str[], size_t len);\n- 655\n- 657 std::string quote_name(const std::string &identifier);\n- 658\n- 660\n- 661 template\n-662 std::string quote(const T &t)\n- 663 {\n- 664 if (string_traits::is_null(t)) return \"NULL\";\n- 665 return \"'\" + this->esc(to_string(t)) + \"'\";\n- 666 }\n- 667\n- 668 std::string quote(const binarystring &);\n- 669\n- 671\n- 694 std::string esc_like(const std::string &str, char escape_char='\\\\') const;\n- 696\n- 698 void cancel_query();\n- 699\n-701 enum error_verbosity\n- 702 {\n- 703 // These values must match those in libpq's PGVerbosity enum.\n-704 terse=0,\n-705 normal=1,\n- 706 verbose=2\n-707 };\n- 708\n- 710\n- 718 void set_verbosity(error_verbosity verbosity) noexcept;\n-720 error_verbosity get_verbosity() const noexcept {return m_verbosity;}\n- 721\n- 723\n- 735 std::vector get_errorhandlers() const;\n- 736\n- 737protected:\n-738 explicit connection_base(connectionpolicy &pol) :\n- 739 m_policy{pol}\n- 740 {\n- 741 // Check library version. The check_library_version template is declared\n- 742 // for any library version, but only actually defined for the version of\n- 743 // the libpqxx binary against which the code is linked.\n- 744 //\n- 745 // If the library binary is a different version than the one declared in\n- 746 // these headers, then this call will fail to link: there will be no\n- 747 // definition for the function with these exact template parameter values.\n- 748 // There will be a definition, but the version in the parameter values\n-will\n- 749 // be different.\n- 750 //\n- 751 // There is no particular reason to do this here in this constructor,\n-except\n- 752 // to ensure that every meaningful libpqxx client will execute it. The\n-call\n- 753 // must be in the execution path somewhere or the compiler won't try to\n+ 19\n+ 20#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_CONST)\n+ 22#define PQXX_CONST __attribute__ ((const))\n+ 23#else\n+ 24#define PQXX_CONST\n+ 25#endif\n+ 26\n+ 27#if defined(PQXX_HAVE_DEPRECATED)\n+ 29#define PQXX_DEPRECATED [[deprecated]]\n+ 30#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_DEPRECATED)\n+ 31#define PQXX_DEPRECATED __attribute__ ((deprecated))\n+ 32#else\n+ 33#define PQXX_DEPRECATED\n+ 34#endif\n+ 35\n+ 36#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_PURE)\n+ 38#define PQXX_PURE __attribute__ ((pure))\n+ 39#else\n+ 40#define PQXX_PURE\n+ 41#endif\n+ 42\n+ 43\n+ 44// Workarounds for Windows\n+ 45#ifdef _WIN32\n+ 46\n+ 47/* For now, export DLL symbols if _DLL is defined. This is done\n+automatically\n+ 48 * by the compiler when linking to the dynamic version of the runtime\n+library,\n+ 49 * according to \"gzh\"\n+ 50 */\n+ 51#if !defined(PQXX_LIBEXPORT) && defined(PQXX_SHARED)\n+ 52#define PQXX_LIBEXPORT __declspec(dllimport)\n+ 53#endif // !PQXX_LIBEXPORT && PQXX_SHARED\n+ 54\n+ 55\n+ 56// Workarounds for Microsoft Visual C++\n+ 57#ifdef _MSC_VER\n+ 58\n+ 59// Suppress vtables on abstract classes.\n+ 60#define PQXX_NOVTABLE __declspec(novtable)\n+ 61\n+ 62// Automatically link with the appropriate libpq (static or dynamic, debug\n+or\n+ 63// release). The default is to use the release DLL. Define PQXX_PQ_STATIC to\n+ 64// link to a static version of libpq, and _DEBUG to link to a debug version.\n+ 65// The two may be combined.\n+ 66#if defined(PQXX_AUTOLINK)\n+ 67#if defined(PQXX_PQ_STATIC)\n+ 68#ifdef _DEBUG\n+ 69#pragma comment(lib, \"libpqd\")\n+ 70#else\n+ 71#pragma comment(lib, \"libpq\")\n+ 72#endif\n+ 73#else\n+ 74#ifdef _DEBUG\n+ 75#pragma comment(lib, \"libpqddll\")\n+ 76#else\n+ 77#pragma comment(lib, \"libpqdll\")\n+ 78#endif\n+ 79#endif\n+ 80#endif\n+ 81\n+ 82// If we're not compiling libpqxx itself, automatically link with the\n+ 83// appropriate libpqxx library. To link with the libpqxx DLL, define\n+ 84// PQXX_SHARED; the default is to link with the static library. A static\n link\n- 754 // it. We can't use it to initialise a global or class-static variable,\n- 755 // because a smart compiler might resolve it at compile time.\n- 756 //\n- 757 // On the other hand, we don't want to make a useless function call too\n- 758 // often for performance reasons. A local static variable is initialised\n- 759 // only on the definition's first execution. Compilers will be well\n- 760 // optimised for this behaviour, so there's a minimal one-time cost.\n- 761 static const auto version_ok =\n- 762 internal::check_library_version();\n- 763 ignore_unused(version_ok);\n- 764\n- 765 clearcaps();\n- 766 }\n- 767 void init();\n- 768\n- 769 void close() noexcept;\n- 770 void wait_read() const;\n- 771 void wait_read(long seconds, long microseconds) const;\n- 772 void wait_write() const;\n- 773\n- 774private:\n- 775\n- 776 result make_result(internal::pq::PGresult *rhs, const std::string &query);\n- 777\n- 778 void clearcaps() noexcept;\n- 779 void PQXX_PRIVATE set_up_state();\n- 780 void PQXX_PRIVATE check_result(const result &);\n- 781\n- 782 void PQXX_PRIVATE internal_set_trace() noexcept;\n- 783 int PQXX_PRIVATE PQXX_PURE status() const noexcept;\n- 784\n-785 friend class internal::gate::const_connection_largeobject;\n- 786 const char * PQXX_PURE err_msg() const noexcept;\n- 787\n- 788 void PQXX_PRIVATE reset();\n- 789 std::string PQXX_PRIVATE raw_get_var(const std::string &);\n- 790 void PQXX_PRIVATE process_notice_raw(const char msg[]) noexcept;\n- 791\n- 792 void read_capabilities();\n- 793\n- 794 prepare::internal::prepared_def &find_prepared(const std::string &);\n- 795\n- 796 prepare::internal::prepared_def ®ister_prepared(const std::string &);\n- 797\n-798 friend class internal::gate::connection_prepare_invocation;\n- 800 PQXX_DEPRECATED result prepared_exec(\n- 801 const std::string &,\n- 802 const char *const[],\n- 803 const int[],\n- 804 const int[],\n- 805 int);\n- 806 result exec_prepared(const std::string &statement, const internal::params\n-&);\n- 807 bool prepared_exists(const std::string &) const;\n- 808\n- 810 internal::pq::PGconn *m_conn = nullptr;\n- 811\n- 812 connectionpolicy &m_policy;\n- 813\n- 815 internal::unique m_trans;\n- 816\n- 818 void set_notice_processor();\n- 820 void clear_notice_processor();\n- 821 std::list m_errorhandlers;\n- 822\n- 824 std::FILE *m_trace = nullptr;\n- 825\n- 826 using receiver_list =\n- 827 std::multimap;\n- 829 receiver_list m_receivers;\n- 830\n- 832 std::map m_vars;\n- 833\n- 834 using PSMap = std::map;\n- 836 PSMap m_prepared;\n- 837\n- 839 int m_serverversion = 0;\n- 840\n- 842 internal::reactivation_avoidance_counter m_reactivation_avoidance;\n- 843\n- 845 int m_unique_id = 0;\n- 846\n- 848 bool m_completed = false;\n- 849\n- 851 bool m_inhibit_reactivation = false;\n- 852\n- 854 std::bitset m_caps;\n- 855\n- 857 error_verbosity m_verbosity = normal;\n- 858\n-859 friend class internal::gate::connection_errorhandler;\n- 860 void PQXX_PRIVATE register_errorhandler(errorhandler *);\n- 861 void PQXX_PRIVATE unregister_errorhandler(errorhandler *) noexcept;\n- 862\n-863 friend class internal::gate::connection_transaction;\n- 864 result PQXX_PRIVATE exec(const char[], int Retries);\n- 865 void PQXX_PRIVATE register_transaction(transaction_base *);\n- 866 void PQXX_PRIVATE unregister_transaction(transaction_base *) noexcept;\n- 867 bool PQXX_PRIVATE read_copy_line(std::string &);\n- 868 void PQXX_PRIVATE write_copy_line(const std::string &);\n- 869 void PQXX_PRIVATE end_copy_write();\n- 870 void PQXX_PRIVATE raw_set_var(const std::string &, const std::string &);\n- 871 void PQXX_PRIVATE add_variables(const std::map\n-&);\n- 872\n-873 friend class internal::gate::connection_largeobject;\n- 874 internal::pq::PGconn *raw_connection() const { return m_conn; }\n- 875\n-876 friend class internal::gate::connection_notification_receiver;\n- 877 void add_receiver(notification_receiver *);\n- 878 void remove_receiver(notification_receiver *) noexcept;\n- 879\n-880 friend class internal::gate::connection_pipeline;\n- 881 void PQXX_PRIVATE start_exec(const std::string &);\n- 882 bool PQXX_PRIVATE consume_input() noexcept;\n- 883 bool PQXX_PRIVATE is_busy() const noexcept;\n- 884 internal::pq::PGresult *get_result();\n- 885\n-886 friend class internal::gate::connection_dbtransaction;\n- 887\n-888 friend class internal::gate::connection_sql_cursor;\n- 889 void add_reactivation_avoidance_count(int);\n- 890\n-891 friend class internal::gate::connection_reactivation_avoidance_exemption;\n- 892\n-893 friend class internal::gate::connection_parameterized_invocation;\n- 895 PQXX_DEPRECATED result parameterized_exec(\n- 896 const std::string &query,\n- 897 const char *const params[],\n- 898 const int paramlengths[],\n- 899 const int binaries[],\n- 900 int nparams);\n- 901\n- 902 result exec_params(\n- 903 const std::string &query,\n- 904 const internal::params &args);\n- 905\n- 906 connection_base(const connection_base &) =delete;\n- 907 connection_base &operator=(const connection_base &) =delete;\n- 908};\n- 909\n- 910\n- 911namespace internal\n- 912{\n- 913\n-915class PQXX_LIBEXPORT reactivation_avoidance_exemption\n- 916{\n- 917public:\n- 918 explicit reactivation_avoidance_exemption(connection_base &C);\n- 919 ~reactivation_avoidance_exemption();\n- 920\n-921 void close_connection() noexcept { m_open = false; }\n- 922\n- 923private:\n- 924 connection_base &m_home;\n- 925 int m_count;\n- 926 bool m_open;\n- 927};\n- 928\n- 929\n- 930void wait_read(const internal::pq::PGconn *);\n- 931void wait_read(const internal::pq::PGconn *, long seconds, long\n-microseconds);\n- 932void wait_write(const internal::pq::PGconn *);\n- 933} // namespace pqxx::internal\n- 934\n- 935} // namespace pqxx\n- 936\n- 937#include \"pqxx/compiler-internal-post.hxx\"\n- 938\n- 939#endif\n-std\n-STL namespace.\n-pqxx\n-The home of all libpqxx classes, functions, templates, etc.\n-Definition: array.hxx:26\n-pqxx::to_string\n-std::string to_string(const field &Obj)\n-Convert a field to a string.\n-Definition: result.cxx:451\n-pqxx::perform\n-auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype\n-(callback())\n-Simple way to execute a transaction with automatic retry.\n-Definition: transactor.hxx:99\n-pqxx::ignore_unused\n-void ignore_unused(T)\n-Suppress compiler warning about an unused item.\n-Definition: util.hxx:38\n-pqxx::encrypt_password\n-std::string encrypt_password(const std::string &user, const std::string\n-&password)\n-Encrypt password for given user.\n-Definition: connection_base.cxx:89\n-pqxx::internal::check_library_version<_PQXX_VERSION_MAJOR,_PQXX_VERSION_MINOR_>\n-int check_library_version< PQXX_VERSION_MAJOR, PQXX_VERSION_MINOR >() noexcept\n-Definition: version.cxx:13\n-pqxx::binarystring\n-Binary data corresponding to PostgreSQL's \"BYTEA\" binary-string type.\n-Definition: binarystring.hxx:54\n-pqxx::internal::reactivation_avoidance_counter\n-Definition: connection_base.hxx:49\n-pqxx::internal::reactivation_avoidance_counter::get\n-int get() const noexcept\n-Definition: connection_base.hxx:55\n-pqxx::internal::reactivation_avoidance_counter::clear\n-void clear() noexcept\n-Definition: connection_base.hxx:54\n-pqxx::internal::reactivation_avoidance_counter::reactivation_avoidance_counter\n-reactivation_avoidance_counter()=default\n-pqxx::internal::reactivation_avoidance_counter::add\n-void add(int n) noexcept\n-Definition: connection_base.hxx:53\n-pqxx::connection_base\n-connection_base abstract base class; represents a connection to a database.\n-Definition: connection_base.hxx:140\n-pqxx::connection_base::connection_base\n-connection_base(connectionpolicy &pol)\n-Definition: connection_base.hxx:738\n-pqxx::connection_base::unesc_raw\n-std::string unesc_raw(const std::string &text)\n-Unescape binary data, e.g. from a table field or notification payload.\n-Definition: connection_base.hxx:644\n-pqxx::connection_base::capability\n-capability\n-Session capabilities.\n-Definition: connection_base.hxx:332\n-pqxx::connection_base::cap_end\n-@ cap_end\n-Not a capability value; end-of-enumeration marker.\n-Definition: connection_base.hxx:334\n-pqxx::connection_base::get_verbosity\n-error_verbosity get_verbosity() const noexcept\n-Retrieve current error verbosity.\n-Definition: connection_base.hxx:720\n-pqxx::connection_base::quote\n-std::string quote(const T &t)\n-Represent object as SQL string, including quoting & escaping.\n-Definition: connection_base.hxx:662\n-pqxx::connection_base::error_verbosity\n-error_verbosity\n-Error verbosity levels.\n-Definition: connection_base.hxx:702\n-pqxx::connection_base::inhibit_reactivation\n-void inhibit_reactivation(bool inhibit)\n-Definition: connection_base.hxx:236\n-pqxx::connection_base::supports\n-bool supports(capability c) const noexcept\n-Does this connection seem to support the given capability?\n-Definition: connection_base.hxx:355\n-pqxx::internal::reactivation_avoidance_exemption\n-Scoped exemption to reactivation avoidance.\n-Definition: connection_base.hxx:916\n-pqxx::internal::reactivation_avoidance_exemption::close_connection\n-void close_connection() noexcept\n-Definition: connection_base.hxx:921\n-pqxx::connectionpolicy\n-Definition: connectionpolicy.hxx:32\n-pqxx::errorhandler\n-Base class for error-handler callbacks.\n-Definition: errorhandler.hxx:55\n-pqxx::notification_receiver\n-Definition: notification.hxx:56\n-pqxx::result\n-Result set containing data returned by a query or command.\n-Definition: result.hxx:70\n-pqxx::string_traits\n-Traits class for use in string conversions.\n-Definition: strconv.hxx:51\n-pqxx::transaction_base\n-Interface definition (and common code) for \"transaction\" classes.\n-Definition: transaction_base.hxx:138\n+ 85// is the recommended practice.\n+ 86//\n+ 87// The preprocessor macro PQXX_INTERNAL is used to detect whether we\n+ 88// are compiling the libpqxx library itself. When you compile the library\n+ 89// yourself using your own project file, make sure to include this macro.\n+ 90#if defined(PQXX_AUTOLINK) && !defined(PQXX_INTERNAL)\n+ 91 #ifdef PQXX_SHARED\n+ 92 #ifdef _DEBUG\n+ 93 #pragma comment(lib, \"libpqxxD\")\n+ 94 #else\n+ 95 #pragma comment(lib, \"libpqxx\")\n+ 96 #endif\n+ 97 #else // !PQXX_SHARED\n+ 98 #ifdef _DEBUG\n+ 99 #pragma comment(lib, \"libpqxx_staticD\")\n+ 100 #else\n+ 101 #pragma comment(lib, \"libpqxx_static\")\n+ 102 #endif\n+ 103 #endif\n+ 104#endif\n+ 105\n+ 106#endif // _MSC_VER\n+ 107#endif // _WIN32\n+ 108\n+ 109\n+ 110#ifndef PQXX_LIBEXPORT\n+ 111#define PQXX_LIBEXPORT\n+ 112#endif\n+ 113\n+ 114#ifndef PQXX_PRIVATE\n+ 115#define PQXX_PRIVATE\n+ 116#endif\n+ 117\n+ 118#ifndef PQXX_NOVTABLE\n+ 119#define PQXX_NOVTABLE\n+ 120#endif\n+ 121\n+ 122#endif\n * include\n * pqxx\n- * connection_base.hxx\n+ * compiler-public.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00113_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00113_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: basic_connection.hxx Source File\n+libpqxx: transactor.hxx Source File\n \n \n \n \n \n \n \n@@ -55,110 +55,190 @@\n \n
\n
\n-
basic_connection.hxx
\n+
transactor.hxx
\n
\n
\n-
1
\n-
13#ifndef PQXX_H_BASIC_CONNECTION
\n-
14#define PQXX_H_BASIC_CONNECTION
\n-
15
\n-
16#include "pqxx/compiler-public.hxx"
\n-
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18
\n-
19#include <cstddef>
\n-
20#include <memory>
\n-
21#include <string>
\n+
1/* Transactor framework, a wrapper for safely retryable transactions.
\n+
2 *
\n+
3 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transactor instead.
\n+
4 *
\n+
5 * Copyright (c) 2000-2019, Jeroen T. Vermeulen.
\n+
6 *
\n+
7 * See COPYING for copyright license. If you did not receive a file called
\n+
8 * COPYING with this source code, please notify the distributor of this mistake,
\n+
9 * or contact the author.
\n+
10 */
\n+
11#ifndef PQXX_H_TRANSACTOR
\n+
12#define PQXX_H_TRANSACTOR
\n+
13
\n+
14#include "pqxx/compiler-public.hxx"
\n+
15#include "pqxx/compiler-internal-pre.hxx"
\n+
16
\n+
17#include "pqxx/connection_base.hxx"
\n+
18#include "pqxx/transaction.hxx"
\n+
19
\n+
20
\n+
21// Methods tested in eg. test module test01 are marked with "//[t01]".
\n
22
\n-
23#include "pqxx/connection_base.hxx"
\n-
24
\n-
25
\n-
26namespace pqxx
\n-
27{
\n-
28
\n-
30
\n-
45template<typename CONNECTPOLICY> class basic_connection_base :
\n-
46 public connection_base
\n-
47{
\n-
48public:
\n-\n-
50 connection_base(m_policy),
\n-
51 m_options(std::string{}),
\n-
52 m_policy(m_options)
\n-
53 { init(); }
\n-
54
\n-
57 explicit basic_connection_base(const std::string &opt) :
\n-
58 connection_base(m_policy),
\n-
59 m_options(opt),
\n-
60 m_policy(m_options)
\n-
61 {init();}
\n-
62
\n-
64 explicit basic_connection_base(const char opt[]) :
\n-
65 basic_connection_base(opt ? std::string{opt} : std::string{}) {}
\n-
66
\n-
67 explicit basic_connection_base(std::nullptr_t) : basic_connection_base() {}
\n-
68
\n-\n-
70 { close(); }
\n-
71
\n-
72 const std::string &options() const noexcept //[t01]
\n-
73 {return m_policy.options();}
\n-
74
\n-
75private:
\n-
77 std::string m_options;
\n-
79 CONNECTPOLICY m_policy;
\n-
80};
\n-
81
\n-
82
\n-
84
\n-
88template<typename CONNECTPOLICY> struct basic_connection :
\n-
89 basic_connection_base<CONNECTPOLICY>
\n-
90{
\n-
91 PQXX_DEPRECATED basic_connection() =default;
\n-
92 PQXX_DEPRECATED explicit basic_connection(const std::string &opt) :
\n-
93 basic_connection(opt) {}
\n-
94 PQXX_DEPRECATED explicit basic_connection(const char opt[]) :
\n-
95 basic_connection(opt) {}
\n-
96
\n-
97 PQXX_DEPRECATED explicit basic_connection(std::nullptr_t) :
\n-\n-
99
\n-
100 using basic_connection_base<CONNECTPOLICY>::options;
\n-
101};
\n-
102
\n-
103} // namespace
\n-
104
\n-
105#include "pqxx/compiler-internal-post.hxx"
\n-
106
\n-
107#endif
\n-
STL namespace.
\n+
23namespace pqxx
\n+
24{
\n+
67
\n+
69
\n+
98template<typename TRANSACTION_CALLBACK>
\n+
99inline auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3)
\n+
100 -> decltype(callback())
\n+
101{
\n+
102 if (attempts <= 0)
\n+
103 throw std::invalid_argument{
\n+
104 "Zero or negative number of attempts passed to pqxx::perform()."};
\n+
105
\n+
106 for (; attempts > 0; --attempts)
\n+
107 {
\n+
108 try
\n+
109 {
\n+
110 return callback();
\n+
111 }
\n+
112 catch (const in_doubt_error &)
\n+
113 {
\n+
114 // Not sure whether transaction went through or not. The last thing in
\n+
115 // the world that we should do now is try again!
\n+
116 throw;
\n+
117 }
\n+
118 catch (const statement_completion_unknown &)
\n+
119 {
\n+
120 // Not sure whether our last statement succeeded. Don't risk running it
\n+
121 // again.
\n+
122 throw;
\n+
123 }
\n+
124 catch (const broken_connection &)
\n+
125 {
\n+
126 // Connection failed. Definitely worth retrying.
\n+
127 if (attempts <= 1) throw;
\n+
128 continue;
\n+
129 }
\n+
130 catch (const transaction_rollback &)
\n+
131 {
\n+
132 // Some error that may well be transient, such as serialization failure
\n+
133 // or deadlock. Worth retrying.
\n+
134 if (attempts <= 1) throw;
\n+
135 continue;
\n+
136 }
\n+
137 }
\n+
138 throw pqxx::internal_error{"No outcome reached on perform()."};
\n+
139}
\n+
140
\n+
142
\n+
156template<typename TRANSACTION=transaction<read_committed>> class transactor
\n+
157{
\n+
158public:
\n+
159 using argument_type = TRANSACTION;
\n+
160 PQXX_DEPRECATED explicit transactor( //[t04]
\n+
161 const std::string &TName="transactor") :
\n+
162 m_name{TName} { }
\n+
163
\n+
165
\n+
176 void operator()(TRANSACTION &T); //[t04]
\n+
177
\n+
178 // Overridable member functions, called by connection_base::perform() if an
\n+
179 // attempt to run transaction fails/succeeds, respectively, or if the
\n+
180 // connection is lost at just the wrong moment, goes into an indeterminate
\n+
181 // state. Use these to patch up runtime state to match events, if needed, or
\n+
182 // to report failure conditions.
\n+
183
\n+
185
\n+
193 void on_abort(const char[]) noexcept {} //[t13]
\n+
194
\n+
196
\n+
200 void on_commit() {} //[t07]
\n+
201
\n+
203
\n+
214 void on_doubt() noexcept {} //[t13]
\n+
215
\n+
217 std::string name() const { return m_name; } //[t13]
\n+
218
\n+
219private:
\n+
220 std::string m_name;
\n+
221};
\n+
222
\n+
223
\n+
224template<typename TRANSACTOR>
\n+\n+
226 const TRANSACTOR &T,
\n+
227 int Attempts)
\n+
228{
\n+
229 if (Attempts <= 0) return;
\n+
230
\n+
231 bool Done = false;
\n+
232
\n+
233 // Make attempts to perform T
\n+
234 do
\n+
235 {
\n+
236 --Attempts;
\n+
237
\n+
238 // Work on a copy of T2 so we can restore the starting situation if need be
\n+
239 TRANSACTOR T2{T};
\n+
240 try
\n+
241 {
\n+
242 typename TRANSACTOR::argument_type X{*this, T2.name()};
\n+
243 T2(X);
\n+
244 X.commit();
\n+
245 Done = true;
\n+
246 }
\n+
247 catch (const in_doubt_error &)
\n+
248 {
\n+
249 // Not sure whether transaction went through or not. The last thing in
\n+
250 // the world that we should do now is retry.
\n+
251 T2.on_doubt();
\n+
252 throw;
\n+
253 }
\n+
254 catch (const std::exception &e)
\n+
255 {
\n+
256 // Could be any kind of error.
\n+
257 T2.on_abort(e.what());
\n+
258 if (Attempts <= 0) throw;
\n+
259 continue;
\n+
260 }
\n+
261 catch (...)
\n+
262 {
\n+
263 // Don't try to forge ahead if we don't even know what happened
\n+
264 T2.on_abort("Unknown exception");
\n+
265 throw;
\n+
266 }
\n+
267
\n+
268 T2.on_commit();
\n+
269 } while (not Done);
\n+
270}
\n+
271} // namespace pqxx
\n+
273#include "pqxx/compiler-internal-post.hxx"
\n+
274#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
Base-class template for all libpqxx connection types.
Definition: basic_connection.hxx:47
\n-
basic_connection_base(const std::string &opt)
Definition: basic_connection.hxx:57
\n-
const std::string & options() const noexcept
Definition: basic_connection.hxx:72
\n-
basic_connection_base(std::nullptr_t)
Definition: basic_connection.hxx:67
\n-
~basic_connection_base() noexcept
Definition: basic_connection.hxx:69
\n-
basic_connection_base(const char opt[])
See: basic_connection(const std::string &opt)
Definition: basic_connection.hxx:64
\n-
basic_connection_base()
Definition: basic_connection.hxx:49
\n-
Concrete connection type template.
Definition: basic_connection.hxx:90
\n-
basic_connection(const std::string &opt)
Definition: basic_connection.hxx:92
\n-
basic_connection(std::nullptr_t)
Definition: basic_connection.hxx:97
\n-
basic_connection(const char opt[])
Definition: basic_connection.hxx:94
\n-\n-
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n-
void init()
Definition: connection_base.cxx:99
\n-
void close() noexcept
Definition: connection_base.cxx:902
\n+
auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype(callback())
Simple way to execute a transaction with automatic retry.
Definition: transactor.hxx:99
\n+
void perform(const TRANSACTOR &T, int Attempts)
Definition: transactor.hxx:225
\n+
Exception class for lost or failed backend connection.
Definition: except.hxx:119
\n+
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:160
\n+
The backend saw itself forced to roll back the ongoing transaction.
Definition: except.hxx:168
\n+
We can't tell whether our last statement succeeded.
Definition: except.hxx:192
\n+
Internal error in libpqxx library.
Definition: except.hxx:209
\n+
Definition: transactor.hxx:157
\n+
void on_doubt() noexcept
Overridable function to be called when "in doubt" about outcome.
Definition: transactor.hxx:214
\n+
transactor(const std::string &TName="transactor")
Definition: transactor.hxx:160
\n+
void on_commit()
Optional overridable function to be called after successful commit.
Definition: transactor.hxx:200
\n+
void operator()(TRANSACTION &T)
Overridable transaction definition; insert your database code here.
\n+
void on_abort(const char[]) noexcept
Optional overridable function to be called if transaction is aborted.
Definition: transactor.hxx:193
\n+
TRANSACTION argument_type
Definition: transactor.hxx:159
\n+
std::string name() const
The transactor's name.
Definition: transactor.hxx:217
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,134 +1,222 @@\n \n \n \n \n \n libpqxx\n \n-basic_connection.hxx\n- 1\n- 13#ifndef PQXX_H_BASIC_CONNECTION\n- 14#define PQXX_H_BASIC_CONNECTION\n- 15\n- 16#include \"pqxx/compiler-public.hxx\"\n- 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18\n- 19#include \n- 20#include \n- 21#include \n+transactor.hxx\n+ 1/* Transactor framework, a wrapper for safely retryable transactions.\n+ 2 *\n+ 3 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transactor instead.\n+ 4 *\n+ 5 * Copyright (c) 2000-2019, Jeroen T. Vermeulen.\n+ 6 *\n+ 7 * See COPYING for copyright license. If you did not receive a file called\n+ 8 * COPYING with this source code, please notify the distributor of this\n+mistake,\n+ 9 * or contact the author.\n+ 10 */\n+ 11#ifndef PQXX_H_TRANSACTOR\n+ 12#define PQXX_H_TRANSACTOR\n+ 13\n+ 14#include \"pqxx/compiler-public.hxx\"\n+ 15#include \"pqxx/compiler-internal-pre.hxx\"\n+ 16\n+ 17#include \"pqxx/connection_base.hxx\"\n+ 18#include \"pqxx/transaction.hxx\"\n+ 19\n+ 20\n+ 21// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n 22\n- 23#include \"pqxx/connection_base.hxx\"\n- 24\n- 25\n- 26namespace pqxx\n- 27{\n- 28\n- 30\n-45template class basic_connection_base :\n- 46 public connection_base\n- 47{\n- 48public:\n-49 basic_connection_base() :\n- 50 connection_base(m_policy),\n- 51 m_options(std::string{}),\n- 52 m_policy(m_options)\n- 53 { init(); }\n- 54\n-57 explicit basic_connection_base(const std::string &opt) :\n- 58 connection_base(m_policy),\n- 59 m_options(opt),\n- 60 m_policy(m_options)\n- 61 {init();}\n- 62\n-64 explicit basic_connection_base(const char opt[]) :\n- 65 basic_connection_base(opt ? std::string{opt} : std::string{}) {}\n- 66\n-67 explicit basic_connection_base(std::nullptr_t) : basic_connection_base() {}\n- 68\n-69 ~basic_connection_base() noexcept\n- 70 { close(); }\n- 71\n-72 const std::string &options() const noexcept //[t01]\n- 73 {return m_policy.options();}\n- 74\n- 75private:\n- 77 std::string m_options;\n- 79 CONNECTPOLICY m_policy;\n- 80};\n- 81\n- 82\n- 84\n-88template struct basic_connection :\n- 89 basic_connection_base\n- 90{\n-91 PQXX_DEPRECATED basic_connection() =default;\n-92 PQXX_DEPRECATED explicit basic_connection(const std::string &opt) :\n- 93 basic_connection(opt) {}\n-94 PQXX_DEPRECATED explicit basic_connection(const char opt[]) :\n- 95 basic_connection(opt) {}\n- 96\n-97 PQXX_DEPRECATED explicit basic_connection(std::nullptr_t) :\n- 98 basic_connection() {}\n- 99\n- 100 using basic_connection_base::options;\n- 101};\n- 102\n- 103} // namespace\n- 104\n- 105#include \"pqxx/compiler-internal-post.hxx\"\n- 106\n- 107#endif\n-std\n-STL namespace.\n+ 23namespace pqxx\n+ 24{\n+ 67\n+ 69\n+ 98template\n+99inline auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3)\n+ 100 -> decltype(callback())\n+ 101{\n+ 102 if (attempts <= 0)\n+ 103 throw std::invalid_argument{\n+ 104 \"Zero or negative number of attempts passed to pqxx::perform().\"};\n+ 105\n+ 106 for (; attempts > 0; --attempts)\n+ 107 {\n+ 108 try\n+ 109 {\n+ 110 return callback();\n+ 111 }\n+ 112 catch (const in_doubt_error &)\n+ 113 {\n+ 114 // Not sure whether transaction went through or not. The last thing in\n+ 115 // the world that we should do now is try again!\n+ 116 throw;\n+ 117 }\n+ 118 catch (const statement_completion_unknown &)\n+ 119 {\n+ 120 // Not sure whether our last statement succeeded. Don't risk running it\n+ 121 // again.\n+ 122 throw;\n+ 123 }\n+ 124 catch (const broken_connection &)\n+ 125 {\n+ 126 // Connection failed. Definitely worth retrying.\n+ 127 if (attempts <= 1) throw;\n+ 128 continue;\n+ 129 }\n+ 130 catch (const transaction_rollback &)\n+ 131 {\n+ 132 // Some error that may well be transient, such as serialization failure\n+ 133 // or deadlock. Worth retrying.\n+ 134 if (attempts <= 1) throw;\n+ 135 continue;\n+ 136 }\n+ 137 }\n+ 138 throw pqxx::internal_error{\"No outcome reached on perform().\"};\n+ 139}\n+ 140\n+ 142\n+156template> class transactor\n+ 157{\n+ 158public:\n+159 using argument_type = TRANSACTION;\n+160 PQXX_DEPRECATED explicit transactor( //[t04]\n+ 161 const std::string &TName=\"transactor\") :\n+ 162 m_name{TName} { }\n+ 163\n+ 165\n+176 void operator()(TRANSACTION &T); //[t04]\n+ 177\n+ 178 // Overridable member functions, called by connection_base::perform() if\n+an\n+ 179 // attempt to run transaction fails/succeeds, respectively, or if the\n+ 180 // connection is lost at just the wrong moment, goes into an indeterminate\n+ 181 // state. Use these to patch up runtime state to match events, if needed,\n+or\n+ 182 // to report failure conditions.\n+ 183\n+ 185\n+193 void on_abort(const char[]) noexcept {} //[t13]\n+ 194\n+ 196\n+200 void on_commit() {} //[t07]\n+ 201\n+ 203\n+214 void on_doubt() noexcept {} //[t13]\n+ 215\n+217 std::string name() const { return m_name; } //[t13]\n+ 218\n+ 219private:\n+ 220 std::string m_name;\n+ 221};\n+ 222\n+ 223\n+ 224template\n+225inline void connection_base::perform(\n+ 226 const TRANSACTOR &T,\n+ 227 int Attempts)\n+ 228{\n+ 229 if (Attempts <= 0) return;\n+ 230\n+ 231 bool Done = false;\n+ 232\n+ 233 // Make attempts to perform T\n+ 234 do\n+ 235 {\n+ 236 --Attempts;\n+ 237\n+ 238 // Work on a copy of T2 so we can restore the starting situation if need\n+be\n+ 239 TRANSACTOR T2{T};\n+ 240 try\n+ 241 {\n+ 242 typename TRANSACTOR::argument_type X{*this, T2.name()};\n+ 243 T2(X);\n+ 244 X.commit();\n+ 245 Done = true;\n+ 246 }\n+ 247 catch (const in_doubt_error &)\n+ 248 {\n+ 249 // Not sure whether transaction went through or not. The last thing in\n+ 250 // the world that we should do now is retry.\n+ 251 T2.on_doubt();\n+ 252 throw;\n+ 253 }\n+ 254 catch (const std::exception &e)\n+ 255 {\n+ 256 // Could be any kind of error.\n+ 257 T2.on_abort(e.what());\n+ 258 if (Attempts <= 0) throw;\n+ 259 continue;\n+ 260 }\n+ 261 catch (...)\n+ 262 {\n+ 263 // Don't try to forge ahead if we don't even know what happened\n+ 264 T2.on_abort(\"Unknown exception\");\n+ 265 throw;\n+ 266 }\n+ 267\n+ 268 T2.on_commit();\n+ 269 } while (not Done);\n+ 270}\n+ 271} // namespace pqxx\n+ 273#include \"pqxx/compiler-internal-post.hxx\"\n+ 274#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::basic_connection_base\n-Base-class template for all libpqxx connection types.\n-Definition: basic_connection.hxx:47\n-pqxx::basic_connection_base::basic_connection_base\n-basic_connection_base(const std::string &opt)\n-Definition: basic_connection.hxx:57\n-pqxx::basic_connection_base::options\n-const std::string & options() const noexcept\n-Definition: basic_connection.hxx:72\n-pqxx::basic_connection_base::basic_connection_base\n-basic_connection_base(std::nullptr_t)\n-Definition: basic_connection.hxx:67\n-pqxx::basic_connection_base::~basic_connection_base\n-~basic_connection_base() noexcept\n-Definition: basic_connection.hxx:69\n-pqxx::basic_connection_base::basic_connection_base\n-basic_connection_base(const char opt[])\n-See: basic_connection(const std::string &opt)\n-Definition: basic_connection.hxx:64\n-pqxx::basic_connection_base::basic_connection_base\n-basic_connection_base()\n-Definition: basic_connection.hxx:49\n-pqxx::basic_connection\n-Concrete connection type template.\n-Definition: basic_connection.hxx:90\n-pqxx::basic_connection::basic_connection\n-basic_connection(const std::string &opt)\n-Definition: basic_connection.hxx:92\n-pqxx::basic_connection::basic_connection\n-basic_connection(std::nullptr_t)\n-Definition: basic_connection.hxx:97\n-pqxx::basic_connection::basic_connection\n-basic_connection(const char opt[])\n-Definition: basic_connection.hxx:94\n-pqxx::basic_connection::basic_connection\n-basic_connection()=default\n-pqxx::connection_base\n-connection_base abstract base class; represents a connection to a database.\n-Definition: connection_base.hxx:140\n-pqxx::connection_base::init\n-void init()\n-Definition: connection_base.cxx:99\n-pqxx::connection_base::close\n-void close() noexcept\n-Definition: connection_base.cxx:902\n+pqxx::perform\n+auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype\n+(callback())\n+Simple way to execute a transaction with automatic retry.\n+Definition: transactor.hxx:99\n+pqxx::connection_base::perform\n+void perform(const TRANSACTOR &T, int Attempts)\n+Definition: transactor.hxx:225\n+pqxx::broken_connection\n+Exception class for lost or failed backend connection.\n+Definition: except.hxx:119\n+pqxx::in_doubt_error\n+\"Help, I don't know whether transaction was committed successfully!\"\n+Definition: except.hxx:160\n+pqxx::transaction_rollback\n+The backend saw itself forced to roll back the ongoing transaction.\n+Definition: except.hxx:168\n+pqxx::statement_completion_unknown\n+We can't tell whether our last statement succeeded.\n+Definition: except.hxx:192\n+pqxx::internal_error\n+Internal error in libpqxx library.\n+Definition: except.hxx:209\n+pqxx::transactor\n+Definition: transactor.hxx:157\n+pqxx::transactor::on_doubt\n+void on_doubt() noexcept\n+Overridable function to be called when \"in doubt\" about outcome.\n+Definition: transactor.hxx:214\n+pqxx::transactor::transactor\n+transactor(const std::string &TName=\"transactor\")\n+Definition: transactor.hxx:160\n+pqxx::transactor::on_commit\n+void on_commit()\n+Optional overridable function to be called after successful commit.\n+Definition: transactor.hxx:200\n+pqxx::transactor::operator()\n+void operator()(TRANSACTION &T)\n+Overridable transaction definition; insert your database code here.\n+pqxx::transactor::on_abort\n+void on_abort(const char[]) noexcept\n+Optional overridable function to be called if transaction is aborted.\n+Definition: transactor.hxx:193\n+pqxx::transactor::argument_type\n+TRANSACTION argument_type\n+Definition: transactor.hxx:159\n+pqxx::transactor::name\n+std::string name() const\n+The transactor's name.\n+Definition: transactor.hxx:217\n * include\n * pqxx\n- * basic_connection.hxx\n+ * transactor.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00116_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00116_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: field.hxx Source File\n+libpqxx: stream_base.hxx Source File\n \n \n \n \n \n \n \n@@ -55,314 +55,80 @@\n \n
\n
\n-
field.hxx
\n+
stream_base.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_FIELD
\n-
14#define PQXX_H_FIELD
\n+
13#ifndef PQXX_H_STREAM_BASE
\n+
14#define PQXX_H_STREAM_BASE
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n-
18#include "pqxx/internal/type_utils.hxx"
\n-
19
\n-
20#if defined(PQXX_HAVE_OPTIONAL)
\n-
21#include <optional>
\n+
18#include "pqxx/transaction_base.hxx"
\n+
19#include "pqxx/util.hxx"
\n+
20
\n+
21#include <string>
\n
22
\n-
23/* Use std::experimental::optional as a fallback for std::optional, if
\n-
24 * present.
\n-
25 *
\n-
26 * This may break compilation for some software, if using a libpqxx that was
\n-
27 * configured for a different language version. To stop libpqxx headers from
\n-
28 * using or supporting std::experimental::optional, define a macro
\n-
29 * PQXX_HIDE_EXP_OPTIONAL when building your software.
\n-
30 */
\n-
31#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)
\n-
32#include <experimental/optional>
\n-
33#endif
\n-
34
\n-
35#include "pqxx/array.hxx"
\n-
36#include "pqxx/result.hxx"
\n-
37#include "pqxx/strconv.hxx"
\n-
38#include "pqxx/types.hxx"
\n-
39
\n-
40
\n-
41// Methods tested in eg. test module test01 are marked with "//[t01]".
\n-
42
\n-
43namespace pqxx
\n-
44{
\n-
46
\n-
49class PQXX_LIBEXPORT field
\n-
50{
\n-
51public:
\n-\n-
53
\n-
55
\n-
59 field(const row &R, row_size_type C) noexcept; //[t01]
\n+
23
\n+
24namespace pqxx
\n+
25{
\n+
26
\n+
27class PQXX_LIBEXPORT PQXX_NOVTABLE stream_base :
\n+\n+
29{
\n+
30public:
\n+
31 explicit stream_base(transaction_base &);
\n+
32 // TODO: Can we get rid of the vtable?
\n+
33 virtual ~stream_base() noexcept =default;
\n+
34 virtual void complete() = 0;
\n+
35 operator bool() const noexcept;
\n+
36 bool operator!() const noexcept;
\n+
37protected:
\n+
38 bool m_finished;
\n+
39 virtual void close();
\n+
40 template<typename C> static std::string columnlist(const C &);
\n+
41 template<typename I> static std::string columnlist(I begin, I end);
\n+
42private:
\n+\n+\n+
45 stream_base & operator=(const stream_base &);
\n+
46};
\n+
47
\n+
48template<typename C> std::string stream_base::columnlist(const C &c)
\n+
49{
\n+
50 return columnlist(std::begin(c), std::end(c));
\n+
51}
\n+
52
\n+
53template<typename I> std::string stream_base::columnlist(I begin, I end)
\n+
54{
\n+
55 return separated_list(",", begin, end);
\n+
56}
\n+
57
\n+
58} // namespace pqxx
\n+
59
\n
60
\n-
66
\n-
82 bool operator==(const field &) const; //[t75]
\n-
83
\n-
85
\n-
87 bool operator!=(const field &rhs) const //[t82]
\n-
88 {return not operator==(rhs);}
\n-
90
\n-
96 const char *name() const; //[t11]
\n-
97
\n-
99 oid type() const; //[t07]
\n-
100
\n-
102 oid table() const; //[t02]
\n-
103
\n-
104 row_size_type num() const { return col(); } //[t82]
\n-
105
\n-
107 row_size_type table_column() const; //[t93]
\n-
109
\n-
115
\n-
120 const char *c_str() const; //[t02]
\n-
121
\n-
123 bool is_null() const noexcept; //[t12]
\n-
124
\n-
126
\n-
129 size_type size() const noexcept; //[t11]
\n-
130
\n-
132
\n-
135 template<typename T> auto to(T &Obj) const //[t03]
\n-
136 -> typename std::enable_if<(
\n-
137 not std::is_pointer<T>::value
\n-
138 or std::is_same<T, const char*>::value
\n-
139 ), bool>::type
\n-
140 {
\n-
141 const char *const bytes = c_str();
\n-
142 if (bytes[0] == '\\0' and is_null()) return false;
\n-
143 from_string(bytes, Obj);
\n-
144 return true;
\n-
145 }
\n-
146
\n-
148 template<typename T> bool operator>>(T &Obj) const //[t07]
\n-
149 { return to(Obj); }
\n-
150
\n-
152
\n-
155 template<typename T> auto to(T &Obj, const T &Default) const //[t12]
\n-
156 -> typename std::enable_if<(
\n-
157 not std::is_pointer<T>::value
\n-
158 or std::is_same<T, const char*>::value
\n-
159 ), bool>::type
\n-
160 {
\n-
161 const bool NotNull = to(Obj);
\n-
162 if (not NotNull) Obj = Default;
\n-
163 return NotNull;
\n-
164 }
\n-
165
\n-
167
\n-
170 template<typename T> T as(const T &Default) const //[t01]
\n-
171 {
\n-
172 T Obj;
\n-
173 to(Obj, Default);
\n-
174 return Obj;
\n-
175 }
\n-
176
\n-
178
\n-
183 template<typename T> T as() const //[t45]
\n-
184 {
\n-
185 T Obj;
\n-
186 if (not to(Obj)) Obj = string_traits<T>::null();
\n-
187 return Obj;
\n-
188 }
\n-
189
\n-
191
\n-
195 template<typename T, template<typename> class O
\n-
196#if defined(PQXX_HAVE_OPTIONAL)
\n-
197 = std::optional
\n-
198#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)
\n-
199 = std::experimental::optional
\n-
200#endif
\n-
201 > constexpr O<T> get() const { return as<O<T>>(); }
\n-
202
\n-
204
\n-\n-
211 { return array_parser{c_str(), m_home.m_encoding}; }
\n-
213
\n-
214
\n-
215protected:
\n-
216 const result &home() const noexcept { return m_home; }
\n-
217 size_t idx() const noexcept { return m_row; }
\n-
218 row_size_type col() const noexcept { return row_size_type(m_col); }
\n-
219
\n-
224 long m_col;
\n-
225
\n-
226private:
\n-
227 result m_home;
\n-
228 size_t m_row;
\n-
229};
\n-
230
\n-
231
\n-
233template<>
\n-
234inline bool field::to<std::string>(std::string &Obj) const
\n-
235{
\n-
236 const char *const bytes = c_str();
\n-
237 if (bytes[0] == '\\0' and is_null()) return false;
\n-
238 Obj = std::string{bytes, size()};
\n-
239 return true;
\n-
240}
\n-
241
\n-
243
\n-
248template<>
\n-
249inline bool field::to<const char *>(const char *&Obj) const
\n-
250{
\n-
251 if (is_null()) return false;
\n-
252 Obj = c_str();
\n-
253 return true;
\n-
254}
\n-
255
\n-
256
\n-
257template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n-\n-
259 public std::basic_streambuf<CHAR, TRAITS>
\n-
260{
\n-
261public:
\n-
262 using char_type = CHAR;
\n-
263 using traits_type = TRAITS;
\n-
264 using int_type = typename traits_type::int_type;
\n-
265 using pos_type = typename traits_type::pos_type;
\n-
266 using off_type = typename traits_type::off_type;
\n-
267 using openmode = std::ios::openmode;
\n-
268 using seekdir = std::ios::seekdir;
\n-
269
\n-
270 explicit field_streambuf(const field &F) : //[t74]
\n-
271 m_field{F}
\n-
272 {
\n-
273 initialize();
\n-
274 }
\n-
275
\n-
276protected:
\n-
277 virtual int sync() override { return traits_type::eof(); }
\n-
278
\n-
279protected:
\n-\n-
281 { return traits_type::eof(); }
\n-\n-
283 {return traits_type::eof();}
\n-
284 virtual int_type overflow(int_type) override
\n-
285 { return traits_type::eof(); }
\n-
286 virtual int_type underflow() override
\n-
287 { return traits_type::eof(); }
\n-
288
\n-
289private:
\n-
290 const field &m_field;
\n-
291
\n-
292 int_type initialize()
\n-
293 {
\n-
294 char_type *G =
\n-
295 reinterpret_cast<char_type *>(const_cast<char *>(m_field.c_str()));
\n-
296 this->setg(G, G, G + m_field.size());
\n-
297 return int_type(m_field.size());
\n-
298 }
\n-
299};
\n-
300
\n-
301
\n-
303
\n-
311template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
\n-\n-
313 public std::basic_istream<CHAR, TRAITS>
\n-
314{
\n-
315 using super = std::basic_istream<CHAR, TRAITS>;
\n-
316
\n-
317public:
\n-
318 using char_type = CHAR;
\n-
319 using traits_type = TRAITS;
\n-
320 using int_type = typename traits_type::int_type;
\n-
321 using pos_type = typename traits_type::pos_type;
\n-
322 using off_type = typename traits_type::off_type;
\n-
323
\n-
324 basic_fieldstream(const field &F) : super{nullptr}, m_buf{F}
\n-
325 { super::init(&m_buf); }
\n-
326
\n-
327private:
\n-\n-
329};
\n-
330
\n-\n-
332
\n-
334
\n-
354template<typename CHAR>
\n-
355inline std::basic_ostream<CHAR> &operator<<(
\n-
356 std::basic_ostream<CHAR> &S, const field &F) //[t46]
\n-
357{
\n-
358 S.write(F.c_str(), std::streamsize(F.size()));
\n-
359 return S;
\n-
360}
\n-
361
\n-
362
\n-
364template<typename T>
\n-
365inline void from_string(const field &F, T &Obj) //[t46]
\n-
366 { from_string(F.c_str(), Obj, F.size()); }
\n-
367
\n-
369template<> PQXX_LIBEXPORT std::string to_string(const field &Obj); //[t74]
\n-
370
\n-
371} // namespace pqxx
\n-
372#include "pqxx/compiler-internal-post.hxx"
\n-
373#endif
\n+
61#include "pqxx/compiler-internal-post.hxx"
\n+
62#endif
\n
STL namespace.
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const field &F)
Write a result field to any type of stream.
Definition: field.hxx:355
\n-
void from_string(const field &F, T &Obj)
Convert a field's string contents to another type.
Definition: field.hxx:365
\n-
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
\n-
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
\n-
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
\n-
Low-level array parser.
Definition: array.hxx:47
\n-
Reference to a field in a result set.
Definition: field.hxx:50
\n-
row_size_type num() const
Definition: field.hxx:104
\n-
row_size_type col() const noexcept
Definition: field.hxx:218
\n-
size_type size() const noexcept
Return number of bytes taken up by the field's value.
Definition: field.cxx:74
\n-
long m_col
Definition: field.hxx:224
\n-
T as(const T &Default) const
Return value as object of given type, or Default if null.
Definition: field.hxx:170
\n-
field_size_type size_type
Definition: field.hxx:52
\n-
bool operator>>(T &Obj) const
Read value into Obj; or leave Obj untouched and return false if null.
Definition: field.hxx:148
\n-
array_parser as_array() const
Parse the field as an SQL array.
Definition: field.hxx:210
\n-
const result & home() const noexcept
Definition: field.hxx:216
\n-
T as() const
Return value as object of given type, or throw exception if null.
Definition: field.hxx:183
\n-
auto to(T &Obj, const T &Default) const -> typename std::enable_if<(not std::is_pointer< T >::value or std::is_same< T, const char * >::value), bool >::type
Read value into Obj; or use Default & return false if null.
Definition: field.hxx:155
\n-
const char * c_str() const
Read as plain C string.
Definition: field.cxx:62
\n-
bool is_null() const noexcept
Is this field's value null?
Definition: field.cxx:68
\n-
constexpr O< T > get() const
Return value wrapped in some optional type (empty for nulls)
Definition: field.hxx:201
\n-
size_t idx() const noexcept
Definition: field.hxx:217
\n-
bool operator!=(const field &rhs) const
Byte-by-byte comparison (all nulls are considered equal)
Definition: field.hxx:87
\n-
Definition: field.hxx:260
\n-
TRAITS traits_type
Definition: field.hxx:263
\n-
typename traits_type::off_type off_type
Definition: field.hxx:266
\n-
virtual pos_type seekoff(off_type, seekdir, openmode) override
Definition: field.hxx:280
\n-
virtual pos_type seekpos(pos_type, openmode) override
Definition: field.hxx:282
\n-
std::ios::openmode openmode
Definition: field.hxx:267
\n-
virtual int_type overflow(int_type) override
Definition: field.hxx:284
\n-
field_streambuf(const field &F)
Definition: field.hxx:270
\n-
typename traits_type::pos_type pos_type
Definition: field.hxx:265
\n-
virtual int sync() override
Definition: field.hxx:277
\n-
typename traits_type::int_type int_type
Definition: field.hxx:264
\n-
virtual int_type underflow() override
Definition: field.hxx:286
\n-
CHAR char_type
Definition: field.hxx:262
\n-
std::ios::seekdir seekdir
Definition: field.hxx:268
\n-
Input stream that gets its data from a result field.
Definition: field.hxx:314
\n-
TRAITS traits_type
Definition: field.hxx:319
\n-
basic_fieldstream(const field &F)
Definition: field.hxx:324
\n-
typename traits_type::pos_type pos_type
Definition: field.hxx:321
\n-
typename traits_type::off_type off_type
Definition: field.hxx:322
\n-
typename traits_type::int_type int_type
Definition: field.hxx:320
\n-
CHAR char_type
Definition: field.hxx:318
\n-
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n-
Reference to one row in a result.
Definition: row.hxx:41
\n-
Traits class for use in string conversions.
Definition: strconv.hxx:51
\n+
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: util.hxx:95
\n+
Definition: stream_base.hxx:29
\n+
virtual ~stream_base() noexcept=default
\n+
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
\n+
Definition: transaction_base.hxx:44
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,418 +1,85 @@\n \n \n \n \n \n libpqxx\n \n-field.hxx\n+stream_base.hxx\n 1\n- 13#ifndef PQXX_H_FIELD\n- 14#define PQXX_H_FIELD\n+ 13#ifndef PQXX_H_STREAM_BASE\n+ 14#define PQXX_H_STREAM_BASE\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n- 18#include \"pqxx/internal/type_utils.hxx\"\n- 19\n- 20#if defined(PQXX_HAVE_OPTIONAL)\n- 21#include \n+ 18#include \"pqxx/transaction_base.hxx\"\n+ 19#include \"pqxx/util.hxx\"\n+ 20\n+ 21#include \n 22\n- 23/* Use std::experimental::optional as a fallback for std::optional, if\n- 24 * present.\n- 25 *\n- 26 * This may break compilation for some software, if using a libpqxx that was\n- 27 * configured for a different language version. To stop libpqxx headers from\n- 28 * using or supporting std::experimental::optional, define a macro\n- 29 * PQXX_HIDE_EXP_OPTIONAL when building your software.\n- 30 */\n- 31#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)\n- 32#include \n- 33#endif\n- 34\n- 35#include \"pqxx/array.hxx\"\n- 36#include \"pqxx/result.hxx\"\n- 37#include \"pqxx/strconv.hxx\"\n- 38#include \"pqxx/types.hxx\"\n- 39\n- 40\n- 41// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n- 42\n- 43namespace pqxx\n- 44{\n- 46\n-49class PQXX_LIBEXPORT field\n- 50{\n- 51public:\n-52 using size_type = field_size_type;\n- 53\n- 55\n- 59 field(const row &R, row_size_type C) noexcept; //[t01]\n+ 23\n+ 24namespace pqxx\n+ 25{\n+ 26\n+27class PQXX_LIBEXPORT PQXX_NOVTABLE stream_base :\n+ 28 public internal::transactionfocus\n+ 29{\n+ 30public:\n+ 31 explicit stream_base(transaction_base &);\n+ 32 // TODO: Can we get rid of the vtable?\n+33 virtual ~stream_base() noexcept =default;\n+34 virtual void complete() = 0;\n+ 35 operator bool() const noexcept;\n+ 36 bool operator!() const noexcept;\n+ 37protected:\n+38 bool m_finished;\n+ 39 virtual void close();\n+ 40 template static std::string columnlist(const C &);\n+ 41 template static std::string columnlist(I begin, I end);\n+ 42private:\n+ 43 stream_base();\n+ 44 stream_base(const stream_base&);\n+ 45 stream_base & operator=(const stream_base &);\n+ 46};\n+ 47\n+48template std::string stream_base::columnlist(const C &c)\n+ 49{\n+ 50 return columnlist(std::begin(c), std::end(c));\n+ 51}\n+ 52\n+53template std::string stream_base::columnlist(I begin, I end)\n+ 54{\n+ 55 return separated_list(\",\", begin, end);\n+ 56}\n+ 57\n+ 58} // namespace pqxx\n+ 59\n 60\n- 66\n- 82 bool operator==(const field &) const; //[t75]\n- 83\n- 85\n-87 bool operator!=(const field &rhs) const //[t82]\n- 88 {return not operator==(rhs);}\n- 90\n- 96 const char *name() const; //[t11]\n- 97\n- 99 oid type() const; //[t07]\n- 100\n- 102 oid table() const; //[t02]\n- 103\n-104 row_size_type num() const { return col(); } //[t82]\n- 105\n- 107 row_size_type table_column() const; //[t93]\n- 109\n- 115\n- 120 const char *c_str() const; //[t02]\n- 121\n- 123 bool is_null() const noexcept; //[t12]\n- 124\n- 126\n- 129 size_type size() const noexcept; //[t11]\n- 130\n- 132\n-135 template auto to(T &Obj) const //[t03]\n- 136 -> typename std::enable_if<(\n- 137 not std::is_pointer::value\n- 138 or std::is_same::value\n- 139 ), bool>::type\n- 140 {\n- 141 const char *const bytes = c_str();\n- 142 if (bytes[0] == '\\0' and is_null()) return false;\n- 143 from_string(bytes, Obj);\n- 144 return true;\n- 145 }\n- 146\n-148 template bool operator>>(T &Obj) const //[t07]\n- 149 { return to(Obj); }\n- 150\n- 152\n-155 template auto to(T &Obj, const T &Default) const //[t12]\n- 156 -> typename std::enable_if<(\n- 157 not std::is_pointer::value\n- 158 or std::is_same::value\n- 159 ), bool>::type\n- 160 {\n- 161 const bool NotNull = to(Obj);\n- 162 if (not NotNull) Obj = Default;\n- 163 return NotNull;\n- 164 }\n- 165\n- 167\n-170 template T as(const T &Default) const //[t01]\n- 171 {\n- 172 T Obj;\n- 173 to(Obj, Default);\n- 174 return Obj;\n- 175 }\n- 176\n- 178\n-183 template T as() const //[t45]\n- 184 {\n- 185 T Obj;\n- 186 if (not to(Obj)) Obj = string_traits::null();\n- 187 return Obj;\n- 188 }\n- 189\n- 191\n- 195 template class O\n- 196#if defined(PQXX_HAVE_OPTIONAL)\n- 197 = std::optional\n- 198#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)\n- 199 = std::experimental::optional\n- 200#endif\n-201 > constexpr O get() const { return as>(); }\n- 202\n- 204\n-210 array_parser as_array() const\n- 211 { return array_parser{c_str(), m_home.m_encoding}; }\n- 213\n- 214\n- 215protected:\n-216 const result &home() const noexcept { return m_home; }\n-217 size_t idx() const noexcept { return m_row; }\n-218 row_size_type col() const noexcept { return row_size_type(m_col); }\n- 219\n-224 long m_col;\n- 225\n- 226private:\n- 227 result m_home;\n- 228 size_t m_row;\n- 229};\n- 230\n- 231\n- 233template<>\n-234inline bool field::to(std::string &Obj) const\n- 235{\n- 236 const char *const bytes = c_str();\n- 237 if (bytes[0] == '\\0' and is_null()) return false;\n- 238 Obj = std::string{bytes, size()};\n- 239 return true;\n- 240}\n- 241\n- 243\n- 248template<>\n-249inline bool field::to(const char *&Obj) const\n- 250{\n- 251 if (is_null()) return false;\n- 252 Obj = c_str();\n- 253 return true;\n- 254}\n- 255\n- 256\n- 257template>\n-258 class field_streambuf :\n- 259 public std::basic_streambuf\n- 260{\n- 261public:\n-262 using char_type = CHAR;\n-263 using traits_type = TRAITS;\n-264 using int_type = typename traits_type::int_type;\n-265 using pos_type = typename traits_type::pos_type;\n-266 using off_type = typename traits_type::off_type;\n-267 using openmode = std::ios::openmode;\n-268 using seekdir = std::ios::seekdir;\n- 269\n-270 explicit field_streambuf(const field &F) : //[t74]\n- 271 m_field{F}\n- 272 {\n- 273 initialize();\n- 274 }\n- 275\n- 276protected:\n-277 virtual int sync() override { return traits_type::eof(); }\n- 278\n- 279protected:\n-280 virtual pos_type seekoff(off_type, seekdir, openmode) override\n- 281 { return traits_type::eof(); }\n-282 virtual pos_type seekpos(pos_type, openmode) override\n- 283 {return traits_type::eof();}\n-284 virtual int_type overflow(int_type) override\n- 285 { return traits_type::eof(); }\n-286 virtual int_type underflow() override\n- 287 { return traits_type::eof(); }\n- 288\n- 289private:\n- 290 const field &m_field;\n- 291\n- 292 int_type initialize()\n- 293 {\n- 294 char_type *G =\n- 295 reinterpret_cast(const_cast(m_field.c_str()));\n- 296 this->setg(G, G, G + m_field.size());\n- 297 return int_type(m_field.size());\n- 298 }\n- 299};\n- 300\n- 301\n- 303\n- 311template>\n-312 class basic_fieldstream :\n- 313 public std::basic_istream\n- 314{\n- 315 using super = std::basic_istream;\n- 316\n- 317public:\n-318 using char_type = CHAR;\n-319 using traits_type = TRAITS;\n-320 using int_type = typename traits_type::int_type;\n-321 using pos_type = typename traits_type::pos_type;\n-322 using off_type = typename traits_type::off_type;\n- 323\n-324 basic_fieldstream(const field &F) : super{nullptr}, m_buf{F}\n- 325 { super::init(&m_buf); }\n- 326\n- 327private:\n- 328 field_streambuf m_buf;\n- 329};\n- 330\n-331using fieldstream = basic_fieldstream;\n- 332\n- 334\n- 354template\n- 355inline std::basic_ostream &operator<<(\n- 356 std::basic_ostream &S, const field &F) //[t46]\n- 357{\n- 358 S.write(F.c_str(), std::streamsize(F.size()));\n- 359 return S;\n- 360}\n- 361\n- 362\n- 364template\n-365inline void from_string(const field &F, T &Obj) //[t46]\n- 366 { from_string(F.c_str(), Obj, F.size()); }\n- 367\n- 369template<> PQXX_LIBEXPORT std::string to_string(const field &Obj); //[t74]\n- 370\n- 371} // namespace pqxx\n- 372#include \"pqxx/compiler-internal-post.hxx\"\n- 373#endif\n+ 61#include \"pqxx/compiler-internal-post.hxx\"\n+ 62#endif\n std\n STL namespace.\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::operator<<\n-std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const\n-field &F)\n-Write a result field to any type of stream.\n-Definition: field.hxx:355\n-pqxx::from_string\n-void from_string(const field &F, T &Obj)\n-Convert a field's string contents to another type.\n-Definition: field.hxx:365\n-pqxx::to_string\n-std::string to_string(const field &Obj)\n-Convert a field to a string.\n-Definition: result.cxx:451\n-pqxx::field_size_type\n-std::size_t field_size_type\n-Number of bytes in a field of database data.\n-Definition: types.hxx:30\n-pqxx::row_size_type\n-unsigned int row_size_type\n-Number of fields in a row of database data.\n-Definition: types.hxx:24\n-pqxx::array_parser\n-Low-level array parser.\n-Definition: array.hxx:47\n-pqxx::field\n-Reference to a field in a result set.\n-Definition: field.hxx:50\n-pqxx::field::num\n-row_size_type num() const\n-Definition: field.hxx:104\n-pqxx::field::col\n-row_size_type col() const noexcept\n-Definition: field.hxx:218\n-pqxx::field::size\n-size_type size() const noexcept\n-Return number of bytes taken up by the field's value.\n-Definition: field.cxx:74\n-pqxx::field::m_col\n-long m_col\n-Definition: field.hxx:224\n-pqxx::field::as\n-T as(const T &Default) const\n-Return value as object of given type, or Default if null.\n-Definition: field.hxx:170\n-pqxx::field::size_type\n-field_size_type size_type\n-Definition: field.hxx:52\n-pqxx::field::operator>>\n-bool operator>>(T &Obj) const\n-Read value into Obj; or leave Obj untouched and return false if null.\n-Definition: field.hxx:148\n-pqxx::field::as_array\n-array_parser as_array() const\n-Parse the field as an SQL array.\n-Definition: field.hxx:210\n-pqxx::field::home\n-const result & home() const noexcept\n-Definition: field.hxx:216\n-pqxx::field::as\n-T as() const\n-Return value as object of given type, or throw exception if null.\n-Definition: field.hxx:183\n-pqxx::field::to\n-auto to(T &Obj, const T &Default) const -> typename std::enable_if<(not std::\n-is_pointer< T >::value or std::is_same< T, const char * >::value), bool >::type\n-Read value into Obj; or use Default & return false if null.\n-Definition: field.hxx:155\n-pqxx::field::c_str\n-const char * c_str() const\n-Read as plain C string.\n-Definition: field.cxx:62\n-pqxx::field::is_null\n-bool is_null() const noexcept\n-Is this field's value null?\n-Definition: field.cxx:68\n-pqxx::field::get\n-constexpr O< T > get() const\n-Return value wrapped in some optional type (empty for nulls)\n-Definition: field.hxx:201\n-pqxx::field::idx\n-size_t idx() const noexcept\n-Definition: field.hxx:217\n-pqxx::field::operator!=\n-bool operator!=(const field &rhs) const\n-Byte-by-byte comparison (all nulls are considered equal)\n-Definition: field.hxx:87\n-pqxx::field_streambuf\n-Definition: field.hxx:260\n-pqxx::field_streambuf::traits_type\n-TRAITS traits_type\n-Definition: field.hxx:263\n-pqxx::field_streambuf::off_type\n-typename traits_type::off_type off_type\n-Definition: field.hxx:266\n-pqxx::field_streambuf::seekoff\n-virtual pos_type seekoff(off_type, seekdir, openmode) override\n-Definition: field.hxx:280\n-pqxx::field_streambuf::seekpos\n-virtual pos_type seekpos(pos_type, openmode) override\n-Definition: field.hxx:282\n-pqxx::field_streambuf::openmode\n-std::ios::openmode openmode\n-Definition: field.hxx:267\n-pqxx::field_streambuf::overflow\n-virtual int_type overflow(int_type) override\n-Definition: field.hxx:284\n-pqxx::field_streambuf::field_streambuf\n-field_streambuf(const field &F)\n-Definition: field.hxx:270\n-pqxx::field_streambuf::pos_type\n-typename traits_type::pos_type pos_type\n-Definition: field.hxx:265\n-pqxx::field_streambuf::sync\n-virtual int sync() override\n-Definition: field.hxx:277\n-pqxx::field_streambuf::int_type\n-typename traits_type::int_type int_type\n-Definition: field.hxx:264\n-pqxx::field_streambuf::underflow\n-virtual int_type underflow() override\n-Definition: field.hxx:286\n-pqxx::field_streambuf::char_type\n-CHAR char_type\n-Definition: field.hxx:262\n-pqxx::field_streambuf::seekdir\n-std::ios::seekdir seekdir\n-Definition: field.hxx:268\n-pqxx::basic_fieldstream\n-Input stream that gets its data from a result field.\n-Definition: field.hxx:314\n-pqxx::basic_fieldstream::traits_type\n-TRAITS traits_type\n-Definition: field.hxx:319\n-pqxx::basic_fieldstream::basic_fieldstream\n-basic_fieldstream(const field &F)\n-Definition: field.hxx:324\n-pqxx::basic_fieldstream::pos_type\n-typename traits_type::pos_type pos_type\n-Definition: field.hxx:321\n-pqxx::basic_fieldstream::off_type\n-typename traits_type::off_type off_type\n-Definition: field.hxx:322\n-pqxx::basic_fieldstream::int_type\n-typename traits_type::int_type int_type\n-Definition: field.hxx:320\n-pqxx::basic_fieldstream::char_type\n-CHAR char_type\n-Definition: field.hxx:318\n-pqxx::result\n-Result set containing data returned by a query or command.\n-Definition: result.hxx:70\n-pqxx::row\n-Reference to one row in a result.\n-Definition: row.hxx:41\n-pqxx::string_traits\n-Traits class for use in string conversions.\n-Definition: strconv.hxx:51\n+pqxx::separated_list\n+std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS\n+access)\n+Represent sequence of values as a string, joined by a given separator.\n+Definition: util.hxx:95\n+pqxx::stream_base\n+Definition: stream_base.hxx:29\n+pqxx::stream_base::~stream_base\n+virtual ~stream_base() noexcept=default\n+pqxx::stream_base::columnlist\n+static std::string columnlist(const C &)\n+Definition: stream_base.hxx:48\n+pqxx::internal::transactionfocus\n+Definition: transaction_base.hxx:44\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * field.hxx\n+ * stream_base.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00119_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00119_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: config-public-compiler.h Source File\n+libpqxx: transaction_base.hxx Source File\n \n \n \n \n \n \n \n@@ -55,27 +55,461 @@\n \n
\n
\n-
config-public-compiler.h
\n+
transaction_base.hxx
\n
\n
\n-
1/* Automatically generated from config.h: public/compiler config. */
\n-
2
\n-
3#define PQXX_HAVE_DEPRECATED 1
\n-
4#define PQXX_HAVE_GCC_CONST 1
\n-
5#define PQXX_HAVE_GCC_DEPRECATED 1
\n-
6#define PQXX_HAVE_GCC_PURE 1
\n+
1
\n+
14#ifndef PQXX_H_TRANSACTION_BASE
\n+
15#define PQXX_H_TRANSACTION_BASE
\n+
16
\n+
17#include "pqxx/compiler-public.hxx"
\n+
18#include "pqxx/compiler-internal-pre.hxx"
\n+
19
\n+
20/* End-user programs need not include this file, unless they define their own
\n+
21 * transaction classes. This is not something the typical program should want
\n+
22 * to do.
\n+
23 *
\n+
24 * However, reading this file is worthwhile because it defines the public
\n+
25 * interface for the available transaction classes such as transaction and
\n+
26 * nontransaction.
\n+
27 */
\n+
28
\n+
29#include "pqxx/connection_base.hxx"
\n+
30#include "pqxx/internal/encoding_group.hxx"
\n+
31#include "pqxx/isolation.hxx"
\n+
32#include "pqxx/result.hxx"
\n+
33#include "pqxx/row.hxx"
\n+
34
\n+
35// Methods tested in eg. test module test01 are marked with "//[t01]".
\n+
36
\n+
37namespace pqxx
\n+
38{
\n+
39namespace internal
\n+
40{
\n+
41class sql_cursor;
\n+
42
\n+
43class PQXX_LIBEXPORT transactionfocus : public virtual namedclass
\n+
44{
\n+
45public:
\n+\n+
47 namedclass{"transactionfocus"},
\n+
48 m_trans{t},
\n+
49 m_registered{false}
\n+
50 {
\n+
51 }
\n+
52
\n+\n+\n+\n+
56
\n+
57protected:
\n+
58 void register_me();
\n+
59 void unregister_me() noexcept;
\n+
60 void reg_pending_error(const std::string &) noexcept;
\n+
61 bool registered() const noexcept { return m_registered; }
\n+
62
\n+\n+
64
\n+
65private:
\n+
66 bool m_registered;
\n+
67};
\n+
68
\n+
69
\n+
71
\n+
73class PQXX_LIBEXPORT parameterized_invocation : statement_parameters
\n+
74{
\n+
75public:
\n+
76 PQXX_DEPRECATED parameterized_invocation(
\n+
77 connection_base &, const std::string &query);
\n+
78
\n+
79 parameterized_invocation &operator()() { add_param(); return *this; }
\n+\n+
81 { add_binary_param(v, true); return *this; }
\n+
82 template<typename T> parameterized_invocation &operator()(const T &v)
\n+
83 { add_param(v, true); return *this; }
\n+\n+
85 { add_binary_param(v, nonnull); return *this; }
\n+
86 template<typename T>
\n+
87 parameterized_invocation &operator()(const T &v, bool nonnull)
\n+
88 { add_param(v, nonnull); return *this; }
\n+
89
\n+
90 result exec();
\n+
91
\n+
92private:
\n+\n+
95 =delete;
\n+
96
\n+
97 connection_base &m_home;
\n+
98 const std::string m_query;
\n+
99};
\n+
100} // namespace internal
\n+
101
\n+
102
\n+
103namespace internal
\n+
104{
\n+
105namespace gate
\n+
106{
\n+
107class transaction_subtransaction;
\n+
108class transaction_tablereader;
\n+
109class transaction_sql_cursor;
\n+
110class transaction_stream_from;
\n+
111class transaction_tablewriter;
\n+
112class transaction_stream_to;
\n+
113class transaction_transactionfocus;
\n+
114} // namespace internal::gate
\n+
115} // namespace internal
\n+
116
\n+
117
\n+
131
\n+
136class PQXX_LIBEXPORT PQXX_NOVTABLE transaction_base :
\n+
137 public virtual internal::namedclass
\n+
138{
\n+
139public:
\n+\n+
142
\n+\n+\n+\n+
146
\n+
147 virtual ~transaction_base() =0; //[t01]
\n+
148
\n+
150
\n+
162 void commit(); //[t01]
\n+
163
\n+
165
\n+
168 void abort(); //[t10]
\n+
169
\n+
175 std::string esc(const char str[]) const { return conn().esc(str); }
\n+
177 std::string esc(const char str[], size_t maxlen) const
\n+
178 { return conn().esc(str, maxlen); }
\n+
180 std::string esc(const std::string &str) const { return conn().esc(str); }
\n+
181
\n+
183
\n+
194 std::string esc_raw(const unsigned char data[], size_t len) const //[t62]
\n+
195 { return conn().esc_raw(data, len); }
\n+
197 std::string esc_raw(const std::string &) const; //[t62]
\n+
198
\n+
200
\n+
203 std::string unesc_raw(const std::string &text) const
\n+
204 { return conn().unesc_raw(text); }
\n+
205
\n+
207
\n+
210 std::string unesc_raw(const char *text) const
\n+
211 { return conn().unesc_raw(text); }
\n+
212
\n+
214
\n+
215 template<typename T> std::string quote(const T &t) const
\n+
216 { return conn().quote(t); }
\n+
217
\n+
219 std::string quote_raw(const unsigned char str[], size_t len) const
\n+
220 { return conn().quote_raw(str, len); }
\n+
221
\n+
222 std::string quote_raw(const std::string &str) const;
\n+
223
\n+
225 std::string quote_name(const std::string &identifier) const
\n+
226 { return conn().quote_name(identifier); }
\n+
227
\n+
229 std::string esc_like(const std::string &str, char escape_char='\\\\') const
\n+
230 { return conn().esc_like(str, escape_char); }
\n+
232
\n+
234
\n+
249 result exec(
\n+
250 const std::string &Query,
\n+
251 const std::string &Desc=std::string{}); //[t01]
\n+
252
\n+\n+
254 const std::stringstream &Query,
\n+
255 const std::string &Desc=std::string{})
\n+
256 { return exec(Query.str(), Desc); }
\n+
257
\n+
259
\n+\n+
265 const std::string &Query,
\n+
266 const std::string &Desc=std::string{})
\n+
267 { return exec_n(0, Query, Desc); }
\n+
268
\n+
270
\n+
276 row exec1(const std::string &Query, const std::string &Desc=std::string{})
\n+
277 { return exec_n(1, Query, Desc).front(); }
\n+
278
\n+
280
\n+
285 result exec_n(
\n+
286 size_t rows,
\n+
287 const std::string &Query,
\n+
288 const std::string &Desc=std::string{});
\n+
289
\n+
320 template<typename ...Args>
\n+
321 result exec_params(const std::string &query, Args &&...args)
\n+
322 {
\n+
323 return internal_exec_params(
\n+
324 query, internal::params(std::forward<Args>(args)...));
\n+
325 }
\n+
326
\n+
327 // Execute parameterised statement, expect a single-row result.
\n+
330 template<typename ...Args>
\n+
331 row exec_params1(const std::string &query, Args&&... args)
\n+
332 {
\n+
333 return exec_params_n(1, query, std::forward<Args>(args)...).front();
\n+
334 }
\n+
335
\n+
336 // Execute parameterised statement, expect a result with zero rows.
\n+
339 template<typename ...Args>
\n+
340 result exec_params0(const std::string &query, Args &&...args)
\n+
341 {
\n+
342 return exec_params_n(0, query, std::forward<Args>(args)...);
\n+
343 }
\n+
344
\n+
345 // Execute parameterised statement, expect exactly a given number of rows.
\n+
348 template<typename ...Args>
\n+
349 result exec_params_n(size_t rows, const std::string &query, Args &&...args)
\n+
350 {
\n+
351 const auto r = exec_params(query, std::forward<Args>(args)...);
\n+
352 check_rowcount_params(rows, r.size());
\n+
353 return r;
\n+
354 }
\n+
355
\n+
357 /* Use this to build up a parameterized statement invocation, then invoke it
\n+
358 * using @c exec()
\n+
359 *
\n+
360 * Example: @c trans.parameterized("SELECT $1 + 1")(1).exec();
\n+
361 *
\n+
362 * This is the old, pre-C++11 way of handling parameterised statements. As
\n+
363 * of libpqxx 6.0, it's made much easier using variadic templates.
\n+
364 */
\n+\n+
366 parameterized(const std::string &query);
\n+
368
\n+
393
\n+
395 template<typename ...Args>
\n+
396 result exec_prepared(const std::string &statement, Args&&... args)
\n+
397 {
\n+
398 return internal_exec_prepared(
\n+
399 statement, internal::params(std::forward<Args>(args)...));
\n+
400 }
\n+
401
\n+
403
\n+
405 template<typename ...Args>
\n+
406 row exec_prepared1(const std::string &statement, Args&&... args)
\n+
407 {
\n+
408 return exec_prepared_n(1, statement, std::forward<Args>(args)...).front();
\n+
409 }
\n+
410
\n+
412
\n+
414 template<typename ...Args>
\n+
415 result exec_prepared0(const std::string &statement, Args&&... args)
\n+
416 {
\n+
417 return exec_prepared_n(0, statement, std::forward<Args>(args)...);
\n+
418 }
\n+
419
\n+
421
\n+
424 template<typename ...Args>
\n+\n+
426 size_t rows,
\n+
427 const std::string &statement,
\n+
428 Args&&... args)
\n+
429 {
\n+
430 const auto r = exec_prepared(statement, std::forward<Args>(args)...);
\n+
431 check_rowcount_prepared(statement, rows, r.size());
\n+
432 return r;
\n+
433 }
\n+
434
\n+
436
\n+
474 PQXX_DEPRECATED prepare::invocation
\n+
475 prepared(const std::string &statement=std::string{});
\n+
476
\n+
478
\n+
484 void process_notice(const char Msg[]) const //[t14]
\n+
485 { m_conn.process_notice(Msg); }
\n+
487 void process_notice(const std::string &Msg) const //[t14]
\n+
488 { m_conn.process_notice(Msg); }
\n+
490
\n+
492 connection_base &conn() const { return m_conn; } //[t04]
\n+
493
\n+
495
\n+
502 void set_variable(const std::string &Var, const std::string &Val); //[t61]
\n+
503
\n+
505
\n+
514 std::string get_variable(const std::string &); //[t61]
\n+
515
\n+
516protected:
\n+
518
\n+
524 explicit transaction_base(connection_base &c, bool direct=true);
\n+
525
\n+
527
\n+
529 void Begin();
\n+
530
\n+
532 void End() noexcept;
\n+
533
\n+
535 virtual void do_begin() =0;
\n+
537 virtual result do_exec(const char Query[]) =0;
\n+
539 virtual void do_commit() =0;
\n+
541 virtual void do_abort() =0;
\n+
542
\n+
543 // For use by implementing class:
\n+
544
\n+
546
\n+
554 result direct_exec(const char C[], int Retries=0);
\n+
555
\n+
557 void reactivation_avoidance_clear() noexcept
\n+
558 {m_reactivation_avoidance.clear();}
\n+
559
\n+
560protected:
\n+
562
\n+\n+
565
\n+
566private:
\n+
567 /* A transaction goes through the following stages in its lifecycle:
\n+
568 * <ul>
\n+
569 * <li> nascent: the transaction hasn't actually begun yet. If our connection
\n+
570 * fails at this stage, it may recover and the transaction can attempt to
\n+
571 * establish itself again.
\n+
572 * <li> active: the transaction has begun. Since no commit command has been
\n+
573 * issued, abortion is implicit if the connection fails now.
\n+
574 * <li> aborted: an abort has been issued; the transaction is terminated and
\n+
575 * its changes to the database rolled back. It will accept no further
\n+
576 * commands.
\n+
577 * <li> committed: the transaction has completed successfully, meaning that a
\n+
578 * commit has been issued. No further commands are accepted.
\n+
579 * <li> in_doubt: the connection was lost at the exact wrong time, and there
\n+
580 * is no way of telling whether the transaction was committed or aborted.
\n+
581 * </ul>
\n+
582 *
\n+
583 * Checking and maintaining state machine logic is the responsibility of the
\n+
584 * base class (ie., this one).
\n+
585 */
\n+
586 enum Status
\n+
587 {
\n+
588 st_nascent,
\n+
589 st_active,
\n+
590 st_aborted,
\n+
591 st_committed,
\n+
592 st_in_doubt
\n+
593 };
\n+
594
\n+
596 PQXX_PRIVATE void activate();
\n+
597
\n+
598 PQXX_PRIVATE void CheckPendingError();
\n+
599
\n+
600 template<typename T> bool parm_is_null(T *p) const noexcept
\n+
601 { return p == nullptr; }
\n+
602 template<typename T> bool parm_is_null(T) const noexcept
\n+
603 { return false; }
\n+
604
\n+
605 result internal_exec_prepared(
\n+
606 const std::string &statement,
\n+
607 const internal::params &args);
\n+
608
\n+
609 result internal_exec_params(
\n+
610 const std::string &query,
\n+
611 const internal::params &args);
\n+
612
\n+
614 void check_rowcount_prepared(
\n+
615 const std::string &statement,
\n+
616 size_t expected_rows,
\n+
617 size_t actual_rows);
\n+
618
\n+
620 void check_rowcount_params(
\n+
621 size_t expected_rows, size_t actual_rows);
\n+
622
\n+
623 friend class pqxx::internal::gate::transaction_transactionfocus;
\n+
624 PQXX_PRIVATE void register_focus(internal::transactionfocus *);
\n+
625 PQXX_PRIVATE void unregister_focus(internal::transactionfocus *) noexcept;
\n+
626 PQXX_PRIVATE void register_pending_error(const std::string &) noexcept;
\n+
627
\n+
628 friend class pqxx::internal::gate::transaction_tablereader;
\n+
629 friend class pqxx::internal::gate::transaction_stream_from;
\n+
630 PQXX_PRIVATE void BeginCopyRead(const std::string &, const std::string &);
\n+
631 bool read_copy_line(std::string &);
\n+
632
\n+
633 friend class pqxx::internal::gate::transaction_tablewriter;
\n+
634 friend class pqxx::internal::gate::transaction_stream_to;
\n+
635 PQXX_PRIVATE void BeginCopyWrite(
\n+
636 const std::string &Table,
\n+
637 const std::string &Columns);
\n+
638 void write_copy_line(const std::string &);
\n+
639 void end_copy_write();
\n+
640
\n+
641 friend class pqxx::internal::gate::transaction_subtransaction;
\n+
642
\n+
643 connection_base &m_conn;
\n+
644
\n+\n+
646 Status m_status = st_nascent;
\n+
647 bool m_registered = false;
\n+
648 std::map<std::string, std::string> m_vars;
\n+
649 std::string m_pending_error;
\n+
650};
\n+
651
\n+
652} // namespace pqxx
\n+
653
\n+
654#include "pqxx/compiler-internal-post.hxx"
\n+
655#endif
\n+
std::string esc(const char str[]) const
Escape string for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:175
\n+
STL namespace.
\n+
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n+
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
\n+
Definition: connection_base.hxx:49
\n+
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n+
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
\n+
Helper class for passing parameters to, and executing, prepared statements.
Definition: prepared_statement.hxx:82
\n+
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n+
void clear() noexcept
Definition: result.hxx:121
\n+
Reference to one row in a result.
Definition: row.hxx:41
\n+
reference front() const noexcept
Definition: row.cxx:59
\n+
Definition: transaction_base.hxx:44
\n+\n+
transactionfocus(const transactionfocus &)=delete
\n+
transactionfocus & operator=(const transactionfocus &)=delete
\n+
transactionfocus(transaction_base &t)
Definition: transaction_base.hxx:46
\n+
transaction_base & m_trans
Definition: transaction_base.hxx:63
\n+
Helper class to construct an invocation of a parameterised statement.
Definition: transaction_base.hxx:74
\n+
parameterized_invocation & operator()(const binarystring &v, bool nonnull)
Definition: transaction_base.hxx:84
\n+
parameterized_invocation & operator()(const binarystring &v)
Definition: transaction_base.hxx:80
\n+
parameterized_invocation & operator()(const T &v)
Definition: transaction_base.hxx:82
\n+
parameterized_invocation & operator()()
Definition: transaction_base.hxx:79
\n+
parameterized_invocation & operator()(const T &v, bool nonnull)
Definition: transaction_base.hxx:87
\n+
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n+
result exec_params(const std::string &query, Args &&...args)
Execute an SQL statement with parameters.
Definition: transaction_base.hxx:321
\n+
std::string quote_raw(const unsigned char str[], size_t len) const
Binary-escape and quote a binarystring for use as an SQL constant.
Definition: transaction_base.hxx:219
\n+
result exec_params_n(size_t rows, const std::string &query, Args &&...args)
Definition: transaction_base.hxx:349
\n+
std::string esc(const char str[], size_t maxlen) const
Escape string for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:177
\n+
result exec(const std::stringstream &Query, const std::string &Desc=std::string{})
Definition: transaction_base.hxx:253
\n+
std::string quote(const T &t) const
Represent object as SQL string, including quoting & escaping.
Definition: transaction_base.hxx:215
\n+
transaction_base(const transaction_base &)=delete
\n+
result exec_prepared0(const std::string &statement, Args &&... args)
Execute a prepared statement, and expect a result with zero rows.
Definition: transaction_base.hxx:415
\n+
result exec_prepared(const std::string &statement, Args &&... args)
Execute a prepared statement, with optional arguments.
Definition: transaction_base.hxx:396
\n+
std::string esc_raw(const unsigned char data[], size_t len) const
Escape binary data for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:194
\n+
result exec0(const std::string &Query, const std::string &Desc=std::string{})
Execute query, which should zero rows of data.
Definition: transaction_base.hxx:264
\n+
transaction_base & operator=(const transaction_base &)=delete
\n+
result exec_prepared_n(size_t rows, const std::string &statement, Args &&... args)
Execute a prepared statement, expect a result with given number of rows.
Definition: transaction_base.hxx:425
\n+
connection_base & conn() const
Connection this transaction is running in.
Definition: transaction_base.hxx:492
\n+
void process_notice(const std::string &Msg) const
Have connection process warning message.
Definition: transaction_base.hxx:487
\n+
void process_notice(const char Msg[]) const
Have connection process warning message.
Definition: transaction_base.hxx:484
\n+
row exec_params1(const std::string &query, Args &&... args)
Definition: transaction_base.hxx:331
\n+\n+
std::string unesc_raw(const std::string &text) const
Unescape binary data, e.g. from a table field or notification payload.
Definition: transaction_base.hxx:203
\n+
result exec_params0(const std::string &query, Args &&...args)
Definition: transaction_base.hxx:340
\n+
std::string esc(const std::string &str) const
Escape string for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:180
\n+
std::string quote_name(const std::string &identifier) const
Escape an SQL identifier for use in a query.
Definition: transaction_base.hxx:225
\n+
row exec_prepared1(const std::string &statement, Args &&... args)
Execute a prepared statement, and expect a single-row result.
Definition: transaction_base.hxx:406
\n+
std::string unesc_raw(const char *text) const
Unescape binary data, e.g. from a table field or notification payload.
Definition: transaction_base.hxx:210
\n+
row exec1(const std::string &Query, const std::string &Desc=std::string{})
Execute query returning a single row of data.
Definition: transaction_base.hxx:276
\n+
internal::reactivation_avoidance_counter m_reactivation_avoidance
Resources allocated in this transaction that make reactivation impossible.
Definition: transaction_base.hxx:564
\n+
std::string esc_like(const std::string &str, char escape_char='\\\\') const
Escape string for literal LIKE match.
Definition: transaction_base.hxx:229
\n+
Helper base class: object descriptions for error messages and such.
Definition: util.hxx:234
\n+
Ensure proper opening/closing of GUEST objects related to a "host" object.
Definition: util.hxx:275
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,18 +1,582 @@\n \n \n \n \n \n libpqxx\n \n-config-public-compiler.h\n- 1/* Automatically generated from config.h: public/compiler config. */\n- 2\n- 3#define PQXX_HAVE_DEPRECATED 1\n- 4#define PQXX_HAVE_GCC_CONST 1\n- 5#define PQXX_HAVE_GCC_DEPRECATED 1\n- 6#define PQXX_HAVE_GCC_PURE 1\n+transaction_base.hxx\n+ 1\n+ 14#ifndef PQXX_H_TRANSACTION_BASE\n+ 15#define PQXX_H_TRANSACTION_BASE\n+ 16\n+ 17#include \"pqxx/compiler-public.hxx\"\n+ 18#include \"pqxx/compiler-internal-pre.hxx\"\n+ 19\n+ 20/* End-user programs need not include this file, unless they define their\n+own\n+ 21 * transaction classes. This is not something the typical program should\n+want\n+ 22 * to do.\n+ 23 *\n+ 24 * However, reading this file is worthwhile because it defines the public\n+ 25 * interface for the available transaction classes such as transaction and\n+ 26 * nontransaction.\n+ 27 */\n+ 28\n+ 29#include \"pqxx/connection_base.hxx\"\n+ 30#include \"pqxx/internal/encoding_group.hxx\"\n+ 31#include \"pqxx/isolation.hxx\"\n+ 32#include \"pqxx/result.hxx\"\n+ 33#include \"pqxx/row.hxx\"\n+ 34\n+ 35// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n+ 36\n+ 37namespace pqxx\n+ 38{\n+ 39namespace internal\n+ 40{\n+ 41class sql_cursor;\n+ 42\n+43class PQXX_LIBEXPORT transactionfocus : public virtual namedclass\n+ 44{\n+ 45public:\n+46 explicit transactionfocus(transaction_base &t) :\n+ 47 namedclass{\"transactionfocus\"},\n+ 48 m_trans{t},\n+ 49 m_registered{false}\n+ 50 {\n+ 51 }\n+ 52\n+53 transactionfocus() =delete;\n+54 transactionfocus(const transactionfocus &) =delete;\n+55 transactionfocus &operator=(const transactionfocus &) =delete;\n+ 56\n+ 57protected:\n+ 58 void register_me();\n+ 59 void unregister_me() noexcept;\n+ 60 void reg_pending_error(const std::string &) noexcept;\n+61 bool registered() const noexcept { return m_registered; }\n+ 62\n+63 transaction_base &m_trans;\n+ 64\n+ 65private:\n+ 66 bool m_registered;\n+ 67};\n+ 68\n+ 69\n+ 71\n+73class PQXX_LIBEXPORT parameterized_invocation : statement_parameters\n+ 74{\n+ 75public:\n+ 76 PQXX_DEPRECATED parameterized_invocation(\n+ 77 connection_base &, const std::string &query);\n+ 78\n+79 parameterized_invocation &operator()() { add_param(); return *this; }\n+80 parameterized_invocation &operator()(const binarystring &v)\n+ 81 { add_binary_param(v, true); return *this; }\n+82 template parameterized_invocation &operator()(const T &v)\n+ 83 { add_param(v, true); return *this; }\n+84 parameterized_invocation &operator()(const binarystring &v, bool nonnull)\n+ 85 { add_binary_param(v, nonnull); return *this; }\n+ 86 template\n+87 parameterized_invocation &operator()(const T &v, bool nonnull)\n+ 88 { add_param(v, nonnull); return *this; }\n+ 89\n+ 90 result exec();\n+ 91\n+ 92private:\n+ 94 parameterized_invocation &operator=(const parameterized_invocation &)\n+ 95 =delete;\n+ 96\n+ 97 connection_base &m_home;\n+ 98 const std::string m_query;\n+ 99};\n+ 100} // namespace internal\n+ 101\n+ 102\n+ 103namespace internal\n+ 104{\n+ 105namespace gate\n+ 106{\n+ 107class transaction_subtransaction;\n+ 108class transaction_tablereader;\n+ 109class transaction_sql_cursor;\n+ 110class transaction_stream_from;\n+ 111class transaction_tablewriter;\n+ 112class transaction_stream_to;\n+ 113class transaction_transactionfocus;\n+ 114} // namespace internal::gate\n+ 115} // namespace internal\n+ 116\n+ 117\n+ 131\n+136class PQXX_LIBEXPORT PQXX_NOVTABLE transaction_base :\n+ 137 public virtual internal::namedclass\n+ 138{\n+ 139public:\n+141 using isolation_tag = isolation_traits;\n+ 142\n+143 transaction_base() =delete;\n+144 transaction_base(const transaction_base &) =delete;\n+145 transaction_base &operator=(const transaction_base &) =delete;\n+ 146\n+ 147 virtual ~transaction_base() =0; //[t01]\n+ 148\n+ 150\n+ 162 void commit(); //[t01]\n+ 163\n+ 165\n+ 168 void abort(); //[t10]\n+ 169\n+175 std::string esc(const char str[]) const { return conn().esc(str); }\n+177 std::string esc(const char str[], size_t maxlen) const\n+ 178 { return conn().esc(str, maxlen); }\n+180 std::string esc(const std::string &str) const { return conn().esc(str); }\n+ 181\n+ 183\n+194 std::string esc_raw(const unsigned char data[], size_t len) const //[t62]\n+ 195 { return conn().esc_raw(data, len); }\n+ 197 std::string esc_raw(const std::string &) const; //[t62]\n+ 198\n+ 200\n+203 std::string unesc_raw(const std::string &text) const\n+ 204 { return conn().unesc_raw(text); }\n+ 205\n+ 207\n+210 std::string unesc_raw(const char *text) const\n+ 211 { return conn().unesc_raw(text); }\n+ 212\n+ 214\n+215 template std::string quote(const T &t) const\n+ 216 { return conn().quote(t); }\n+ 217\n+219 std::string quote_raw(const unsigned char str[], size_t len) const\n+ 220 { return conn().quote_raw(str, len); }\n+ 221\n+ 222 std::string quote_raw(const std::string &str) const;\n+ 223\n+225 std::string quote_name(const std::string &identifier) const\n+ 226 { return conn().quote_name(identifier); }\n+ 227\n+229 std::string esc_like(const std::string &str, char escape_char='\\\\') const\n+ 230 { return conn().esc_like(str, escape_char); }\n+ 232\n+ 234\n+ 249 result exec(\n+ 250 const std::string &Query,\n+ 251 const std::string &Desc=std::string{}); //[t01]\n+ 252\n+253 result exec(\n+ 254 const std::stringstream &Query,\n+ 255 const std::string &Desc=std::string{})\n+ 256 { return exec(Query.str(), Desc); }\n+ 257\n+ 259\n+264 result exec0(\n+ 265 const std::string &Query,\n+ 266 const std::string &Desc=std::string{})\n+ 267 { return exec_n(0, Query, Desc); }\n+ 268\n+ 270\n+276 row exec1(const std::string &Query, const std::string &Desc=std::string{})\n+ 277 { return exec_n(1, Query, Desc).front(); }\n+ 278\n+ 280\n+ 285 result exec_n(\n+ 286 size_t rows,\n+ 287 const std::string &Query,\n+ 288 const std::string &Desc=std::string{});\n+ 289\n+ 320 template\n+321 result exec_params(const std::string &query, Args &&...args)\n+ 322 {\n+ 323 return internal_exec_params(\n+ 324 query, internal::params(std::forward(args)...));\n+ 325 }\n+ 326\n+ 327 // Execute parameterised statement, expect a single-row result.\n+ 330 template\n+331 row exec_params1(const std::string &query, Args&&... args)\n+ 332 {\n+ 333 return exec_params_n(1, query, std::forward(args)...).front();\n+ 334 }\n+ 335\n+ 336 // Execute parameterised statement, expect a result with zero rows.\n+ 339 template\n+340 result exec_params0(const std::string &query, Args &&...args)\n+ 341 {\n+ 342 return exec_params_n(0, query, std::forward(args)...);\n+ 343 }\n+ 344\n+ 345 // Execute parameterised statement, expect exactly a given number of rows.\n+ 348 template\n+349 result exec_params_n(size_t rows, const std::string &query, Args &&...args)\n+ 350 {\n+ 351 const auto r = exec_params(query, std::forward(args)...);\n+ 352 check_rowcount_params(rows, r.size());\n+ 353 return r;\n+ 354 }\n+ 355\n+ 357 /* Use this to build up a parameterized statement invocation, then invoke\n+it\n+ 358 * using @c exec()\n+ 359 *\n+ 360 * Example: @c trans.parameterized(\"SELECT $1 + 1\")(1).exec();\n+ 361 *\n+ 362 * This is the old, pre-C++11 way of handling parameterised statements. As\n+ 363 * of libpqxx 6.0, it's made much easier using variadic templates.\n+ 364 */\n+ 365 PQXX_DEPRECATED internal::parameterized_invocation\n+ 366 parameterized(const std::string &query);\n+ 368\n+ 393\n+ 395 template\n+396 result exec_prepared(const std::string &statement, Args&&... args)\n+ 397 {\n+ 398 return internal_exec_prepared(\n+ 399 statement, internal::params(std::forward(args)...));\n+ 400 }\n+ 401\n+ 403\n+ 405 template\n+406 row exec_prepared1(const std::string &statement, Args&&... args)\n+ 407 {\n+ 408 return exec_prepared_n(1, statement, std::forward(args)...).front();\n+ 409 }\n+ 410\n+ 412\n+ 414 template\n+415 result exec_prepared0(const std::string &statement, Args&&... args)\n+ 416 {\n+ 417 return exec_prepared_n(0, statement, std::forward(args)...);\n+ 418 }\n+ 419\n+ 421\n+ 424 template\n+425 result exec_prepared_n(\n+ 426 size_t rows,\n+ 427 const std::string &statement,\n+ 428 Args&&... args)\n+ 429 {\n+ 430 const auto r = exec_prepared(statement, std::forward(args)...);\n+ 431 check_rowcount_prepared(statement, rows, r.size());\n+ 432 return r;\n+ 433 }\n+ 434\n+ 436\n+ 474 PQXX_DEPRECATED prepare::invocation\n+ 475 prepared(const std::string &statement=std::string{});\n+ 476\n+ 478\n+484 void process_notice(const char Msg[]) const //[t14]\n+ 485 { m_conn.process_notice(Msg); }\n+487 void process_notice(const std::string &Msg) const //[t14]\n+ 488 { m_conn.process_notice(Msg); }\n+ 490\n+492 connection_base &conn() const { return m_conn; } //[t04]\n+ 493\n+ 495\n+ 502 void set_variable(const std::string &Var, const std::string &Val); //[t61]\n+ 503\n+ 505\n+ 514 std::string get_variable(const std::string &); //[t61]\n+ 515\n+ 516protected:\n+ 518\n+ 524 explicit transaction_base(connection_base &c, bool direct=true);\n+ 525\n+ 527\n+ 529 void Begin();\n+ 530\n+ 532 void End() noexcept;\n+ 533\n+535 virtual void do_begin() =0;\n+537 virtual result do_exec(const char Query[]) =0;\n+539 virtual void do_commit() =0;\n+541 virtual void do_abort() =0;\n+ 542\n+ 543 // For use by implementing class:\n+ 544\n+ 546\n+ 554 result direct_exec(const char C[], int Retries=0);\n+ 555\n+557 void reactivation_avoidance_clear() noexcept\n+ 558 {m_reactivation_avoidance.clear();}\n+ 559\n+ 560protected:\n+ 562\n+564 internal::reactivation_avoidance_counter m_reactivation_avoidance;\n+ 565\n+ 566private:\n+ 567 /* A transaction goes through the following stages in its lifecycle:\n+ 568 *
    \n+ 569 *
  • nascent: the transaction hasn't actually begun yet. If our\n+connection\n+ 570 * fails at this stage, it may recover and the transaction can attempt to\n+ 571 * establish itself again.\n+ 572 *
  • active: the transaction has begun. Since no commit command has been\n+ 573 * issued, abortion is implicit if the connection fails now.\n+ 574 *
  • aborted: an abort has been issued; the transaction is terminated\n+and\n+ 575 * its changes to the database rolled back. It will accept no further\n+ 576 * commands.\n+ 577 *
  • committed: the transaction has completed successfully, meaning that\n+a\n+ 578 * commit has been issued. No further commands are accepted.\n+ 579 *
  • in_doubt: the connection was lost at the exact wrong time, and\n+there\n+ 580 * is no way of telling whether the transaction was committed or aborted.\n+ 581 *
\n+ 582 *\n+ 583 * Checking and maintaining state machine logic is the responsibility of\n+the\n+ 584 * base class (ie., this one).\n+ 585 */\n+ 586 enum Status\n+ 587 {\n+ 588 st_nascent,\n+ 589 st_active,\n+ 590 st_aborted,\n+ 591 st_committed,\n+ 592 st_in_doubt\n+ 593 };\n+ 594\n+ 596 PQXX_PRIVATE void activate();\n+ 597\n+ 598 PQXX_PRIVATE void CheckPendingError();\n+ 599\n+ 600 template bool parm_is_null(T *p) const noexcept\n+ 601 { return p == nullptr; }\n+ 602 template bool parm_is_null(T) const noexcept\n+ 603 { return false; }\n+ 604\n+ 605 result internal_exec_prepared(\n+ 606 const std::string &statement,\n+ 607 const internal::params &args);\n+ 608\n+ 609 result internal_exec_params(\n+ 610 const std::string &query,\n+ 611 const internal::params &args);\n+ 612\n+ 614 void check_rowcount_prepared(\n+ 615 const std::string &statement,\n+ 616 size_t expected_rows,\n+ 617 size_t actual_rows);\n+ 618\n+ 620 void check_rowcount_params(\n+ 621 size_t expected_rows, size_t actual_rows);\n+ 622\n+623 friend class pqxx::internal::gate::transaction_transactionfocus;\n+ 624 PQXX_PRIVATE void register_focus(internal::transactionfocus *);\n+ 625 PQXX_PRIVATE void unregister_focus(internal::transactionfocus *) noexcept;\n+ 626 PQXX_PRIVATE void register_pending_error(const std::string &) noexcept;\n+ 627\n+628 friend class pqxx::internal::gate::transaction_tablereader;\n+629 friend class pqxx::internal::gate::transaction_stream_from;\n+ 630 PQXX_PRIVATE void BeginCopyRead(const std::string &, const std::string &);\n+ 631 bool read_copy_line(std::string &);\n+ 632\n+633 friend class pqxx::internal::gate::transaction_tablewriter;\n+634 friend class pqxx::internal::gate::transaction_stream_to;\n+ 635 PQXX_PRIVATE void BeginCopyWrite(\n+ 636 const std::string &Table,\n+ 637 const std::string &Columns);\n+ 638 void write_copy_line(const std::string &);\n+ 639 void end_copy_write();\n+ 640\n+641 friend class pqxx::internal::gate::transaction_subtransaction;\n+ 642\n+ 643 connection_base &m_conn;\n+ 644\n+ 645 internal::unique m_focus;\n+ 646 Status m_status = st_nascent;\n+ 647 bool m_registered = false;\n+ 648 std::map m_vars;\n+ 649 std::string m_pending_error;\n+ 650};\n+ 651\n+ 652} // namespace pqxx\n+ 653\n+ 654#include \"pqxx/compiler-internal-post.hxx\"\n+ 655#endif\n+pqxx::transaction_base::esc\n+std::string esc(const char str[]) const\n+Escape string for use as SQL string literal in this transaction.\n+Definition: transaction_base.hxx:175\n+std\n+STL namespace.\n+pqxx\n+The home of all libpqxx classes, functions, templates, etc.\n+Definition: array.hxx:26\n+pqxx::binarystring\n+Binary data corresponding to PostgreSQL's \"BYTEA\" binary-string type.\n+Definition: binarystring.hxx:54\n+pqxx::internal::reactivation_avoidance_counter\n+Definition: connection_base.hxx:49\n+pqxx::connection_base\n+connection_base abstract base class; represents a connection to a database.\n+Definition: connection_base.hxx:140\n+pqxx::isolation_traits\n+Traits class to describe an isolation level; primarly for libpqxx's own use.\n+Definition: isolation.hxx:66\n+pqxx::prepare::invocation\n+Helper class for passing parameters to, and executing, prepared statements.\n+Definition: prepared_statement.hxx:82\n+pqxx::result\n+Result set containing data returned by a query or command.\n+Definition: result.hxx:70\n+pqxx::result::clear\n+void clear() noexcept\n+Definition: result.hxx:121\n+pqxx::row\n+Reference to one row in a result.\n+Definition: row.hxx:41\n+pqxx::row::front\n+reference front() const noexcept\n+Definition: row.cxx:59\n+pqxx::internal::transactionfocus\n+Definition: transaction_base.hxx:44\n+pqxx::internal::transactionfocus::transactionfocus\n+transactionfocus()=delete\n+pqxx::internal::transactionfocus::transactionfocus\n+transactionfocus(const transactionfocus &)=delete\n+pqxx::internal::transactionfocus::operator=\n+transactionfocus & operator=(const transactionfocus &)=delete\n+pqxx::internal::transactionfocus::transactionfocus\n+transactionfocus(transaction_base &t)\n+Definition: transaction_base.hxx:46\n+pqxx::internal::transactionfocus::m_trans\n+transaction_base & m_trans\n+Definition: transaction_base.hxx:63\n+pqxx::internal::parameterized_invocation\n+Helper class to construct an invocation of a parameterised statement.\n+Definition: transaction_base.hxx:74\n+pqxx::internal::parameterized_invocation::operator()\n+parameterized_invocation & operator()(const binarystring &v, bool nonnull)\n+Definition: transaction_base.hxx:84\n+pqxx::internal::parameterized_invocation::operator()\n+parameterized_invocation & operator()(const binarystring &v)\n+Definition: transaction_base.hxx:80\n+pqxx::internal::parameterized_invocation::operator()\n+parameterized_invocation & operator()(const T &v)\n+Definition: transaction_base.hxx:82\n+pqxx::internal::parameterized_invocation::operator()\n+parameterized_invocation & operator()()\n+Definition: transaction_base.hxx:79\n+pqxx::internal::parameterized_invocation::operator()\n+parameterized_invocation & operator()(const T &v, bool nonnull)\n+Definition: transaction_base.hxx:87\n+pqxx::transaction_base\n+Interface definition (and common code) for \"transaction\" classes.\n+Definition: transaction_base.hxx:138\n+pqxx::transaction_base::exec_params\n+result exec_params(const std::string &query, Args &&...args)\n+Execute an SQL statement with parameters.\n+Definition: transaction_base.hxx:321\n+pqxx::transaction_base::quote_raw\n+std::string quote_raw(const unsigned char str[], size_t len) const\n+Binary-escape and quote a binarystring for use as an SQL constant.\n+Definition: transaction_base.hxx:219\n+pqxx::transaction_base::exec_params_n\n+result exec_params_n(size_t rows, const std::string &query, Args &&...args)\n+Definition: transaction_base.hxx:349\n+pqxx::transaction_base::esc\n+std::string esc(const char str[], size_t maxlen) const\n+Escape string for use as SQL string literal in this transaction.\n+Definition: transaction_base.hxx:177\n+pqxx::transaction_base::exec\n+result exec(const std::stringstream &Query, const std::string &Desc=std::string\n+{})\n+Definition: transaction_base.hxx:253\n+pqxx::transaction_base::quote\n+std::string quote(const T &t) const\n+Represent object as SQL string, including quoting & escaping.\n+Definition: transaction_base.hxx:215\n+pqxx::transaction_base::transaction_base\n+transaction_base(const transaction_base &)=delete\n+pqxx::transaction_base::exec_prepared0\n+result exec_prepared0(const std::string &statement, Args &&... args)\n+Execute a prepared statement, and expect a result with zero rows.\n+Definition: transaction_base.hxx:415\n+pqxx::transaction_base::exec_prepared\n+result exec_prepared(const std::string &statement, Args &&... args)\n+Execute a prepared statement, with optional arguments.\n+Definition: transaction_base.hxx:396\n+pqxx::transaction_base::esc_raw\n+std::string esc_raw(const unsigned char data[], size_t len) const\n+Escape binary data for use as SQL string literal in this transaction.\n+Definition: transaction_base.hxx:194\n+pqxx::transaction_base::exec0\n+result exec0(const std::string &Query, const std::string &Desc=std::string{})\n+Execute query, which should zero rows of data.\n+Definition: transaction_base.hxx:264\n+pqxx::transaction_base::operator=\n+transaction_base & operator=(const transaction_base &)=delete\n+pqxx::transaction_base::exec_prepared_n\n+result exec_prepared_n(size_t rows, const std::string &statement, Args &&...\n+args)\n+Execute a prepared statement, expect a result with given number of rows.\n+Definition: transaction_base.hxx:425\n+pqxx::transaction_base::conn\n+connection_base & conn() const\n+Connection this transaction is running in.\n+Definition: transaction_base.hxx:492\n+pqxx::transaction_base::process_notice\n+void process_notice(const std::string &Msg) const\n+Have connection process warning message.\n+Definition: transaction_base.hxx:487\n+pqxx::transaction_base::process_notice\n+void process_notice(const char Msg[]) const\n+Have connection process warning message.\n+Definition: transaction_base.hxx:484\n+pqxx::transaction_base::exec_params1\n+row exec_params1(const std::string &query, Args &&... args)\n+Definition: transaction_base.hxx:331\n+pqxx::transaction_base::transaction_base\n+transaction_base()=delete\n+pqxx::transaction_base::unesc_raw\n+std::string unesc_raw(const std::string &text) const\n+Unescape binary data, e.g. from a table field or notification payload.\n+Definition: transaction_base.hxx:203\n+pqxx::transaction_base::exec_params0\n+result exec_params0(const std::string &query, Args &&...args)\n+Definition: transaction_base.hxx:340\n+pqxx::transaction_base::esc\n+std::string esc(const std::string &str) const\n+Escape string for use as SQL string literal in this transaction.\n+Definition: transaction_base.hxx:180\n+pqxx::transaction_base::quote_name\n+std::string quote_name(const std::string &identifier) const\n+Escape an SQL identifier for use in a query.\n+Definition: transaction_base.hxx:225\n+pqxx::transaction_base::exec_prepared1\n+row exec_prepared1(const std::string &statement, Args &&... args)\n+Execute a prepared statement, and expect a single-row result.\n+Definition: transaction_base.hxx:406\n+pqxx::transaction_base::unesc_raw\n+std::string unesc_raw(const char *text) const\n+Unescape binary data, e.g. from a table field or notification payload.\n+Definition: transaction_base.hxx:210\n+pqxx::transaction_base::exec1\n+row exec1(const std::string &Query, const std::string &Desc=std::string{})\n+Execute query returning a single row of data.\n+Definition: transaction_base.hxx:276\n+pqxx::transaction_base::m_reactivation_avoidance\n+internal::reactivation_avoidance_counter m_reactivation_avoidance\n+Resources allocated in this transaction that make reactivation impossible.\n+Definition: transaction_base.hxx:564\n+pqxx::transaction_base::esc_like\n+std::string esc_like(const std::string &str, char escape_char='\\\\') const\n+Escape string for literal LIKE match.\n+Definition: transaction_base.hxx:229\n+pqxx::internal::namedclass\n+Helper base class: object descriptions for error messages and such.\n+Definition: util.hxx:234\n+pqxx::internal::unique\n+Ensure proper opening/closing of GUEST objects related to a \"host\" object.\n+Definition: util.hxx:275\n * include\n * pqxx\n- * config-public-compiler.h\n+ * transaction_base.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00125_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00125_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: row.hxx Source File\n+libpqxx: notification.hxx Source File\n \n \n \n \n \n \n \n@@ -55,353 +55,69 @@\n \n
\n
\n-
row.hxx
\n+
notification.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_ROW
\n-
14#define PQXX_H_ROW
\n+
13#ifndef PQXX_H_NOTIFICATION
\n+
14#define PQXX_H_NOTIFICATION
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n
18
\n-
19#include "pqxx/except.hxx"
\n-
20#include "pqxx/field.hxx"
\n-
21#include "pqxx/result.hxx"
\n+
19#include <string>
\n+
20
\n+
21#include "pqxx/types.hxx"
\n
22
\n
23
\n-
24// Methods tested in eg. test module test01 are marked with "//[t01]".
\n-
25
\n-
26namespace pqxx
\n-
27{
\n-
29
\n-
40class PQXX_LIBEXPORT row
\n-
41{
\n-
42public:
\n-\n-\n-\n-\n-\n-\n-\n-\n-
51
\n-
52 row() =default;
\n-
53
\n-
55 row(result r, size_t i) noexcept;
\n-
56
\n-
57 ~row() noexcept =default; // Yes Scott Meyers, you're absolutely right[1]
\n-
58
\n-
63 PQXX_PURE bool operator==(const row &) const noexcept; //[t75]
\n-
64 bool operator!=(const row &rhs) const noexcept //[t75]
\n-
65 { return not operator==(rhs); }
\n+
24namespace pqxx
\n+
25{
\n+
27
\n+
55class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver
\n+
56{
\n+
57public:
\n+
59
\n+
63 notification_receiver(connection_base &c, const std::string &channel);
\n+\n+\n+
66 virtual ~notification_receiver();
\n
67
\n-
68 const_iterator begin() const noexcept; //[t82]
\n-
69 const_iterator cbegin() const noexcept;
\n-
70 const_iterator end() const noexcept; //[t82]
\n-
71 const_iterator cend() const noexcept;
\n+
69 const std::string &channel() const { return m_channel; }
\n+
70
\n
72
\n-
77 reference front() const noexcept; //[t74]
\n-
78 reference back() const noexcept; //[t75]
\n-
79
\n-
80 const_reverse_row_iterator rbegin() const; //[t82]
\n-
81 const_reverse_row_iterator crbegin() const;
\n-
82 const_reverse_row_iterator rend() const; //[t82]
\n-
83 const_reverse_row_iterator crend() const;
\n-
84
\n-
85 reference operator[](size_type) const noexcept; //[t11]
\n-
86 reference operator[](int) const noexcept; //[t02]
\n-
90 reference operator[](const char[]) const; //[t11]
\n-
94 reference operator[](const std::string &) const; //[t11]
\n-
95 reference at(size_type) const; //[t11]
\n-
96 reference at(int) const; //[t11]
\n-
100 reference at(const char[]) const; //[t11]
\n-
104 reference at(const std::string &) const; //[t11]
\n-
106
\n-
107 size_type size() const noexcept //[t11]
\n-
108 { return m_end-m_begin; }
\n-
109
\n-
110 void swap(row &) noexcept; //[t11]
\n-
111
\n-
113 size_t rownumber() const noexcept { return size_t(m_index); } //[t11]
\n-
114
\n-
120 size_type column_number(const std::string &ColName) const //[t30]
\n-
121 { return column_number(ColName.c_str()); }
\n-
122
\n-
124 size_type column_number(const char[]) const; //[t30]
\n-
125
\n-
127 oid column_type(size_type) const; //[t07]
\n-
128
\n-
130 oid column_type(int ColNum) const //[t07]
\n-
131 { return column_type(size_type(ColNum)); }
\n-
132
\n-
134 oid column_type(const std::string &ColName) const //[t07]
\n-
135 { return column_type(column_number(ColName)); }
\n-
136
\n-
138 oid column_type(const char ColName[]) const //[t07]
\n-
139 { return column_type(column_number(ColName)); }
\n-
140
\n-
142 oid column_table(size_type ColNum) const; //[t02]
\n-
143
\n-
145 oid column_table(int ColNum) const //[t02]
\n-
146 { return column_table(size_type(ColNum)); }
\n-
148 oid column_table(const std::string &ColName) const //[t02]
\n-
149 { return column_table(column_number(ColName)); }
\n-
150
\n-
152
\n-
159 size_type table_column(size_type) const; //[t93]
\n-
160
\n-
162 size_type table_column(int ColNum) const //[t93]
\n-
163 { return table_column(size_type(ColNum)); }
\n-
164
\n-
166 size_type table_column(const std::string &ColName) const //[t93]
\n-
167 { return table_column(column_number(ColName)); }
\n-
169
\n-
170 size_t num() const { return rownumber(); } //[t01]
\n-
171
\n-
184 row slice(size_type Begin, size_type End) const;
\n-
185
\n-
186 // Is this an empty slice?
\n-
187 PQXX_PURE bool empty() const noexcept;
\n-
188
\n-
189protected:
\n-
190 friend class field;
\n-
192 result m_result;
\n-
194
\n-
198 long m_index = 0;
\n-
200 size_type m_begin = 0;
\n-
202 size_type m_end = 0;
\n-
203};
\n-
204
\n-
205
\n-
207class PQXX_LIBEXPORT const_row_iterator : public field
\n-
208{
\n-
209public:
\n-
210 using iterator_category = std::random_access_iterator_tag;
\n-
211 using value_type = const field;
\n-
212 using pointer = const field *;
\n-\n-\n-\n-
216
\n-
217 const_row_iterator(const row &T, row_size_type C) noexcept : //[t82]
\n-
218 field{T, C} {}
\n-
219 const_row_iterator(const field &F) noexcept : field{F} {} //[t82]
\n-
220
\n-
225 pointer operator->() const { return this; } //[t82]
\n-
226 reference operator*() const { return field{*this}; } //[t82]
\n-
228
\n-
233 const_row_iterator operator++(int); //[t82]
\n-
234 const_row_iterator &operator++() { ++m_col; return *this; } //[t82]
\n-
235 const_row_iterator operator--(int); //[t82]
\n-
236 const_row_iterator &operator--() { --m_col; return *this; } //[t82]
\n-
237
\n-\n-
239 { m_col = size_type(difference_type(m_col) + i); return *this; }
\n-\n-
241 { m_col = size_type(difference_type(m_col) - i); return *this; }
\n-
243
\n-
248 bool operator==(const const_row_iterator &i) const //[t82]
\n-
249 {return col()==i.col();}
\n-
250 bool operator!=(const const_row_iterator &i) const //[t82]
\n-
251 {return col()!=i.col();}
\n-
252 bool operator<(const const_row_iterator &i) const //[t82]
\n-
253 {return col()<i.col();}
\n-
254 bool operator<=(const const_row_iterator &i) const //[t82]
\n-
255 {return col()<=i.col();}
\n-
256 bool operator>(const const_row_iterator &i) const //[t82]
\n-
257 {return col()>i.col();}
\n-
258 bool operator>=(const const_row_iterator &i) const //[t82]
\n-
259 {return col()>=i.col();}
\n-
261
\n-
266 inline const_row_iterator operator+(difference_type) const; //[t82]
\n-
267
\n-
268 friend const_row_iterator operator+( //[t82]
\n-
269 difference_type,
\n-\n-
271
\n-
272 inline const_row_iterator operator-(difference_type) const; //[t82]
\n-
273 inline difference_type operator-(const_row_iterator) const; //[t82]
\n-
275};
\n-
276
\n-
277
\n-
279class PQXX_LIBEXPORT const_reverse_row_iterator : private const_row_iterator
\n-
280{
\n-
281public:
\n-\n-\n-\n-\n-\n-\n-\n-
289
\n-\n-\n-
292 explicit
\n-
293 const_reverse_row_iterator(const super &rhs) noexcept : //[t82]
\n-
294 const_row_iterator{rhs} { super::operator--(); }
\n-
295
\n-
296 PQXX_PURE iterator_type base() const noexcept; //[t82]
\n-
297
\n-
302 using iterator_type::operator->; //[t82]
\n-
303 using iterator_type::operator*; //[t82]
\n-
305
\n-
310 const_reverse_row_iterator &
\n-
311 operator=(const const_reverse_row_iterator &r) //[t82]
\n-
312 { iterator_type::operator=(r); return *this; }
\n-\n-
314 { iterator_type::operator--(); return *this; }
\n-
315 const_reverse_row_iterator operator++(int); //[t82]
\n-\n-
317 { iterator_type::operator++(); return *this; }
\n-
318 const_reverse_row_iterator operator--(int); //[t82]
\n-\n-
320 { iterator_type::operator-=(i); return *this; }
\n-\n-
322 { iterator_type::operator+=(i); return *this; }
\n-
324
\n-\n-
330 { return const_reverse_row_iterator{base()-i}; }
\n-\n-
332 { return const_reverse_row_iterator{base()+i}; }
\n-
333 difference_type
\n-
334 operator-(const const_reverse_row_iterator &rhs) const //[t82]
\n-
335 { return rhs.const_row_iterator::operator-(*this); }
\n-
337
\n-
342 bool operator==(const const_reverse_row_iterator &rhs) const noexcept //[t82]
\n-
343 { return iterator_type::operator==(rhs); }
\n-
344 bool operator!=(const const_reverse_row_iterator &rhs) const noexcept //[t82]
\n-
345 { return !operator==(rhs); }
\n-
346
\n-
347 bool operator<(const const_reverse_row_iterator &rhs) const //[t82]
\n-
348 { return iterator_type::operator>(rhs); }
\n-
349 bool operator<=(const const_reverse_row_iterator &rhs) const //[t82]
\n-
350 { return iterator_type::operator>=(rhs); }
\n-
351 bool operator>(const const_reverse_row_iterator &rhs) const //[t82]
\n-
352 { return iterator_type::operator<(rhs); }
\n-
353 bool operator>=(const const_reverse_row_iterator &rhs) const //[t82]
\n-
354 { return iterator_type::operator<=(rhs); }
\n-
356};
\n-
357
\n-
358
\n-
359inline const_row_iterator
\n-\n-
361{
\n-
362 return const_row_iterator{
\n-
363 row(home(), idx()),
\n-
364 size_type(difference_type(col()) + o)};
\n-
365}
\n-
366
\n-\n-\n-
369 { return i + o; }
\n-
370
\n-\n-\n-
373{
\n-
374 return const_row_iterator{
\n-
375 row(home(), idx()),
\n-
376 size_type(difference_type(col()) - o)};
\n-
377}
\n-
378
\n-\n-\n-
381 { return difference_type(num() - i.num()); }
\n-
382
\n-
383
\n-
384} // namespace pqxx
\n-
385
\n-
386
\n-
387/*
\n-
388[1] Scott Meyers, in one of his essential books, "Effective C++" and "More
\n-
389Effective C++", points out that it is good style to have any class containing
\n-
390a member of pointer type define a destructor--just to show that it knows what
\n-
391it is doing with the pointer. This helps prevent nasty memory leak / double
\n-
392deletion bugs typically resulting from programmers' omission to deal with such
\n-
393issues in their destructors.
\n-
394
\n-
395The @c -Weffc++ option in gcc generates warnings for noncompliance with Scott's
\n-
396style guidelines, and hence necessitates the definition of this destructor,
\n-
397trivial as it may be.
\n-
398*/
\n-
399
\n-
400
\n-
401#include "pqxx/compiler-internal-post.hxx"
\n-
402
\n-
403#endif
\n-
STL namespace.
\n+
79 virtual void operator()(const std::string &payload, int backend_pid) =0;
\n+
80
\n+
81protected:
\n+
82 connection_base &conn() const noexcept { return m_conn; }
\n+
83
\n+
84private:
\n+
85 connection_base &m_conn;
\n+
86 std::string m_channel;
\n+
87};
\n+
88}
\n+
89
\n+
90#include "pqxx/compiler-internal-post.hxx"
\n+
91#endif
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
const_result_iterator operator+(result::difference_type o, const_result_iterator i)
Definition: result_iterator.hxx:212
\n-
signed int row_difference_type
Difference between row sizes.
Definition: types.hxx:27
\n-
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
\n-
Reference to a field in a result set.
Definition: field.hxx:50
\n-
row_size_type num() const
Definition: field.hxx:104
\n-
field_size_type size_type
Definition: field.hxx:52
\n-
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n-
Reference to one row in a result.
Definition: row.hxx:41
\n-
size_t rownumber() const noexcept
Row number, assuming this is a real row and not end()/rend().
Definition: row.hxx:113
\n-
oid column_type(const std::string &ColName) const
Type of given column.
Definition: row.hxx:134
\n-
oid column_table(const std::string &ColName) const
What table did this column come from?
Definition: row.hxx:148
\n-
row_size_type size_type
Definition: row.hxx:43
\n-
row_difference_type difference_type
Definition: row.hxx:44
\n-
row()=default
\n-
size_t num() const
Definition: row.hxx:170
\n-
size_type table_column(const std::string &ColName) const
What column number in its table did this result column come from?
Definition: row.hxx:166
\n-
size_type column_number(const std::string &ColName) const
Number of given column (throws exception if it doesn't exist)
Definition: row.hxx:120
\n-
~row() noexcept=default
\n-
oid column_table(int ColNum) const
What table did this column come from?
Definition: row.hxx:145
\n-
oid column_type(const char ColName[]) const
Type of given column.
Definition: row.hxx:138
\n-
size_type table_column(int ColNum) const
What column number in its table did this result column come from?
Definition: row.hxx:162
\n-
oid column_type(int ColNum) const
Type of given column.
Definition: row.hxx:130
\n-
Iterator for fields in a row. Use as row::const_iterator.
Definition: row.hxx:208
\n-
bool operator!=(const const_row_iterator &i) const
Definition: row.hxx:250
\n-
const_row_iterator & operator++()
Definition: row.hxx:234
\n-
const_row_iterator & operator--()
Definition: row.hxx:236
\n-
bool operator<=(const const_row_iterator &i) const
Definition: row.hxx:254
\n-
std::random_access_iterator_tag iterator_category
Definition: row.hxx:210
\n-
const_row_iterator & operator-=(difference_type i)
Definition: row.hxx:240
\n-
const_row_iterator operator-(difference_type) const
Definition: row.hxx:372
\n-
const_row_iterator operator+(difference_type) const
Definition: row.hxx:360
\n-
bool operator==(const const_row_iterator &i) const
Definition: row.hxx:248
\n-
bool operator>=(const const_row_iterator &i) const
Definition: row.hxx:258
\n-
reference operator*() const
Definition: row.hxx:226
\n-
const_row_iterator(const row &T, row_size_type C) noexcept
Definition: row.hxx:217
\n-
row_difference_type difference_type
Definition: row.hxx:214
\n-
pointer operator->() const
Definition: row.hxx:225
\n-
bool operator<(const const_row_iterator &i) const
Definition: row.hxx:252
\n-
const_row_iterator & operator+=(difference_type i)
Definition: row.hxx:238
\n-
bool operator>(const const_row_iterator &i) const
Definition: row.hxx:256
\n-
const_row_iterator(const field &F) noexcept
Definition: row.hxx:219
\n-
Reverse iterator for a row. Use as row::const_reverse_iterator.
Definition: row.hxx:280
\n-
const_reverse_row_iterator & operator+=(difference_type i)
Definition: row.hxx:319
\n-
const_reverse_row_iterator(const const_reverse_row_iterator &r)
Definition: row.hxx:290
\n-
const_reverse_row_iterator & operator-=(difference_type i)
Definition: row.hxx:321
\n-
bool operator!=(const const_reverse_row_iterator &rhs) const noexcept
Definition: row.hxx:344
\n-
const_reverse_row_iterator operator+(difference_type i) const
Definition: row.hxx:329
\n-
bool operator<(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:347
\n-
const_reverse_row_iterator operator-(difference_type i)
Definition: row.hxx:331
\n-
bool operator<=(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:349
\n-
bool operator>=(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:353
\n-
bool operator>(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:351
\n-
bool operator==(const const_reverse_row_iterator &rhs) const noexcept
Definition: row.hxx:342
\n-
const_reverse_row_iterator & operator--()
Definition: row.hxx:316
\n-
difference_type operator-(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:334
\n-
const_reverse_row_iterator operator++()
Definition: row.hxx:313
\n-
const_reverse_row_iterator(const super &rhs) noexcept
Definition: row.hxx:293
\n+
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n+
Definition: notification.hxx:56
\n+
notification_receiver(const notification_receiver &)=delete
\n+
connection_base & conn() const noexcept
Definition: notification.hxx:82
\n+
const std::string & channel() const
The channel that this receiver listens on.
Definition: notification.hxx:69
\n+
virtual void operator()(const std::string &payload, int backend_pid)=0
Overridable: action to invoke when notification arrives.
\n+
notification_receiver & operator=(const notification_receiver &)=delete
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,477 +1,74 @@\n \n \n \n \n \n libpqxx\n \n-row.hxx\n+notification.hxx\n 1\n- 13#ifndef PQXX_H_ROW\n- 14#define PQXX_H_ROW\n+ 13#ifndef PQXX_H_NOTIFICATION\n+ 14#define PQXX_H_NOTIFICATION\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n 18\n- 19#include \"pqxx/except.hxx\"\n- 20#include \"pqxx/field.hxx\"\n- 21#include \"pqxx/result.hxx\"\n+ 19#include \n+ 20\n+ 21#include \"pqxx/types.hxx\"\n 22\n 23\n- 24// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n- 25\n- 26namespace pqxx\n- 27{\n- 29\n-40class PQXX_LIBEXPORT row\n- 41{\n- 42public:\n-43 using size_type = row_size_type;\n-44 using difference_type = row_difference_type;\n-45 using const_iterator = const_row_iterator;\n-46 using iterator = const_iterator;\n-47 using reference = field;\n-48 using pointer = const_row_iterator;\n-49 using const_reverse_iterator = const_reverse_row_iterator;\n-50 using reverse_iterator = const_reverse_iterator;\n- 51\n-52 row() =default;\n- 53\n- 55 row(result r, size_t i) noexcept;\n- 56\n-57 ~row() noexcept =default; // Yes Scott Meyers, you're absolutely right[1]\n- 58\n- 63 PQXX_PURE bool operator==(const row &) const noexcept; //[t75]\n-64 bool operator!=(const row &rhs) const noexcept //[t75]\n- 65 { return not operator==(rhs); }\n+ 24namespace pqxx\n+ 25{\n+ 27\n+55class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver\n+ 56{\n+ 57public:\n+ 59\n+ 63 notification_receiver(connection_base &c, const std::string &channel);\n+64 notification_receiver(const notification_receiver &) =delete;\n+65 notification_receiver &operator=(const notification_receiver &) =delete;\n+ 66 virtual ~notification_receiver();\n 67\n- 68 const_iterator begin() const noexcept; //[t82]\n- 69 const_iterator cbegin() const noexcept;\n- 70 const_iterator end() const noexcept; //[t82]\n- 71 const_iterator cend() const noexcept;\n+69 const std::string &channel() const { return m_channel; }\n+ 70\n 72\n- 77 reference front() const noexcept; //[t74]\n- 78 reference back() const noexcept; //[t75]\n- 79\n- 80 const_reverse_row_iterator rbegin() const; //[t82]\n- 81 const_reverse_row_iterator crbegin() const;\n- 82 const_reverse_row_iterator rend() const; //[t82]\n- 83 const_reverse_row_iterator crend() const;\n- 84\n- 85 reference operator[](size_type) const noexcept; //[t11]\n- 86 reference operator[](int) const noexcept; //[t02]\n- 90 reference operator[](const char[]) const; //[t11]\n- 94 reference operator[](const std::string &) const; //[t11]\n- 95 reference at(size_type) const; //[t11]\n- 96 reference at(int) const; //[t11]\n- 100 reference at(const char[]) const; //[t11]\n- 104 reference at(const std::string &) const; //[t11]\n- 106\n-107 size_type size() const noexcept //[t11]\n- 108 { return m_end-m_begin; }\n- 109\n- 110 void swap(row &) noexcept; //[t11]\n- 111\n-113 size_t rownumber() const noexcept { return size_t(m_index); } //[t11]\n- 114\n-120 size_type column_number(const std::string &ColName) const //[t30]\n- 121 { return column_number(ColName.c_str()); }\n- 122\n- 124 size_type column_number(const char[]) const; //[t30]\n- 125\n- 127 oid column_type(size_type) const; //[t07]\n- 128\n-130 oid column_type(int ColNum) const //[t07]\n- 131 { return column_type(size_type(ColNum)); }\n- 132\n-134 oid column_type(const std::string &ColName) const //[t07]\n- 135 { return column_type(column_number(ColName)); }\n- 136\n-138 oid column_type(const char ColName[]) const //[t07]\n- 139 { return column_type(column_number(ColName)); }\n- 140\n- 142 oid column_table(size_type ColNum) const; //[t02]\n- 143\n-145 oid column_table(int ColNum) const //[t02]\n- 146 { return column_table(size_type(ColNum)); }\n-148 oid column_table(const std::string &ColName) const //[t02]\n- 149 { return column_table(column_number(ColName)); }\n- 150\n- 152\n- 159 size_type table_column(size_type) const; //[t93]\n- 160\n-162 size_type table_column(int ColNum) const //[t93]\n- 163 { return table_column(size_type(ColNum)); }\n- 164\n-166 size_type table_column(const std::string &ColName) const //[t93]\n- 167 { return table_column(column_number(ColName)); }\n- 169\n-170 size_t num() const { return rownumber(); } //[t01]\n- 171\n- 184 row slice(size_type Begin, size_type End) const;\n- 185\n- 186 // Is this an empty slice?\n- 187 PQXX_PURE bool empty() const noexcept;\n- 188\n- 189protected:\n-190 friend class field;\n-192 result m_result;\n- 194\n-198 long m_index = 0;\n-200 size_type m_begin = 0;\n-202 size_type m_end = 0;\n- 203};\n- 204\n- 205\n-207class PQXX_LIBEXPORT const_row_iterator : public field\n- 208{\n- 209public:\n-210 using iterator_category = std::random_access_iterator_tag;\n-211 using value_type = const field;\n-212 using pointer = const field *;\n-213 using size_type = row_size_type;\n-214 using difference_type = row_difference_type;\n-215 using reference = field;\n- 216\n-217 const_row_iterator(const row &T, row_size_type C) noexcept : //[t82]\n- 218 field{T, C} {}\n-219 const_row_iterator(const field &F) noexcept : field{F} {} //[t82]\n- 220\n-225 pointer operator->() const { return this; } //[t82]\n-226 reference operator*() const { return field{*this}; } //[t82]\n- 228\n- 233 const_row_iterator operator++(int); //[t82]\n-234 const_row_iterator &operator++() { ++m_col; return *this; } //[t82]\n- 235 const_row_iterator operator--(int); //[t82]\n-236 const_row_iterator &operator--() { --m_col; return *this; } //[t82]\n- 237\n-238 const_row_iterator &operator+=(difference_type i) //[t82]\n- 239 { m_col = size_type(difference_type(m_col) + i); return *this; }\n-240 const_row_iterator &operator-=(difference_type i) //[t82]\n- 241 { m_col = size_type(difference_type(m_col) - i); return *this; }\n- 243\n-248 bool operator==(const const_row_iterator &i) const //[t82]\n- 249 {return col()==i.col();}\n-250 bool operator!=(const const_row_iterator &i) const //[t82]\n- 251 {return col()!=i.col();}\n-252 bool operator<(const const_row_iterator &i) const //[t82]\n- 253 {return col()(const const_row_iterator &i) const //[t82]\n- 257 {return col()>i.col();}\n-258 bool operator>=(const const_row_iterator &i) const //[t82]\n- 259 {return col()>=i.col();}\n- 261\n- 266 inline const_row_iterator operator+(difference_type) const; //[t82]\n- 267\n- 268 friend const_row_iterator operator+( //[t82]\n- 269 difference_type,\n- 270 const_row_iterator);\n- 271\n-272 inline const_row_iterator operator-(difference_type) const; //[t82]\n-273 inline difference_type operator-(const_row_iterator) const; //[t82]\n- 275};\n- 276\n- 277\n-279class PQXX_LIBEXPORT const_reverse_row_iterator : private const_row_iterator\n- 280{\n- 281public:\n-282 using super = const_row_iterator;\n-283 using iterator_type = const_row_iterator;\n- 284 using iterator_type::iterator_category;\n- 285 using iterator_type::difference_type;\n- 286 using iterator_type::pointer;\n-287 using value_type = iterator_type::value_type;\n-288 using reference = iterator_type::reference;\n- 289\n-290 const_reverse_row_iterator(const const_reverse_row_iterator &r) : //[t82]\n- 291 const_row_iterator{r} {}\n- 292 explicit\n-293 const_reverse_row_iterator(const super &rhs) noexcept : //[t82]\n- 294 const_row_iterator{rhs} { super::operator--(); }\n- 295\n- 296 PQXX_PURE iterator_type base() const noexcept; //[t82]\n- 297\n- 302 using iterator_type::operator->; //[t82]\n- 303 using iterator_type::operator*; //[t82]\n- 305\n- 310 const_reverse_row_iterator &\n-311 operator=(const const_reverse_row_iterator &r) //[t82]\n- 312 { iterator_type::operator=(r); return *this; }\n-313 const_reverse_row_iterator operator++() //[t82]\n- 314 { iterator_type::operator--(); return *this; }\n- 315 const_reverse_row_iterator operator++(int); //[t82]\n-316 const_reverse_row_iterator &operator--() //[t82]\n- 317 { iterator_type::operator++(); return *this; }\n- 318 const_reverse_row_iterator operator--(int); //[t82]\n-319 const_reverse_row_iterator &operator+=(difference_type i) //[t82]\n- 320 { iterator_type::operator-=(i); return *this; }\n-321 const_reverse_row_iterator &operator-=(difference_type i) //[t82]\n- 322 { iterator_type::operator+=(i); return *this; }\n- 324\n-329 const_reverse_row_iterator operator+(difference_type i) const //[t82]\n- 330 { return const_reverse_row_iterator{base()-i}; }\n-331 const_reverse_row_iterator operator-(difference_type i) //[t82]\n- 332 { return const_reverse_row_iterator{base()+i}; }\n- 333 difference_type\n-334 operator-(const const_reverse_row_iterator &rhs) const //[t82]\n- 335 { return rhs.const_row_iterator::operator-(*this); }\n- 337\n-342 bool operator==(const const_reverse_row_iterator &rhs) const noexcept //\n-[t82]\n- 343 { return iterator_type::operator==(rhs); }\n-344 bool operator!=(const const_reverse_row_iterator &rhs) const noexcept //\n-[t82]\n- 345 { return !operator==(rhs); }\n- 346\n-347 bool operator<(const const_reverse_row_iterator &rhs) const //[t82]\n- 348 { return iterator_type::operator>(rhs); }\n-349 bool operator<=(const const_reverse_row_iterator &rhs) const //[t82]\n- 350 { return iterator_type::operator>=(rhs); }\n-351 bool operator>(const const_reverse_row_iterator &rhs) const //[t82]\n- 352 { return iterator_type::operator<(rhs); }\n-353 bool operator>=(const const_reverse_row_iterator &rhs) const //[t82]\n- 354 { return iterator_type::operator<=(rhs); }\n- 356};\n- 357\n- 358\n- 359inline const_row_iterator\n-360const_row_iterator::operator+(difference_type o) const\n- 361{\n- 362 return const_row_iterator{\n- 363 row(home(), idx()),\n- 364 size_type(difference_type(col()) + o)};\n- 365}\n- 366\n- 367inline const_row_iterator\n-368operator+(const_row_iterator::difference_type o, const_row_iterator i)\n- 369 { return i + o; }\n- 370\n- 371inline const_row_iterator\n-372const_row_iterator::operator-(difference_type o) const\n- 373{\n- 374 return const_row_iterator{\n- 375 row(home(), idx()),\n- 376 size_type(difference_type(col()) - o)};\n- 377}\n- 378\n- 379inline const_row_iterator::difference_type\n-380const_row_iterator::operator-(const_row_iterator i) const\n- 381 { return difference_type(num() - i.num()); }\n- 382\n- 383\n- 384} // namespace pqxx\n- 385\n- 386\n- 387/*\n- 388[1] Scott Meyers, in one of his essential books, \"Effective C++\" and \"More\n- 389Effective C++\", points out that it is good style to have any class\n-containing\n- 390a member of pointer type define a destructor--just to show that it knows\n-what\n- 391it is doing with the pointer. This helps prevent nasty memory leak / double\n- 392deletion bugs typically resulting from programmers' omission to deal with\n-such\n- 393issues in their destructors.\n- 394\n- 395The @c -Weffc++ option in gcc generates warnings for noncompliance with\n-Scott's\n- 396style guidelines, and hence necessitates the definition of this destructor,\n- 397trivial as it may be.\n- 398*/\n- 399\n- 400\n- 401#include \"pqxx/compiler-internal-post.hxx\"\n- 402\n- 403#endif\n-std\n-STL namespace.\n+79 virtual void operator()(const std::string &payload, int backend_pid) =0;\n+ 80\n+ 81protected:\n+82 connection_base &conn() const noexcept { return m_conn; }\n+ 83\n+ 84private:\n+ 85 connection_base &m_conn;\n+ 86 std::string m_channel;\n+ 87};\n+ 88}\n+ 89\n+ 90#include \"pqxx/compiler-internal-post.hxx\"\n+ 91#endif\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::operator+\n-const_result_iterator operator+(result::difference_type o,\n-const_result_iterator i)\n-Definition: result_iterator.hxx:212\n-pqxx::row_difference_type\n-signed int row_difference_type\n-Difference between row sizes.\n-Definition: types.hxx:27\n-pqxx::row_size_type\n-unsigned int row_size_type\n-Number of fields in a row of database data.\n-Definition: types.hxx:24\n-pqxx::field\n-Reference to a field in a result set.\n-Definition: field.hxx:50\n-pqxx::field::num\n-row_size_type num() const\n-Definition: field.hxx:104\n-pqxx::field::size_type\n-field_size_type size_type\n-Definition: field.hxx:52\n-pqxx::result\n-Result set containing data returned by a query or command.\n-Definition: result.hxx:70\n-pqxx::row\n-Reference to one row in a result.\n-Definition: row.hxx:41\n-pqxx::row::rownumber\n-size_t rownumber() const noexcept\n-Row number, assuming this is a real row and not end()/rend().\n-Definition: row.hxx:113\n-pqxx::row::column_type\n-oid column_type(const std::string &ColName) const\n-Type of given column.\n-Definition: row.hxx:134\n-pqxx::row::column_table\n-oid column_table(const std::string &ColName) const\n-What table did this column come from?\n-Definition: row.hxx:148\n-pqxx::row::size_type\n-row_size_type size_type\n-Definition: row.hxx:43\n-pqxx::row::difference_type\n-row_difference_type difference_type\n-Definition: row.hxx:44\n-pqxx::row::row\n-row()=default\n-pqxx::row::num\n-size_t num() const\n-Definition: row.hxx:170\n-pqxx::row::table_column\n-size_type table_column(const std::string &ColName) const\n-What column number in its table did this result column come from?\n-Definition: row.hxx:166\n-pqxx::row::column_number\n-size_type column_number(const std::string &ColName) const\n-Number of given column (throws exception if it doesn't exist)\n-Definition: row.hxx:120\n-pqxx::row::~row\n-~row() noexcept=default\n-pqxx::row::column_table\n-oid column_table(int ColNum) const\n-What table did this column come from?\n-Definition: row.hxx:145\n-pqxx::row::column_type\n-oid column_type(const char ColName[]) const\n-Type of given column.\n-Definition: row.hxx:138\n-pqxx::row::table_column\n-size_type table_column(int ColNum) const\n-What column number in its table did this result column come from?\n-Definition: row.hxx:162\n-pqxx::row::column_type\n-oid column_type(int ColNum) const\n-Type of given column.\n-Definition: row.hxx:130\n-pqxx::const_row_iterator\n-Iterator for fields in a row. Use as row::const_iterator.\n-Definition: row.hxx:208\n-pqxx::const_row_iterator::operator!=\n-bool operator!=(const const_row_iterator &i) const\n-Definition: row.hxx:250\n-pqxx::const_row_iterator::operator++\n-const_row_iterator & operator++()\n-Definition: row.hxx:234\n-pqxx::const_row_iterator::operator--\n-const_row_iterator & operator--()\n-Definition: row.hxx:236\n-pqxx::const_row_iterator::operator<=\n-bool operator<=(const const_row_iterator &i) const\n-Definition: row.hxx:254\n-pqxx::const_row_iterator::iterator_category\n-std::random_access_iterator_tag iterator_category\n-Definition: row.hxx:210\n-pqxx::const_row_iterator::operator-=\n-const_row_iterator & operator-=(difference_type i)\n-Definition: row.hxx:240\n-pqxx::const_row_iterator::operator-\n-const_row_iterator operator-(difference_type) const\n-Definition: row.hxx:372\n-pqxx::const_row_iterator::operator+\n-const_row_iterator operator+(difference_type) const\n-Definition: row.hxx:360\n-pqxx::const_row_iterator::operator==\n-bool operator==(const const_row_iterator &i) const\n-Definition: row.hxx:248\n-pqxx::const_row_iterator::operator>=\n-bool operator>=(const const_row_iterator &i) const\n-Definition: row.hxx:258\n-pqxx::const_row_iterator::operator*\n-reference operator*() const\n-Definition: row.hxx:226\n-pqxx::const_row_iterator::const_row_iterator\n-const_row_iterator(const row &T, row_size_type C) noexcept\n-Definition: row.hxx:217\n-pqxx::const_row_iterator::difference_type\n-row_difference_type difference_type\n-Definition: row.hxx:214\n-pqxx::const_row_iterator::operator->\n-pointer operator->() const\n-Definition: row.hxx:225\n-pqxx::const_row_iterator::operator<\n-bool operator<(const const_row_iterator &i) const\n-Definition: row.hxx:252\n-pqxx::const_row_iterator::operator+=\n-const_row_iterator & operator+=(difference_type i)\n-Definition: row.hxx:238\n-pqxx::const_row_iterator::operator>\n-bool operator>(const const_row_iterator &i) const\n-Definition: row.hxx:256\n-pqxx::const_row_iterator::const_row_iterator\n-const_row_iterator(const field &F) noexcept\n-Definition: row.hxx:219\n-pqxx::const_reverse_row_iterator\n-Reverse iterator for a row. Use as row::const_reverse_iterator.\n-Definition: row.hxx:280\n-pqxx::const_reverse_row_iterator::operator+=\n-const_reverse_row_iterator & operator+=(difference_type i)\n-Definition: row.hxx:319\n-pqxx::const_reverse_row_iterator::const_reverse_row_iterator\n-const_reverse_row_iterator(const const_reverse_row_iterator &r)\n-Definition: row.hxx:290\n-pqxx::const_reverse_row_iterator::operator-=\n-const_reverse_row_iterator & operator-=(difference_type i)\n-Definition: row.hxx:321\n-pqxx::const_reverse_row_iterator::operator!=\n-bool operator!=(const const_reverse_row_iterator &rhs) const noexcept\n-Definition: row.hxx:344\n-pqxx::const_reverse_row_iterator::operator+\n-const_reverse_row_iterator operator+(difference_type i) const\n-Definition: row.hxx:329\n-pqxx::const_reverse_row_iterator::operator<\n-bool operator<(const const_reverse_row_iterator &rhs) const\n-Definition: row.hxx:347\n-pqxx::const_reverse_row_iterator::operator-\n-const_reverse_row_iterator operator-(difference_type i)\n-Definition: row.hxx:331\n-pqxx::const_reverse_row_iterator::operator<=\n-bool operator<=(const const_reverse_row_iterator &rhs) const\n-Definition: row.hxx:349\n-pqxx::const_reverse_row_iterator::operator>=\n-bool operator>=(const const_reverse_row_iterator &rhs) const\n-Definition: row.hxx:353\n-pqxx::const_reverse_row_iterator::operator>\n-bool operator>(const const_reverse_row_iterator &rhs) const\n-Definition: row.hxx:351\n-pqxx::const_reverse_row_iterator::operator==\n-bool operator==(const const_reverse_row_iterator &rhs) const noexcept\n-Definition: row.hxx:342\n-pqxx::const_reverse_row_iterator::operator--\n-const_reverse_row_iterator & operator--()\n-Definition: row.hxx:316\n-pqxx::const_reverse_row_iterator::operator-\n-difference_type operator-(const const_reverse_row_iterator &rhs) const\n-Definition: row.hxx:334\n-pqxx::const_reverse_row_iterator::operator++\n-const_reverse_row_iterator operator++()\n-Definition: row.hxx:313\n-pqxx::const_reverse_row_iterator::const_reverse_row_iterator\n-const_reverse_row_iterator(const super &rhs) noexcept\n-Definition: row.hxx:293\n+pqxx::connection_base\n+connection_base abstract base class; represents a connection to a database.\n+Definition: connection_base.hxx:140\n+pqxx::notification_receiver\n+Definition: notification.hxx:56\n+pqxx::notification_receiver::notification_receiver\n+notification_receiver(const notification_receiver &)=delete\n+pqxx::notification_receiver::conn\n+connection_base & conn() const noexcept\n+Definition: notification.hxx:82\n+pqxx::notification_receiver::channel\n+const std::string & channel() const\n+The channel that this receiver listens on.\n+Definition: notification.hxx:69\n+pqxx::notification_receiver::operator()\n+virtual void operator()(const std::string &payload, int backend_pid)=0\n+Overridable: action to invoke when notification arrives.\n+pqxx::notification_receiver::operator=\n+notification_receiver & operator=(const notification_receiver &)=delete\n * include\n * pqxx\n- * row.hxx\n+ * notification.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00128_source.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00128_source.html", "unified_diff": "@@ -1,15 +1,15 @@\n \n \n \n \n \n \n \n-libpqxx: pipeline.hxx Source File\n+libpqxx: connection_base.hxx Source File\n \n \n \n \n \n \n \n@@ -55,162 +55,485 @@\n \n
\n
\n-
pipeline.hxx
\n+
connection_base.hxx
\n
\n
\n
1
\n-
13#ifndef PQXX_H_PIPELINE
\n-
14#define PQXX_H_PIPELINE
\n+
13#ifndef PQXX_H_CONNECTION_BASE
\n+
14#define PQXX_H_CONNECTION_BASE
\n
15
\n
16#include "pqxx/compiler-public.hxx"
\n
17#include "pqxx/compiler-internal-pre.hxx"
\n
18
\n-
19#include <limits>
\n-
20#include <map>
\n-
21#include <string>
\n-
22
\n-
23#include "pqxx/transaction_base.hxx"
\n-
24
\n-
25
\n-
26// Methods tested in eg. test module test01 are marked with "//[t01]".
\n-
27
\n-
28namespace pqxx
\n-
29{
\n+
19#include <bitset>
\n+
20#include <list>
\n+
21#include <map>
\n+
22#include <memory>
\n+
23
\n+
24#include "pqxx/errorhandler.hxx"
\n+
25#include "pqxx/except.hxx"
\n+
26#include "pqxx/prepared_statement.hxx"
\n+
27#include "pqxx/strconv.hxx"
\n+
28#include "pqxx/util.hxx"
\n+
29#include "pqxx/version.hxx"
\n
30
\n-
32
\n-
48class PQXX_LIBEXPORT pipeline : public internal::transactionfocus
\n+
31
\n+
32/* Use of the libpqxx library starts here.
\n+
33 *
\n+
34 * Everything that can be done with a database through libpqxx must go through
\n+
35 * a connection object derived from connection_base.
\n+
36 */
\n+
37
\n+
38/* Methods tested in eg. self-test program test1 are marked with "//[t01]"
\n+
39 */
\n+
40
\n+
41namespace pqxx
\n+
42{
\n+
43namespace internal
\n+
44{
\n+\n+
46class sql_cursor;
\n+
47
\n+\n
49{
\n
50public:
\n-
51 using query_id = long;
\n+\n
52
\n-
53 pipeline(const pipeline &) =delete;
\n-
54 pipeline &operator=(const pipeline &) =delete;
\n-
55
\n-
56 explicit pipeline( //[t69]
\n-\n-
58 const std::string &Name=std::string{});
\n-
59
\n-
60 ~pipeline() noexcept;
\n-
61
\n+
53 void add(int n) noexcept { m_counter += n; }
\n+
54 void clear() noexcept { m_counter = 0; }
\n+
55 int get() const noexcept { return m_counter; }
\n+
56
\n+
57private:
\n+
58 int m_counter = 0;
\n+
59};
\n+
60
\n+
61}
\n+
62
\n
63
\n-
69 query_id insert(const std::string &); //[t69]
\n-
70
\n-
72
\n-
73 void complete(); //[t71]
\n-
74
\n-
76
\n-
85 void flush(); //[t70]
\n-
86
\n-
88
\n-
96 void cancel();
\n-
97
\n-
99 bool is_finished(query_id) const; //[t71]
\n-
100
\n-
102
\n-
108 result retrieve(query_id qid) //[t71]
\n-
109 { return retrieve(m_queries.find(qid)).second; }
\n-
110
\n-
112
\n-
113 std::pair<query_id, result> retrieve(); //[t69]
\n-
114
\n-
115 bool empty() const noexcept { return m_queries.empty(); } //[t69]
\n-
116
\n-
118
\n-
129 int retain(int retain_max=2); //[t70]
\n-
130
\n-
131
\n-
133 void resume(); //[t70]
\n-
134
\n-
135private:
\n-
136 class PQXX_PRIVATE Query
\n-
137 {
\n-
138 public:
\n-
139 explicit Query(const std::string &q) : m_query{q}, m_res{} {}
\n-
140
\n-
141 const result &get_result() const noexcept { return m_res; }
\n-
142 void set_result(const result &r) noexcept { m_res = r; }
\n-
143 const std::string &get_query() const noexcept { return m_query; }
\n+
65
\n+
81std::string PQXX_LIBEXPORT encrypt_password( //[t00]
\n+
82 const std::string &user,
\n+
83 const std::string &password);
\n+
84
\n+
85
\n+
86namespace internal
\n+
87{
\n+
88namespace gate
\n+
89{
\n+
90class connection_dbtransaction;
\n+
91class connection_errorhandler;
\n+
92class connection_largeobject;
\n+
93class connection_notification_receiver;
\n+
94class connection_parameterized_invocation;
\n+
95class connection_pipeline;
\n+
96class connection_prepare_invocation;
\n+
97class connection_reactivation_avoidance_exemption;
\n+
98class connection_sql_cursor;
\n+
99class connection_transaction;
\n+
100class const_connection_largeobject;
\n+
101} // namespace pqxx::internal::gate
\n+
102} // namespace pqxx::internal
\n+
103
\n+
104
\n+
106
\n+
139class PQXX_LIBEXPORT connection_base
\n+
140{
\n+
141public:
\n+
143 void disconnect() noexcept; //[t02]
\n
144
\n-
145 private:
\n-
146 std::string m_query;
\n-
147 result m_res;
\n-
148 };
\n-
149
\n-
150 using QueryMap = std::map<query_id,Query>;
\n+
146
\n+
150 bool PQXX_PURE is_open() const noexcept; //[t01]
\n
151
\n-
152 void attach();
\n-
153 void detach();
\n-
154
\n-
156 static constexpr query_id qid_limit() noexcept
\n-
157 {
\n-
158 // Parenthesise this to work around an eternal Visual C++ problem:
\n-
159 // Without the extra parentheses, unless NOMINMAX is defined, the
\n-
160 // preprocessor will mistake this "max" for its annoying built-in macro
\n-
161 // of the same name.
\n-
162 return (std::numeric_limits<query_id>::max)();
\n-
163 }
\n-
164
\n-
166 PQXX_PRIVATE query_id generate_id();
\n-
167
\n-
168 bool have_pending() const noexcept
\n-
169 { return m_issuedrange.second != m_issuedrange.first; }
\n-
170
\n-
171 PQXX_PRIVATE void issue();
\n-
172
\n-
174 void set_error_at(query_id qid) noexcept
\n-
175 { if (qid < m_error) m_error = qid; }
\n-
176
\n-
178 [[noreturn]] PQXX_PRIVATE void internal_error(const std::string &err);
\n+
168
\n+
178 PQXX_DEPRECATED void activate(); //[t12]
\n
179
\n-
180 PQXX_PRIVATE bool obtain_result(bool expect_none=false);
\n
181
\n-
182 PQXX_PRIVATE void obtain_dummy();
\n-
183 PQXX_PRIVATE void get_further_available_results();
\n-
184 PQXX_PRIVATE void check_end_results();
\n-
185
\n-
187 PQXX_PRIVATE void receive_if_available();
\n-
188
\n-
190 PQXX_PRIVATE void receive(pipeline::QueryMap::const_iterator stop);
\n-
191 std::pair<pipeline::query_id, result>
\n-
192 retrieve(pipeline::QueryMap::iterator);
\n-
193
\n-
194 QueryMap m_queries;
\n-
195 std::pair<QueryMap::iterator,QueryMap::iterator> m_issuedrange;
\n-
196 int m_retain = 0;
\n-
197 int m_num_waiting = 0;
\n-
198 query_id m_q_id = 0;
\n-
199
\n-
201 bool m_dummy_pending = false;
\n-
202
\n-
204 query_id m_error = qid_limit();
\n-
205};
\n-
206
\n-
207} // namespace
\n-
208
\n-
209#include "pqxx/compiler-internal-post.hxx"
\n-
210#endif
\n+
189 PQXX_DEPRECATED void deactivate(); //[t12]
\n+
190
\n+
192
\n+
236 PQXX_DEPRECATED void inhibit_reactivation(bool inhibit) //[t86]
\n+
237 { m_inhibit_reactivation=inhibit; }
\n+
238
\n+
240
\n+
245 void simulate_failure(); //[t94]
\n+
247
\n+
249 void process_notice(const char[]) noexcept; //[t14]
\n+
251 void process_notice(const std::string &) noexcept; //[t14]
\n+
252
\n+
254 void trace(std::FILE *) noexcept; //[t03]
\n+
255
\n+
265
\n+
268 const char *dbname(); //[t01]
\n+
269
\n+
271
\n+
274 const char *username(); //[t01]
\n+
275
\n+
277
\n+
280 const char *hostname(); //[t01]
\n+
281
\n+
283
\n+
286 const char *port(); //[t01]
\n+
287
\n+
289
\n+
298 int PQXX_PURE backendpid() const noexcept; //[t01]
\n+
299
\n+
301
\n+
316 int PQXX_PURE sock() const noexcept; //[t87]
\n+
317
\n+
326
\n+
328
\n+\n+
332 {
\n+\n+
335 };
\n+
336
\n+
337
\n+
339
\n+
355 bool supports(capability c) const noexcept //[t88]
\n+
356 { return m_caps.test(c); }
\n+
357
\n+
359
\n+
367 int PQXX_PURE protocol_version() const noexcept; //[t01]
\n+
368
\n+
370
\n+
382 int PQXX_PURE server_version() const noexcept; //[t01]
\n+
384
\n+
386
\n+
407 std::string get_client_encoding() const;
\n+
408
\n+
410
\n+
413 void set_client_encoding(const std::string &encoding); //[t07]
\n+
414
\n+
416
\n+
419 void set_client_encoding(const char encoding[]); //[t07]
\n+
420
\n+
422 int PQXX_PRIVATE encoding_id() const;
\n+
423
\n+
425
\n+
427
\n+
443 void set_variable( //[t60]
\n+
444 const std::string &Var,
\n+
445 const std::string &Value);
\n+
446
\n+
448
\n+
455 std::string get_variable(const std::string &); //[t60]
\n+
457
\n+
458
\n+
464
\n+
476 int get_notifs(); //[t04]
\n+
477
\n+
478
\n+
480
\n+
486 int await_notification(); //[t78]
\n+
487
\n+
489
\n+
495 int await_notification(long seconds, long microseconds); //[t79]
\n+
497
\n+
498
\n+
524
\n+
557 void prepare(const std::string &name, const std::string &definition);
\n+
558
\n+
560
\n+
566 void prepare(const std::string &definition);
\n+
567
\n+
569 void unprepare(const std::string &name);
\n+
570
\n+
572
\n+
582 void prepare_now(const std::string &name);
\n+
583
\n+
589
\n+
600 template<typename TRANSACTOR>
\n+
601 PQXX_DEPRECATED void perform(const TRANSACTOR &T, int Attempts); //[t04]
\n+
602
\n+
604
\n+
610 template<typename TRANSACTOR>
\n+
611 PQXX_DEPRECATED void perform(const TRANSACTOR &T)
\n+
612 {
\n+
613#include "pqxx/internal/ignore-deprecated-pre.hxx"
\n+
614 perform(T, 3);
\n+
615#include "pqxx/internal/ignore-deprecated-post.hxx"
\n+
616 }
\n+
617
\n+
619
\n+
622 std::string adorn_name(const std::string &); //[90]
\n+
623
\n+
629 std::string esc(const char str[]);
\n+
630
\n+
632 std::string esc(const char str[], size_t maxlen);
\n+
633
\n+
635 std::string esc(const std::string &str);
\n+
636
\n+
638 std::string esc_raw(const unsigned char str[], size_t len);
\n+
639
\n+
641
\n+
644 std::string unesc_raw(const std::string &text)
\n+
645 { return unesc_raw(text.c_str()); }
\n+
646
\n+
648
\n+
651 std::string unesc_raw(const char *text);
\n+
652
\n+
654 std::string quote_raw(const unsigned char str[], size_t len);
\n+
655
\n+
657 std::string quote_name(const std::string &identifier);
\n+
658
\n+
660
\n+
661 template<typename T>
\n+
662 std::string quote(const T &t)
\n+
663 {
\n+
664 if (string_traits<T>::is_null(t)) return "NULL";
\n+
665 return "'" + this->esc(to_string(t)) + "'";
\n+
666 }
\n+
667
\n+
668 std::string quote(const binarystring &);
\n+
669
\n+
671
\n+
694 std::string esc_like(const std::string &str, char escape_char='\\\\') const;
\n+
696
\n+
698 void cancel_query();
\n+
699
\n+\n+
702 {
\n+
703 // These values must match those in libpq's PGVerbosity enum.
\n+
704 terse=0,
\n+
705 normal=1,
\n+
706 verbose=2
\n+
707 };
\n+
708
\n+
710
\n+
718 void set_verbosity(error_verbosity verbosity) noexcept;
\n+
720 error_verbosity get_verbosity() const noexcept {return m_verbosity;}
\n+
721
\n+
723
\n+
735 std::vector<errorhandler *> get_errorhandlers() const;
\n+
736
\n+
737protected:
\n+\n+
739 m_policy{pol}
\n+
740 {
\n+
741 // Check library version. The check_library_version template is declared
\n+
742 // for any library version, but only actually defined for the version of
\n+
743 // the libpqxx binary against which the code is linked.
\n+
744 //
\n+
745 // If the library binary is a different version than the one declared in
\n+
746 // these headers, then this call will fail to link: there will be no
\n+
747 // definition for the function with these exact template parameter values.
\n+
748 // There will be a definition, but the version in the parameter values will
\n+
749 // be different.
\n+
750 //
\n+
751 // There is no particular reason to do this here in this constructor, except
\n+
752 // to ensure that every meaningful libpqxx client will execute it. The call
\n+
753 // must be in the execution path somewhere or the compiler won't try to link
\n+
754 // it. We can't use it to initialise a global or class-static variable,
\n+
755 // because a smart compiler might resolve it at compile time.
\n+
756 //
\n+
757 // On the other hand, we don't want to make a useless function call too
\n+
758 // often for performance reasons. A local static variable is initialised
\n+
759 // only on the definition's first execution. Compilers will be well
\n+
760 // optimised for this behaviour, so there's a minimal one-time cost.
\n+
761 static const auto version_ok =
\n+\n+
763 ignore_unused(version_ok);
\n+
764
\n+
765 clearcaps();
\n+
766 }
\n+
767 void init();
\n+
768
\n+
769 void close() noexcept;
\n+
770 void wait_read() const;
\n+
771 void wait_read(long seconds, long microseconds) const;
\n+
772 void wait_write() const;
\n+
773
\n+
774private:
\n+
775
\n+
776 result make_result(internal::pq::PGresult *rhs, const std::string &query);
\n+
777
\n+
778 void clearcaps() noexcept;
\n+
779 void PQXX_PRIVATE set_up_state();
\n+
780 void PQXX_PRIVATE check_result(const result &);
\n+
781
\n+
782 void PQXX_PRIVATE internal_set_trace() noexcept;
\n+
783 int PQXX_PRIVATE PQXX_PURE status() const noexcept;
\n+
784
\n+
785 friend class internal::gate::const_connection_largeobject;
\n+
786 const char * PQXX_PURE err_msg() const noexcept;
\n+
787
\n+
788 void PQXX_PRIVATE reset();
\n+
789 std::string PQXX_PRIVATE raw_get_var(const std::string &);
\n+
790 void PQXX_PRIVATE process_notice_raw(const char msg[]) noexcept;
\n+
791
\n+
792 void read_capabilities();
\n+
793
\n+
794 prepare::internal::prepared_def &find_prepared(const std::string &);
\n+
795
\n+
796 prepare::internal::prepared_def &register_prepared(const std::string &);
\n+
797
\n+
798 friend class internal::gate::connection_prepare_invocation;
\n+
800 PQXX_DEPRECATED result prepared_exec(
\n+
801 const std::string &,
\n+
802 const char *const[],
\n+
803 const int[],
\n+
804 const int[],
\n+
805 int);
\n+
806 result exec_prepared(const std::string &statement, const internal::params &);
\n+
807 bool prepared_exists(const std::string &) const;
\n+
808
\n+
810 internal::pq::PGconn *m_conn = nullptr;
\n+
811
\n+
812 connectionpolicy &m_policy;
\n+
813
\n+
815 internal::unique<transaction_base> m_trans;
\n+
816
\n+
818 void set_notice_processor();
\n+
820 void clear_notice_processor();
\n+
821 std::list<errorhandler *> m_errorhandlers;
\n+
822
\n+
824 std::FILE *m_trace = nullptr;
\n+
825
\n+
826 using receiver_list =
\n+
827 std::multimap<std::string, pqxx::notification_receiver *>;
\n+
829 receiver_list m_receivers;
\n+
830
\n+
832 std::map<std::string, std::string> m_vars;
\n+
833
\n+
834 using PSMap = std::map<std::string, prepare::internal::prepared_def>;
\n+
836 PSMap m_prepared;
\n+
837
\n+
839 int m_serverversion = 0;
\n+
840
\n+
842 internal::reactivation_avoidance_counter m_reactivation_avoidance;
\n+
843
\n+
845 int m_unique_id = 0;
\n+
846
\n+
848 bool m_completed = false;
\n+
849
\n+
851 bool m_inhibit_reactivation = false;
\n+
852
\n+
854 std::bitset<cap_end> m_caps;
\n+
855
\n+
857 error_verbosity m_verbosity = normal;
\n+
858
\n+
859 friend class internal::gate::connection_errorhandler;
\n+
860 void PQXX_PRIVATE register_errorhandler(errorhandler *);
\n+
861 void PQXX_PRIVATE unregister_errorhandler(errorhandler *) noexcept;
\n+
862
\n+
863 friend class internal::gate::connection_transaction;
\n+
864 result PQXX_PRIVATE exec(const char[], int Retries);
\n+
865 void PQXX_PRIVATE register_transaction(transaction_base *);
\n+
866 void PQXX_PRIVATE unregister_transaction(transaction_base *) noexcept;
\n+
867 bool PQXX_PRIVATE read_copy_line(std::string &);
\n+
868 void PQXX_PRIVATE write_copy_line(const std::string &);
\n+
869 void PQXX_PRIVATE end_copy_write();
\n+
870 void PQXX_PRIVATE raw_set_var(const std::string &, const std::string &);
\n+
871 void PQXX_PRIVATE add_variables(const std::map<std::string, std::string> &);
\n+
872
\n+
873 friend class internal::gate::connection_largeobject;
\n+
874 internal::pq::PGconn *raw_connection() const { return m_conn; }
\n+
875
\n+
876 friend class internal::gate::connection_notification_receiver;
\n+
877 void add_receiver(notification_receiver *);
\n+
878 void remove_receiver(notification_receiver *) noexcept;
\n+
879
\n+
880 friend class internal::gate::connection_pipeline;
\n+
881 void PQXX_PRIVATE start_exec(const std::string &);
\n+
882 bool PQXX_PRIVATE consume_input() noexcept;
\n+
883 bool PQXX_PRIVATE is_busy() const noexcept;
\n+
884 internal::pq::PGresult *get_result();
\n+
885
\n+
886 friend class internal::gate::connection_dbtransaction;
\n+
887
\n+
888 friend class internal::gate::connection_sql_cursor;
\n+
889 void add_reactivation_avoidance_count(int);
\n+
890
\n+
891 friend class internal::gate::connection_reactivation_avoidance_exemption;
\n+
892
\n+
893 friend class internal::gate::connection_parameterized_invocation;
\n+
895 PQXX_DEPRECATED result parameterized_exec(
\n+
896 const std::string &query,
\n+
897 const char *const params[],
\n+
898 const int paramlengths[],
\n+
899 const int binaries[],
\n+
900 int nparams);
\n+
901
\n+
902 result exec_params(
\n+
903 const std::string &query,
\n+
904 const internal::params &args);
\n+
905
\n+
906 connection_base(const connection_base &) =delete;
\n+
907 connection_base &operator=(const connection_base &) =delete;
\n+
908};
\n+
909
\n+
910
\n+
911namespace internal
\n+
912{
\n+
913
\n+\n+
916{
\n+
917public:
\n+\n+\n+
920
\n+
921 void close_connection() noexcept { m_open = false; }
\n+
922
\n+
923private:
\n+
924 connection_base &m_home;
\n+
925 int m_count;
\n+
926 bool m_open;
\n+
927};
\n+
928
\n+
929
\n+
930void wait_read(const internal::pq::PGconn *);
\n+
931void wait_read(const internal::pq::PGconn *, long seconds, long microseconds);
\n+
932void wait_write(const internal::pq::PGconn *);
\n+
933} // namespace pqxx::internal
\n+
934
\n+
935} // namespace pqxx
\n+
936
\n+
937#include "pqxx/compiler-internal-post.hxx"
\n+
938
\n+
939#endif
\n
STL namespace.
\n
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
\n-
Processes several queries in FIFO manner, optimized for high throughput.
Definition: pipeline.hxx:49
\n-
pipeline & operator=(const pipeline &)=delete
\n-
bool empty() const noexcept
Definition: pipeline.hxx:115
\n-
pipeline(const pipeline &)=delete
\n-
long query_id
Definition: pipeline.hxx:51
\n+
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
\n+
auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype(callback())
Simple way to execute a transaction with automatic retry.
Definition: transactor.hxx:99
\n+
void ignore_unused(T)
Suppress compiler warning about an unused item.
Definition: util.hxx:38
\n+
std::string encrypt_password(const std::string &user, const std::string &password)
Encrypt password for given user.
Definition: connection_base.cxx:89
\n+
int check_library_version< PQXX_VERSION_MAJOR, PQXX_VERSION_MINOR >() noexcept
Definition: version.cxx:13
\n+
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
\n+
Definition: connection_base.hxx:49
\n+
int get() const noexcept
Definition: connection_base.hxx:55
\n+
void clear() noexcept
Definition: connection_base.hxx:54
\n+\n+
void add(int n) noexcept
Definition: connection_base.hxx:53
\n+
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
\n+
connection_base(connectionpolicy &pol)
Definition: connection_base.hxx:738
\n+
std::string unesc_raw(const std::string &text)
Unescape binary data, e.g. from a table field or notification payload.
Definition: connection_base.hxx:644
\n+
capability
Session capabilities.
Definition: connection_base.hxx:332
\n+
@ cap_end
Not a capability value; end-of-enumeration marker.
Definition: connection_base.hxx:334
\n+
error_verbosity get_verbosity() const noexcept
Retrieve current error verbosity.
Definition: connection_base.hxx:720
\n+
std::string quote(const T &t)
Represent object as SQL string, including quoting & escaping.
Definition: connection_base.hxx:662
\n+
error_verbosity
Error verbosity levels.
Definition: connection_base.hxx:702
\n+
void inhibit_reactivation(bool inhibit)
Definition: connection_base.hxx:236
\n+
bool supports(capability c) const noexcept
Does this connection seem to support the given capability?
Definition: connection_base.hxx:355
\n+
Scoped exemption to reactivation avoidance.
Definition: connection_base.hxx:916
\n+
void close_connection() noexcept
Definition: connection_base.hxx:921
\n+
Definition: connectionpolicy.hxx:32
\n+
Base class for error-handler callbacks.
Definition: errorhandler.hxx:55
\n+
Definition: notification.hxx:56
\n
Result set containing data returned by a query or command.
Definition: result.hxx:70
\n-
Definition: transaction_base.hxx:44
\n+
Traits class for use in string conversions.
Definition: strconv.hxx:51
\n
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
\n
\n
\n \n
\n \n
\n \n \n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -1,169 +1,554 @@\n \n \n \n \n \n libpqxx\n \n-pipeline.hxx\n+connection_base.hxx\n 1\n- 13#ifndef PQXX_H_PIPELINE\n- 14#define PQXX_H_PIPELINE\n+ 13#ifndef PQXX_H_CONNECTION_BASE\n+ 14#define PQXX_H_CONNECTION_BASE\n 15\n 16#include \"pqxx/compiler-public.hxx\"\n 17#include \"pqxx/compiler-internal-pre.hxx\"\n 18\n- 19#include \n- 20#include \n- 21#include \n- 22\n- 23#include \"pqxx/transaction_base.hxx\"\n- 24\n- 25\n- 26// Methods tested in eg. test module test01 are marked with \"//[t01]\".\n- 27\n- 28namespace pqxx\n- 29{\n+ 19#include \n+ 20#include \n+ 21#include \n+ 22#include \n+ 23\n+ 24#include \"pqxx/errorhandler.hxx\"\n+ 25#include \"pqxx/except.hxx\"\n+ 26#include \"pqxx/prepared_statement.hxx\"\n+ 27#include \"pqxx/strconv.hxx\"\n+ 28#include \"pqxx/util.hxx\"\n+ 29#include \"pqxx/version.hxx\"\n 30\n- 32\n-48class PQXX_LIBEXPORT pipeline : public internal::transactionfocus\n+ 31\n+ 32/* Use of the libpqxx library starts here.\n+ 33 *\n+ 34 * Everything that can be done with a database through libpqxx must go\n+through\n+ 35 * a connection object derived from connection_base.\n+ 36 */\n+ 37\n+ 38/* Methods tested in eg. self-test program test1 are marked with \"//[t01]\"\n+ 39 */\n+ 40\n+ 41namespace pqxx\n+ 42{\n+43namespace internal\n+ 44{\n+ 45class reactivation_avoidance_exemption;\n+ 46class sql_cursor;\n+ 47\n+48class reactivation_avoidance_counter\n 49{\n 50public:\n-51 using query_id = long;\n+51 reactivation_avoidance_counter() =default;\n 52\n-53 pipeline(const pipeline &) =delete;\n-54 pipeline &operator=(const pipeline &) =delete;\n- 55\n- 56 explicit pipeline( //[t69]\n- 57 transaction_base &,\n- 58 const std::string &Name=std::string{});\n- 59\n- 60 ~pipeline() noexcept;\n- 61\n+53 void add(int n) noexcept { m_counter += n; }\n+54 void clear() noexcept { m_counter = 0; }\n+55 int get() const noexcept { return m_counter; }\n+ 56\n+ 57private:\n+ 58 int m_counter = 0;\n+ 59};\n+ 60\n+ 61}\n+ 62\n 63\n- 69 query_id insert(const std::string &); //[t69]\n- 70\n- 72\n- 73 void complete(); //[t71]\n- 74\n- 76\n- 85 void flush(); //[t70]\n- 86\n- 88\n- 96 void cancel();\n- 97\n- 99 bool is_finished(query_id) const; //[t71]\n- 100\n- 102\n-108 result retrieve(query_id qid) //[t71]\n- 109 { return retrieve(m_queries.find(qid)).second; }\n- 110\n- 112\n- 113 std::pair retrieve(); //[t69]\n- 114\n-115 bool empty() const noexcept { return m_queries.empty(); } //[t69]\n- 116\n- 118\n- 129 int retain(int retain_max=2); //[t70]\n- 130\n- 131\n- 133 void resume(); //[t70]\n- 134\n- 135private:\n- 136 class PQXX_PRIVATE Query\n- 137 {\n- 138 public:\n- 139 explicit Query(const std::string &q) : m_query{q}, m_res{} {}\n- 140\n- 141 const result &get_result() const noexcept { return m_res; }\n- 142 void set_result(const result &r) noexcept { m_res = r; }\n- 143 const std::string &get_query() const noexcept { return m_query; }\n+ 65\n+ 81std::string PQXX_LIBEXPORT encrypt_password( //[t00]\n+ 82 const std::string &user,\n+ 83 const std::string &password);\n+ 84\n+ 85\n+ 86namespace internal\n+ 87{\n+88namespace gate\n+ 89{\n+ 90class connection_dbtransaction;\n+ 91class connection_errorhandler;\n+ 92class connection_largeobject;\n+ 93class connection_notification_receiver;\n+ 94class connection_parameterized_invocation;\n+ 95class connection_pipeline;\n+ 96class connection_prepare_invocation;\n+ 97class connection_reactivation_avoidance_exemption;\n+ 98class connection_sql_cursor;\n+ 99class connection_transaction;\n+ 100class const_connection_largeobject;\n+ 101} // namespace pqxx::internal::gate\n+ 102} // namespace pqxx::internal\n+ 103\n+ 104\n+ 106\n+139class PQXX_LIBEXPORT connection_base\n+ 140{\n+ 141public:\n+ 143 void disconnect() noexcept; //[t02]\n 144\n- 145 private:\n- 146 std::string m_query;\n- 147 result m_res;\n- 148 };\n- 149\n- 150 using QueryMap = std::map;\n+ 146\n+ 150 bool PQXX_PURE is_open() const noexcept; //[t01]\n 151\n- 152 void attach();\n- 153 void detach();\n- 154\n- 156 static constexpr query_id qid_limit() noexcept\n- 157 {\n- 158 // Parenthesise this to work around an eternal Visual C++ problem:\n- 159 // Without the extra parentheses, unless NOMINMAX is defined, the\n- 160 // preprocessor will mistake this \"max\" for its annoying built-in macro\n- 161 // of the same name.\n- 162 return (std::numeric_limits::max)();\n- 163 }\n- 164\n- 166 PQXX_PRIVATE query_id generate_id();\n- 167\n- 168 bool have_pending() const noexcept\n- 169 { return m_issuedrange.second != m_issuedrange.first; }\n- 170\n- 171 PQXX_PRIVATE void issue();\n- 172\n- 174 void set_error_at(query_id qid) noexcept\n- 175 { if (qid < m_error) m_error = qid; }\n- 176\n- 178 [[noreturn]] PQXX_PRIVATE void internal_error(const std::string &err);\n+ 168\n+ 178 PQXX_DEPRECATED void activate(); //[t12]\n 179\n- 180 PQXX_PRIVATE bool obtain_result(bool expect_none=false);\n 181\n- 182 PQXX_PRIVATE void obtain_dummy();\n- 183 PQXX_PRIVATE void get_further_available_results();\n- 184 PQXX_PRIVATE void check_end_results();\n- 185\n- 187 PQXX_PRIVATE void receive_if_available();\n- 188\n- 190 PQXX_PRIVATE void receive(pipeline::QueryMap::const_iterator stop);\n- 191 std::pair\n- 192 retrieve(pipeline::QueryMap::iterator);\n- 193\n- 194 QueryMap m_queries;\n- 195 std::pair m_issuedrange;\n- 196 int m_retain = 0;\n- 197 int m_num_waiting = 0;\n- 198 query_id m_q_id = 0;\n- 199\n- 201 bool m_dummy_pending = false;\n- 202\n- 204 query_id m_error = qid_limit();\n- 205};\n- 206\n- 207} // namespace\n- 208\n- 209#include \"pqxx/compiler-internal-post.hxx\"\n- 210#endif\n+ 189 PQXX_DEPRECATED void deactivate(); //[t12]\n+ 190\n+ 192\n+236 PQXX_DEPRECATED void inhibit_reactivation(bool inhibit) //[t86]\n+ 237 { m_inhibit_reactivation=inhibit; }\n+ 238\n+ 240\n+ 245 void simulate_failure(); //[t94]\n+ 247\n+ 249 void process_notice(const char[]) noexcept; //[t14]\n+ 251 void process_notice(const std::string &) noexcept; //[t14]\n+ 252\n+ 254 void trace(std::FILE *) noexcept; //[t03]\n+ 255\n+ 265\n+ 268 const char *dbname(); //[t01]\n+ 269\n+ 271\n+ 274 const char *username(); //[t01]\n+ 275\n+ 277\n+ 280 const char *hostname(); //[t01]\n+ 281\n+ 283\n+ 286 const char *port(); //[t01]\n+ 287\n+ 289\n+ 298 int PQXX_PURE backendpid() const noexcept; //[t01]\n+ 299\n+ 301\n+ 316 int PQXX_PURE sock() const noexcept; //[t87]\n+ 317\n+ 326\n+ 328\n+331 enum capability\n+ 332 {\n+334 cap_end,\n+ 335 };\n+ 336\n+ 337\n+ 339\n+355 bool supports(capability c) const noexcept //[t88]\n+ 356 { return m_caps.test(c); }\n+ 357\n+ 359\n+ 367 int PQXX_PURE protocol_version() const noexcept; //[t01]\n+ 368\n+ 370\n+ 382 int PQXX_PURE server_version() const noexcept; //[t01]\n+ 384\n+ 386\n+ 407 std::string get_client_encoding() const;\n+ 408\n+ 410\n+ 413 void set_client_encoding(const std::string &encoding); //[t07]\n+ 414\n+ 416\n+ 419 void set_client_encoding(const char encoding[]); //[t07]\n+ 420\n+ 422 int PQXX_PRIVATE encoding_id() const;\n+ 423\n+ 425\n+ 427\n+ 443 void set_variable( //[t60]\n+ 444 const std::string &Var,\n+ 445 const std::string &Value);\n+ 446\n+ 448\n+ 455 std::string get_variable(const std::string &); //[t60]\n+ 457\n+ 458\n+ 464\n+ 476 int get_notifs(); //[t04]\n+ 477\n+ 478\n+ 480\n+ 486 int await_notification(); //[t78]\n+ 487\n+ 489\n+ 495 int await_notification(long seconds, long microseconds); //[t79]\n+ 497\n+ 498\n+ 524\n+ 557 void prepare(const std::string &name, const std::string &definition);\n+ 558\n+ 560\n+ 566 void prepare(const std::string &definition);\n+ 567\n+ 569 void unprepare(const std::string &name);\n+ 570\n+ 572\n+ 582 void prepare_now(const std::string &name);\n+ 583\n+ 589\n+ 600 template\n+ 601 PQXX_DEPRECATED void perform(const TRANSACTOR &T, int Attempts); //[t04]\n+ 602\n+ 604\n+ 610 template\n+611 PQXX_DEPRECATED void perform(const TRANSACTOR &T)\n+ 612 {\n+ 613#include \"pqxx/internal/ignore-deprecated-pre.hxx\"\n+ 614 perform(T, 3);\n+ 615#include \"pqxx/internal/ignore-deprecated-post.hxx\"\n+ 616 }\n+ 617\n+ 619\n+ 622 std::string adorn_name(const std::string &); //[90]\n+ 623\n+ 629 std::string esc(const char str[]);\n+ 630\n+ 632 std::string esc(const char str[], size_t maxlen);\n+ 633\n+ 635 std::string esc(const std::string &str);\n+ 636\n+ 638 std::string esc_raw(const unsigned char str[], size_t len);\n+ 639\n+ 641\n+644 std::string unesc_raw(const std::string &text)\n+ 645 { return unesc_raw(text.c_str()); }\n+ 646\n+ 648\n+ 651 std::string unesc_raw(const char *text);\n+ 652\n+ 654 std::string quote_raw(const unsigned char str[], size_t len);\n+ 655\n+ 657 std::string quote_name(const std::string &identifier);\n+ 658\n+ 660\n+ 661 template\n+662 std::string quote(const T &t)\n+ 663 {\n+ 664 if (string_traits::is_null(t)) return \"NULL\";\n+ 665 return \"'\" + this->esc(to_string(t)) + \"'\";\n+ 666 }\n+ 667\n+ 668 std::string quote(const binarystring &);\n+ 669\n+ 671\n+ 694 std::string esc_like(const std::string &str, char escape_char='\\\\') const;\n+ 696\n+ 698 void cancel_query();\n+ 699\n+701 enum error_verbosity\n+ 702 {\n+ 703 // These values must match those in libpq's PGVerbosity enum.\n+704 terse=0,\n+705 normal=1,\n+ 706 verbose=2\n+707 };\n+ 708\n+ 710\n+ 718 void set_verbosity(error_verbosity verbosity) noexcept;\n+720 error_verbosity get_verbosity() const noexcept {return m_verbosity;}\n+ 721\n+ 723\n+ 735 std::vector get_errorhandlers() const;\n+ 736\n+ 737protected:\n+738 explicit connection_base(connectionpolicy &pol) :\n+ 739 m_policy{pol}\n+ 740 {\n+ 741 // Check library version. The check_library_version template is declared\n+ 742 // for any library version, but only actually defined for the version of\n+ 743 // the libpqxx binary against which the code is linked.\n+ 744 //\n+ 745 // If the library binary is a different version than the one declared in\n+ 746 // these headers, then this call will fail to link: there will be no\n+ 747 // definition for the function with these exact template parameter values.\n+ 748 // There will be a definition, but the version in the parameter values\n+will\n+ 749 // be different.\n+ 750 //\n+ 751 // There is no particular reason to do this here in this constructor,\n+except\n+ 752 // to ensure that every meaningful libpqxx client will execute it. The\n+call\n+ 753 // must be in the execution path somewhere or the compiler won't try to\n+link\n+ 754 // it. We can't use it to initialise a global or class-static variable,\n+ 755 // because a smart compiler might resolve it at compile time.\n+ 756 //\n+ 757 // On the other hand, we don't want to make a useless function call too\n+ 758 // often for performance reasons. A local static variable is initialised\n+ 759 // only on the definition's first execution. Compilers will be well\n+ 760 // optimised for this behaviour, so there's a minimal one-time cost.\n+ 761 static const auto version_ok =\n+ 762 internal::check_library_version();\n+ 763 ignore_unused(version_ok);\n+ 764\n+ 765 clearcaps();\n+ 766 }\n+ 767 void init();\n+ 768\n+ 769 void close() noexcept;\n+ 770 void wait_read() const;\n+ 771 void wait_read(long seconds, long microseconds) const;\n+ 772 void wait_write() const;\n+ 773\n+ 774private:\n+ 775\n+ 776 result make_result(internal::pq::PGresult *rhs, const std::string &query);\n+ 777\n+ 778 void clearcaps() noexcept;\n+ 779 void PQXX_PRIVATE set_up_state();\n+ 780 void PQXX_PRIVATE check_result(const result &);\n+ 781\n+ 782 void PQXX_PRIVATE internal_set_trace() noexcept;\n+ 783 int PQXX_PRIVATE PQXX_PURE status() const noexcept;\n+ 784\n+785 friend class internal::gate::const_connection_largeobject;\n+ 786 const char * PQXX_PURE err_msg() const noexcept;\n+ 787\n+ 788 void PQXX_PRIVATE reset();\n+ 789 std::string PQXX_PRIVATE raw_get_var(const std::string &);\n+ 790 void PQXX_PRIVATE process_notice_raw(const char msg[]) noexcept;\n+ 791\n+ 792 void read_capabilities();\n+ 793\n+ 794 prepare::internal::prepared_def &find_prepared(const std::string &);\n+ 795\n+ 796 prepare::internal::prepared_def ®ister_prepared(const std::string &);\n+ 797\n+798 friend class internal::gate::connection_prepare_invocation;\n+ 800 PQXX_DEPRECATED result prepared_exec(\n+ 801 const std::string &,\n+ 802 const char *const[],\n+ 803 const int[],\n+ 804 const int[],\n+ 805 int);\n+ 806 result exec_prepared(const std::string &statement, const internal::params\n+&);\n+ 807 bool prepared_exists(const std::string &) const;\n+ 808\n+ 810 internal::pq::PGconn *m_conn = nullptr;\n+ 811\n+ 812 connectionpolicy &m_policy;\n+ 813\n+ 815 internal::unique m_trans;\n+ 816\n+ 818 void set_notice_processor();\n+ 820 void clear_notice_processor();\n+ 821 std::list m_errorhandlers;\n+ 822\n+ 824 std::FILE *m_trace = nullptr;\n+ 825\n+ 826 using receiver_list =\n+ 827 std::multimap;\n+ 829 receiver_list m_receivers;\n+ 830\n+ 832 std::map m_vars;\n+ 833\n+ 834 using PSMap = std::map;\n+ 836 PSMap m_prepared;\n+ 837\n+ 839 int m_serverversion = 0;\n+ 840\n+ 842 internal::reactivation_avoidance_counter m_reactivation_avoidance;\n+ 843\n+ 845 int m_unique_id = 0;\n+ 846\n+ 848 bool m_completed = false;\n+ 849\n+ 851 bool m_inhibit_reactivation = false;\n+ 852\n+ 854 std::bitset m_caps;\n+ 855\n+ 857 error_verbosity m_verbosity = normal;\n+ 858\n+859 friend class internal::gate::connection_errorhandler;\n+ 860 void PQXX_PRIVATE register_errorhandler(errorhandler *);\n+ 861 void PQXX_PRIVATE unregister_errorhandler(errorhandler *) noexcept;\n+ 862\n+863 friend class internal::gate::connection_transaction;\n+ 864 result PQXX_PRIVATE exec(const char[], int Retries);\n+ 865 void PQXX_PRIVATE register_transaction(transaction_base *);\n+ 866 void PQXX_PRIVATE unregister_transaction(transaction_base *) noexcept;\n+ 867 bool PQXX_PRIVATE read_copy_line(std::string &);\n+ 868 void PQXX_PRIVATE write_copy_line(const std::string &);\n+ 869 void PQXX_PRIVATE end_copy_write();\n+ 870 void PQXX_PRIVATE raw_set_var(const std::string &, const std::string &);\n+ 871 void PQXX_PRIVATE add_variables(const std::map\n+&);\n+ 872\n+873 friend class internal::gate::connection_largeobject;\n+ 874 internal::pq::PGconn *raw_connection() const { return m_conn; }\n+ 875\n+876 friend class internal::gate::connection_notification_receiver;\n+ 877 void add_receiver(notification_receiver *);\n+ 878 void remove_receiver(notification_receiver *) noexcept;\n+ 879\n+880 friend class internal::gate::connection_pipeline;\n+ 881 void PQXX_PRIVATE start_exec(const std::string &);\n+ 882 bool PQXX_PRIVATE consume_input() noexcept;\n+ 883 bool PQXX_PRIVATE is_busy() const noexcept;\n+ 884 internal::pq::PGresult *get_result();\n+ 885\n+886 friend class internal::gate::connection_dbtransaction;\n+ 887\n+888 friend class internal::gate::connection_sql_cursor;\n+ 889 void add_reactivation_avoidance_count(int);\n+ 890\n+891 friend class internal::gate::connection_reactivation_avoidance_exemption;\n+ 892\n+893 friend class internal::gate::connection_parameterized_invocation;\n+ 895 PQXX_DEPRECATED result parameterized_exec(\n+ 896 const std::string &query,\n+ 897 const char *const params[],\n+ 898 const int paramlengths[],\n+ 899 const int binaries[],\n+ 900 int nparams);\n+ 901\n+ 902 result exec_params(\n+ 903 const std::string &query,\n+ 904 const internal::params &args);\n+ 905\n+ 906 connection_base(const connection_base &) =delete;\n+ 907 connection_base &operator=(const connection_base &) =delete;\n+ 908};\n+ 909\n+ 910\n+ 911namespace internal\n+ 912{\n+ 913\n+915class PQXX_LIBEXPORT reactivation_avoidance_exemption\n+ 916{\n+ 917public:\n+ 918 explicit reactivation_avoidance_exemption(connection_base &C);\n+ 919 ~reactivation_avoidance_exemption();\n+ 920\n+921 void close_connection() noexcept { m_open = false; }\n+ 922\n+ 923private:\n+ 924 connection_base &m_home;\n+ 925 int m_count;\n+ 926 bool m_open;\n+ 927};\n+ 928\n+ 929\n+ 930void wait_read(const internal::pq::PGconn *);\n+ 931void wait_read(const internal::pq::PGconn *, long seconds, long\n+microseconds);\n+ 932void wait_write(const internal::pq::PGconn *);\n+ 933} // namespace pqxx::internal\n+ 934\n+ 935} // namespace pqxx\n+ 936\n+ 937#include \"pqxx/compiler-internal-post.hxx\"\n+ 938\n+ 939#endif\n std\n STL namespace.\n pqxx\n The home of all libpqxx classes, functions, templates, etc.\n Definition: array.hxx:26\n-pqxx::pipeline\n-Processes several queries in FIFO manner, optimized for high throughput.\n-Definition: pipeline.hxx:49\n-pqxx::pipeline::operator=\n-pipeline & operator=(const pipeline &)=delete\n-pqxx::pipeline::empty\n-bool empty() const noexcept\n-Definition: pipeline.hxx:115\n-pqxx::pipeline::pipeline\n-pipeline(const pipeline &)=delete\n-pqxx::pipeline::query_id\n-long query_id\n-Definition: pipeline.hxx:51\n+pqxx::to_string\n+std::string to_string(const field &Obj)\n+Convert a field to a string.\n+Definition: result.cxx:451\n+pqxx::perform\n+auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype\n+(callback())\n+Simple way to execute a transaction with automatic retry.\n+Definition: transactor.hxx:99\n+pqxx::ignore_unused\n+void ignore_unused(T)\n+Suppress compiler warning about an unused item.\n+Definition: util.hxx:38\n+pqxx::encrypt_password\n+std::string encrypt_password(const std::string &user, const std::string\n+&password)\n+Encrypt password for given user.\n+Definition: connection_base.cxx:89\n+pqxx::internal::check_library_version<_PQXX_VERSION_MAJOR,_PQXX_VERSION_MINOR_>\n+int check_library_version< PQXX_VERSION_MAJOR, PQXX_VERSION_MINOR >() noexcept\n+Definition: version.cxx:13\n+pqxx::binarystring\n+Binary data corresponding to PostgreSQL's \"BYTEA\" binary-string type.\n+Definition: binarystring.hxx:54\n+pqxx::internal::reactivation_avoidance_counter\n+Definition: connection_base.hxx:49\n+pqxx::internal::reactivation_avoidance_counter::get\n+int get() const noexcept\n+Definition: connection_base.hxx:55\n+pqxx::internal::reactivation_avoidance_counter::clear\n+void clear() noexcept\n+Definition: connection_base.hxx:54\n+pqxx::internal::reactivation_avoidance_counter::reactivation_avoidance_counter\n+reactivation_avoidance_counter()=default\n+pqxx::internal::reactivation_avoidance_counter::add\n+void add(int n) noexcept\n+Definition: connection_base.hxx:53\n+pqxx::connection_base\n+connection_base abstract base class; represents a connection to a database.\n+Definition: connection_base.hxx:140\n+pqxx::connection_base::connection_base\n+connection_base(connectionpolicy &pol)\n+Definition: connection_base.hxx:738\n+pqxx::connection_base::unesc_raw\n+std::string unesc_raw(const std::string &text)\n+Unescape binary data, e.g. from a table field or notification payload.\n+Definition: connection_base.hxx:644\n+pqxx::connection_base::capability\n+capability\n+Session capabilities.\n+Definition: connection_base.hxx:332\n+pqxx::connection_base::cap_end\n+@ cap_end\n+Not a capability value; end-of-enumeration marker.\n+Definition: connection_base.hxx:334\n+pqxx::connection_base::get_verbosity\n+error_verbosity get_verbosity() const noexcept\n+Retrieve current error verbosity.\n+Definition: connection_base.hxx:720\n+pqxx::connection_base::quote\n+std::string quote(const T &t)\n+Represent object as SQL string, including quoting & escaping.\n+Definition: connection_base.hxx:662\n+pqxx::connection_base::error_verbosity\n+error_verbosity\n+Error verbosity levels.\n+Definition: connection_base.hxx:702\n+pqxx::connection_base::inhibit_reactivation\n+void inhibit_reactivation(bool inhibit)\n+Definition: connection_base.hxx:236\n+pqxx::connection_base::supports\n+bool supports(capability c) const noexcept\n+Does this connection seem to support the given capability?\n+Definition: connection_base.hxx:355\n+pqxx::internal::reactivation_avoidance_exemption\n+Scoped exemption to reactivation avoidance.\n+Definition: connection_base.hxx:916\n+pqxx::internal::reactivation_avoidance_exemption::close_connection\n+void close_connection() noexcept\n+Definition: connection_base.hxx:921\n+pqxx::connectionpolicy\n+Definition: connectionpolicy.hxx:32\n+pqxx::errorhandler\n+Base class for error-handler callbacks.\n+Definition: errorhandler.hxx:55\n+pqxx::notification_receiver\n+Definition: notification.hxx:56\n pqxx::result\n Result set containing data returned by a query or command.\n Definition: result.hxx:70\n-pqxx::internal::transactionfocus\n-Definition: transaction_base.hxx:44\n+pqxx::string_traits\n+Traits class for use in string conversions.\n+Definition: strconv.hxx:51\n pqxx::transaction_base\n Interface definition (and common code) for \"transaction\" classes.\n Definition: transaction_base.hxx:138\n * include\n * pqxx\n- * pipeline.hxx\n+ * connection_base.hxx\n * Generated by [doxygen] 1.9.4\n"}]}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a00265.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a00265.html", "unified_diff": "@@ -597,15 +597,15 @@\n

Definition of the pqxx::stream_from class.

\n

pqxx::stream_from enables optimized batch reads from a database table.

\n

DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/stream_from instead.

\n

Copyright (c) 2000-2019, Jeroen T. Vermeulen.

\n

See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.

\n

Definition of the pqxx::stream_to class.

\n

pqxx::stream_to enables optimized batch updates to a database table.

\n-

DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/stream_to.hxx instead.

\n+

DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/stream_to.hxx instead.

\n

Copyright (c) 2000-2019, Jeroen T. Vermeulen.

\n

See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.

\n

Definition of the pqxx::subtransaction class.

\n

pqxx::subtransaction is a nested transaction, i.e. one within a transaction.

\n

DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/subtransaction instead.

\n

Copyright (c) 2000-2019, Jeroen T. Vermeulen.

\n

See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.

\n@@ -617,15 +617,15 @@\n

Definition of the pqxx::tablestream class.

\n

pqxx::tablestream provides optimized batch access to a database table.

\n

DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/tablestream instead.

\n

Copyright (c) 2000-2019, Jeroen T. Vermeulen.

\n

See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.

\n

Definition of the pqxx::tablewriter class.

\n

pqxx::tablewriter enables optimized batch updates to a database table.

\n-

DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/tablewriter.hxx instead.

\n+

DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/tablewriter.hxx instead.

\n

Copyright (c) 2000-2019, Jeroen T. Vermeulen.

\n

See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.

\n

Definition of the pqxx::transaction class. pqxx::transaction represents a standard database transaction.

\n

DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transaction instead.

\n

Copyright (c) 2000-2019, Jeroen T. Vermeulen.

\n

See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.

\n

Common code and definitions for the transaction classes.

\n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01099.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01099.html", "unified_diff": "@@ -66,15 +66,15 @@\n
pqxx::array_parser Class Reference
\n
\n
\n \n

Low-level array parser. \n More...

\n \n-

#include <array.hxx>

\n+

#include <array.hxx>

\n \n \n \n

\n Public Types

enum  juncture {
\n   row_start\n , row_end\n , null_value\n@@ -189,15 +189,15 @@\n

Parse the next step in the array.

\n

Returns what it found. If the juncture is string_value, the string will contain the value. Otherwise, it will be empty.

\n

Call this until the juncture it returns is done.

\n \n \n \n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01103.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01103.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::basic_connection_base< CONNECTPOLICY > Class Template Reference
    \n
\n
\n \n

Base-class template for all libpqxx connection types. \n More...

\n \n-

#include <basic_connection.hxx>

\n+

#include <basic_connection.hxx>

\n
\n Inheritance diagram for pqxx::basic_connection_base< CONNECTPOLICY >:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -440,15 +440,15 @@\n
\n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n
\n
\n \n
\n
    \n
  • pqxx
  • basic_connection_base
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01107.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01107.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::basic_connection< CONNECTPOLICY > Struct Template Reference
    \n
\n
\n \n

Concrete connection type template. \n More...

\n \n-

#include <basic_connection.hxx>

\n+

#include <basic_connection.hxx>

\n
\n Inheritance diagram for pqxx::basic_connection< CONNECTPOLICY >:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -391,15 +391,15 @@\n \n \n
\n \n
\n
\n
The documentation for this struct was generated from the following file:\n
\n
\n \n
\n
    \n
  • pqxx
  • basic_connection
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01111.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01111.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::binarystring Class Reference
    \n
\n
\n \n

Binary data corresponding to PostgreSQL's \"BYTEA\" binary-string type. \n More...

\n \n-

#include <binarystring.hxx>

\n+

#include <binarystring.hxx>

\n \n \n \n \n \n \n@@ -909,15 +909,15 @@\n
\n \n

Swap contents with other binarystring.

\n \n
\n \n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01115.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01115.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::connect_direct Class Reference
    \n
\n
\n \n

Connection policy; creates an immediate connection to a database. \n More...

\n \n-

#include <connection.hxx>

\n+

#include <connection.hxx>

\n
\n Inheritance diagram for pqxx::connect_direct:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -171,15 +171,15 @@\n
\n \n

Reimplemented from pqxx::connectionpolicy.

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01119.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01119.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::connect_lazy Class Reference
    \n
\n
\n \n

Lazy connection policy; causes connection to be deferred until first use. \n More...

\n \n-

#include <connection.hxx>

\n+

#include <connection.hxx>

\n
\n Inheritance diagram for pqxx::connect_lazy:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -170,15 +170,15 @@\n
\n \n

Reimplemented from pqxx::connectionpolicy.

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01123.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01123.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::connect_async Class Reference
    \n
\n
\n \n

Asynchronous connection policy; connects \"in the background\". \n More...

\n \n-

#include <connection.hxx>

\n+

#include <connection.hxx>

\n
\n Inheritance diagram for pqxx::connect_async:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -263,15 +263,15 @@\n
\n \n

Reimplemented from pqxx::connectionpolicy.

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01127.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01127.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::connect_null Class Reference
    \n
\n
\n \n

Nonfunctional, always-down connection policy for testing/debugging purposes. \n More...

\n \n-

#include <connection.hxx>

\n+

#include <connection.hxx>

\n
\n Inheritance diagram for pqxx::connect_null:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -138,15 +138,15 @@\n \n

\n Public Types

using char_type = unsigned char
 
using value_type = std::char_traits< char_type >::char_type
 
\n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n
\n
\n \n
\n
    \n
  • pqxx
  • connect_null
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01131.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01131.html", "unified_diff": "@@ -62,15 +62,15 @@\n \n
    pqxx::internal::reactivation_avoidance_counter Class Reference
    \n
\n
\n \n-

#include <connection_base.hxx>

\n+

#include <connection_base.hxx>

\n \n \n \n \n \n \n@@ -179,15 +179,15 @@\n \n

\n Public Member Functions

 reactivation_avoidance_counter ()=default
 
void add (int n) noexcept
 
\n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • internal
  • reactivation_avoidance_counter
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01135.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01135.html", "unified_diff": "@@ -68,15 +68,15 @@\n
    pqxx::connection_base Class Reference
    \n
\n
\n \n

connection_base abstract base class; represents a connection to a database. \n More...

\n \n-

#include <connection_base.hxx>

\n+

#include <connection_base.hxx>

\n
\n Inheritance diagram for pqxx::connection_base:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -303,15 +303,15 @@\n int PQXX_PURE server_version () const noexcept\n  What version of the PostgreSQL server are we connected to? More...
\n  \n \n

Detailed Description

\n

connection_base abstract base class; represents a connection to a database.

\n

This is the first class to look at when you wish to work with a database through libpqxx. Depending on the implementing concrete child class, a connection can be automatically opened when it is constructed, or when it is first used, or somewhere inbetween. The connection is automatically closed upon destruction (if it hasn't been closed already).

\n-

To query or manipulate the database once connected, use one of the transaction classes (see pqxx/transaction_base.hxx) or preferably the transactor framework (see pqxx/transactor.hxx).

\n+

To query or manipulate the database once connected, use one of the transaction classes (see pqxx/transaction_base.hxx) or preferably the transactor framework (see pqxx/transactor.hxx).

\n

If a network connection to the database server fails, the connection will be restored automatically (although any transaction going on at the time will have to be aborted). This also means that any information set in previous transactions that is not stored in the database, such as temp tables or connection-local variables defined with PostgreSQL's SET command, will be lost. Whenever you create such state, either keept it local to one transaction, where possible, or inhibit automatic reactivation of the connection using the inhibit_reactivation() method.

\n

When a connection breaks, you will typically get a broken_connection exception. This can happen at almost any point, and the details may depend on which connection class (all derived from this one) you use.

\n

As a general rule, always avoid raw queries if libpqxx offers a dedicated function for the same purpose. There may be hidden logic to hide certain complications from you, such as reinstating session variables when a broken or disabled connection is reactivated.

\n
Warning
On Unix-like systems, including GNU and BSD systems, your program may receive the SIGPIPE signal when the connection to the backend breaks. By default this signal will abort your program. Use \"signal(SIGPIPE, SIG_IGN)\" if you want your program to continue running after a connection fails.
\n

Member Enumeration Documentation

\n \n

◆ capability

\n@@ -2056,16 +2056,16 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01139.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01139.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::internal::reactivation_avoidance_exemption Class Reference
    \n
\n
\n \n

Scoped exemption to reactivation avoidance. \n More...

\n \n-

#include <connection_base.hxx>

\n+

#include <connection_base.hxx>

\n \n \n \n \n \n \n@@ -149,15 +149,15 @@\n \n

\n Public Member Functions

 reactivation_avoidance_exemption (connection_base &C)
 
 ~reactivation_avoidance_exemption ()
 
\n
\n \n
\n \n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01147.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01147.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::cursor_base Class Reference
    \n
\n
\n \n

Common definitions for cursor types. \n More...

\n \n-

#include <cursor.hxx>

\n+

#include <cursor.hxx>

\n \n \n \n \n@@ -515,15 +515,15 @@\n \n

\n Public Types

enum  accesspolicy { forward_only\n , random_access\n }
 Cursor access-pattern policy. More...
\n
\n \n
\n \n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01151.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01151.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::stateless_cursor< up, op > Class Template Reference
    \n
\n
\n \n

\"Stateless cursor\" class: easy API for retrieving parts of result sets \n More...

\n \n-

#include <cursor.hxx>

\n+

#include <cursor.hxx>

\n \n \n \n \n \n \n@@ -333,15 +333,15 @@\n
Note
This function is not const; it may need to scroll to find the size of the result set.
\n \n

Referenced by pqxx::stateless_cursor< up, op >::retrieve().

\n \n \n \n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • stateless_cursor
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01155.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01155.html", "unified_diff": "@@ -67,15 +67,15 @@\n
    pqxx::icursorstream Class Reference
    \n
\n
\n \n

Simple read-only cursor represented as a stream of results. \n More...

\n \n-

#include <cursor.hxx>

\n+

#include <cursor.hxx>

\n

\n Public Types

using size_type = result_size_type
 
using difference_type = result_difference_type
 
\n \n \n \n \n \n@@ -420,15 +420,15 @@\n \n

\n Public Types

using size_type = cursor_base::size_type
 
using difference_type = cursor_base::difference_type
 
\n
\n \n
\n \n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01159.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01159.html", "unified_diff": "@@ -67,15 +67,15 @@\n
    pqxx::icursor_iterator Class Reference
    \n
\n
\n \n

Approximate istream_iterator for icursorstream. \n More...

\n \n-

#include <cursor.hxx>

\n+

#include <cursor.hxx>

\n \n \n \n \n \n \n@@ -592,15 +592,15 @@\n \n

\n Public Types

using iterator_category = std::input_iterator_tag
 
using value_type = result
 
\n
\n \n
\n \n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01163.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01163.html", "unified_diff": "@@ -67,15 +67,15 @@\n
    pqxx::dbtransaction Class Referenceabstract
    \n
\n
\n \n

Abstract base class responsible for bracketing a backend transaction. \n More...

\n \n-

#include <dbtransaction.hxx>

\n+

#include <dbtransaction.hxx>

\n
\n Inheritance diagram for pqxx::dbtransaction:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -577,15 +577,15 @@\n
\n \n

Start a transaction on the backend and set desired isolation level.

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01167.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01167.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::errorhandler Class Referenceabstract
    \n
\n
\n \n

Base class for error-handler callbacks. \n More...

\n \n-

#include <errorhandler.hxx>

\n+

#include <errorhandler.hxx>

\n
\n Inheritance diagram for pqxx::errorhandler:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -209,15 +209,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01171.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01171.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::quiet_errorhandler Class Reference
    \n
\n
\n \n

An error handler that suppresses any previously registered error handlers. \n More...

\n \n-

#include <errorhandler.hxx>

\n+

#include <errorhandler.hxx>

\n
\n Inheritance diagram for pqxx::quiet_errorhandler:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -146,15 +146,15 @@\n
Returns
Whether the same error message should also be passed to the remaining, older errorhandlers.
\n \n

Implements pqxx::errorhandler.

\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • quiet_errorhandler
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01175.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01175.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::pqxx_exception Class Referenceabstract
    \n
\n
\n \n

Mixin base class to identify libpqxx-specific exception types. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::pqxx_exception:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -203,15 +203,15 @@\n
virtual PQXX_CONST const std::exception & base() const noexcept=0
Return std::exception base-class object.
\n
Exception class for failed queries.
Definition: except.hxx:131
\n
PQXX_PURE const std::string & query() const noexcept
The query whose execution triggered the exception.
Definition: except.cxx:53
\n
\n
\n \n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01179.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01179.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::failure Class Reference
    \n
\n
\n \n

Run-time failure encountered by libpqxx, similar to std::runtime_error. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::failure:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -151,15 +151,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01183.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01183.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::broken_connection Class Reference
    \n
\n
\n \n

Exception class for lost or failed backend connection. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::broken_connection:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -152,15 +152,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01187.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01187.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::sql_error Class Reference
    \n
\n
\n \n

Exception class for failed queries. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::sql_error:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -252,15 +252,15 @@\n
\n \n

SQLSTATE error code if known, or empty string otherwise.

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01191.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01191.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::in_doubt_error Class Reference
    \n
\n
\n \n

\"Help, I don't know whether transaction was committed successfully!\" \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::in_doubt_error:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -125,15 +125,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01195.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01195.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::transaction_rollback Class Reference
    \n
\n
\n \n

The backend saw itself forced to roll back the ongoing transaction. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::transaction_rollback:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -127,15 +127,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01199.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01199.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::serialization_failure Class Reference
    \n
\n
\n \n

Transaction failed to serialize. Please retry it. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::serialization_failure:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -130,15 +130,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01203.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01203.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::statement_completion_unknown Class Reference
    \n
\n
\n \n

We can't tell whether our last statement succeeded. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::statement_completion_unknown:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -128,15 +128,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01207.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01207.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::deadlock_detected Class Reference
    \n
\n
\n \n

The ongoing transaction has deadlocked. Retrying it may help. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::deadlock_detected:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -128,15 +128,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01211.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01211.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::internal_error Class Reference
    \n
\n
\n \n

Internal error in libpqxx library. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::internal_error:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -120,15 +120,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01215.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01215.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::usage_error Class Reference
    \n
\n
\n \n

Error in usage of libpqxx library, similar to std::logic_error. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::usage_error:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -120,15 +120,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01219.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01219.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::argument_error Class Reference
    \n
\n
\n \n

Invalid argument passed to libpqxx, similar to std::invalid_argument. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::argument_error:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -121,15 +121,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01223.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01223.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::conversion_error Class Reference
    \n
\n
\n \n

Value conversion failed, e.g. when converting \"Hello\" to int. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::conversion_error:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -121,15 +121,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01227.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01227.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::range_error Class Reference
    \n
\n
\n \n

Something is out of range, similar to std::out_of_range. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::range_error:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -122,15 +122,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01231.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01231.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::unexpected_rows Class Reference
    \n
\n
\n \n

Query returned an unexpected number of rows. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::unexpected_rows:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -125,15 +125,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • unexpected_rows
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01235.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01235.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::feature_not_supported Class Reference
    \n
\n
\n \n

Database feature not supported in current setup. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::feature_not_supported:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -152,15 +152,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • feature_not_supported
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01239.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01239.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::data_exception Class Reference
    \n
\n
\n \n

Error in data provided to SQL statement. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::data_exception:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -152,15 +152,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::integrity_constraint_violation:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -152,15 +152,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::restrict_violation:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -151,15 +151,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::not_null_violation:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -151,15 +151,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::foreign_key_violation:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -151,15 +151,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::unique_violation:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -151,15 +151,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::check_violation:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -151,15 +151,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::invalid_cursor_state:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -147,15 +147,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::invalid_sql_statement_name:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -147,15 +147,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::invalid_cursor_name:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -147,15 +147,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
pqxx::syntax_error Class Reference
\n \n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::syntax_error:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -180,15 +180,15 @@\n
\n \n

Approximate position in string where error occurred, or -1 if unknown.

\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::undefined_column:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -158,15 +158,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::undefined_function:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -158,15 +158,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::undefined_table:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -158,15 +158,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::insufficient_privilege:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -147,15 +147,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • insufficient_privilege
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01299.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01299.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::insufficient_resources Class Reference
    \n
\n
\n \n

Resource shortage on the server. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::insufficient_resources:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -154,15 +154,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::disk_full:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -151,15 +151,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::out_of_memory:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -151,15 +151,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::too_many_connections:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -125,15 +125,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • too_many_connections
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01315.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01315.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::plpgsql_error Class Reference
    \n
\n
\n \n

PL/pgSQL error. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::plpgsql_error:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -156,15 +156,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • plpgsql_error
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01319.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01319.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::plpgsql_raise Class Reference
    \n
\n
\n \n

Exception raised in PL/pgSQL procedure. \n More...

\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::plpgsql_raise:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -156,15 +156,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::plpgsql_no_data_found:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -151,15 +151,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <except.hxx>

\n+

#include <except.hxx>

\n
\n Inheritance diagram for pqxx::plpgsql_too_many_rows:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -151,15 +151,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • plpgsql_too_many_rows
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01331.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01331.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::field Class Reference
    \n
\n
\n \n

Reference to a field in a result set. \n More...

\n \n-

#include <field.hxx>

\n+

#include <field.hxx>

\n
\n Inheritance diagram for pqxx::field:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -762,15 +762,15 @@\n \n
\n

You'd expect this to be a size_t, but due to the way reverse iterators are related to regular iterators, it must be allowed to underflow to -1.

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
\n
pqxx::field_streambuf< CHAR, TRAITS > Class Template Reference
\n \n
\n \n-

#include <field.hxx>

\n+

#include <field.hxx>

\n
\n Inheritance diagram for pqxx::field_streambuf< CHAR, TRAITS >:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -419,15 +419,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • field_streambuf
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01339.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01339.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::basic_fieldstream< CHAR, TRAITS > Class Template Reference
    \n
\n
\n \n

Input stream that gets its data from a result field. \n More...

\n \n-

#include <field.hxx>

\n+

#include <field.hxx>

\n
\n Inheritance diagram for pqxx::basic_fieldstream< CHAR, TRAITS >:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -205,15 +205,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • basic_fieldstream
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01343.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01343.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::isolation_traits< LEVEL > Struct Template Reference
    \n
\n
\n \n

Traits class to describe an isolation level; primarly for libpqxx's own use. \n More...

\n \n-

#include <isolation.hxx>

\n+

#include <isolation.hxx>

\n \n \n \n \n \n \n@@ -218,15 +218,15 @@\n \n

\n Public Member Functions

constexpr const char * name () noexcept
 
constexpr const char * name () noexcept
 
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • isolation_traits
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01347.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01347.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::largeobject Class Reference
    \n
\n
\n \n

Identity of a large object. \n More...

\n \n-

#include <largeobject.hxx>

\n+

#include <largeobject.hxx>

\n
\n Inheritance diagram for pqxx::largeobject:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -618,15 +618,15 @@\n \n \n

Referenced by pqxx::largeobjectaccess::to_file().

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01351.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01351.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::largeobjectaccess Class Reference
    \n
\n
\n \n

Accessor for large object's contents. \n More...

\n \n-

#include <largeobject.hxx>

\n+

#include <largeobject.hxx>

\n
\n Inheritance diagram for pqxx::largeobjectaccess:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -1066,15 +1066,15 @@\n \n \n \n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01355.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01355.html", "unified_diff": "@@ -67,15 +67,15 @@\n
    pqxx::largeobject_streambuf< CHAR, TRAITS > Class Template Reference
    \n
\n
\n \n

Streambuf to use large objects in standard I/O streams. \n More...

\n \n-

#include <largeobject.hxx>

\n+

#include <largeobject.hxx>

\n
\n Inheritance diagram for pqxx::largeobject_streambuf< CHAR, TRAITS >:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -539,15 +539,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • largeobject_streambuf
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01359.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01359.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::basic_ilostream< CHAR, TRAITS > Class Template Reference
    \n
\n
\n \n

Input stream that gets its data from a large object. \n More...

\n \n-

#include <largeobject.hxx>

\n+

#include <largeobject.hxx>

\n
\n Inheritance diagram for pqxx::basic_ilostream< CHAR, TRAITS >:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -281,15 +281,15 @@\n \n \n \n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • basic_ilostream
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01363.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01363.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::basic_olostream< CHAR, TRAITS > Class Template Reference
    \n
\n
\n \n

Output stream that writes data back to a large object. \n More...

\n \n-

#include <largeobject.hxx>

\n+

#include <largeobject.hxx>

\n
\n Inheritance diagram for pqxx::basic_olostream< CHAR, TRAITS >:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -302,15 +302,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • basic_olostream
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01367.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01367.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::basic_lostream< CHAR, TRAITS > Class Template Reference
    \n
\n
\n \n

Stream that reads and writes a large object. \n More...

\n \n-

#include <largeobject.hxx>

\n+

#include <largeobject.hxx>

\n
\n Inheritance diagram for pqxx::basic_lostream< CHAR, TRAITS >:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -304,15 +304,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • basic_lostream
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01371.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01371.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::nontransaction Class Reference
    \n
\n
\n \n

Simple \"transaction\" class offering no transactional integrity. \n More...

\n \n-

#include <nontransaction.hxx>

\n+

#include <nontransaction.hxx>

\n
\n Inheritance diagram for pqxx::nontransaction:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -326,15 +326,15 @@\n

See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.

\n \n

References pqxx::transaction_base::End().

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
\n
pqxx::notification_receiver Class Referenceabstract
\n \n
\n \n-

#include <notification.hxx>

\n+

#include <notification.hxx>

\n \n \n \n \n \n \n@@ -294,15 +294,15 @@\n \n

\n Public Member Functions

 notification_receiver (connection_base &c, const std::string &channel)
 Register the receiver with a connection. More...
 
 notification_receiver (const notification_receiver &)=delete
\n
\n \n
\n \n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01379.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01379.html", "unified_diff": "@@ -67,15 +67,15 @@\n
    pqxx::pipeline Class Reference
    \n
\n
\n \n

Processes several queries in FIFO manner, optimized for high throughput. \n More...

\n \n-

#include <pipeline.hxx>

\n+

#include <pipeline.hxx>

\n
\n Inheritance diagram for pqxx::pipeline:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -519,15 +519,15 @@\n \n

Retrieve result for given query.

\n

If the query failed for whatever reason, this will throw an exception. The function will block if the query has not finished yet.

Warning
If results are retrieved out-of-order, i.e. in a different order than the one in which their queries were inserted, errors may \"propagate\" to subsequent queries.
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01387.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01387.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::prepare::invocation Class Reference
    \n
\n
\n \n

Helper class for passing parameters to, and executing, prepared statements. \n More...

\n \n-

#include <prepared_statement.hxx>

\n+

#include <prepared_statement.hxx>

\n
\n Inheritance diagram for pqxx::prepare::invocation:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -431,15 +431,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01391.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01391.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::prepare::internal::prepared_def Struct Reference
    \n
\n
\n \n

Internal representation of a prepared statement definition. \n More...

\n \n-

#include <prepared_statement.hxx>

\n+

#include <prepared_statement.hxx>

\n \n \n \n \n \n \n@@ -172,15 +172,15 @@\n
\n \n

Has this prepared statement been prepared in the current session?

\n \n
\n \n
The documentation for this struct was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01395.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01395.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::result Class Reference
    \n
\n
\n \n

Result set containing data returned by a query or command. \n More...

\n \n-

#include <result.hxx>

\n+

#include <result.hxx>

\n

\n Public Member Functions

 prepared_def ()=default
 
 prepared_def (const std::string &)
 
\n \n \n \n \n \n@@ -1325,16 +1325,16 @@\n \n

\n Public Types

using size_type = result_size_type
 
using difference_type = result_difference_type
 
\n
\n \n
\n \n
The documentation for this class was generated from the following files:\n \n \n \n
\n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01399.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01399.html", "unified_diff": "@@ -66,15 +66,15 @@\n
pqxx::const_result_iterator Class Reference
\n
\n
\n \n

Iterator for rows in a result. Use as result::const_iterator. \n More...

\n \n-

#include <result_iterator.hxx>

\n+

#include <result_iterator.hxx>

\n
\n Inheritance diagram for pqxx::const_result_iterator:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -783,15 +783,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01403.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01403.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::const_reverse_result_iterator Class Reference
    \n
\n
\n \n

Reverse iterator for result. Use as result::const_reverse_iterator. \n More...

\n \n-

#include <result_iterator.hxx>

\n+

#include <result_iterator.hxx>

\n
\n Inheritance diagram for pqxx::const_reverse_result_iterator:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -676,15 +676,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01407.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01407.html", "unified_diff": "@@ -67,15 +67,15 @@\n
    pqxx::internal::basic_robusttransaction Class Referenceabstract
    \n
\n
\n \n

Helper base class for the robusttransaction class template. \n More...

\n \n-

#include <robusttransaction.hxx>

\n+

#include <robusttransaction.hxx>

\n
\n Inheritance diagram for pqxx::internal::basic_robusttransaction:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -367,15 +367,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01411.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01411.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::robusttransaction< ISOLATIONLEVEL > Class Template Reference
    \n
\n
\n \n

Slightly slower, better-fortified version of transaction. \n More...

\n \n-

#include <robusttransaction.hxx>

\n+

#include <robusttransaction.hxx>

\n
\n Inheritance diagram for pqxx::robusttransaction< ISOLATIONLEVEL >:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -398,15 +398,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • robusttransaction
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01415.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01415.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::row Class Reference
    \n
\n
\n \n

Reference to one row in a result. \n More...

\n \n-

#include <row.hxx>

\n+

#include <row.hxx>

\n
\n Inheritance diagram for pqxx::row:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -1394,15 +1394,15 @@\n

Result set of which this is one row.

\n \n

Referenced by pqxx::const_result_iterator::operator+(), and pqxx::const_result_iterator::operator-().

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01419.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01419.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::const_row_iterator Class Reference
    \n
\n
\n \n

Iterator for fields in a row. Use as row::const_iterator. \n More...

\n \n-

#include <row.hxx>

\n+

#include <row.hxx>

\n
\n Inheritance diagram for pqxx::const_row_iterator:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -714,15 +714,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01423.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01423.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::const_reverse_row_iterator Class Reference
    \n
\n
\n \n

Reverse iterator for a row. Use as row::const_reverse_iterator. \n More...

\n \n-

#include <row.hxx>

\n+

#include <row.hxx>

\n
\n Inheritance diagram for pqxx::const_reverse_row_iterator:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -674,15 +674,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01427.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01427.html", "unified_diff": "@@ -66,15 +66,15 @@\n

    Traits class for use in string conversions. \n More...

    \n

    Detailed Description

    \n
    template<typename T, typename = void>
    \n struct pqxx::string_traits< T, typename >

    Traits class for use in string conversions.

    \n

    Specialize this template for a type that you wish to add to_string and from_string support for.

    \n

    The documentation for this struct was generated from the following file:\n
\n \n \n
\n
    \n
  • pqxx
  • string_traits
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01431.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01431.html", "unified_diff": "@@ -67,15 +67,15 @@\n More...

    \n

    Detailed Description

    \n
    template<typename TYPE>
    \n struct pqxx::internal::type_name< TYPE >

    Give a human-readable name for a type, at compile time.

    \n

    Each instantiation contains a static member called value which is the type's name, as a string.

    \n

    This template should not be around for long. C++14's variable templates make it easier (eliminating the cumbersome struct) and C++20's introspection should obviate it completely.

    \n

    The documentation for this struct was generated from the following file:\n
\n \n \n
\n
    \n
  • pqxx
  • internal
  • type_name
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01435.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01435.html", "unified_diff": "@@ -62,15 +62,15 @@\n \n
    pqxx::internal::type_name< char[N]> Struct Template Reference
    \n
\n
\n \n-

#include <strconv.hxx>

\n+

#include <strconv.hxx>

\n \n \n \n \n

\n Static Public Attributes

static constexpr const char * value = "char[]"
 
\n

Member Data Documentation

\n@@ -95,15 +95,15 @@\n \n \n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • internal
  • type_name< char[N]>
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01439.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01439.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::internal::builtin_traits< TYPE > Struct Template Reference
    \n
\n
\n \n

Helper: string traits implementation for built-in types. \n More...

\n \n-

#include <strconv.hxx>

\n+

#include <strconv.hxx>

\n \n \n \n \n \n \n@@ -870,15 +870,15 @@\n \n

\n Public Member Functions

void from_string (const char Str[], short &Obj)
 
std::string to_string (short Obj)
 
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • internal
  • builtin_traits
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01443.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01443.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::enum_traits< ENUM > Struct Template Reference
    \n
\n
\n \n

Helper class for defining enum conversions. \n More...

\n \n-

#include <strconv.hxx>

\n+

#include <strconv.hxx>

\n \n \n \n \n \n \n@@ -249,15 +249,15 @@\n \n

\n Public Types

using underlying_type = typename std::underlying_type< ENUM >::type
 
using underlying_traits = string_traits< underlying_type >
 
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • enum_traits
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01447.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01447.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::string_traits< const char * > Struct Reference
    \n
\n
\n \n

String traits for C-style string (\"pointer to const char\") \n More...

\n \n-

#include <strconv.hxx>

\n+

#include <strconv.hxx>

\n \n \n \n \n \n \n@@ -249,15 +249,15 @@\n \n

\n Static Public Member Functions

static constexpr const char * name () noexcept
 
static constexpr bool has_null () noexcept
 
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • string_traits< const char * >
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01451.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01451.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::string_traits< char * > Struct Reference
    \n
\n
\n \n

String traits for non-const C-style string (\"pointer to char\") \n More...

\n \n-

#include <strconv.hxx>

\n+

#include <strconv.hxx>

\n \n \n \n \n \n \n@@ -211,15 +211,15 @@\n \n

\n Static Public Member Functions

static constexpr const char * name () noexcept
 
static constexpr bool has_null () noexcept
 
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • string_traits< char * >
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01455.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01455.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::string_traits< char[N]> Struct Template Reference
    \n
\n
\n \n

String traits for C-style string constant (\"array of char\") \n More...

\n \n-

#include <strconv.hxx>

\n+

#include <strconv.hxx>

\n \n \n \n \n \n \n@@ -222,15 +222,15 @@\n \n

\n Static Public Member Functions

static constexpr const char * name () noexcept
 
static constexpr bool has_null () noexcept
 
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <strconv.hxx>

\n+

#include <strconv.hxx>

\n \n \n \n \n \n \n@@ -246,15 +246,15 @@\n \n

\n Static Public Member Functions

static constexpr const char * name () noexcept
 
static constexpr bool has_null () noexcept
 
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <strconv.hxx>

\n+

#include <strconv.hxx>

\n \n \n \n \n \n \n@@ -208,15 +208,15 @@\n \n

\n Static Public Member Functions

static constexpr const char * name () noexcept
 
static constexpr bool has_null () noexcept
 
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <strconv.hxx>

\n+

#include <strconv.hxx>

\n \n \n \n \n \n \n@@ -246,15 +246,15 @@\n \n

\n Static Public Member Functions

static constexpr const char * name () noexcept
 
static constexpr bool has_null () noexcept
 
\n
\n \n
\n \n
The documentation for this struct was generated from the following file:\n \n \n \n
\n
\n
pqxx::stream_base Class Referenceabstract
\n \n
\n \n-

#include <stream_base.hxx>

\n+

#include <stream_base.hxx>

\n
\n Inheritance diagram for pqxx::stream_base:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -403,15 +403,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01475.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01475.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::stream_from Class Reference
    \n
\n
\n \n

Efficiently pull data directly out of a table. \n More...

\n \n-

#include <stream_from.hxx>

\n+

#include <stream_from.hxx>

\n
\n Inheritance diagram for pqxx::stream_from:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -366,15 +366,15 @@\n
\n \n

References get_raw_line().

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01479.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01479.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::stream_to Class Reference
    \n
\n
\n \n

Efficiently write data directly to a database table. \n More...

\n \n-

#include <stream_to.hxx>

\n+

#include <stream_to.hxx>

\n
\n Inheritance diagram for pqxx::stream_to:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -401,15 +401,15 @@\n

This can be useful when copying between different databases. If the source and the destination are on the same database, you'll get better performance doing it all in a regular query.

\n \n

References pqxx::stream_from::get_raw_line().

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01483.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01483.html", "unified_diff": "@@ -62,15 +62,15 @@\n \n
    pqxx::internal::TypedCopyEscaper Class Reference
    \n
\n
\n \n-

#include <stream_to.hxx>

\n+

#include <stream_to.hxx>

\n \n \n \n \n \n \n@@ -117,15 +117,15 @@\n
\n \n

References pqxx::internal::escape(), and pqxx::to_string().

\n \n
\n \n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01487.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01487.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::subtransaction Class Reference
    \n
\n
\n \n

\"Transaction\" nested within another transaction \n More...

\n \n-

#include <subtransaction.hxx>

\n+

#include <subtransaction.hxx>

\n
\n Inheritance diagram for pqxx::subtransaction:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -436,15 +436,15 @@\n \n

\n Public Member Functions

template<typename T >
std::string operator() (const T *t) const
 
template<>
\n
\n \n
\n \n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01491.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01491.html", "unified_diff": "@@ -62,15 +62,15 @@\n \n
    pqxx::tablereader Class Reference
    \n
\n
\n \n-

#include <tablereader.hxx>

\n+

#include <tablereader.hxx>

\n
\n Inheritance diagram for pqxx::tablereader:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -464,15 +464,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01495.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01495.html", "unified_diff": "@@ -67,15 +67,15 @@\n
    pqxx::tablestream Class Referenceabstract
    \n
\n
\n \n

Base class for obsolete tablereader/tablewriter classes. \n More...

\n \n-

#include <tablestream.hxx>

\n+

#include <tablestream.hxx>

\n
\n Inheritance diagram for pqxx::tablestream:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -364,15 +364,15 @@\n
\n \n

Referenced by pqxx::tablewriter::generate().

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01499.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01499.html", "unified_diff": "@@ -62,15 +62,15 @@\n \n
    pqxx::tablewriter Class Reference
    \n
\n
\n \n-

#include <tablewriter.hxx>

\n+

#include <tablewriter.hxx>

\n
\n Inheritance diagram for pqxx::tablewriter:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -608,15 +608,15 @@\n
\n \n

Referenced by insert().

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
\n
std::back_insert_iterator< pqxx::tablewriter > Class Reference
\n \n
\n \n-

#include <tablewriter.hxx>

\n+

#include <tablewriter.hxx>

\n \n \n \n \n

\n Public Types

using iterator_category = output_iterator_tag
 
\n \n

\n@@ -228,15 +228,15 @@\n

\n
\n \n
\n \n
The documentation for this class was generated from the following file:\n \n \n \n
\n
\n
\n \n-

#include <tablewriter.hxx>

\n+

#include <tablewriter.hxx>

\n \n \n \n \n \n \n@@ -124,15 +124,15 @@\n
\n \n

References pqxx::internal::escape_any().

\n \n
\n \n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • internal
  • Escaper
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01511.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01511.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::internal::basic_transaction Class Reference
    \n
\n
\n \n

Helper base class for the transaction class template. \n More...

\n \n-

#include <transaction.hxx>

\n+

#include <transaction.hxx>

\n
\n Inheritance diagram for pqxx::internal::basic_transaction:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -316,15 +316,15 @@\n

pqxx::transaction represents a regular database transaction.

\n

Copyright (c) 2000-2019, Jeroen T. Vermeulen.

\n

See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01515.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01515.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::transaction< ISOLATIONLEVEL, READWRITE > Class Template Reference
    \n
\n
\n \n

Standard back-end transaction, templatized on isolation level. \n More...

\n \n-

#include <transaction.hxx>

\n+

#include <transaction.hxx>

\n
\n Inheritance diagram for pqxx::transaction< ISOLATIONLEVEL, READWRITE >:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -284,15 +284,15 @@\n
\n \n

\n Public Member Functions

 Escaper (const std::string &null)
 
std::string operator() (IT i) const
 
 Resources allocated in this transaction that make reactivation impossible. More...
 
\n

Detailed Description

\n
template<isolation_level ISOLATIONLEVEL = read_committed, readwrite_policy READWRITE = read_write>
\n class pqxx::transaction< ISOLATIONLEVEL, READWRITE >

Standard back-end transaction, templatized on isolation level.

\n

This is the type you'll normally want to use to represent a transaction on the database.

\n-

While you may choose to create your own transaction object to interface to the database backend, it is recommended that you wrap your transaction code into a transactor code instead and let the transaction be created for you.

See also
pqxx/transactor.hxx
\n+

While you may choose to create your own transaction object to interface to the database backend, it is recommended that you wrap your transaction code into a transactor code instead and let the transaction be created for you.

See also
pqxx/transactor.hxx
\n

If you should find that using a transactor makes your code less portable or too complex, go ahead, create your own transaction anyway.

\n

Usage example: double all wages

\n
extern connection C;
\n
work T(C);
\n
try
\n
{
\n
T.exec("UPDATE employees SET wage=wage*2");
\n@@ -426,15 +426,15 @@\n
\n \n

References pqxx::transaction_base::End().

\n \n
\n
\n
The documentation for this class was generated from the following file:\n
\n \n \n
\n
\n
pqxx::internal::transactionfocus Class Reference
\n \n
\n \n-

#include <transaction_base.hxx>

\n+

#include <transaction_base.hxx>

\n
\n Inheritance diagram for pqxx::internal::transactionfocus:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -354,15 +354,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01523.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01523.html", "unified_diff": "@@ -65,15 +65,15 @@\n
    pqxx::internal::parameterized_invocation Class Reference
    \n
\n
\n \n

Helper class to construct an invocation of a parameterised statement. \n More...

\n \n-

#include <transaction_base.hxx>

\n+

#include <transaction_base.hxx>

\n
\n Inheritance diagram for pqxx::internal::parameterized_invocation:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -259,15 +259,15 @@\n \n \n
\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
    \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/a01527.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/a01527.html", "unified_diff": "@@ -66,15 +66,15 @@\n
    pqxx::transaction_base Class Referenceabstract
    \n
\n
\n \n

Interface definition (and common code) for \"transaction\" classes. \n More...

\n \n-

#include <transaction_base.hxx>

\n+

#include <transaction_base.hxx>

\n
\n Inheritance diagram for pqxx::transaction_base:
\n
\n
\"Inheritance
\n \n \"\"\n \"\"\n@@ -1839,15 +1839,15 @@\n \n

Resources allocated in this transaction that make reactivation impossible.

\n

This number may be negative!

\n \n
\n
\n
The documentation for this class was generated from the following files:\n \n \n \n
\n
\n
pqxx::transactor< TRANSACTION > Class Template Reference
\n \n
\n \n-

#include <transactor.hxx>

\n+

#include <transactor.hxx>

\n \n \n \n \n

\n Public Types

using argument_type = TRANSACTION
 
\n

\n@@ -279,15 +279,15 @@\n

\n \n \n \n
\n \n
The documentation for this class was generated from the following file:\n \n \n \n
\n
    \n
  • pqxx
  • transactor
  • \n"}, {"source1": "./usr/share/doc/libpqxx-doc/html/Reference/dir_3d7cbfaf9a6edea0a348c9e21a88d076.html", "source2": "./usr/share/doc/libpqxx-doc/html/Reference/dir_3d7cbfaf9a6edea0a348c9e21a88d076.html", "unified_diff": "@@ -76,99 +76,99 @@\n

    \n Directories

    \n directory  doc\n  \n \n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n \n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n \n \n-\n+\n \n

    \n Files

    file  array.hxx [code]
    file  array.hxx [code]
     
    file  basic_connection.hxx [code]
    file  basic_connection.hxx [code]
     
    file  binarystring.hxx [code]
    file  binarystring.hxx [code]
     
    file  compiler-internal-post.hxx [code]
    file  compiler-internal-post.hxx [code]
     
    file  compiler-internal-pre.hxx [code]
    file  compiler-internal-pre.hxx [code]
     
    file  compiler-internal.hxx [code]
    file  compiler-internal.hxx [code]
     
    file  compiler-public.hxx [code]
    file  compiler-public.hxx [code]
     
    file  config-internal-autotools.h [code]
    file  config-internal-autotools.h [code]
     
    file  config-internal-compiler.h [code]
    file  config-internal-compiler.h [code]
     
    file  config-public-compiler.h [code]
    file  config-public-compiler.h [code]
     
    file  config.h [code]
    file  config.h [code]
     
    file  connection.hxx [code]
    file  connection.hxx [code]
     
    file  connection_base.hxx [code]
    file  connection_base.hxx [code]
     
    file  connectionpolicy.hxx [code]
     
    file  cursor.hxx [code]
    file  cursor.hxx [code]
     
    file  dbtransaction.hxx [code]
    file  dbtransaction.hxx [code]
     
    file  errorhandler.hxx [code]
    file  errorhandler.hxx [code]
     
    file  except.hxx [code]
    file  except.hxx [code]
     
    file  field.hxx [code]
    file  field.hxx [code]
     
    file  isolation.hxx [code]
    file  isolation.hxx [code]
     
    file  largeobject.hxx [code]
    file  largeobject.hxx [code]
     
    file  nontransaction.hxx [code]
    file  nontransaction.hxx [code]
     
    file  notification.hxx [code]
    file  notification.hxx [code]
     
    file  pipeline.hxx [code]
    file  pipeline.hxx [code]
     
    file  prepared_statement.hxx [code]
    file  prepared_statement.hxx [code]
     
    file  result.hxx [code]
    file  result.hxx [code]
     
    file  result_iterator.hxx [code]
    file  result_iterator.hxx [code]
     
    file  robusttransaction.hxx [code]
    file  robusttransaction.hxx [code]
     
    file  row.hxx [code]
    file  row.hxx [code]
     
    file  strconv.hxx [code]
    file  strconv.hxx [code]
     
    file  stream_base.hxx [code]
    file  stream_base.hxx [code]
     
    file  stream_from.hxx [code]
    file  stream_from.hxx [code]
     
    file  stream_to.hxx [code]
    file  stream_to.hxx [code]
     
    file  subtransaction.hxx [code]
    file  subtransaction.hxx [code]
     
    file  tablereader.hxx [code]
    file  tablereader.hxx [code]
     
    file  tablestream.hxx [code]
    file  tablestream.hxx [code]
     
    file  tablewriter.hxx [code]
    file  tablewriter.hxx [code]
     
    file  transaction.hxx [code]
    file  transaction.hxx [code]
     
    file  transaction_base.hxx [code]
    file  transaction_base.hxx [code]
     
    file  transactor.hxx [code]
    file  transactor.hxx [code]
     
    file  types.hxx [code]
    file  types.hxx [code]
     
    file  util.hxx [code]
     
    file  version.hxx [code]
    file  version.hxx [code]
     
    \n
\n \n \n
\n
    \n"}]}]}]}]}