--- /srv/reproducible-results/rbuild-debian/r-b-build.BXHsVJq8/b1/libpqxx_6.4.5-2_i386.changes +++ /srv/reproducible-results/rbuild-debian/r-b-build.BXHsVJq8/b2/libpqxx_6.4.5-2_i386.changes ├── Files │ @@ -1,5 +1,5 @@ │ │ 7239bb41f4f19c95136f744d5489e632 2023456 debug optional libpqxx-6.4-dbgsym_6.4.5-2_i386.deb │ add0fd97c67aa4b348a05b08aae7d25a 167900 libs optional libpqxx-6.4_6.4.5-2_i386.deb │ d97f0d8107e4b33e35cb14b960fbfcc1 279432 libdevel optional libpqxx-dev_6.4.5-2_i386.deb │ - 8788044f58368b05c2661d1c60aadc8e 1864372 doc optional libpqxx-doc_6.4.5-2_all.deb │ + b6580e98388834778ed21b0b7770eae8 1863948 doc optional libpqxx-doc_6.4.5-2_all.deb ├── libpqxx-doc_6.4.5-2_all.deb │ ├── file list │ │ @@ -1,3 +1,3 @@ │ │ -rw-r--r-- 0 0 0 4 2019-09-26 12:21:28.000000 debian-binary │ │ --rw-r--r-- 0 0 0 17820 2019-09-26 12:21:28.000000 control.tar.xz │ │ --rw-r--r-- 0 0 0 1846360 2019-09-26 12:21:28.000000 data.tar.xz │ │ +-rw-r--r-- 0 0 0 17932 2019-09-26 12:21:28.000000 control.tar.xz │ │ +-rw-r--r-- 0 0 0 1845824 2019-09-26 12:21:28.000000 data.tar.xz │ ├── control.tar.xz │ │ ├── control.tar │ │ │ ├── ./md5sums │ │ │ │ ├── ./md5sums │ │ │ │ │┄ Files differ │ ├── data.tar.xz │ │ ├── data.tar │ │ │ ├── file list │ │ │ │ @@ -77,57 +77,57 @@ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 2067 2019-06-14 08:20:39.000000 ./usr/share/doc/libpqxx-doc/examples/test92.cxx │ │ │ │ -rw-r--r-- 0 root (0) root (0) 1962 2019-06-14 08:20:39.000000 ./usr/share/doc/libpqxx-doc/examples/test93.cxx │ │ │ │ -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 │ │ │ │ -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 │ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 75 2019-06-14 08:20:39.000000 ./usr/share/doc/libpqxx-doc/html/README.md │ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/ │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33729 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00002_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10935 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00005_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 16855 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00008_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 33579 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00011_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 49299 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00014_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6412 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00017_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12139 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00020_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 84967 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00023_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 15403 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00026_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13643 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00029_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4098 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00032_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13284 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00035_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4464 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00038_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 63410 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00041_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 18616 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00044_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 46628 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00047_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13533 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00050_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 24862 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00053_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 31642 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00056_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 20385 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00059_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10851 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00062_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 76233 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00065_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 64031 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00068_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17940 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00071_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 15413 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00074_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7733 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00002_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 64031 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00005_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 18616 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00008_source.html │ │ │ │ +-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 │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10272 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00014_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 20385 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00017_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13284 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00020_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 3959 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00023_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 92975 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00026_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 89497 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00029_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6695 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00032_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 25872 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00035_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 46628 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00038_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 31642 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00041_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 63410 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00044_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 64763 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00047_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 26731 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00050_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 49299 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00053_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 15403 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00056_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12139 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00059_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4464 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00062_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 84967 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00065_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17797 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00068_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 15413 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00071_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 24862 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00074_source.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 82623 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00077_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4522 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00080_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 89497 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00083_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7733 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00086_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 64763 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00089_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6695 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00092_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 26731 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00095_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 17797 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00098_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 20541 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00101_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 102603 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00104_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10272 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00107_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 25872 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00110_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 21972 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00113_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 92975 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00116_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 13623 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00119_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 45129 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00122_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 19295 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00125_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 3959 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00128_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10851 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00080_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13533 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00083_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33729 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00086_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 16855 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00089_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 76233 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00092_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13623 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00095_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 19295 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00098_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 45129 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00101_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4522 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00104_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 33579 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00107_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6412 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00110_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 102603 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00113_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 13643 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00116_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 20541 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00119_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 21972 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00122_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4098 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00125_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 17940 2019-09-26 12:21:28.000000 ./usr/share/doc/libpqxx-doc/html/Reference/a00128_source.html │ │ │ │ -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 │ │ │ │ -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 │ │ │ │ -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 │ │ │ │ -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 │ │ │ │ -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 │ │ │ │ -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 │ │ │ │ -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 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00002_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: binarystring.hxx Source File │ │ │ │ +libpqxx: compiler-internal.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,148 +55,54 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
binarystring.hxx
│ │ │ │ +
compiler-internal.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
11#ifndef PQXX_H_BINARYSTRING
│ │ │ │ -
12#define PQXX_H_BINARYSTRING
│ │ │ │ +
11#ifndef PQXX_H_COMPILER_INTERNAL
│ │ │ │ +
12#define PQXX_H_COMPILER_INTERNAL
│ │ │ │
13
│ │ │ │ -
14#include "pqxx/compiler-public.hxx"
│ │ │ │ -
15#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
16
│ │ │ │ -
17#include <memory>
│ │ │ │ -
18#include <string>
│ │ │ │ +
14
│ │ │ │ +
15// Workarounds & definitions needed to compile libpqxx into a library
│ │ │ │ +
16#include "pqxx/config-internal-compiler.h"
│ │ │ │ +
17
│ │ │ │ +
18#ifdef _WIN32
│ │ │ │
19
│ │ │ │ -
20#include "pqxx/result.hxx"
│ │ │ │ -
21
│ │ │ │ -
22
│ │ │ │ -
23namespace pqxx
│ │ │ │ -
24{
│ │ │ │ +
20#ifdef PQXX_SHARED
│ │ │ │ +
21#undef PQXX_LIBEXPORT
│ │ │ │ +
22#define PQXX_LIBEXPORT __declspec(dllexport)
│ │ │ │ +
23#define PQXX_PRIVATE __declspec()
│ │ │ │ +
24#endif // PQXX_SHARED
│ │ │ │
25
│ │ │ │ -
27
│ │ │ │ -
53class PQXX_LIBEXPORT binarystring
│ │ │ │ -
54{
│ │ │ │ -
55public:
│ │ │ │ -
56 using char_type = unsigned char;
│ │ │ │ -
57 using value_type = std::char_traits<char_type>::char_type;
│ │ │ │ -
58 using size_type = size_t;
│ │ │ │ -
59 using difference_type = long;
│ │ │ │ -
60 using const_reference = const value_type &;
│ │ │ │ -
61 using const_pointer = const value_type *;
│ │ │ │ - │ │ │ │ -
63 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
│ │ │ │ -
64
│ │ │ │ -
65 binarystring(const binarystring &) =default;
│ │ │ │ -
66
│ │ │ │ -
68
│ │ │ │ -
71 explicit binarystring(const field &); //[t62]
│ │ │ │ -
72
│ │ │ │ -
74 explicit binarystring(const std::string &);
│ │ │ │ -
75
│ │ │ │ -
77 binarystring(const void *, size_t);
│ │ │ │ -
78
│ │ │ │ -
80 size_type size() const noexcept { return m_size; } //[t62]
│ │ │ │ -
82 size_type length() const noexcept { return size(); } //[t62]
│ │ │ │ -
83 bool empty() const noexcept { return size()==0; } //[t62]
│ │ │ │ -
84
│ │ │ │ -
85 const_iterator begin() const noexcept { return data(); } //[t62]
│ │ │ │ -
86 const_iterator cbegin() const noexcept { return begin(); }
│ │ │ │ -
87 const_iterator end() const noexcept { return data()+m_size; } //[t62]
│ │ │ │ -
88 const_iterator cend() const noexcept { return end(); }
│ │ │ │ -
89
│ │ │ │ -
90 const_reference front() const noexcept { return *begin(); } //[t62]
│ │ │ │ -
91 const_reference back() const noexcept //[t62]
│ │ │ │ -
92 { return *(data()+m_size-1); }
│ │ │ │ -
93
│ │ │ │ - │ │ │ │ -
95 { return const_reverse_iterator{end()}; }
│ │ │ │ -
96 const_reverse_iterator crbegin() const { return rbegin(); }
│ │ │ │ - │ │ │ │ -
98 { return const_reverse_iterator{begin()}; }
│ │ │ │ -
99 const_reverse_iterator crend() const { return rend(); }
│ │ │ │ -
100
│ │ │ │ -
102 const value_type *data() const noexcept {return m_buf.get();} //[t62]
│ │ │ │ -
103
│ │ │ │ -
104 const_reference operator[](size_type i) const noexcept //[t62]
│ │ │ │ -
105 { return data()[i]; }
│ │ │ │ -
106
│ │ │ │ -
107 PQXX_PURE bool operator==(const binarystring &) const noexcept; //[t62]
│ │ │ │ -
108 bool operator!=(const binarystring &rhs) const noexcept //[t62]
│ │ │ │ -
109 { return not operator==(rhs); }
│ │ │ │ -
110
│ │ │ │ -
111 binarystring &operator=(const binarystring &);
│ │ │ │ -
112
│ │ │ │ -
114 const_reference at(size_type) const; //[t62]
│ │ │ │ -
115
│ │ │ │ -
117 void swap(binarystring &); //[t62]
│ │ │ │ -
118
│ │ │ │ -
120
│ │ │ │ -
123 const char *get() const noexcept //[t62]
│ │ │ │ -
124 { return reinterpret_cast<const char *>(m_buf.get()); }
│ │ │ │ -
125
│ │ │ │ -
127
│ │ │ │ -
133 std::string str() const; //[t62]
│ │ │ │ -
134
│ │ │ │ -
135private:
│ │ │ │ -
136 using smart_pointer_type = std::shared_ptr<value_type>;
│ │ │ │ -
137
│ │ │ │ -
139 static smart_pointer_type make_smart_pointer(unsigned char *buf=nullptr)
│ │ │ │ -
140 {
│ │ │ │ -
141 return smart_pointer_type{
│ │ │ │ -
142 buf,
│ │ │ │ -
143 internal::freemallocmem_templated<unsigned char>};
│ │ │ │ -
144 }
│ │ │ │ -
145
│ │ │ │ -
146 smart_pointer_type m_buf;
│ │ │ │ -
147 size_type m_size;
│ │ │ │ -
148};
│ │ │ │ -
149}
│ │ │ │ -
150
│ │ │ │ -
151#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
152
│ │ │ │ -
153#endif
│ │ │ │ -
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
│ │ │ │ -
const_reverse_iterator crend() const
Definition: binarystring.hxx:99
│ │ │ │ -
const_reverse_iterator rbegin() const
Definition: binarystring.hxx:94
│ │ │ │ -
const_pointer const_iterator
Definition: binarystring.hxx:62
│ │ │ │ -
const value_type & const_reference
Definition: binarystring.hxx:60
│ │ │ │ -
const value_type * const_pointer
Definition: binarystring.hxx:61
│ │ │ │ -
const_iterator end() const noexcept
Definition: binarystring.hxx:87
│ │ │ │ -
const_iterator begin() const noexcept
Definition: binarystring.hxx:85
│ │ │ │ -
std::char_traits< char_type >::char_type value_type
Definition: binarystring.hxx:57
│ │ │ │ -
long difference_type
Definition: binarystring.hxx:59
│ │ │ │ -
const_reverse_iterator crbegin() const
Definition: binarystring.hxx:96
│ │ │ │ -
const_reference front() const noexcept
Definition: binarystring.hxx:90
│ │ │ │ -
const_reference back() const noexcept
Definition: binarystring.hxx:91
│ │ │ │ -
bool operator!=(const binarystring &rhs) const noexcept
Definition: binarystring.hxx:108
│ │ │ │ -
bool empty() const noexcept
Definition: binarystring.hxx:83
│ │ │ │ -
binarystring(const binarystring &)=default
│ │ │ │ -
const_reference operator[](size_type i) const noexcept
Definition: binarystring.hxx:104
│ │ │ │ -
const_iterator cend() const noexcept
Definition: binarystring.hxx:88
│ │ │ │ -
const_reverse_iterator rend() const
Definition: binarystring.hxx:97
│ │ │ │ -
size_type length() const noexcept
Size of converted string in bytes.
Definition: binarystring.hxx:82
│ │ │ │ -
unsigned char char_type
Definition: binarystring.hxx:56
│ │ │ │ -
size_t size_type
Definition: binarystring.hxx:58
│ │ │ │ -
const value_type * data() const noexcept
Unescaped field contents.
Definition: binarystring.hxx:102
│ │ │ │ -
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: binarystring.hxx:63
│ │ │ │ -
const_iterator cbegin() const noexcept
Definition: binarystring.hxx:86
│ │ │ │ -
const char * get() const noexcept
Raw character buffer (no terminating zero is added)
Definition: binarystring.hxx:123
│ │ │ │ -
size_type size() const noexcept
Size of converted string in bytes.
Definition: binarystring.hxx:80
│ │ │ │ -
Reference to a field in a result set.
Definition: field.hxx:50
│ │ │ │ +
26#ifdef _MSC_VER
│ │ │ │ +
27#pragma warning (disable: 4251 4275 4273)
│ │ │ │ +
28#pragma warning (disable: 4355)
│ │ │ │ +
29#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy().
│ │ │ │ +
30#endif
│ │ │ │ +
31
│ │ │ │ +
32#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_VISIBILITY) // !_WIN32
│ │ │ │ +
33
│ │ │ │ +
34#define PQXX_LIBEXPORT __attribute__ ((visibility("default")))
│ │ │ │ +
35#define PQXX_PRIVATE __attribute__ ((visibility("hidden")))
│ │ │ │ +
36
│ │ │ │ +
37#endif // __GNUC__ && PQXX_HAVE_GCC_VISIBILITY
│ │ │ │ +
38
│ │ │ │ +
39
│ │ │ │ +
40#include "pqxx/compiler-public.hxx"
│ │ │ │ +
41
│ │ │ │ +
42#endif
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,200 +1,46 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -binarystring.hxx │ │ │ │ │ +compiler-internal.hxx │ │ │ │ │ 1 │ │ │ │ │ - 11#ifndef PQXX_H_BINARYSTRING │ │ │ │ │ - 12#define PQXX_H_BINARYSTRING │ │ │ │ │ + 11#ifndef PQXX_H_COMPILER_INTERNAL │ │ │ │ │ + 12#define PQXX_H_COMPILER_INTERNAL │ │ │ │ │ 13 │ │ │ │ │ - 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 15#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 16 │ │ │ │ │ - 17#include │ │ │ │ │ - 18#include │ │ │ │ │ + 14 │ │ │ │ │ + 15// Workarounds & definitions needed to compile libpqxx into a library │ │ │ │ │ + 16#include "pqxx/config-internal-compiler.h" │ │ │ │ │ + 17 │ │ │ │ │ + 18#ifdef _WIN32 │ │ │ │ │ 19 │ │ │ │ │ - 20#include "pqxx/result.hxx" │ │ │ │ │ - 21 │ │ │ │ │ - 22 │ │ │ │ │ - 23namespace pqxx │ │ │ │ │ - 24{ │ │ │ │ │ + 20#ifdef PQXX_SHARED │ │ │ │ │ + 21#undef PQXX_LIBEXPORT │ │ │ │ │ + 22#define PQXX_LIBEXPORT __declspec(dllexport) │ │ │ │ │ + 23#define PQXX_PRIVATE __declspec() │ │ │ │ │ + 24#endif // PQXX_SHARED │ │ │ │ │ 25 │ │ │ │ │ - 27 │ │ │ │ │ -53class PQXX_LIBEXPORT binarystring │ │ │ │ │ - 54{ │ │ │ │ │ - 55public: │ │ │ │ │ -56 using char_type = unsigned char; │ │ │ │ │ -57 using value_type = std::char_traits::char_type; │ │ │ │ │ -58 using size_type = size_t; │ │ │ │ │ -59 using difference_type = long; │ │ │ │ │ -60 using const_reference = const value_type &; │ │ │ │ │ -61 using const_pointer = const value_type *; │ │ │ │ │ -62 using const_iterator = const_pointer; │ │ │ │ │ -63 using const_reverse_iterator = std::reverse_iterator; │ │ │ │ │ - 64 │ │ │ │ │ -65 binarystring(const binarystring &) =default; │ │ │ │ │ - 66 │ │ │ │ │ - 68 │ │ │ │ │ - 71 explicit binarystring(const field &); //[t62] │ │ │ │ │ - 72 │ │ │ │ │ - 74 explicit binarystring(const std::string &); │ │ │ │ │ - 75 │ │ │ │ │ - 77 binarystring(const void *, size_t); │ │ │ │ │ - 78 │ │ │ │ │ -80 size_type size() const noexcept { return m_size; } //[t62] │ │ │ │ │ -82 size_type length() const noexcept { return size(); } //[t62] │ │ │ │ │ -83 bool empty() const noexcept { return size()==0; } //[t62] │ │ │ │ │ - 84 │ │ │ │ │ -85 const_iterator begin() const noexcept { return data(); } //[t62] │ │ │ │ │ -86 const_iterator cbegin() const noexcept { return begin(); } │ │ │ │ │ -87 const_iterator end() const noexcept { return data()+m_size; } //[t62] │ │ │ │ │ -88 const_iterator cend() const noexcept { return end(); } │ │ │ │ │ - 89 │ │ │ │ │ -90 const_reference front() const noexcept { return *begin(); } //[t62] │ │ │ │ │ -91 const_reference back() const noexcept //[t62] │ │ │ │ │ - 92 { return *(data()+m_size-1); } │ │ │ │ │ - 93 │ │ │ │ │ -94 const_reverse_iterator rbegin() const //[t62] │ │ │ │ │ - 95 { return const_reverse_iterator{end()}; } │ │ │ │ │ -96 const_reverse_iterator crbegin() const { return rbegin(); } │ │ │ │ │ -97 const_reverse_iterator rend() const //[t62] │ │ │ │ │ - 98 { return const_reverse_iterator{begin()}; } │ │ │ │ │ -99 const_reverse_iterator crend() const { return rend(); } │ │ │ │ │ - 100 │ │ │ │ │ -102 const value_type *data() const noexcept {return m_buf.get();} //[t62] │ │ │ │ │ - 103 │ │ │ │ │ -104 const_reference operator[](size_type i) const noexcept //[t62] │ │ │ │ │ - 105 { return data()[i]; } │ │ │ │ │ - 106 │ │ │ │ │ - 107 PQXX_PURE bool operator==(const binarystring &) const noexcept; //[t62] │ │ │ │ │ -108 bool operator!=(const binarystring &rhs) const noexcept //[t62] │ │ │ │ │ - 109 { return not operator==(rhs); } │ │ │ │ │ - 110 │ │ │ │ │ - 111 binarystring &operator=(const binarystring &); │ │ │ │ │ - 112 │ │ │ │ │ - 114 const_reference at(size_type) const; //[t62] │ │ │ │ │ - 115 │ │ │ │ │ - 117 void swap(binarystring &); //[t62] │ │ │ │ │ - 118 │ │ │ │ │ - 120 │ │ │ │ │ -123 const char *get() const noexcept //[t62] │ │ │ │ │ - 124 { return reinterpret_cast(m_buf.get()); } │ │ │ │ │ - 125 │ │ │ │ │ - 127 │ │ │ │ │ - 133 std::string str() const; //[t62] │ │ │ │ │ - 134 │ │ │ │ │ - 135private: │ │ │ │ │ - 136 using smart_pointer_type = std::shared_ptr; │ │ │ │ │ - 137 │ │ │ │ │ - 139 static smart_pointer_type make_smart_pointer(unsigned char *buf=nullptr) │ │ │ │ │ - 140 { │ │ │ │ │ - 141 return smart_pointer_type{ │ │ │ │ │ - 142 buf, │ │ │ │ │ - 143 internal::freemallocmem_templated}; │ │ │ │ │ - 144 } │ │ │ │ │ - 145 │ │ │ │ │ - 146 smart_pointer_type m_buf; │ │ │ │ │ - 147 size_type m_size; │ │ │ │ │ - 148}; │ │ │ │ │ - 149} │ │ │ │ │ - 150 │ │ │ │ │ - 151#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 152 │ │ │ │ │ - 153#endif │ │ │ │ │ -pqxx │ │ │ │ │ -The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ -Definition: array.hxx:26 │ │ │ │ │ -pqxx::binarystring │ │ │ │ │ -Binary data corresponding to PostgreSQL's "BYTEA" binary-string type. │ │ │ │ │ -Definition: binarystring.hxx:54 │ │ │ │ │ -pqxx::binarystring::crend │ │ │ │ │ -const_reverse_iterator crend() const │ │ │ │ │ -Definition: binarystring.hxx:99 │ │ │ │ │ -pqxx::binarystring::rbegin │ │ │ │ │ -const_reverse_iterator rbegin() const │ │ │ │ │ -Definition: binarystring.hxx:94 │ │ │ │ │ -pqxx::binarystring::const_iterator │ │ │ │ │ -const_pointer const_iterator │ │ │ │ │ -Definition: binarystring.hxx:62 │ │ │ │ │ -pqxx::binarystring::const_reference │ │ │ │ │ -const value_type & const_reference │ │ │ │ │ -Definition: binarystring.hxx:60 │ │ │ │ │ -pqxx::binarystring::const_pointer │ │ │ │ │ -const value_type * const_pointer │ │ │ │ │ -Definition: binarystring.hxx:61 │ │ │ │ │ -pqxx::binarystring::end │ │ │ │ │ -const_iterator end() const noexcept │ │ │ │ │ -Definition: binarystring.hxx:87 │ │ │ │ │ -pqxx::binarystring::begin │ │ │ │ │ -const_iterator begin() const noexcept │ │ │ │ │ -Definition: binarystring.hxx:85 │ │ │ │ │ -pqxx::binarystring::value_type │ │ │ │ │ -std::char_traits< char_type >::char_type value_type │ │ │ │ │ -Definition: binarystring.hxx:57 │ │ │ │ │ -pqxx::binarystring::difference_type │ │ │ │ │ -long difference_type │ │ │ │ │ -Definition: binarystring.hxx:59 │ │ │ │ │ -pqxx::binarystring::crbegin │ │ │ │ │ -const_reverse_iterator crbegin() const │ │ │ │ │ -Definition: binarystring.hxx:96 │ │ │ │ │ -pqxx::binarystring::front │ │ │ │ │ -const_reference front() const noexcept │ │ │ │ │ -Definition: binarystring.hxx:90 │ │ │ │ │ -pqxx::binarystring::back │ │ │ │ │ -const_reference back() const noexcept │ │ │ │ │ -Definition: binarystring.hxx:91 │ │ │ │ │ -pqxx::binarystring::operator!= │ │ │ │ │ -bool operator!=(const binarystring &rhs) const noexcept │ │ │ │ │ -Definition: binarystring.hxx:108 │ │ │ │ │ -pqxx::binarystring::empty │ │ │ │ │ -bool empty() const noexcept │ │ │ │ │ -Definition: binarystring.hxx:83 │ │ │ │ │ -pqxx::binarystring::binarystring │ │ │ │ │ -binarystring(const binarystring &)=default │ │ │ │ │ -pqxx::binarystring::operator[] │ │ │ │ │ -const_reference operator[](size_type i) const noexcept │ │ │ │ │ -Definition: binarystring.hxx:104 │ │ │ │ │ -pqxx::binarystring::cend │ │ │ │ │ -const_iterator cend() const noexcept │ │ │ │ │ -Definition: binarystring.hxx:88 │ │ │ │ │ -pqxx::binarystring::rend │ │ │ │ │ -const_reverse_iterator rend() const │ │ │ │ │ -Definition: binarystring.hxx:97 │ │ │ │ │ -pqxx::binarystring::length │ │ │ │ │ -size_type length() const noexcept │ │ │ │ │ -Size of converted string in bytes. │ │ │ │ │ -Definition: binarystring.hxx:82 │ │ │ │ │ -pqxx::binarystring::char_type │ │ │ │ │ -unsigned char char_type │ │ │ │ │ -Definition: binarystring.hxx:56 │ │ │ │ │ -pqxx::binarystring::size_type │ │ │ │ │ -size_t size_type │ │ │ │ │ -Definition: binarystring.hxx:58 │ │ │ │ │ -pqxx::binarystring::data │ │ │ │ │ -const value_type * data() const noexcept │ │ │ │ │ -Unescaped field contents. │ │ │ │ │ -Definition: binarystring.hxx:102 │ │ │ │ │ -pqxx::binarystring::const_reverse_iterator │ │ │ │ │ -std::reverse_iterator< const_iterator > const_reverse_iterator │ │ │ │ │ -Definition: binarystring.hxx:63 │ │ │ │ │ -pqxx::binarystring::cbegin │ │ │ │ │ -const_iterator cbegin() const noexcept │ │ │ │ │ -Definition: binarystring.hxx:86 │ │ │ │ │ -pqxx::binarystring::get │ │ │ │ │ -const char * get() const noexcept │ │ │ │ │ -Raw character buffer (no terminating zero is added) │ │ │ │ │ -Definition: binarystring.hxx:123 │ │ │ │ │ -pqxx::binarystring::size │ │ │ │ │ -size_type size() const noexcept │ │ │ │ │ -Size of converted string in bytes. │ │ │ │ │ -Definition: binarystring.hxx:80 │ │ │ │ │ -pqxx::field │ │ │ │ │ -Reference to a field in a result set. │ │ │ │ │ -Definition: field.hxx:50 │ │ │ │ │ + 26#ifdef _MSC_VER │ │ │ │ │ + 27#pragma warning (disable: 4251 4275 4273) │ │ │ │ │ + 28#pragma warning (disable: 4355) │ │ │ │ │ + 29#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy │ │ │ │ │ +(). │ │ │ │ │ + 30#endif │ │ │ │ │ + 31 │ │ │ │ │ + 32#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_VISIBILITY) // !_WIN32 │ │ │ │ │ + 33 │ │ │ │ │ + 34#define PQXX_LIBEXPORT __attribute__ ((visibility("default"))) │ │ │ │ │ + 35#define PQXX_PRIVATE __attribute__ ((visibility("hidden"))) │ │ │ │ │ + 36 │ │ │ │ │ + 37#endif // __GNUC__ && PQXX_HAVE_GCC_VISIBILITY │ │ │ │ │ + 38 │ │ │ │ │ + 39 │ │ │ │ │ + 40#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 41 │ │ │ │ │ + 42#endif │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * binarystring.hxx │ │ │ │ │ + * compiler-internal.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00005_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: subtransaction.hxx Source File │ │ │ │ +libpqxx: field.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,69 +55,314 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
subtransaction.hxx
│ │ │ │ +
field.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_SUBTRANSACTION
│ │ │ │ -
14#define PQXX_H_SUBTRANSACTION
│ │ │ │ +
13#ifndef PQXX_H_FIELD
│ │ │ │ +
14#define PQXX_H_FIELD
│ │ │ │
15
│ │ │ │
16#include "pqxx/compiler-public.hxx"
│ │ │ │
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include "pqxx/dbtransaction.hxx"
│ │ │ │ -
20
│ │ │ │ -
21
│ │ │ │ -
22/* Methods tested in eg. self-test program test1 are marked with "//[t01]"
│ │ │ │ -
23 */
│ │ │ │ -
24
│ │ │ │ -
25
│ │ │ │ -
26namespace pqxx
│ │ │ │ -
27{
│ │ │ │ -
28
│ │ │ │ -
33
│ │ │ │ -
79class PQXX_LIBEXPORT subtransaction :
│ │ │ │ - │ │ │ │ -
81 public dbtransaction
│ │ │ │ -
82{
│ │ │ │ -
83public:
│ │ │ │ -
85 explicit subtransaction( //[t88]
│ │ │ │ -
86 dbtransaction &T, const std::string &Name=std::string{});
│ │ │ │ -
87
│ │ │ │ -
89 explicit subtransaction(
│ │ │ │ -
90 subtransaction &T, const std::string &Name=std::string{});
│ │ │ │ -
91
│ │ │ │ -
92 virtual ~subtransaction() noexcept
│ │ │ │ -
93 { End(); }
│ │ │ │ -
94
│ │ │ │ -
95private:
│ │ │ │ -
96 virtual void do_begin() override; //[t88]
│ │ │ │ -
97 virtual void do_commit() override; //[t88]
│ │ │ │ -
98 virtual void do_abort() override; //[t88]
│ │ │ │ -
99
│ │ │ │ -
100 dbtransaction &m_parent;
│ │ │ │ -
101};
│ │ │ │ -
102}
│ │ │ │ +
18#include "pqxx/internal/type_utils.hxx"
│ │ │ │ +
19
│ │ │ │ +
20#if defined(PQXX_HAVE_OPTIONAL)
│ │ │ │ +
21#include <optional>
│ │ │ │ +
22
│ │ │ │ +
23/* Use std::experimental::optional as a fallback for std::optional, if
│ │ │ │ +
24 * present.
│ │ │ │ +
25 *
│ │ │ │ +
26 * This may break compilation for some software, if using a libpqxx that was
│ │ │ │ +
27 * configured for a different language version. To stop libpqxx headers from
│ │ │ │ +
28 * using or supporting std::experimental::optional, define a macro
│ │ │ │ +
29 * PQXX_HIDE_EXP_OPTIONAL when building your software.
│ │ │ │ +
30 */
│ │ │ │ +
31#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)
│ │ │ │ +
32#include <experimental/optional>
│ │ │ │ +
33#endif
│ │ │ │ +
34
│ │ │ │ +
35#include "pqxx/array.hxx"
│ │ │ │ +
36#include "pqxx/result.hxx"
│ │ │ │ +
37#include "pqxx/strconv.hxx"
│ │ │ │ +
38#include "pqxx/types.hxx"
│ │ │ │ +
39
│ │ │ │ +
40
│ │ │ │ +
41// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ +
42
│ │ │ │ +
43namespace pqxx
│ │ │ │ +
44{
│ │ │ │ +
46
│ │ │ │ +
49class PQXX_LIBEXPORT field
│ │ │ │ +
50{
│ │ │ │ +
51public:
│ │ │ │ + │ │ │ │ +
53
│ │ │ │ +
55
│ │ │ │ +
59 field(const row &R, row_size_type C) noexcept; //[t01]
│ │ │ │ +
60
│ │ │ │ +
66
│ │ │ │ +
82 bool operator==(const field &) const; //[t75]
│ │ │ │ +
83
│ │ │ │ +
85
│ │ │ │ +
87 bool operator!=(const field &rhs) const //[t82]
│ │ │ │ +
88 {return not operator==(rhs);}
│ │ │ │ +
90
│ │ │ │ +
96 const char *name() const; //[t11]
│ │ │ │ +
97
│ │ │ │ +
99 oid type() const; //[t07]
│ │ │ │ +
100
│ │ │ │ +
102 oid table() const; //[t02]
│ │ │ │
103
│ │ │ │ -
104#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
105#endif
│ │ │ │ +
104 row_size_type num() const { return col(); } //[t82]
│ │ │ │ +
105
│ │ │ │ +
107 row_size_type table_column() const; //[t93]
│ │ │ │ +
109
│ │ │ │ +
115
│ │ │ │ +
120 const char *c_str() const; //[t02]
│ │ │ │ +
121
│ │ │ │ +
123 bool is_null() const noexcept; //[t12]
│ │ │ │ +
124
│ │ │ │ +
126
│ │ │ │ +
129 size_type size() const noexcept; //[t11]
│ │ │ │ +
130
│ │ │ │ +
132
│ │ │ │ +
135 template<typename T> auto to(T &Obj) const //[t03]
│ │ │ │ +
136 -> typename std::enable_if<(
│ │ │ │ +
137 not std::is_pointer<T>::value
│ │ │ │ +
138 or std::is_same<T, const char*>::value
│ │ │ │ +
139 ), bool>::type
│ │ │ │ +
140 {
│ │ │ │ +
141 const char *const bytes = c_str();
│ │ │ │ +
142 if (bytes[0] == '\0' and is_null()) return false;
│ │ │ │ +
143 from_string(bytes, Obj);
│ │ │ │ +
144 return true;
│ │ │ │ +
145 }
│ │ │ │ +
146
│ │ │ │ +
148 template<typename T> bool operator>>(T &Obj) const //[t07]
│ │ │ │ +
149 { return to(Obj); }
│ │ │ │ +
150
│ │ │ │ +
152
│ │ │ │ +
155 template<typename T> auto to(T &Obj, const T &Default) const //[t12]
│ │ │ │ +
156 -> typename std::enable_if<(
│ │ │ │ +
157 not std::is_pointer<T>::value
│ │ │ │ +
158 or std::is_same<T, const char*>::value
│ │ │ │ +
159 ), bool>::type
│ │ │ │ +
160 {
│ │ │ │ +
161 const bool NotNull = to(Obj);
│ │ │ │ +
162 if (not NotNull) Obj = Default;
│ │ │ │ +
163 return NotNull;
│ │ │ │ +
164 }
│ │ │ │ +
165
│ │ │ │ +
167
│ │ │ │ +
170 template<typename T> T as(const T &Default) const //[t01]
│ │ │ │ +
171 {
│ │ │ │ +
172 T Obj;
│ │ │ │ +
173 to(Obj, Default);
│ │ │ │ +
174 return Obj;
│ │ │ │ +
175 }
│ │ │ │ +
176
│ │ │ │ +
178
│ │ │ │ +
183 template<typename T> T as() const //[t45]
│ │ │ │ +
184 {
│ │ │ │ +
185 T Obj;
│ │ │ │ +
186 if (not to(Obj)) Obj = string_traits<T>::null();
│ │ │ │ +
187 return Obj;
│ │ │ │ +
188 }
│ │ │ │ +
189
│ │ │ │ +
191
│ │ │ │ +
195 template<typename T, template<typename> class O
│ │ │ │ +
196#if defined(PQXX_HAVE_OPTIONAL)
│ │ │ │ +
197 = std::optional
│ │ │ │ +
198#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)
│ │ │ │ +
199 = std::experimental::optional
│ │ │ │ +
200#endif
│ │ │ │ +
201 > constexpr O<T> get() const { return as<O<T>>(); }
│ │ │ │ +
202
│ │ │ │ +
204
│ │ │ │ + │ │ │ │ +
211 { return array_parser{c_str(), m_home.m_encoding}; }
│ │ │ │ +
213
│ │ │ │ +
214
│ │ │ │ +
215protected:
│ │ │ │ +
216 const result &home() const noexcept { return m_home; }
│ │ │ │ +
217 size_t idx() const noexcept { return m_row; }
│ │ │ │ +
218 row_size_type col() const noexcept { return row_size_type(m_col); }
│ │ │ │ +
219
│ │ │ │ +
224 long m_col;
│ │ │ │ +
225
│ │ │ │ +
226private:
│ │ │ │ +
227 result m_home;
│ │ │ │ +
228 size_t m_row;
│ │ │ │ +
229};
│ │ │ │ +
230
│ │ │ │ +
231
│ │ │ │ +
233template<>
│ │ │ │ +
234inline bool field::to<std::string>(std::string &Obj) const
│ │ │ │ +
235{
│ │ │ │ +
236 const char *const bytes = c_str();
│ │ │ │ +
237 if (bytes[0] == '\0' and is_null()) return false;
│ │ │ │ +
238 Obj = std::string{bytes, size()};
│ │ │ │ +
239 return true;
│ │ │ │ +
240}
│ │ │ │ +
241
│ │ │ │ +
243
│ │ │ │ +
248template<>
│ │ │ │ +
249inline bool field::to<const char *>(const char *&Obj) const
│ │ │ │ +
250{
│ │ │ │ +
251 if (is_null()) return false;
│ │ │ │ +
252 Obj = c_str();
│ │ │ │ +
253 return true;
│ │ │ │ +
254}
│ │ │ │ +
255
│ │ │ │ +
256
│ │ │ │ +
257template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ + │ │ │ │ +
259 public std::basic_streambuf<CHAR, TRAITS>
│ │ │ │ +
260{
│ │ │ │ +
261public:
│ │ │ │ +
262 using char_type = CHAR;
│ │ │ │ +
263 using traits_type = TRAITS;
│ │ │ │ +
264 using int_type = typename traits_type::int_type;
│ │ │ │ +
265 using pos_type = typename traits_type::pos_type;
│ │ │ │ +
266 using off_type = typename traits_type::off_type;
│ │ │ │ +
267 using openmode = std::ios::openmode;
│ │ │ │ +
268 using seekdir = std::ios::seekdir;
│ │ │ │ +
269
│ │ │ │ +
270 explicit field_streambuf(const field &F) : //[t74]
│ │ │ │ +
271 m_field{F}
│ │ │ │ +
272 {
│ │ │ │ +
273 initialize();
│ │ │ │ +
274 }
│ │ │ │ +
275
│ │ │ │ +
276protected:
│ │ │ │ +
277 virtual int sync() override { return traits_type::eof(); }
│ │ │ │ +
278
│ │ │ │ +
279protected:
│ │ │ │ + │ │ │ │ +
281 { return traits_type::eof(); }
│ │ │ │ + │ │ │ │ +
283 {return traits_type::eof();}
│ │ │ │ +
284 virtual int_type overflow(int_type) override
│ │ │ │ +
285 { return traits_type::eof(); }
│ │ │ │ +
286 virtual int_type underflow() override
│ │ │ │ +
287 { return traits_type::eof(); }
│ │ │ │ +
288
│ │ │ │ +
289private:
│ │ │ │ +
290 const field &m_field;
│ │ │ │ +
291
│ │ │ │ +
292 int_type initialize()
│ │ │ │ +
293 {
│ │ │ │ +
294 char_type *G =
│ │ │ │ +
295 reinterpret_cast<char_type *>(const_cast<char *>(m_field.c_str()));
│ │ │ │ +
296 this->setg(G, G, G + m_field.size());
│ │ │ │ +
297 return int_type(m_field.size());
│ │ │ │ +
298 }
│ │ │ │ +
299};
│ │ │ │ +
300
│ │ │ │ +
301
│ │ │ │ +
303
│ │ │ │ +
311template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ + │ │ │ │ +
313 public std::basic_istream<CHAR, TRAITS>
│ │ │ │ +
314{
│ │ │ │ +
315 using super = std::basic_istream<CHAR, TRAITS>;
│ │ │ │ +
316
│ │ │ │ +
317public:
│ │ │ │ +
318 using char_type = CHAR;
│ │ │ │ +
319 using traits_type = TRAITS;
│ │ │ │ +
320 using int_type = typename traits_type::int_type;
│ │ │ │ +
321 using pos_type = typename traits_type::pos_type;
│ │ │ │ +
322 using off_type = typename traits_type::off_type;
│ │ │ │ +
323
│ │ │ │ +
324 basic_fieldstream(const field &F) : super{nullptr}, m_buf{F}
│ │ │ │ +
325 { super::init(&m_buf); }
│ │ │ │ +
326
│ │ │ │ +
327private:
│ │ │ │ + │ │ │ │ +
329};
│ │ │ │ +
330
│ │ │ │ + │ │ │ │ +
332
│ │ │ │ +
334
│ │ │ │ +
354template<typename CHAR>
│ │ │ │ +
355inline std::basic_ostream<CHAR> &operator<<(
│ │ │ │ +
356 std::basic_ostream<CHAR> &S, const field &F) //[t46]
│ │ │ │ +
357{
│ │ │ │ +
358 S.write(F.c_str(), std::streamsize(F.size()));
│ │ │ │ +
359 return S;
│ │ │ │ +
360}
│ │ │ │ +
361
│ │ │ │ +
362
│ │ │ │ +
364template<typename T>
│ │ │ │ +
365inline void from_string(const field &F, T &Obj) //[t46]
│ │ │ │ +
366 { from_string(F.c_str(), Obj, F.size()); }
│ │ │ │ +
367
│ │ │ │ +
369template<> PQXX_LIBEXPORT std::string to_string(const field &Obj); //[t74]
│ │ │ │ +
370
│ │ │ │ +
371} // namespace pqxx
│ │ │ │ +
372#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
373#endif
│ │ │ │ +
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ -
"Transaction" nested within another transaction
Definition: subtransaction.hxx:82
│ │ │ │ -
virtual ~subtransaction() noexcept
Definition: subtransaction.hxx:92
│ │ │ │ -
Definition: transaction_base.hxx:44
│ │ │ │ +
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
│ │ │ │ +
void from_string(const field &F, T &Obj)
Convert a field's string contents to another type.
Definition: field.hxx:365
│ │ │ │ +
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
│ │ │ │ +
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
│ │ │ │ +
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
│ │ │ │ +
Low-level array parser.
Definition: array.hxx:47
│ │ │ │ +
Reference to a field in a result set.
Definition: field.hxx:50
│ │ │ │ +
row_size_type num() const
Definition: field.hxx:104
│ │ │ │ +
row_size_type col() const noexcept
Definition: field.hxx:218
│ │ │ │ +
size_type size() const noexcept
Return number of bytes taken up by the field's value.
Definition: field.cxx:74
│ │ │ │ +
long m_col
Definition: field.hxx:224
│ │ │ │ +
T as(const T &Default) const
Return value as object of given type, or Default if null.
Definition: field.hxx:170
│ │ │ │ +
field_size_type size_type
Definition: field.hxx:52
│ │ │ │ +
bool operator>>(T &Obj) const
Read value into Obj; or leave Obj untouched and return false if null.
Definition: field.hxx:148
│ │ │ │ +
array_parser as_array() const
Parse the field as an SQL array.
Definition: field.hxx:210
│ │ │ │ +
const result & home() const noexcept
Definition: field.hxx:216
│ │ │ │ +
T as() const
Return value as object of given type, or throw exception if null.
Definition: field.hxx:183
│ │ │ │ +
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
│ │ │ │ +
const char * c_str() const
Read as plain C string.
Definition: field.cxx:62
│ │ │ │ +
bool is_null() const noexcept
Is this field's value null?
Definition: field.cxx:68
│ │ │ │ +
constexpr O< T > get() const
Return value wrapped in some optional type (empty for nulls)
Definition: field.hxx:201
│ │ │ │ +
size_t idx() const noexcept
Definition: field.hxx:217
│ │ │ │ +
bool operator!=(const field &rhs) const
Byte-by-byte comparison (all nulls are considered equal)
Definition: field.hxx:87
│ │ │ │ +
Definition: field.hxx:260
│ │ │ │ +
TRAITS traits_type
Definition: field.hxx:263
│ │ │ │ +
typename traits_type::off_type off_type
Definition: field.hxx:266
│ │ │ │ +
virtual pos_type seekoff(off_type, seekdir, openmode) override
Definition: field.hxx:280
│ │ │ │ +
virtual pos_type seekpos(pos_type, openmode) override
Definition: field.hxx:282
│ │ │ │ +
std::ios::openmode openmode
Definition: field.hxx:267
│ │ │ │ +
virtual int_type overflow(int_type) override
Definition: field.hxx:284
│ │ │ │ +
field_streambuf(const field &F)
Definition: field.hxx:270
│ │ │ │ +
typename traits_type::pos_type pos_type
Definition: field.hxx:265
│ │ │ │ +
virtual int sync() override
Definition: field.hxx:277
│ │ │ │ +
typename traits_type::int_type int_type
Definition: field.hxx:264
│ │ │ │ +
virtual int_type underflow() override
Definition: field.hxx:286
│ │ │ │ +
CHAR char_type
Definition: field.hxx:262
│ │ │ │ +
std::ios::seekdir seekdir
Definition: field.hxx:268
│ │ │ │ +
Input stream that gets its data from a result field.
Definition: field.hxx:314
│ │ │ │ +
TRAITS traits_type
Definition: field.hxx:319
│ │ │ │ +
basic_fieldstream(const field &F)
Definition: field.hxx:324
│ │ │ │ +
typename traits_type::pos_type pos_type
Definition: field.hxx:321
│ │ │ │ +
typename traits_type::off_type off_type
Definition: field.hxx:322
│ │ │ │ +
typename traits_type::int_type int_type
Definition: field.hxx:320
│ │ │ │ +
CHAR char_type
Definition: field.hxx:318
│ │ │ │ +
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ +
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │ +
Traits class for use in string conversions.
Definition: strconv.hxx:51
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,69 +1,418 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -subtransaction.hxx │ │ │ │ │ +field.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_SUBTRANSACTION │ │ │ │ │ - 14#define PQXX_H_SUBTRANSACTION │ │ │ │ │ + 13#ifndef PQXX_H_FIELD │ │ │ │ │ + 14#define PQXX_H_FIELD │ │ │ │ │ 15 │ │ │ │ │ 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include "pqxx/dbtransaction.hxx" │ │ │ │ │ - 20 │ │ │ │ │ - 21 │ │ │ │ │ - 22/* Methods tested in eg. self-test program test1 are marked with "//[t01]" │ │ │ │ │ - 23 */ │ │ │ │ │ - 24 │ │ │ │ │ - 25 │ │ │ │ │ - 26namespace pqxx │ │ │ │ │ - 27{ │ │ │ │ │ - 28 │ │ │ │ │ - 33 │ │ │ │ │ -79class PQXX_LIBEXPORT subtransaction : │ │ │ │ │ - 80 public internal::transactionfocus, │ │ │ │ │ - 81 public dbtransaction │ │ │ │ │ - 82{ │ │ │ │ │ - 83public: │ │ │ │ │ - 85 explicit subtransaction( //[t88] │ │ │ │ │ - 86 dbtransaction &T, const std::string &Name=std::string{}); │ │ │ │ │ - 87 │ │ │ │ │ - 89 explicit subtransaction( │ │ │ │ │ - 90 subtransaction &T, const std::string &Name=std::string{}); │ │ │ │ │ - 91 │ │ │ │ │ -92 virtual ~subtransaction() noexcept │ │ │ │ │ - 93 { End(); } │ │ │ │ │ - 94 │ │ │ │ │ - 95private: │ │ │ │ │ - 96 virtual void do_begin() override; //[t88] │ │ │ │ │ - 97 virtual void do_commit() override; //[t88] │ │ │ │ │ - 98 virtual void do_abort() override; //[t88] │ │ │ │ │ - 99 │ │ │ │ │ - 100 dbtransaction &m_parent; │ │ │ │ │ - 101}; │ │ │ │ │ - 102} │ │ │ │ │ + 18#include "pqxx/internal/type_utils.hxx" │ │ │ │ │ + 19 │ │ │ │ │ + 20#if defined(PQXX_HAVE_OPTIONAL) │ │ │ │ │ + 21#include │ │ │ │ │ + 22 │ │ │ │ │ + 23/* Use std::experimental::optional as a fallback for std::optional, if │ │ │ │ │ + 24 * present. │ │ │ │ │ + 25 * │ │ │ │ │ + 26 * This may break compilation for some software, if using a libpqxx that was │ │ │ │ │ + 27 * configured for a different language version. To stop libpqxx headers from │ │ │ │ │ + 28 * using or supporting std::experimental::optional, define a macro │ │ │ │ │ + 29 * PQXX_HIDE_EXP_OPTIONAL when building your software. │ │ │ │ │ + 30 */ │ │ │ │ │ + 31#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL) │ │ │ │ │ + 32#include │ │ │ │ │ + 33#endif │ │ │ │ │ + 34 │ │ │ │ │ + 35#include "pqxx/array.hxx" │ │ │ │ │ + 36#include "pqxx/result.hxx" │ │ │ │ │ + 37#include "pqxx/strconv.hxx" │ │ │ │ │ + 38#include "pqxx/types.hxx" │ │ │ │ │ + 39 │ │ │ │ │ + 40 │ │ │ │ │ + 41// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ + 42 │ │ │ │ │ + 43namespace pqxx │ │ │ │ │ + 44{ │ │ │ │ │ + 46 │ │ │ │ │ +49class PQXX_LIBEXPORT field │ │ │ │ │ + 50{ │ │ │ │ │ + 51public: │ │ │ │ │ +52 using size_type = field_size_type; │ │ │ │ │ + 53 │ │ │ │ │ + 55 │ │ │ │ │ + 59 field(const row &R, row_size_type C) noexcept; //[t01] │ │ │ │ │ + 60 │ │ │ │ │ + 66 │ │ │ │ │ + 82 bool operator==(const field &) const; //[t75] │ │ │ │ │ + 83 │ │ │ │ │ + 85 │ │ │ │ │ +87 bool operator!=(const field &rhs) const //[t82] │ │ │ │ │ + 88 {return not operator==(rhs);} │ │ │ │ │ + 90 │ │ │ │ │ + 96 const char *name() const; //[t11] │ │ │ │ │ + 97 │ │ │ │ │ + 99 oid type() const; //[t07] │ │ │ │ │ + 100 │ │ │ │ │ + 102 oid table() const; //[t02] │ │ │ │ │ 103 │ │ │ │ │ - 104#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 105#endif │ │ │ │ │ +104 row_size_type num() const { return col(); } //[t82] │ │ │ │ │ + 105 │ │ │ │ │ + 107 row_size_type table_column() const; //[t93] │ │ │ │ │ + 109 │ │ │ │ │ + 115 │ │ │ │ │ + 120 const char *c_str() const; //[t02] │ │ │ │ │ + 121 │ │ │ │ │ + 123 bool is_null() const noexcept; //[t12] │ │ │ │ │ + 124 │ │ │ │ │ + 126 │ │ │ │ │ + 129 size_type size() const noexcept; //[t11] │ │ │ │ │ + 130 │ │ │ │ │ + 132 │ │ │ │ │ +135 template auto to(T &Obj) const //[t03] │ │ │ │ │ + 136 -> typename std::enable_if<( │ │ │ │ │ + 137 not std::is_pointer::value │ │ │ │ │ + 138 or std::is_same::value │ │ │ │ │ + 139 ), bool>::type │ │ │ │ │ + 140 { │ │ │ │ │ + 141 const char *const bytes = c_str(); │ │ │ │ │ + 142 if (bytes[0] == '\0' and is_null()) return false; │ │ │ │ │ + 143 from_string(bytes, Obj); │ │ │ │ │ + 144 return true; │ │ │ │ │ + 145 } │ │ │ │ │ + 146 │ │ │ │ │ +148 template bool operator>>(T &Obj) const //[t07] │ │ │ │ │ + 149 { return to(Obj); } │ │ │ │ │ + 150 │ │ │ │ │ + 152 │ │ │ │ │ +155 template auto to(T &Obj, const T &Default) const //[t12] │ │ │ │ │ + 156 -> typename std::enable_if<( │ │ │ │ │ + 157 not std::is_pointer::value │ │ │ │ │ + 158 or std::is_same::value │ │ │ │ │ + 159 ), bool>::type │ │ │ │ │ + 160 { │ │ │ │ │ + 161 const bool NotNull = to(Obj); │ │ │ │ │ + 162 if (not NotNull) Obj = Default; │ │ │ │ │ + 163 return NotNull; │ │ │ │ │ + 164 } │ │ │ │ │ + 165 │ │ │ │ │ + 167 │ │ │ │ │ +170 template T as(const T &Default) const //[t01] │ │ │ │ │ + 171 { │ │ │ │ │ + 172 T Obj; │ │ │ │ │ + 173 to(Obj, Default); │ │ │ │ │ + 174 return Obj; │ │ │ │ │ + 175 } │ │ │ │ │ + 176 │ │ │ │ │ + 178 │ │ │ │ │ +183 template T as() const //[t45] │ │ │ │ │ + 184 { │ │ │ │ │ + 185 T Obj; │ │ │ │ │ + 186 if (not to(Obj)) Obj = string_traits::null(); │ │ │ │ │ + 187 return Obj; │ │ │ │ │ + 188 } │ │ │ │ │ + 189 │ │ │ │ │ + 191 │ │ │ │ │ + 195 template class O │ │ │ │ │ + 196#if defined(PQXX_HAVE_OPTIONAL) │ │ │ │ │ + 197 = std::optional │ │ │ │ │ + 198#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL) │ │ │ │ │ + 199 = std::experimental::optional │ │ │ │ │ + 200#endif │ │ │ │ │ +201 > constexpr O get() const { return as>(); } │ │ │ │ │ + 202 │ │ │ │ │ + 204 │ │ │ │ │ +210 array_parser as_array() const │ │ │ │ │ + 211 { return array_parser{c_str(), m_home.m_encoding}; } │ │ │ │ │ + 213 │ │ │ │ │ + 214 │ │ │ │ │ + 215protected: │ │ │ │ │ +216 const result &home() const noexcept { return m_home; } │ │ │ │ │ +217 size_t idx() const noexcept { return m_row; } │ │ │ │ │ +218 row_size_type col() const noexcept { return row_size_type(m_col); } │ │ │ │ │ + 219 │ │ │ │ │ +224 long m_col; │ │ │ │ │ + 225 │ │ │ │ │ + 226private: │ │ │ │ │ + 227 result m_home; │ │ │ │ │ + 228 size_t m_row; │ │ │ │ │ + 229}; │ │ │ │ │ + 230 │ │ │ │ │ + 231 │ │ │ │ │ + 233template<> │ │ │ │ │ +234inline bool field::to(std::string &Obj) const │ │ │ │ │ + 235{ │ │ │ │ │ + 236 const char *const bytes = c_str(); │ │ │ │ │ + 237 if (bytes[0] == '\0' and is_null()) return false; │ │ │ │ │ + 238 Obj = std::string{bytes, size()}; │ │ │ │ │ + 239 return true; │ │ │ │ │ + 240} │ │ │ │ │ + 241 │ │ │ │ │ + 243 │ │ │ │ │ + 248template<> │ │ │ │ │ +249inline bool field::to(const char *&Obj) const │ │ │ │ │ + 250{ │ │ │ │ │ + 251 if (is_null()) return false; │ │ │ │ │ + 252 Obj = c_str(); │ │ │ │ │ + 253 return true; │ │ │ │ │ + 254} │ │ │ │ │ + 255 │ │ │ │ │ + 256 │ │ │ │ │ + 257template> │ │ │ │ │ +258 class field_streambuf : │ │ │ │ │ + 259 public std::basic_streambuf │ │ │ │ │ + 260{ │ │ │ │ │ + 261public: │ │ │ │ │ +262 using char_type = CHAR; │ │ │ │ │ +263 using traits_type = TRAITS; │ │ │ │ │ +264 using int_type = typename traits_type::int_type; │ │ │ │ │ +265 using pos_type = typename traits_type::pos_type; │ │ │ │ │ +266 using off_type = typename traits_type::off_type; │ │ │ │ │ +267 using openmode = std::ios::openmode; │ │ │ │ │ +268 using seekdir = std::ios::seekdir; │ │ │ │ │ + 269 │ │ │ │ │ +270 explicit field_streambuf(const field &F) : //[t74] │ │ │ │ │ + 271 m_field{F} │ │ │ │ │ + 272 { │ │ │ │ │ + 273 initialize(); │ │ │ │ │ + 274 } │ │ │ │ │ + 275 │ │ │ │ │ + 276protected: │ │ │ │ │ +277 virtual int sync() override { return traits_type::eof(); } │ │ │ │ │ + 278 │ │ │ │ │ + 279protected: │ │ │ │ │ +280 virtual pos_type seekoff(off_type, seekdir, openmode) override │ │ │ │ │ + 281 { return traits_type::eof(); } │ │ │ │ │ +282 virtual pos_type seekpos(pos_type, openmode) override │ │ │ │ │ + 283 {return traits_type::eof();} │ │ │ │ │ +284 virtual int_type overflow(int_type) override │ │ │ │ │ + 285 { return traits_type::eof(); } │ │ │ │ │ +286 virtual int_type underflow() override │ │ │ │ │ + 287 { return traits_type::eof(); } │ │ │ │ │ + 288 │ │ │ │ │ + 289private: │ │ │ │ │ + 290 const field &m_field; │ │ │ │ │ + 291 │ │ │ │ │ + 292 int_type initialize() │ │ │ │ │ + 293 { │ │ │ │ │ + 294 char_type *G = │ │ │ │ │ + 295 reinterpret_cast(const_cast(m_field.c_str())); │ │ │ │ │ + 296 this->setg(G, G, G + m_field.size()); │ │ │ │ │ + 297 return int_type(m_field.size()); │ │ │ │ │ + 298 } │ │ │ │ │ + 299}; │ │ │ │ │ + 300 │ │ │ │ │ + 301 │ │ │ │ │ + 303 │ │ │ │ │ + 311template> │ │ │ │ │ +312 class basic_fieldstream : │ │ │ │ │ + 313 public std::basic_istream │ │ │ │ │ + 314{ │ │ │ │ │ + 315 using super = std::basic_istream; │ │ │ │ │ + 316 │ │ │ │ │ + 317public: │ │ │ │ │ +318 using char_type = CHAR; │ │ │ │ │ +319 using traits_type = TRAITS; │ │ │ │ │ +320 using int_type = typename traits_type::int_type; │ │ │ │ │ +321 using pos_type = typename traits_type::pos_type; │ │ │ │ │ +322 using off_type = typename traits_type::off_type; │ │ │ │ │ + 323 │ │ │ │ │ +324 basic_fieldstream(const field &F) : super{nullptr}, m_buf{F} │ │ │ │ │ + 325 { super::init(&m_buf); } │ │ │ │ │ + 326 │ │ │ │ │ + 327private: │ │ │ │ │ + 328 field_streambuf m_buf; │ │ │ │ │ + 329}; │ │ │ │ │ + 330 │ │ │ │ │ +331using fieldstream = basic_fieldstream; │ │ │ │ │ + 332 │ │ │ │ │ + 334 │ │ │ │ │ + 354template │ │ │ │ │ + 355inline std::basic_ostream &operator<<( │ │ │ │ │ + 356 std::basic_ostream &S, const field &F) //[t46] │ │ │ │ │ + 357{ │ │ │ │ │ + 358 S.write(F.c_str(), std::streamsize(F.size())); │ │ │ │ │ + 359 return S; │ │ │ │ │ + 360} │ │ │ │ │ + 361 │ │ │ │ │ + 362 │ │ │ │ │ + 364template │ │ │ │ │ +365inline void from_string(const field &F, T &Obj) //[t46] │ │ │ │ │ + 366 { from_string(F.c_str(), Obj, F.size()); } │ │ │ │ │ + 367 │ │ │ │ │ + 369template<> PQXX_LIBEXPORT std::string to_string(const field &Obj); //[t74] │ │ │ │ │ + 370 │ │ │ │ │ + 371} // namespace pqxx │ │ │ │ │ + 372#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 373#endif │ │ │ │ │ +std │ │ │ │ │ +STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::dbtransaction │ │ │ │ │ -Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ -Definition: dbtransaction.hxx:63 │ │ │ │ │ -pqxx::subtransaction │ │ │ │ │ -"Transaction" nested within another transaction │ │ │ │ │ -Definition: subtransaction.hxx:82 │ │ │ │ │ -pqxx::subtransaction::~subtransaction │ │ │ │ │ -virtual ~subtransaction() noexcept │ │ │ │ │ -Definition: subtransaction.hxx:92 │ │ │ │ │ -pqxx::internal::transactionfocus │ │ │ │ │ -Definition: transaction_base.hxx:44 │ │ │ │ │ +pqxx::operator<< │ │ │ │ │ +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 │ │ │ │ │ +pqxx::from_string │ │ │ │ │ +void from_string(const field &F, T &Obj) │ │ │ │ │ +Convert a field's string contents to another type. │ │ │ │ │ +Definition: field.hxx:365 │ │ │ │ │ +pqxx::to_string │ │ │ │ │ +std::string to_string(const field &Obj) │ │ │ │ │ +Convert a field to a string. │ │ │ │ │ +Definition: result.cxx:451 │ │ │ │ │ +pqxx::field_size_type │ │ │ │ │ +std::size_t field_size_type │ │ │ │ │ +Number of bytes in a field of database data. │ │ │ │ │ +Definition: types.hxx:30 │ │ │ │ │ +pqxx::row_size_type │ │ │ │ │ +unsigned int row_size_type │ │ │ │ │ +Number of fields in a row of database data. │ │ │ │ │ +Definition: types.hxx:24 │ │ │ │ │ +pqxx::array_parser │ │ │ │ │ +Low-level array parser. │ │ │ │ │ +Definition: array.hxx:47 │ │ │ │ │ +pqxx::field │ │ │ │ │ +Reference to a field in a result set. │ │ │ │ │ +Definition: field.hxx:50 │ │ │ │ │ +pqxx::field::num │ │ │ │ │ +row_size_type num() const │ │ │ │ │ +Definition: field.hxx:104 │ │ │ │ │ +pqxx::field::col │ │ │ │ │ +row_size_type col() const noexcept │ │ │ │ │ +Definition: field.hxx:218 │ │ │ │ │ +pqxx::field::size │ │ │ │ │ +size_type size() const noexcept │ │ │ │ │ +Return number of bytes taken up by the field's value. │ │ │ │ │ +Definition: field.cxx:74 │ │ │ │ │ +pqxx::field::m_col │ │ │ │ │ +long m_col │ │ │ │ │ +Definition: field.hxx:224 │ │ │ │ │ +pqxx::field::as │ │ │ │ │ +T as(const T &Default) const │ │ │ │ │ +Return value as object of given type, or Default if null. │ │ │ │ │ +Definition: field.hxx:170 │ │ │ │ │ +pqxx::field::size_type │ │ │ │ │ +field_size_type size_type │ │ │ │ │ +Definition: field.hxx:52 │ │ │ │ │ +pqxx::field::operator>> │ │ │ │ │ +bool operator>>(T &Obj) const │ │ │ │ │ +Read value into Obj; or leave Obj untouched and return false if null. │ │ │ │ │ +Definition: field.hxx:148 │ │ │ │ │ +pqxx::field::as_array │ │ │ │ │ +array_parser as_array() const │ │ │ │ │ +Parse the field as an SQL array. │ │ │ │ │ +Definition: field.hxx:210 │ │ │ │ │ +pqxx::field::home │ │ │ │ │ +const result & home() const noexcept │ │ │ │ │ +Definition: field.hxx:216 │ │ │ │ │ +pqxx::field::as │ │ │ │ │ +T as() const │ │ │ │ │ +Return value as object of given type, or throw exception if null. │ │ │ │ │ +Definition: field.hxx:183 │ │ │ │ │ +pqxx::field::to │ │ │ │ │ +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 │ │ │ │ │ +pqxx::field::c_str │ │ │ │ │ +const char * c_str() const │ │ │ │ │ +Read as plain C string. │ │ │ │ │ +Definition: field.cxx:62 │ │ │ │ │ +pqxx::field::is_null │ │ │ │ │ +bool is_null() const noexcept │ │ │ │ │ +Is this field's value null? │ │ │ │ │ +Definition: field.cxx:68 │ │ │ │ │ +pqxx::field::get │ │ │ │ │ +constexpr O< T > get() const │ │ │ │ │ +Return value wrapped in some optional type (empty for nulls) │ │ │ │ │ +Definition: field.hxx:201 │ │ │ │ │ +pqxx::field::idx │ │ │ │ │ +size_t idx() const noexcept │ │ │ │ │ +Definition: field.hxx:217 │ │ │ │ │ +pqxx::field::operator!= │ │ │ │ │ +bool operator!=(const field &rhs) const │ │ │ │ │ +Byte-by-byte comparison (all nulls are considered equal) │ │ │ │ │ +Definition: field.hxx:87 │ │ │ │ │ +pqxx::field_streambuf │ │ │ │ │ +Definition: field.hxx:260 │ │ │ │ │ +pqxx::field_streambuf::traits_type │ │ │ │ │ +TRAITS traits_type │ │ │ │ │ +Definition: field.hxx:263 │ │ │ │ │ +pqxx::field_streambuf::off_type │ │ │ │ │ +typename traits_type::off_type off_type │ │ │ │ │ +Definition: field.hxx:266 │ │ │ │ │ +pqxx::field_streambuf::seekoff │ │ │ │ │ +virtual pos_type seekoff(off_type, seekdir, openmode) override │ │ │ │ │ +Definition: field.hxx:280 │ │ │ │ │ +pqxx::field_streambuf::seekpos │ │ │ │ │ +virtual pos_type seekpos(pos_type, openmode) override │ │ │ │ │ +Definition: field.hxx:282 │ │ │ │ │ +pqxx::field_streambuf::openmode │ │ │ │ │ +std::ios::openmode openmode │ │ │ │ │ +Definition: field.hxx:267 │ │ │ │ │ +pqxx::field_streambuf::overflow │ │ │ │ │ +virtual int_type overflow(int_type) override │ │ │ │ │ +Definition: field.hxx:284 │ │ │ │ │ +pqxx::field_streambuf::field_streambuf │ │ │ │ │ +field_streambuf(const field &F) │ │ │ │ │ +Definition: field.hxx:270 │ │ │ │ │ +pqxx::field_streambuf::pos_type │ │ │ │ │ +typename traits_type::pos_type pos_type │ │ │ │ │ +Definition: field.hxx:265 │ │ │ │ │ +pqxx::field_streambuf::sync │ │ │ │ │ +virtual int sync() override │ │ │ │ │ +Definition: field.hxx:277 │ │ │ │ │ +pqxx::field_streambuf::int_type │ │ │ │ │ +typename traits_type::int_type int_type │ │ │ │ │ +Definition: field.hxx:264 │ │ │ │ │ +pqxx::field_streambuf::underflow │ │ │ │ │ +virtual int_type underflow() override │ │ │ │ │ +Definition: field.hxx:286 │ │ │ │ │ +pqxx::field_streambuf::char_type │ │ │ │ │ +CHAR char_type │ │ │ │ │ +Definition: field.hxx:262 │ │ │ │ │ +pqxx::field_streambuf::seekdir │ │ │ │ │ +std::ios::seekdir seekdir │ │ │ │ │ +Definition: field.hxx:268 │ │ │ │ │ +pqxx::basic_fieldstream │ │ │ │ │ +Input stream that gets its data from a result field. │ │ │ │ │ +Definition: field.hxx:314 │ │ │ │ │ +pqxx::basic_fieldstream::traits_type │ │ │ │ │ +TRAITS traits_type │ │ │ │ │ +Definition: field.hxx:319 │ │ │ │ │ +pqxx::basic_fieldstream::basic_fieldstream │ │ │ │ │ +basic_fieldstream(const field &F) │ │ │ │ │ +Definition: field.hxx:324 │ │ │ │ │ +pqxx::basic_fieldstream::pos_type │ │ │ │ │ +typename traits_type::pos_type pos_type │ │ │ │ │ +Definition: field.hxx:321 │ │ │ │ │ +pqxx::basic_fieldstream::off_type │ │ │ │ │ +typename traits_type::off_type off_type │ │ │ │ │ +Definition: field.hxx:322 │ │ │ │ │ +pqxx::basic_fieldstream::int_type │ │ │ │ │ +typename traits_type::int_type int_type │ │ │ │ │ +Definition: field.hxx:320 │ │ │ │ │ +pqxx::basic_fieldstream::char_type │ │ │ │ │ +CHAR char_type │ │ │ │ │ +Definition: field.hxx:318 │ │ │ │ │ +pqxx::result │ │ │ │ │ +Result set containing data returned by a query or command. │ │ │ │ │ +Definition: result.hxx:70 │ │ │ │ │ +pqxx::row │ │ │ │ │ +Reference to one row in a result. │ │ │ │ │ +Definition: row.hxx:41 │ │ │ │ │ +pqxx::string_traits │ │ │ │ │ +Traits class for use in string conversions. │ │ │ │ │ +Definition: strconv.hxx:51 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * subtransaction.hxx │ │ │ │ │ + * field.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00008_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: types.hxx Source File │ │ │ │ +libpqxx: config.h Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,87 +55,130 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
types.hxx
│ │ │ │ +
config.h
│ │ │ │
│ │ │ │
│ │ │ │ -
1
│ │ │ │ -
10#ifndef PQXX_H_TYPES
│ │ │ │ -
11#define PQXX_H_TYPES
│ │ │ │ +
1/* include/pqxx/config.h. Generated from config.h.in by configure. */
│ │ │ │ +
2/* include/pqxx/config.h.in. Generated from configure.ac by autoheader. */
│ │ │ │ +
3
│ │ │ │ +
4/* most gcc compilers know a function __attribute__((__const__)) */
│ │ │ │ +
5#define GCC_CONST_CALL __attribute__((__const__))
│ │ │ │ +
6
│ │ │ │ +
7/* define if the compiler supports basic C++11 syntax */
│ │ │ │ +
8#define HAVE_CXX11 1
│ │ │ │ +
9
│ │ │ │ +
10/* Define to 1 if you have the <dlfcn.h> header file. */
│ │ │ │ +
11#define HAVE_DLFCN_H 1
│ │ │ │
12
│ │ │ │ -
13#include <cstddef>
│ │ │ │ -
14
│ │ │ │ -
15namespace pqxx
│ │ │ │ -
16{
│ │ │ │ -
18using result_size_type = unsigned long;
│ │ │ │ -
19
│ │ │ │ -
21using result_difference_type = signed long;
│ │ │ │ -
22
│ │ │ │ -
24using row_size_type = unsigned int;
│ │ │ │ -
25
│ │ │ │ -
27using row_difference_type = signed int;
│ │ │ │ -
28
│ │ │ │ -
30using field_size_type = std::size_t;
│ │ │ │ -
31
│ │ │ │ - │ │ │ │ -
34
│ │ │ │ -
35
│ │ │ │ -
36// Forward declarations, to help break compilation dependencies.
│ │ │ │ -
37// These won't necessarily include all classes in libpqxx.
│ │ │ │ -
38class binarystring;
│ │ │ │ - │ │ │ │ -
40class connection_base;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
45class dbtransaction;
│ │ │ │ -
46class field;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
49class range_error;
│ │ │ │ -
50class result;
│ │ │ │ -
51class row;
│ │ │ │ -
52class tablereader;
│ │ │ │ - │ │ │ │ +
13/* Define to 1 if you have the <inttypes.h> header file. */
│ │ │ │ +
14#define HAVE_INTTYPES_H 1
│ │ │ │ +
15
│ │ │ │ +
16/* Define to 1 if you have the `pq' library (-lpq). */
│ │ │ │ +
17#define HAVE_LIBPQ 1
│ │ │ │ +
18
│ │ │ │ +
19/* System supports poll(). */
│ │ │ │ +
20#define HAVE_POLL 1
│ │ │ │ +
21
│ │ │ │ +
22/* Define to 1 if you have the <stdint.h> header file. */
│ │ │ │ +
23#define HAVE_STDINT_H 1
│ │ │ │ +
24
│ │ │ │ +
25/* Define to 1 if you have the <stdio.h> header file. */
│ │ │ │ +
26#define HAVE_STDIO_H 1
│ │ │ │ +
27
│ │ │ │ +
28/* Define to 1 if you have the <stdlib.h> header file. */
│ │ │ │ +
29#define HAVE_STDLIB_H 1
│ │ │ │ +
30
│ │ │ │ +
31/* Define to 1 if you have the <strings.h> header file. */
│ │ │ │ +
32#define HAVE_STRINGS_H 1
│ │ │ │ +
33
│ │ │ │ +
34/* Define to 1 if you have the <string.h> header file. */
│ │ │ │ +
35#define HAVE_STRING_H 1
│ │ │ │ +
36
│ │ │ │ +
37/* Define to 1 if you have the <sys/select.h> header file. */
│ │ │ │ +
38/* #undef HAVE_SYS_SELECT_H */
│ │ │ │ +
39
│ │ │ │ +
40/* Define to 1 if you have the <sys/stat.h> header file. */
│ │ │ │ +
41#define HAVE_SYS_STAT_H 1
│ │ │ │ +
42
│ │ │ │ +
43/* Define to 1 if you have the <sys/time.h> header file. */
│ │ │ │ +
44#define HAVE_SYS_TIME_H 1
│ │ │ │ +
45
│ │ │ │ +
46/* Define to 1 if you have the <sys/types.h> header file. */
│ │ │ │ +
47#define HAVE_SYS_TYPES_H 1
│ │ │ │ +
48
│ │ │ │ +
49/* Define to 1 if you have the <unistd.h> header file. */
│ │ │ │ +
50#define HAVE_UNISTD_H 1
│ │ │ │ +
51
│ │ │ │ +
52/* Define to the sub-directory where libtool stores uninstalled libraries. */
│ │ │ │ +
53#define LT_OBJDIR ".libs/"
│ │ │ │
54
│ │ │ │ -
55} // namespace pqxx
│ │ │ │ -
56
│ │ │ │ -
57#endif
│ │ │ │ -
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
signed int row_difference_type
Difference between row sizes.
Definition: types.hxx:27
│ │ │ │ -
long large_object_size_type
Number of bytes in a large object. (Unusual: it's signed.)
Definition: types.hxx:33
│ │ │ │ -
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
│ │ │ │ -
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
│ │ │ │ -
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
│ │ │ │ -
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
│ │ │ │ -
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
│ │ │ │ -
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ -
Definition: connectionpolicy.hxx:32
│ │ │ │ -
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ -
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:253
│ │ │ │ -
Reference to a field in a result set.
Definition: field.hxx:50
│ │ │ │ -
Accessor for large object's contents.
Definition: largeobject.hxx:138
│ │ │ │ -
Definition: notification.hxx:56
│ │ │ │ -
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ -
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
│ │ │ │ -
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:122
│ │ │ │ -
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │ -
Iterator for fields in a row. Use as row::const_iterator.
Definition: row.hxx:208
│ │ │ │ -
Reverse iterator for a row. Use as row::const_reverse_iterator.
Definition: row.hxx:280
│ │ │ │ -
Definition: tablereader.hxx:30
│ │ │ │ -
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │ +
55/* Name of package */
│ │ │ │ +
56#define PACKAGE "libpqxx"
│ │ │ │ +
57
│ │ │ │ +
58/* Define to the address where bug reports for this package should be sent. */
│ │ │ │ +
59#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen"
│ │ │ │ +
60
│ │ │ │ +
61/* Define to the full name of this package. */
│ │ │ │ +
62#define PACKAGE_NAME "libpqxx"
│ │ │ │ +
63
│ │ │ │ +
64/* Define to the full name and version of this package. */
│ │ │ │ +
65#define PACKAGE_STRING "libpqxx 6.4.5"
│ │ │ │ +
66
│ │ │ │ +
67/* Define to the one symbol short name of this package. */
│ │ │ │ +
68#define PACKAGE_TARNAME "libpqxx"
│ │ │ │ +
69
│ │ │ │ +
70/* Define to the home page for this package. */
│ │ │ │ +
71#define PACKAGE_URL ""
│ │ │ │ +
72
│ │ │ │ +
73/* Define to the version of this package. */
│ │ │ │ +
74#define PACKAGE_VERSION "6.4.5"
│ │ │ │ +
75
│ │ │ │ +
76/* Define if <charconv> supports floating-point conversion. */
│ │ │ │ +
77/* #undef PQXX_HAVE_CHARCONV_FLOAT */
│ │ │ │ +
78
│ │ │ │ +
79/* Define if <charconv> supports integer conversion. */
│ │ │ │ +
80/* #undef PQXX_HAVE_CHARCONV_INT */
│ │ │ │ +
81
│ │ │ │ +
82/* Define if compiler supports [[deprecated]] attribute */
│ │ │ │ +
83#define PQXX_HAVE_DEPRECATED 1
│ │ │ │ +
84
│ │ │ │ +
85/* Define if the compiler supports std::experimental::optional. */
│ │ │ │ +
86/* #undef PQXX_HAVE_EXP_OPTIONAL */
│ │ │ │ +
87
│ │ │ │ +
88/* Define if g++ supports const attribute. */
│ │ │ │ +
89#define PQXX_HAVE_GCC_CONST 1
│ │ │ │ +
90
│ │ │ │ +
91/* Define if g++ supports deprecated attribute. */
│ │ │ │ +
92#define PQXX_HAVE_GCC_DEPRECATED 1
│ │ │ │ +
93
│ │ │ │ +
94/* Define if g++ supports pure attribute */
│ │ │ │ +
95#define PQXX_HAVE_GCC_PURE 1
│ │ │ │ +
96
│ │ │ │ +
97/* Define if g++ supports visibility attribute. */
│ │ │ │ +
98#define PQXX_HAVE_GCC_VISIBILITY 1
│ │ │ │ +
99
│ │ │ │ +
100/* Define if the compiler supports std::optional. */
│ │ │ │ +
101/* #undef PQXX_HAVE_OPTIONAL */
│ │ │ │ +
102
│ │ │ │ +
103/* Define to 1 if all of the C90 standard headers exist (not just the ones
│ │ │ │ +
104 required in a freestanding environment). This macro is provided for
│ │ │ │ +
105 backward compatibility; new code need not use it. */
│ │ │ │ +
106#define STDC_HEADERS 1
│ │ │ │ +
107
│ │ │ │ +
108/* Version number of package */
│ │ │ │ +
109#define VERSION "6.4.5"
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,127 +1,123 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -types.hxx │ │ │ │ │ - 1 │ │ │ │ │ - 10#ifndef PQXX_H_TYPES │ │ │ │ │ - 11#define PQXX_H_TYPES │ │ │ │ │ +config.h │ │ │ │ │ + 1/* include/pqxx/config.h. Generated from config.h.in by configure. */ │ │ │ │ │ + 2/* include/pqxx/config.h.in. Generated from configure.ac by autoheader. */ │ │ │ │ │ + 3 │ │ │ │ │ + 4/* most gcc compilers know a function __attribute__((__const__)) */ │ │ │ │ │ + 5#define GCC_CONST_CALL __attribute__((__const__)) │ │ │ │ │ + 6 │ │ │ │ │ + 7/* define if the compiler supports basic C++11 syntax */ │ │ │ │ │ + 8#define HAVE_CXX11 1 │ │ │ │ │ + 9 │ │ │ │ │ + 10/* Define to 1 if you have the header file. */ │ │ │ │ │ + 11#define HAVE_DLFCN_H 1 │ │ │ │ │ 12 │ │ │ │ │ - 13#include │ │ │ │ │ - 14 │ │ │ │ │ - 15namespace pqxx │ │ │ │ │ - 16{ │ │ │ │ │ -18using result_size_type = unsigned long; │ │ │ │ │ - 19 │ │ │ │ │ -21using result_difference_type = signed long; │ │ │ │ │ - 22 │ │ │ │ │ -24using row_size_type = unsigned int; │ │ │ │ │ - 25 │ │ │ │ │ -27using row_difference_type = signed int; │ │ │ │ │ - 28 │ │ │ │ │ -30using field_size_type = std::size_t; │ │ │ │ │ - 31 │ │ │ │ │ -33using large_object_size_type = long; │ │ │ │ │ - 34 │ │ │ │ │ - 35 │ │ │ │ │ - 36// Forward declarations, to help break compilation dependencies. │ │ │ │ │ - 37// These won't necessarily include all classes in libpqxx. │ │ │ │ │ - 38class binarystring; │ │ │ │ │ - 39class connectionpolicy; │ │ │ │ │ - 40class connection_base; │ │ │ │ │ - 41class const_result_iterator; │ │ │ │ │ - 42class const_reverse_result_iterator; │ │ │ │ │ - 43class const_reverse_row_iterator; │ │ │ │ │ - 44class const_row_iterator; │ │ │ │ │ - 45class dbtransaction; │ │ │ │ │ - 46class field; │ │ │ │ │ - 47class largeobjectaccess; │ │ │ │ │ - 48class notification_receiver; │ │ │ │ │ - 49class range_error; │ │ │ │ │ - 50class result; │ │ │ │ │ - 51class row; │ │ │ │ │ - 52class tablereader; │ │ │ │ │ - 53class transaction_base; │ │ │ │ │ + 13/* Define to 1 if you have the header file. */ │ │ │ │ │ + 14#define HAVE_INTTYPES_H 1 │ │ │ │ │ + 15 │ │ │ │ │ + 16/* Define to 1 if you have the `pq' library (-lpq). */ │ │ │ │ │ + 17#define HAVE_LIBPQ 1 │ │ │ │ │ + 18 │ │ │ │ │ + 19/* System supports poll(). */ │ │ │ │ │ + 20#define HAVE_POLL 1 │ │ │ │ │ + 21 │ │ │ │ │ + 22/* Define to 1 if you have the header file. */ │ │ │ │ │ + 23#define HAVE_STDINT_H 1 │ │ │ │ │ + 24 │ │ │ │ │ + 25/* Define to 1 if you have the header file. */ │ │ │ │ │ + 26#define HAVE_STDIO_H 1 │ │ │ │ │ + 27 │ │ │ │ │ + 28/* Define to 1 if you have the header file. */ │ │ │ │ │ + 29#define HAVE_STDLIB_H 1 │ │ │ │ │ + 30 │ │ │ │ │ + 31/* Define to 1 if you have the header file. */ │ │ │ │ │ + 32#define HAVE_STRINGS_H 1 │ │ │ │ │ + 33 │ │ │ │ │ + 34/* Define to 1 if you have the header file. */ │ │ │ │ │ + 35#define HAVE_STRING_H 1 │ │ │ │ │ + 36 │ │ │ │ │ + 37/* Define to 1 if you have the header file. */ │ │ │ │ │ + 38/* #undef HAVE_SYS_SELECT_H */ │ │ │ │ │ + 39 │ │ │ │ │ + 40/* Define to 1 if you have the header file. */ │ │ │ │ │ + 41#define HAVE_SYS_STAT_H 1 │ │ │ │ │ + 42 │ │ │ │ │ + 43/* Define to 1 if you have the header file. */ │ │ │ │ │ + 44#define HAVE_SYS_TIME_H 1 │ │ │ │ │ + 45 │ │ │ │ │ + 46/* Define to 1 if you have the header file. */ │ │ │ │ │ + 47#define HAVE_SYS_TYPES_H 1 │ │ │ │ │ + 48 │ │ │ │ │ + 49/* Define to 1 if you have the header file. */ │ │ │ │ │ + 50#define HAVE_UNISTD_H 1 │ │ │ │ │ + 51 │ │ │ │ │ + 52/* Define to the sub-directory where libtool stores uninstalled libraries. │ │ │ │ │ +*/ │ │ │ │ │ + 53#define LT_OBJDIR ".libs/" │ │ │ │ │ 54 │ │ │ │ │ - 55} // namespace pqxx │ │ │ │ │ - 56 │ │ │ │ │ - 57#endif │ │ │ │ │ -pqxx │ │ │ │ │ -The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ -Definition: array.hxx:26 │ │ │ │ │ -pqxx::row_difference_type │ │ │ │ │ -signed int row_difference_type │ │ │ │ │ -Difference between row sizes. │ │ │ │ │ -Definition: types.hxx:27 │ │ │ │ │ -pqxx::large_object_size_type │ │ │ │ │ -long large_object_size_type │ │ │ │ │ -Number of bytes in a large object. (Unusual: it's signed.) │ │ │ │ │ -Definition: types.hxx:33 │ │ │ │ │ -pqxx::result_difference_type │ │ │ │ │ -signed long result_difference_type │ │ │ │ │ -Difference between result sizes. │ │ │ │ │ -Definition: types.hxx:21 │ │ │ │ │ -pqxx::field_size_type │ │ │ │ │ -std::size_t field_size_type │ │ │ │ │ -Number of bytes in a field of database data. │ │ │ │ │ -Definition: types.hxx:30 │ │ │ │ │ -pqxx::result_size_type │ │ │ │ │ -unsigned long result_size_type │ │ │ │ │ -Number of rows in a result set. │ │ │ │ │ -Definition: types.hxx:18 │ │ │ │ │ -pqxx::row_size_type │ │ │ │ │ -unsigned int row_size_type │ │ │ │ │ -Number of fields in a row of database data. │ │ │ │ │ -Definition: types.hxx:24 │ │ │ │ │ -pqxx::binarystring │ │ │ │ │ -Binary data corresponding to PostgreSQL's "BYTEA" binary-string type. │ │ │ │ │ -Definition: binarystring.hxx:54 │ │ │ │ │ -pqxx::connection_base │ │ │ │ │ -connection_base abstract base class; represents a connection to a database. │ │ │ │ │ -Definition: connection_base.hxx:140 │ │ │ │ │ -pqxx::connectionpolicy │ │ │ │ │ -Definition: connectionpolicy.hxx:32 │ │ │ │ │ -pqxx::dbtransaction │ │ │ │ │ -Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ -Definition: dbtransaction.hxx:63 │ │ │ │ │ -pqxx::range_error │ │ │ │ │ -Something is out of range, similar to std::out_of_range. │ │ │ │ │ -Definition: except.hxx:253 │ │ │ │ │ -pqxx::field │ │ │ │ │ -Reference to a field in a result set. │ │ │ │ │ -Definition: field.hxx:50 │ │ │ │ │ -pqxx::largeobjectaccess │ │ │ │ │ -Accessor for large object's contents. │ │ │ │ │ -Definition: largeobject.hxx:138 │ │ │ │ │ -pqxx::notification_receiver │ │ │ │ │ -Definition: notification.hxx:56 │ │ │ │ │ -pqxx::result │ │ │ │ │ -Result set containing data returned by a query or command. │ │ │ │ │ -Definition: result.hxx:70 │ │ │ │ │ -pqxx::const_result_iterator │ │ │ │ │ -Iterator for rows in a result. Use as result::const_iterator. │ │ │ │ │ -Definition: result_iterator.hxx:36 │ │ │ │ │ -pqxx::const_reverse_result_iterator │ │ │ │ │ -Reverse iterator for result. Use as result::const_reverse_iterator. │ │ │ │ │ -Definition: result_iterator.hxx:122 │ │ │ │ │ -pqxx::row │ │ │ │ │ -Reference to one row in a result. │ │ │ │ │ -Definition: row.hxx:41 │ │ │ │ │ -pqxx::const_row_iterator │ │ │ │ │ -Iterator for fields in a row. Use as row::const_iterator. │ │ │ │ │ -Definition: row.hxx:208 │ │ │ │ │ -pqxx::const_reverse_row_iterator │ │ │ │ │ -Reverse iterator for a row. Use as row::const_reverse_iterator. │ │ │ │ │ -Definition: row.hxx:280 │ │ │ │ │ -pqxx::tablereader │ │ │ │ │ -Definition: tablereader.hxx:30 │ │ │ │ │ -pqxx::transaction_base │ │ │ │ │ -Interface definition (and common code) for "transaction" classes. │ │ │ │ │ -Definition: transaction_base.hxx:138 │ │ │ │ │ + 55/* Name of package */ │ │ │ │ │ + 56#define PACKAGE "libpqxx" │ │ │ │ │ + 57 │ │ │ │ │ + 58/* Define to the address where bug reports for this package should be sent. │ │ │ │ │ +*/ │ │ │ │ │ + 59#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen" │ │ │ │ │ + 60 │ │ │ │ │ + 61/* Define to the full name of this package. */ │ │ │ │ │ + 62#define PACKAGE_NAME "libpqxx" │ │ │ │ │ + 63 │ │ │ │ │ + 64/* Define to the full name and version of this package. */ │ │ │ │ │ + 65#define PACKAGE_STRING "libpqxx 6.4.5" │ │ │ │ │ + 66 │ │ │ │ │ + 67/* Define to the one symbol short name of this package. */ │ │ │ │ │ + 68#define PACKAGE_TARNAME "libpqxx" │ │ │ │ │ + 69 │ │ │ │ │ + 70/* Define to the home page for this package. */ │ │ │ │ │ + 71#define PACKAGE_URL "" │ │ │ │ │ + 72 │ │ │ │ │ + 73/* Define to the version of this package. */ │ │ │ │ │ + 74#define PACKAGE_VERSION "6.4.5" │ │ │ │ │ + 75 │ │ │ │ │ + 76/* Define if supports floating-point conversion. */ │ │ │ │ │ + 77/* #undef PQXX_HAVE_CHARCONV_FLOAT */ │ │ │ │ │ + 78 │ │ │ │ │ + 79/* Define if supports integer conversion. */ │ │ │ │ │ + 80/* #undef PQXX_HAVE_CHARCONV_INT */ │ │ │ │ │ + 81 │ │ │ │ │ + 82/* Define if compiler supports [[deprecated]] attribute */ │ │ │ │ │ + 83#define PQXX_HAVE_DEPRECATED 1 │ │ │ │ │ + 84 │ │ │ │ │ + 85/* Define if the compiler supports std::experimental::optional. */ │ │ │ │ │ + 86/* #undef PQXX_HAVE_EXP_OPTIONAL */ │ │ │ │ │ + 87 │ │ │ │ │ + 88/* Define if g++ supports const attribute. */ │ │ │ │ │ + 89#define PQXX_HAVE_GCC_CONST 1 │ │ │ │ │ + 90 │ │ │ │ │ + 91/* Define if g++ supports deprecated attribute. */ │ │ │ │ │ + 92#define PQXX_HAVE_GCC_DEPRECATED 1 │ │ │ │ │ + 93 │ │ │ │ │ + 94/* Define if g++ supports pure attribute */ │ │ │ │ │ + 95#define PQXX_HAVE_GCC_PURE 1 │ │ │ │ │ + 96 │ │ │ │ │ + 97/* Define if g++ supports visibility attribute. */ │ │ │ │ │ + 98#define PQXX_HAVE_GCC_VISIBILITY 1 │ │ │ │ │ + 99 │ │ │ │ │ + 100/* Define if the compiler supports std::optional. */ │ │ │ │ │ + 101/* #undef PQXX_HAVE_OPTIONAL */ │ │ │ │ │ + 102 │ │ │ │ │ + 103/* Define to 1 if all of the C90 standard headers exist (not just the ones │ │ │ │ │ + 104 required in a freestanding environment). This macro is provided for │ │ │ │ │ + 105 backward compatibility; new code need not use it. */ │ │ │ │ │ + 106#define STDC_HEADERS 1 │ │ │ │ │ + 107 │ │ │ │ │ + 108/* Version number of package */ │ │ │ │ │ + 109#define VERSION "6.4.5" │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * types.hxx │ │ │ │ │ + * config.h │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00011_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: stream_from.hxx Source File │ │ │ │ +libpqxx: subtransaction.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,229 +55,69 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
stream_from.hxx
│ │ │ │ +
subtransaction.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_STREAM_FROM
│ │ │ │ -
14#define PQXX_H_STREAM_FROM
│ │ │ │ +
13#ifndef PQXX_H_SUBTRANSACTION
│ │ │ │ +
14#define PQXX_H_SUBTRANSACTION
│ │ │ │
15
│ │ │ │
16#include "pqxx/compiler-public.hxx"
│ │ │ │
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18#include "pqxx/transaction_base.hxx"
│ │ │ │ -
19#include "pqxx/stream_base.hxx"
│ │ │ │ -
20#include "pqxx/internal/type_utils.hxx"
│ │ │ │ +
18
│ │ │ │ +
19#include "pqxx/dbtransaction.hxx"
│ │ │ │ +
20
│ │ │ │
21
│ │ │ │ -
22#include <string>
│ │ │ │ -
23
│ │ │ │ +
22/* Methods tested in eg. self-test program test1 are marked with "//[t01]"
│ │ │ │ +
23 */
│ │ │ │
24
│ │ │ │ -
25namespace pqxx
│ │ │ │ -
26{
│ │ │ │ -
27
│ │ │ │ -
29class PQXX_LIBEXPORT stream_from : public stream_base
│ │ │ │ -
30{
│ │ │ │ -
31public:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
34 const std::string &table_name
│ │ │ │ -
35 );
│ │ │ │ -
36 template<typename Columns> stream_from(
│ │ │ │ - │ │ │ │ -
38 const std::string &table_name,
│ │ │ │ -
39 const Columns& columns
│ │ │ │ -
40 );
│ │ │ │ -
41 template<typename Iter> stream_from(
│ │ │ │ - │ │ │ │ -
43 const std::string &table_name,
│ │ │ │ -
44 Iter columns_begin,
│ │ │ │ -
45 Iter columns_end
│ │ │ │ -
46 );
│ │ │ │ -
47
│ │ │ │ -
48 ~stream_from() noexcept;
│ │ │ │ -
49
│ │ │ │ -
50 void complete() override;
│ │ │ │ -
51
│ │ │ │ -
52 bool get_raw_line(std::string &);
│ │ │ │ -
53 template<typename Tuple> stream_from & operator>>(Tuple &);
│ │ │ │ -
54
│ │ │ │ -
55private:
│ │ │ │ -
56 internal::encoding_group m_copy_encoding;
│ │ │ │ -
57 std::string m_current_line;
│ │ │ │ -
58 bool m_retry_line;
│ │ │ │ -
59
│ │ │ │ -
60 void set_up(transaction_base &, const std::string &table_name);
│ │ │ │ -
61 void set_up(
│ │ │ │ - │ │ │ │ -
63 const std::string &table_name,
│ │ │ │ -
64 const std::string &columns
│ │ │ │ -
65 );
│ │ │ │ -
66
│ │ │ │ -
67 void close() override;
│ │ │ │ -
68
│ │ │ │ -
69 bool extract_field(
│ │ │ │ -
70 const std::string &,
│ │ │ │ -
71 std::string::size_type &,
│ │ │ │ -
72 std::string &
│ │ │ │ -
73 ) const;
│ │ │ │ -
74
│ │ │ │ -
75 template<typename Tuple, std::size_t I> auto tokenize_ith(
│ │ │ │ -
76 const std::string &,
│ │ │ │ -
77 Tuple &,
│ │ │ │ -
78 std::string::size_type,
│ │ │ │ -
79 std::string &
│ │ │ │ -
80 ) const -> typename std::enable_if<(
│ │ │ │ -
81 std::tuple_size<Tuple>::value > I
│ │ │ │ -
82 )>::type;
│ │ │ │ -
83 template<typename Tuple, std::size_t I> auto tokenize_ith(
│ │ │ │ -
84 const std::string &,
│ │ │ │ -
85 Tuple &,
│ │ │ │ -
86 std::string::size_type,
│ │ │ │ -
87 std::string &
│ │ │ │ -
88 ) const -> typename std::enable_if<(
│ │ │ │ -
89 std::tuple_size<Tuple>::value <= I
│ │ │ │ -
90 )>::type;
│ │ │ │ +
25
│ │ │ │ +
26namespace pqxx
│ │ │ │ +
27{
│ │ │ │ +
28
│ │ │ │ +
33
│ │ │ │ +
79class PQXX_LIBEXPORT subtransaction :
│ │ │ │ + │ │ │ │ +
81 public dbtransaction
│ │ │ │ +
82{
│ │ │ │ +
83public:
│ │ │ │ +
85 explicit subtransaction( //[t88]
│ │ │ │ +
86 dbtransaction &T, const std::string &Name=std::string{});
│ │ │ │ +
87
│ │ │ │ +
89 explicit subtransaction(
│ │ │ │ +
90 subtransaction &T, const std::string &Name=std::string{});
│ │ │ │
91
│ │ │ │ -
92 template<typename T> void extract_value(
│ │ │ │ -
93 const std::string &line,
│ │ │ │ -
94 T& t,
│ │ │ │ -
95 std::string::size_type &here,
│ │ │ │ -
96 std::string &workspace
│ │ │ │ -
97 ) const;
│ │ │ │ -
98};
│ │ │ │ +
92 virtual ~subtransaction() noexcept
│ │ │ │ +
93 { End(); }
│ │ │ │ +
94
│ │ │ │ +
95private:
│ │ │ │ +
96 virtual void do_begin() override; //[t88]
│ │ │ │ +
97 virtual void do_commit() override; //[t88]
│ │ │ │ +
98 virtual void do_abort() override; //[t88]
│ │ │ │
99
│ │ │ │ -
100
│ │ │ │ -
101template<typename Columns> stream_from::stream_from(
│ │ │ │ - │ │ │ │ -
103 const std::string &table_name,
│ │ │ │ -
104 const Columns& columns
│ │ │ │ -
105) : stream_from{
│ │ │ │ -
106 tb,
│ │ │ │ -
107 table_name,
│ │ │ │ -
108 std::begin(columns),
│ │ │ │ -
109 std::end(columns)
│ │ │ │ -
110} {}
│ │ │ │ -
111
│ │ │ │ -
112
│ │ │ │ -
113template<typename Iter> stream_from::stream_from(
│ │ │ │ - │ │ │ │ -
115 const std::string &table_name,
│ │ │ │ -
116 Iter columns_begin,
│ │ │ │ -
117 Iter columns_end
│ │ │ │ -
118) :
│ │ │ │ -
119 namedclass{"stream_from", table_name},
│ │ │ │ -
120 stream_base{tb}
│ │ │ │ -
121{
│ │ │ │ -
122 set_up(
│ │ │ │ -
123 tb,
│ │ │ │ -
124 table_name,
│ │ │ │ -
125 columnlist(columns_begin, columns_end)
│ │ │ │ -
126 );
│ │ │ │ -
127}
│ │ │ │ -
128
│ │ │ │ -
129
│ │ │ │ -
130template<typename Tuple> stream_from & stream_from::operator>>(
│ │ │ │ -
131 Tuple &t
│ │ │ │ -
132)
│ │ │ │ -
133{
│ │ │ │ -
134 if (m_retry_line or get_raw_line(m_current_line))
│ │ │ │ -
135 {
│ │ │ │ -
136 std::string workspace;
│ │ │ │ -
137 try
│ │ │ │ -
138 {
│ │ │ │ -
139 tokenize_ith<Tuple, 0>(m_current_line, t, 0, workspace);
│ │ │ │ -
140 m_retry_line = false;
│ │ │ │ -
141 }
│ │ │ │ -
142 catch (...)
│ │ │ │ -
143 {
│ │ │ │ -
144 m_retry_line = true;
│ │ │ │ -
145 throw;
│ │ │ │ -
146 }
│ │ │ │ -
147 }
│ │ │ │ -
148 return *this;
│ │ │ │ -
149}
│ │ │ │ -
150
│ │ │ │ -
151
│ │ │ │ -
152template<typename Tuple, std::size_t I> auto stream_from::tokenize_ith(
│ │ │ │ -
153 const std::string &line,
│ │ │ │ -
154 Tuple &t,
│ │ │ │ -
155 std::string::size_type here,
│ │ │ │ -
156 std::string &workspace
│ │ │ │ -
157) const -> typename std::enable_if<(
│ │ │ │ -
158 std::tuple_size<Tuple>::value > I
│ │ │ │ -
159)>::type
│ │ │ │ -
160{
│ │ │ │ -
161 if (here >= line.size())
│ │ │ │ -
162 throw usage_error{"Too few fields to extract from stream_from line."};
│ │ │ │ -
163
│ │ │ │ -
164 extract_value(line, std::get<I>(t), here, workspace);
│ │ │ │ -
165 tokenize_ith<Tuple, I+1>(line, t, here, workspace);
│ │ │ │ -
166}
│ │ │ │ -
167
│ │ │ │ -
168
│ │ │ │ -
169template<typename Tuple, std::size_t I> auto stream_from::tokenize_ith(
│ │ │ │ -
170 const std::string &line,
│ │ │ │ -
171 Tuple & /* t */,
│ │ │ │ -
172 std::string::size_type here,
│ │ │ │ -
173 std::string & /* workspace */
│ │ │ │ -
174) const -> typename std::enable_if<(
│ │ │ │ -
175 std::tuple_size<Tuple>::value <= I
│ │ │ │ -
176)>::type
│ │ │ │ -
177{
│ │ │ │ -
178 // Zero-column line may still have a trailing newline
│ │ │ │ -
179 if (
│ │ │ │ -
180 here < line.size() and
│ │ │ │ -
181 not (here == line.size() - 1 and line[here] == '\n'))
│ │ │ │ -
182 throw usage_error{"Not all fields extracted from stream_from line"};
│ │ │ │ -
183}
│ │ │ │ -
184
│ │ │ │ -
185
│ │ │ │ -
186template<typename T> void stream_from::extract_value(
│ │ │ │ -
187 const std::string &line,
│ │ │ │ -
188 T& t,
│ │ │ │ -
189 std::string::size_type &here,
│ │ │ │ -
190 std::string &workspace
│ │ │ │ -
191) const
│ │ │ │ -
192{
│ │ │ │ -
193 if (extract_field(line, here, workspace))
│ │ │ │ -
194 from_string<T>(workspace, t);
│ │ │ │ -
195 else
│ │ │ │ -
196 t = internal::null_value<T>();
│ │ │ │ -
197}
│ │ │ │ -
198
│ │ │ │ -
199template<> void stream_from::extract_value<std::nullptr_t>(
│ │ │ │ -
200 const std::string &line,
│ │ │ │ -
201 std::nullptr_t&,
│ │ │ │ -
202 std::string::size_type &here,
│ │ │ │ -
203 std::string &workspace
│ │ │ │ -
204) const;
│ │ │ │ -
205
│ │ │ │ -
206} // namespace pqxx
│ │ │ │ -
207
│ │ │ │ -
208
│ │ │ │ -
209#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
210#endif
│ │ │ │ -
STL namespace.
│ │ │ │ +
100 dbtransaction &m_parent;
│ │ │ │ +
101};
│ │ │ │ +
102}
│ │ │ │ +
103
│ │ │ │ +
104#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
105#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:220
│ │ │ │ -
Definition: stream_base.hxx:29
│ │ │ │ -
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
│ │ │ │ -
Efficiently pull data directly out of a table.
Definition: stream_from.hxx:30
│ │ │ │ -
stream_from & operator>>(Tuple &)
Definition: stream_from.hxx:130
│ │ │ │ -
stream_from(transaction_base &, const std::string &table_name)
Definition: stream_from.cxx:41
│ │ │ │ -
bool get_raw_line(std::string &)
Definition: stream_from.cxx:72
│ │ │ │ -
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │ +
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ +
"Transaction" nested within another transaction
Definition: subtransaction.hxx:82
│ │ │ │ +
virtual ~subtransaction() noexcept
Definition: subtransaction.hxx:92
│ │ │ │ +
Definition: transaction_base.hxx:44
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,238 +1,69 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -stream_from.hxx │ │ │ │ │ +subtransaction.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_STREAM_FROM │ │ │ │ │ - 14#define PQXX_H_STREAM_FROM │ │ │ │ │ + 13#ifndef PQXX_H_SUBTRANSACTION │ │ │ │ │ + 14#define PQXX_H_SUBTRANSACTION │ │ │ │ │ 15 │ │ │ │ │ 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18#include "pqxx/transaction_base.hxx" │ │ │ │ │ - 19#include "pqxx/stream_base.hxx" │ │ │ │ │ - 20#include "pqxx/internal/type_utils.hxx" │ │ │ │ │ + 18 │ │ │ │ │ + 19#include "pqxx/dbtransaction.hxx" │ │ │ │ │ + 20 │ │ │ │ │ 21 │ │ │ │ │ - 22#include │ │ │ │ │ - 23 │ │ │ │ │ + 22/* Methods tested in eg. self-test program test1 are marked with "//[t01]" │ │ │ │ │ + 23 */ │ │ │ │ │ 24 │ │ │ │ │ - 25namespace pqxx │ │ │ │ │ - 26{ │ │ │ │ │ - 27 │ │ │ │ │ -29class PQXX_LIBEXPORT stream_from : public stream_base │ │ │ │ │ - 30{ │ │ │ │ │ - 31public: │ │ │ │ │ - 32 stream_from( │ │ │ │ │ - 33 transaction_base &, │ │ │ │ │ - 34 const std::string &table_name │ │ │ │ │ - 35 ); │ │ │ │ │ - 36 template stream_from( │ │ │ │ │ - 37 transaction_base &, │ │ │ │ │ - 38 const std::string &table_name, │ │ │ │ │ - 39 const Columns& columns │ │ │ │ │ - 40 ); │ │ │ │ │ - 41 template stream_from( │ │ │ │ │ - 42 transaction_base &, │ │ │ │ │ - 43 const std::string &table_name, │ │ │ │ │ - 44 Iter columns_begin, │ │ │ │ │ - 45 Iter columns_end │ │ │ │ │ - 46 ); │ │ │ │ │ - 47 │ │ │ │ │ - 48 ~stream_from() noexcept; │ │ │ │ │ - 49 │ │ │ │ │ - 50 void complete() override; │ │ │ │ │ - 51 │ │ │ │ │ - 52 bool get_raw_line(std::string &); │ │ │ │ │ - 53 template stream_from & operator>>(Tuple &); │ │ │ │ │ - 54 │ │ │ │ │ - 55private: │ │ │ │ │ - 56 internal::encoding_group m_copy_encoding; │ │ │ │ │ - 57 std::string m_current_line; │ │ │ │ │ - 58 bool m_retry_line; │ │ │ │ │ - 59 │ │ │ │ │ - 60 void set_up(transaction_base &, const std::string &table_name); │ │ │ │ │ - 61 void set_up( │ │ │ │ │ - 62 transaction_base &, │ │ │ │ │ - 63 const std::string &table_name, │ │ │ │ │ - 64 const std::string &columns │ │ │ │ │ - 65 ); │ │ │ │ │ - 66 │ │ │ │ │ - 67 void close() override; │ │ │ │ │ - 68 │ │ │ │ │ - 69 bool extract_field( │ │ │ │ │ - 70 const std::string &, │ │ │ │ │ - 71 std::string::size_type &, │ │ │ │ │ - 72 std::string & │ │ │ │ │ - 73 ) const; │ │ │ │ │ - 74 │ │ │ │ │ - 75 template auto tokenize_ith( │ │ │ │ │ - 76 const std::string &, │ │ │ │ │ - 77 Tuple &, │ │ │ │ │ - 78 std::string::size_type, │ │ │ │ │ - 79 std::string & │ │ │ │ │ - 80 ) const -> typename std::enable_if<( │ │ │ │ │ - 81 std::tuple_size::value > I │ │ │ │ │ - 82 )>::type; │ │ │ │ │ - 83 template auto tokenize_ith( │ │ │ │ │ - 84 const std::string &, │ │ │ │ │ - 85 Tuple &, │ │ │ │ │ - 86 std::string::size_type, │ │ │ │ │ - 87 std::string & │ │ │ │ │ - 88 ) const -> typename std::enable_if<( │ │ │ │ │ - 89 std::tuple_size::value <= I │ │ │ │ │ - 90 )>::type; │ │ │ │ │ + 25 │ │ │ │ │ + 26namespace pqxx │ │ │ │ │ + 27{ │ │ │ │ │ + 28 │ │ │ │ │ + 33 │ │ │ │ │ +79class PQXX_LIBEXPORT subtransaction : │ │ │ │ │ + 80 public internal::transactionfocus, │ │ │ │ │ + 81 public dbtransaction │ │ │ │ │ + 82{ │ │ │ │ │ + 83public: │ │ │ │ │ + 85 explicit subtransaction( //[t88] │ │ │ │ │ + 86 dbtransaction &T, const std::string &Name=std::string{}); │ │ │ │ │ + 87 │ │ │ │ │ + 89 explicit subtransaction( │ │ │ │ │ + 90 subtransaction &T, const std::string &Name=std::string{}); │ │ │ │ │ 91 │ │ │ │ │ - 92 template void extract_value( │ │ │ │ │ - 93 const std::string &line, │ │ │ │ │ - 94 T& t, │ │ │ │ │ - 95 std::string::size_type &here, │ │ │ │ │ - 96 std::string &workspace │ │ │ │ │ - 97 ) const; │ │ │ │ │ - 98}; │ │ │ │ │ +92 virtual ~subtransaction() noexcept │ │ │ │ │ + 93 { End(); } │ │ │ │ │ + 94 │ │ │ │ │ + 95private: │ │ │ │ │ + 96 virtual void do_begin() override; //[t88] │ │ │ │ │ + 97 virtual void do_commit() override; //[t88] │ │ │ │ │ + 98 virtual void do_abort() override; //[t88] │ │ │ │ │ 99 │ │ │ │ │ - 100 │ │ │ │ │ -101template stream_from::stream_from( │ │ │ │ │ - 102 transaction_base &tb, │ │ │ │ │ - 103 const std::string &table_name, │ │ │ │ │ - 104 const Columns& columns │ │ │ │ │ - 105) : stream_from{ │ │ │ │ │ - 106 tb, │ │ │ │ │ - 107 table_name, │ │ │ │ │ - 108 std::begin(columns), │ │ │ │ │ - 109 std::end(columns) │ │ │ │ │ - 110} {} │ │ │ │ │ - 111 │ │ │ │ │ - 112 │ │ │ │ │ -113template stream_from::stream_from( │ │ │ │ │ - 114 transaction_base &tb, │ │ │ │ │ - 115 const std::string &table_name, │ │ │ │ │ - 116 Iter columns_begin, │ │ │ │ │ - 117 Iter columns_end │ │ │ │ │ - 118) : │ │ │ │ │ - 119 namedclass{"stream_from", table_name}, │ │ │ │ │ - 120 stream_base{tb} │ │ │ │ │ - 121{ │ │ │ │ │ - 122 set_up( │ │ │ │ │ - 123 tb, │ │ │ │ │ - 124 table_name, │ │ │ │ │ - 125 columnlist(columns_begin, columns_end) │ │ │ │ │ - 126 ); │ │ │ │ │ - 127} │ │ │ │ │ - 128 │ │ │ │ │ - 129 │ │ │ │ │ -130template stream_from & stream_from::operator>>( │ │ │ │ │ - 131 Tuple &t │ │ │ │ │ - 132) │ │ │ │ │ - 133{ │ │ │ │ │ - 134 if (m_retry_line or get_raw_line(m_current_line)) │ │ │ │ │ - 135 { │ │ │ │ │ - 136 std::string workspace; │ │ │ │ │ - 137 try │ │ │ │ │ - 138 { │ │ │ │ │ - 139 tokenize_ith(m_current_line, t, 0, workspace); │ │ │ │ │ - 140 m_retry_line = false; │ │ │ │ │ - 141 } │ │ │ │ │ - 142 catch (...) │ │ │ │ │ - 143 { │ │ │ │ │ - 144 m_retry_line = true; │ │ │ │ │ - 145 throw; │ │ │ │ │ - 146 } │ │ │ │ │ - 147 } │ │ │ │ │ - 148 return *this; │ │ │ │ │ - 149} │ │ │ │ │ - 150 │ │ │ │ │ - 151 │ │ │ │ │ - 152template auto stream_from::tokenize_ith( │ │ │ │ │ - 153 const std::string &line, │ │ │ │ │ - 154 Tuple &t, │ │ │ │ │ - 155 std::string::size_type here, │ │ │ │ │ - 156 std::string &workspace │ │ │ │ │ - 157) const -> typename std::enable_if<( │ │ │ │ │ - 158 std::tuple_size::value > I │ │ │ │ │ - 159)>::type │ │ │ │ │ - 160{ │ │ │ │ │ - 161 if (here >= line.size()) │ │ │ │ │ - 162 throw usage_error{"Too few fields to extract from stream_from line."}; │ │ │ │ │ - 163 │ │ │ │ │ - 164 extract_value(line, std::get(t), here, workspace); │ │ │ │ │ - 165 tokenize_ith(line, t, here, workspace); │ │ │ │ │ - 166} │ │ │ │ │ - 167 │ │ │ │ │ - 168 │ │ │ │ │ - 169template auto stream_from::tokenize_ith( │ │ │ │ │ - 170 const std::string &line, │ │ │ │ │ - 171 Tuple & /* t */, │ │ │ │ │ - 172 std::string::size_type here, │ │ │ │ │ - 173 std::string & /* workspace */ │ │ │ │ │ - 174) const -> typename std::enable_if<( │ │ │ │ │ - 175 std::tuple_size::value <= I │ │ │ │ │ - 176)>::type │ │ │ │ │ - 177{ │ │ │ │ │ - 178 // Zero-column line may still have a trailing newline │ │ │ │ │ - 179 if ( │ │ │ │ │ - 180 here < line.size() and │ │ │ │ │ - 181 not (here == line.size() - 1 and line[here] == '\n')) │ │ │ │ │ - 182 throw usage_error{"Not all fields extracted from stream_from line"}; │ │ │ │ │ - 183} │ │ │ │ │ - 184 │ │ │ │ │ - 185 │ │ │ │ │ - 186template void stream_from::extract_value( │ │ │ │ │ - 187 const std::string &line, │ │ │ │ │ - 188 T& t, │ │ │ │ │ - 189 std::string::size_type &here, │ │ │ │ │ - 190 std::string &workspace │ │ │ │ │ - 191) const │ │ │ │ │ - 192{ │ │ │ │ │ - 193 if (extract_field(line, here, workspace)) │ │ │ │ │ - 194 from_string(workspace, t); │ │ │ │ │ - 195 else │ │ │ │ │ - 196 t = internal::null_value(); │ │ │ │ │ - 197} │ │ │ │ │ - 198 │ │ │ │ │ -199template<> void stream_from::extract_value( │ │ │ │ │ - 200 const std::string &line, │ │ │ │ │ - 201 std::nullptr_t&, │ │ │ │ │ - 202 std::string::size_type &here, │ │ │ │ │ - 203 std::string &workspace │ │ │ │ │ - 204) const; │ │ │ │ │ - 205 │ │ │ │ │ - 206} // namespace pqxx │ │ │ │ │ - 207 │ │ │ │ │ - 208 │ │ │ │ │ - 209#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 210#endif │ │ │ │ │ -std │ │ │ │ │ -STL namespace. │ │ │ │ │ + 100 dbtransaction &m_parent; │ │ │ │ │ + 101}; │ │ │ │ │ + 102} │ │ │ │ │ + 103 │ │ │ │ │ + 104#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 105#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::usage_error │ │ │ │ │ -Error in usage of libpqxx library, similar to std::logic_error. │ │ │ │ │ -Definition: except.hxx:220 │ │ │ │ │ -pqxx::stream_base │ │ │ │ │ -Definition: stream_base.hxx:29 │ │ │ │ │ -pqxx::stream_base::columnlist │ │ │ │ │ -static std::string columnlist(const C &) │ │ │ │ │ -Definition: stream_base.hxx:48 │ │ │ │ │ -pqxx::stream_from │ │ │ │ │ -Efficiently pull data directly out of a table. │ │ │ │ │ -Definition: stream_from.hxx:30 │ │ │ │ │ -pqxx::stream_from::operator>> │ │ │ │ │ -stream_from & operator>>(Tuple &) │ │ │ │ │ -Definition: stream_from.hxx:130 │ │ │ │ │ -pqxx::stream_from::stream_from │ │ │ │ │ -stream_from(transaction_base &, const std::string &table_name) │ │ │ │ │ -Definition: stream_from.cxx:41 │ │ │ │ │ -pqxx::stream_from::get_raw_line │ │ │ │ │ -bool get_raw_line(std::string &) │ │ │ │ │ -Definition: stream_from.cxx:72 │ │ │ │ │ -pqxx::transaction_base │ │ │ │ │ -Interface definition (and common code) for "transaction" classes. │ │ │ │ │ -Definition: transaction_base.hxx:138 │ │ │ │ │ +pqxx::dbtransaction │ │ │ │ │ +Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ +Definition: dbtransaction.hxx:63 │ │ │ │ │ +pqxx::subtransaction │ │ │ │ │ +"Transaction" nested within another transaction │ │ │ │ │ +Definition: subtransaction.hxx:82 │ │ │ │ │ +pqxx::subtransaction::~subtransaction │ │ │ │ │ +virtual ~subtransaction() noexcept │ │ │ │ │ +Definition: subtransaction.hxx:92 │ │ │ │ │ +pqxx::internal::transactionfocus │ │ │ │ │ +Definition: transaction_base.hxx:44 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * stream_from.hxx │ │ │ │ │ + * subtransaction.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00014_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: util.hxx Source File │ │ │ │ +libpqxx: connectionpolicy.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,288 +55,69 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
util.hxx
│ │ │ │ +
connectionpolicy.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
11#ifndef PQXX_H_UTIL
│ │ │ │ -
12#define PQXX_H_UTIL
│ │ │ │ -
13
│ │ │ │ -
14#include "pqxx/compiler-public.hxx"
│ │ │ │ -
15
│ │ │ │ -
16#include <cstdio>
│ │ │ │ -
17#include <cctype>
│ │ │ │ -
18#include <iterator>
│ │ │ │ -
19#include <memory>
│ │ │ │ -
20#include <stdexcept>
│ │ │ │ -
21#include <string>
│ │ │ │ -
22#include <type_traits>
│ │ │ │ -
23#include <typeinfo>
│ │ │ │ -
24#include <vector>
│ │ │ │ +
12#ifndef PQXX_H_CONNECTIONPOLICY
│ │ │ │ +
13#define PQXX_H_CONNECTIONPOLICY
│ │ │ │ +
14
│ │ │ │ +
15#include "pqxx/compiler-public.hxx"
│ │ │ │ +
16#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
17
│ │ │ │ +
18#include <string>
│ │ │ │ +
19
│ │ │ │ +
20#include "pqxx/internal/libpq-forward.hxx"
│ │ │ │ +
21
│ │ │ │ +
22
│ │ │ │ +
23namespace pqxx
│ │ │ │ +
24{
│ │ │ │
25
│ │ │ │ -
26#include "pqxx/strconv.hxx"
│ │ │ │ -
27
│ │ │ │ -
28
│ │ │ │ -
30namespace pqxx {}
│ │ │ │ -
31
│ │ │ │ -
32#include <pqxx/internal/libpq-forward.hxx>
│ │ │ │ -
33
│ │ │ │ -
34
│ │ │ │ -
35namespace pqxx
│ │ │ │ -
36{
│ │ │ │ -
38template<typename T> inline void ignore_unused(T) {}
│ │ │ │ -
39
│ │ │ │ +
30
│ │ │ │ +
31class PQXX_LIBEXPORT connectionpolicy
│ │ │ │ +
32{
│ │ │ │ +
33public:
│ │ │ │ +
34 using handle = internal::pq::PGconn *;
│ │ │ │ +
35
│ │ │ │ +
36 explicit connectionpolicy(const std::string &opts);
│ │ │ │ +
37 virtual ~connectionpolicy() noexcept;
│ │ │ │ +
38
│ │ │ │ +
39 const std::string &options() const noexcept { return m_options; }
│ │ │ │
40
│ │ │ │ -
42
│ │ │ │ -
44struct PQXX_LIBEXPORT thread_safety_model
│ │ │ │ -
45{
│ │ │ │ -
47 bool have_safe_strerror = true;
│ │ │ │ -
48
│ │ │ │ - │ │ │ │ -
51
│ │ │ │ -
53 bool safe_query_cancel = true;
│ │ │ │ -
54
│ │ │ │ -
56 bool safe_result_copy = true;
│ │ │ │ -
57
│ │ │ │ -
59
│ │ │ │ - │ │ │ │ -
66
│ │ │ │ -
68 std::string description;
│ │ │ │ -
69};
│ │ │ │ -
70
│ │ │ │ -
71
│ │ │ │ -
73PQXX_LIBEXPORT thread_safety_model describe_thread_safety() noexcept;
│ │ │ │ -
74
│ │ │ │ -
75
│ │ │ │ -
77constexpr oid oid_none = 0;
│ │ │ │ -
78
│ │ │ │ -
79
│ │ │ │ -
84
│ │ │ │ -
86
│ │ │ │ -
94template<typename ITER, typename ACCESS> inline
│ │ │ │ -
95std::string separated_list( //[t00]
│ │ │ │ -
96 const std::string &sep,
│ │ │ │ -
97 ITER begin,
│ │ │ │ -
98 ITER end,
│ │ │ │ -
99 ACCESS access)
│ │ │ │ -
100{
│ │ │ │ -
101 std::string result;
│ │ │ │ -
102 if (begin != end)
│ │ │ │ -
103 {
│ │ │ │ -
104 result = to_string(access(begin));
│ │ │ │ -
105 for (++begin; begin != end; ++begin)
│ │ │ │ -
106 {
│ │ │ │ -
107 result += sep;
│ │ │ │ -
108 result += to_string(access(begin));
│ │ │ │ -
109 }
│ │ │ │ -
110 }
│ │ │ │ -
111 return result;
│ │ │ │ -
112}
│ │ │ │ -
113
│ │ │ │ -
114
│ │ │ │ -
116template<typename ITER> inline std::string
│ │ │ │ -
117separated_list(const std::string &sep, ITER begin, ITER end) //[t00]
│ │ │ │ -
118 { return separated_list(sep, begin, end, [](ITER i){ return *i; }); }
│ │ │ │ -
119
│ │ │ │ -
120
│ │ │ │ -
122template<typename CONTAINER> inline auto
│ │ │ │ -
123separated_list(const std::string &sep, const CONTAINER &c) //[t10]
│ │ │ │ -
124 /*
│ │ │ │ -
125 Always std::string; necessary because SFINAE doesn't work with the
│ │ │ │ -
126 contents of function bodies, so the check for iterability has to be in
│ │ │ │ -
127 the signature.
│ │ │ │ -
128 */
│ │ │ │ -
129 -> typename std::enable_if<
│ │ │ │ -
130 (
│ │ │ │ -
131 not std::is_void<decltype(std::begin(c))>::value
│ │ │ │ -
132 and not std::is_void<decltype(std::end(c))>::value
│ │ │ │ -
133 ),
│ │ │ │ -
134 std::string
│ │ │ │ -
135 >::type
│ │ │ │ -
136{
│ │ │ │ -
137 return separated_list(sep, std::begin(c), std::end(c));
│ │ │ │ -
138}
│ │ │ │ -
139
│ │ │ │ -
140
│ │ │ │ -
142template<
│ │ │ │ -
143 typename TUPLE,
│ │ │ │ -
144 std::size_t INDEX=0,
│ │ │ │ -
145 typename ACCESS,
│ │ │ │ -
146 typename std::enable_if<
│ │ │ │ -
147 (INDEX == std::tuple_size<TUPLE>::value-1),
│ │ │ │ -
148 int
│ │ │ │ -
149 >::type=0
│ │ │ │ -
150>
│ │ │ │ -
151inline std::string
│ │ │ │ - │ │ │ │ -
153 const std::string & /* sep */,
│ │ │ │ -
154 const TUPLE &t,
│ │ │ │ -
155 const ACCESS& access
│ │ │ │ -
156)
│ │ │ │ -
157{
│ │ │ │ -
158 return to_string(access(&std::get<INDEX>(t)));
│ │ │ │ -
159}
│ │ │ │ -
160
│ │ │ │ -
161template<
│ │ │ │ -
162 typename TUPLE,
│ │ │ │ -
163 std::size_t INDEX=0,
│ │ │ │ -
164 typename ACCESS,
│ │ │ │ -
165 typename std::enable_if<
│ │ │ │ -
166 (INDEX < std::tuple_size<TUPLE>::value-1),
│ │ │ │ -
167 int
│ │ │ │ -
168 >::type=0
│ │ │ │ -
169>
│ │ │ │ -
170inline std::string
│ │ │ │ -
171separated_list(const std::string &sep, const TUPLE &t, const ACCESS& access)
│ │ │ │ -
172{
│ │ │ │ -
173 return
│ │ │ │ -
174 to_string(access(&std::get<INDEX>(t))) +
│ │ │ │ -
175 sep +
│ │ │ │ -
176 separated_list<TUPLE, INDEX+1>(sep, t, access);
│ │ │ │ -
177}
│ │ │ │ -
178
│ │ │ │ -
179template<
│ │ │ │ -
180 typename TUPLE,
│ │ │ │ -
181 std::size_t INDEX=0,
│ │ │ │ -
182 typename std::enable_if<
│ │ │ │ -
183 (INDEX <= std::tuple_size<TUPLE>::value),
│ │ │ │ -
184 int
│ │ │ │ -
185 >::type=0
│ │ │ │ -
186>
│ │ │ │ -
187inline std::string
│ │ │ │ -
188separated_list(const std::string &sep, const TUPLE &t)
│ │ │ │ -
189{
│ │ │ │ -
190 return separated_list(sep, t, [](const TUPLE &tup){return *tup;});
│ │ │ │ -
191}
│ │ │ │ -
193
│ │ │ │ -
194
│ │ │ │ -
196
│ │ │ │ -
205namespace internal
│ │ │ │ -
206{
│ │ │ │ -
207PQXX_LIBEXPORT void freepqmem(const void *) noexcept;
│ │ │ │ -
208template<typename P> inline void freepqmem_templated(P *p) noexcept
│ │ │ │ -
209{
│ │ │ │ -
210 freepqmem(p);
│ │ │ │ -
211}
│ │ │ │ -
212
│ │ │ │ -
213PQXX_LIBEXPORT void freemallocmem(const void *) noexcept;
│ │ │ │ -
214template<typename P> inline void freemallocmem_templated(P *p) noexcept
│ │ │ │ -
215{
│ │ │ │ -
216 freemallocmem(p);
│ │ │ │ -
217}
│ │ │ │ -
218
│ │ │ │ -
219
│ │ │ │ -
221
│ │ │ │ -
233class PQXX_LIBEXPORT namedclass
│ │ │ │ -
234{
│ │ │ │ -
235public:
│ │ │ │ -
236 explicit namedclass(const std::string &Classname) :
│ │ │ │ -
237 m_classname{Classname},
│ │ │ │ -
238 m_name{}
│ │ │ │ -
239 {
│ │ │ │ -
240 }
│ │ │ │ -
241
│ │ │ │ -
242 namedclass(const std::string &Classname, const std::string &Name) :
│ │ │ │ -
243 m_classname{Classname},
│ │ │ │ -
244 m_name{Name}
│ │ │ │ -
245 {
│ │ │ │ -
246 }
│ │ │ │ -
247
│ │ │ │ -
249 const std::string &name() const noexcept { return m_name; } //[t01]
│ │ │ │ -
250
│ │ │ │ -
252 const std::string &classname() const noexcept //[t73]
│ │ │ │ -
253 { return m_classname; }
│ │ │ │ -
254
│ │ │ │ -
256 std::string description() const;
│ │ │ │ -
257
│ │ │ │ -
258private:
│ │ │ │ -
259 std::string m_classname, m_name;
│ │ │ │ -
260};
│ │ │ │ -
261
│ │ │ │ -
262
│ │ │ │ -
263PQXX_PRIVATE void CheckUniqueRegistration(
│ │ │ │ -
264 const namedclass *New, const namedclass *Old);
│ │ │ │ -
265PQXX_PRIVATE void CheckUniqueUnregistration(
│ │ │ │ -
266 const namedclass *New, const namedclass *Old);
│ │ │ │ -
267
│ │ │ │ -
268
│ │ │ │ -
270
│ │ │ │ -
273template<typename GUEST>
│ │ │ │ - │ │ │ │ -
275{
│ │ │ │ -
276public:
│ │ │ │ -
277 unique() =default;
│ │ │ │ -
278 unique(const unique &) =delete;
│ │ │ │ -
279 unique &operator=(const unique &) =delete;
│ │ │ │ -
280
│ │ │ │ -
281 GUEST *get() const noexcept { return m_guest; }
│ │ │ │ -
282
│ │ │ │ -
283 void register_guest(GUEST *G)
│ │ │ │ -
284 {
│ │ │ │ -
285 CheckUniqueRegistration(G, m_guest);
│ │ │ │ -
286 m_guest = G;
│ │ │ │ -
287 }
│ │ │ │ -
288
│ │ │ │ -
289 void unregister_guest(GUEST *G)
│ │ │ │ -
290 {
│ │ │ │ -
291 CheckUniqueUnregistration(G, m_guest);
│ │ │ │ -
292 m_guest = nullptr;
│ │ │ │ -
293 }
│ │ │ │ -
294
│ │ │ │ -
295private:
│ │ │ │ -
296 GUEST *m_guest = nullptr;
│ │ │ │ -
297};
│ │ │ │ -
298
│ │ │ │ -
299
│ │ │ │ -
301
│ │ │ │ -
304PQXX_LIBEXPORT void sleep_seconds(int);
│ │ │ │ -
305
│ │ │ │ -
306} // namespace internal
│ │ │ │ -
307} // namespace pqxx
│ │ │ │ -
308
│ │ │ │ -
309#endif
│ │ │ │ +
41 virtual handle do_startconnect(handle orig);
│ │ │ │ +
42 virtual handle do_completeconnect(handle orig);
│ │ │ │ +
43 virtual handle do_dropconnect(handle orig) noexcept;
│ │ │ │ +
44 virtual handle do_disconnect(handle orig) noexcept;
│ │ │ │ +
45 virtual bool is_ready(handle) const noexcept;
│ │ │ │ +
46
│ │ │ │ +
47protected:
│ │ │ │ +
48 handle normalconnect(handle);
│ │ │ │ +
49
│ │ │ │ +
50private:
│ │ │ │ +
51 std::string m_options;
│ │ │ │ +
52};
│ │ │ │ +
53
│ │ │ │ +
55} // namespace
│ │ │ │ +
56
│ │ │ │ +
57#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
58
│ │ │ │ +
59#endif
│ │ │ │
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
thread_safety_model describe_thread_safety() noexcept
Describe thread safety available in this build.
Definition: util.cxx:31
│ │ │ │ -
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
│ │ │ │ -
void ignore_unused(T)
Suppress compiler warning about an unused item.
Definition: util.hxx:38
│ │ │ │ -
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
│ │ │ │ -
constexpr oid oid_none
The "null" oid.
Definition: util.hxx:77
│ │ │ │ -
void freepqmem_templated(P *p) noexcept
Definition: util.hxx:208
│ │ │ │ -
void CheckUniqueUnregistration(const namedclass *New, const namedclass *Old)
Definition: util.cxx:88
│ │ │ │ -
void CheckUniqueRegistration(const namedclass *New, const namedclass *Old)
Definition: util.cxx:72
│ │ │ │ -
void freemallocmem(const void *) noexcept
Definition: util.cxx:112
│ │ │ │ -
void freepqmem(const void *) noexcept
Definition: util.cxx:106
│ │ │ │ -
void freemallocmem_templated(P *p) noexcept
Definition: util.hxx:214
│ │ │ │ -
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ -
Descriptor of library's thread-safety model.
Definition: util.hxx:45
│ │ │ │ -
bool safe_libpq
Is the underlying libpq build thread-safe?
Definition: util.hxx:50
│ │ │ │ -
bool safe_kerberos
Is Kerberos thread-safe?
Definition: util.hxx:65
│ │ │ │ -
std::string description
A human-readable description of any thread-safety issues.
Definition: util.hxx:68
│ │ │ │ -
Helper base class: object descriptions for error messages and such.
Definition: util.hxx:234
│ │ │ │ -
const std::string & classname() const noexcept
Class name.
Definition: util.hxx:252
│ │ │ │ -
namedclass(const std::string &Classname, const std::string &Name)
Definition: util.hxx:242
│ │ │ │ -
namedclass(const std::string &Classname)
Definition: util.hxx:236
│ │ │ │ -
const std::string & name() const noexcept
Object name, or the empty string if no name was given.
Definition: util.hxx:249
│ │ │ │ -
Ensure proper opening/closing of GUEST objects related to a "host" object.
Definition: util.hxx:275
│ │ │ │ - │ │ │ │ -
unique(const unique &)=delete
│ │ │ │ -
GUEST * get() const noexcept
Definition: util.hxx:281
│ │ │ │ -
void unregister_guest(GUEST *G)
Definition: util.hxx:289
│ │ │ │ -
void register_guest(GUEST *G)
Definition: util.hxx:283
│ │ │ │ -
unique & operator=(const unique &)=delete
│ │ │ │ +
Definition: connectionpolicy.hxx:32
│ │ │ │ +
internal::pq::PGconn * handle
Definition: connectionpolicy.hxx:34
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,347 +1,66 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -util.hxx │ │ │ │ │ +connectionpolicy.hxx │ │ │ │ │ 1 │ │ │ │ │ - 11#ifndef PQXX_H_UTIL │ │ │ │ │ - 12#define PQXX_H_UTIL │ │ │ │ │ - 13 │ │ │ │ │ - 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 15 │ │ │ │ │ - 16#include │ │ │ │ │ - 17#include │ │ │ │ │ - 18#include │ │ │ │ │ - 19#include │ │ │ │ │ - 20#include │ │ │ │ │ - 21#include │ │ │ │ │ - 22#include │ │ │ │ │ - 23#include │ │ │ │ │ - 24#include │ │ │ │ │ + 12#ifndef PQXX_H_CONNECTIONPOLICY │ │ │ │ │ + 13#define PQXX_H_CONNECTIONPOLICY │ │ │ │ │ + 14 │ │ │ │ │ + 15#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 16#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 17 │ │ │ │ │ + 18#include │ │ │ │ │ + 19 │ │ │ │ │ + 20#include "pqxx/internal/libpq-forward.hxx" │ │ │ │ │ + 21 │ │ │ │ │ + 22 │ │ │ │ │ + 23namespace pqxx │ │ │ │ │ + 24{ │ │ │ │ │ 25 │ │ │ │ │ - 26#include "pqxx/strconv.hxx" │ │ │ │ │ - 27 │ │ │ │ │ - 28 │ │ │ │ │ - 30namespace pqxx {} │ │ │ │ │ - 31 │ │ │ │ │ - 32#include │ │ │ │ │ - 33 │ │ │ │ │ - 34 │ │ │ │ │ - 35namespace pqxx │ │ │ │ │ - 36{ │ │ │ │ │ -38template inline void ignore_unused(T) {} │ │ │ │ │ - 39 │ │ │ │ │ + 30 │ │ │ │ │ +31class PQXX_LIBEXPORT connectionpolicy │ │ │ │ │ + 32{ │ │ │ │ │ + 33public: │ │ │ │ │ +34 using handle = internal::pq::PGconn *; │ │ │ │ │ + 35 │ │ │ │ │ + 36 explicit connectionpolicy(const std::string &opts); │ │ │ │ │ + 37 virtual ~connectionpolicy() noexcept; │ │ │ │ │ + 38 │ │ │ │ │ +39 const std::string &options() const noexcept { return m_options; } │ │ │ │ │ 40 │ │ │ │ │ - 42 │ │ │ │ │ -44struct PQXX_LIBEXPORT thread_safety_model │ │ │ │ │ - 45{ │ │ │ │ │ -47 bool have_safe_strerror = true; │ │ │ │ │ - 48 │ │ │ │ │ -50 bool safe_libpq; │ │ │ │ │ - 51 │ │ │ │ │ -53 bool safe_query_cancel = true; │ │ │ │ │ - 54 │ │ │ │ │ -56 bool safe_result_copy = true; │ │ │ │ │ - 57 │ │ │ │ │ - 59 │ │ │ │ │ -65 bool safe_kerberos; │ │ │ │ │ - 66 │ │ │ │ │ -68 std::string description; │ │ │ │ │ - 69}; │ │ │ │ │ - 70 │ │ │ │ │ - 71 │ │ │ │ │ - 73PQXX_LIBEXPORT thread_safety_model describe_thread_safety() noexcept; │ │ │ │ │ - 74 │ │ │ │ │ - 75 │ │ │ │ │ -77constexpr oid oid_none = 0; │ │ │ │ │ - 78 │ │ │ │ │ - 79 │ │ │ │ │ - 84 │ │ │ │ │ - 86 │ │ │ │ │ - 94template inline │ │ │ │ │ -95std::string separated_list( //[t00] │ │ │ │ │ - 96 const std::string &sep, │ │ │ │ │ - 97 ITER begin, │ │ │ │ │ - 98 ITER end, │ │ │ │ │ - 99 ACCESS access) │ │ │ │ │ - 100{ │ │ │ │ │ - 101 std::string result; │ │ │ │ │ - 102 if (begin != end) │ │ │ │ │ - 103 { │ │ │ │ │ - 104 result = to_string(access(begin)); │ │ │ │ │ - 105 for (++begin; begin != end; ++begin) │ │ │ │ │ - 106 { │ │ │ │ │ - 107 result += sep; │ │ │ │ │ - 108 result += to_string(access(begin)); │ │ │ │ │ - 109 } │ │ │ │ │ - 110 } │ │ │ │ │ - 111 return result; │ │ │ │ │ - 112} │ │ │ │ │ - 113 │ │ │ │ │ - 114 │ │ │ │ │ - 116template inline std::string │ │ │ │ │ -117separated_list(const std::string &sep, ITER begin, ITER end) //[t00] │ │ │ │ │ - 118 { return separated_list(sep, begin, end, [](ITER i){ return *i; }); } │ │ │ │ │ - 119 │ │ │ │ │ - 120 │ │ │ │ │ - 122template inline auto │ │ │ │ │ -123separated_list(const std::string &sep, const CONTAINER &c) //[t10] │ │ │ │ │ - 124 /* │ │ │ │ │ - 125 Always std::string; necessary because SFINAE doesn't work with the │ │ │ │ │ - 126 contents of function bodies, so the check for iterability has to be in │ │ │ │ │ - 127 the signature. │ │ │ │ │ - 128 */ │ │ │ │ │ - 129 -> typename std::enable_if< │ │ │ │ │ - 130 ( │ │ │ │ │ - 131 not std::is_void::value │ │ │ │ │ - 132 and not std::is_void::value │ │ │ │ │ - 133 ), │ │ │ │ │ - 134 std::string │ │ │ │ │ - 135 >::type │ │ │ │ │ - 136{ │ │ │ │ │ - 137 return separated_list(sep, std::begin(c), std::end(c)); │ │ │ │ │ - 138} │ │ │ │ │ - 139 │ │ │ │ │ - 140 │ │ │ │ │ - 142template< │ │ │ │ │ - 143 typename TUPLE, │ │ │ │ │ - 144 std::size_t INDEX=0, │ │ │ │ │ - 145 typename ACCESS, │ │ │ │ │ - 146 typename std::enable_if< │ │ │ │ │ - 147 (INDEX == std::tuple_size::value-1), │ │ │ │ │ - 148 int │ │ │ │ │ - 149 >::type=0 │ │ │ │ │ - 150> │ │ │ │ │ - 151inline std::string │ │ │ │ │ -152separated_list( │ │ │ │ │ - 153 const std::string & /* sep */, │ │ │ │ │ - 154 const TUPLE &t, │ │ │ │ │ - 155 const ACCESS& access │ │ │ │ │ - 156) │ │ │ │ │ - 157{ │ │ │ │ │ - 158 return to_string(access(&std::get(t))); │ │ │ │ │ - 159} │ │ │ │ │ - 160 │ │ │ │ │ - 161template< │ │ │ │ │ - 162 typename TUPLE, │ │ │ │ │ - 163 std::size_t INDEX=0, │ │ │ │ │ - 164 typename ACCESS, │ │ │ │ │ - 165 typename std::enable_if< │ │ │ │ │ - 166 (INDEX < std::tuple_size::value-1), │ │ │ │ │ - 167 int │ │ │ │ │ - 168 >::type=0 │ │ │ │ │ - 169> │ │ │ │ │ - 170inline std::string │ │ │ │ │ - 171separated_list(const std::string &sep, const TUPLE &t, const ACCESS& │ │ │ │ │ -access) │ │ │ │ │ - 172{ │ │ │ │ │ - 173 return │ │ │ │ │ - 174 to_string(access(&std::get(t))) + │ │ │ │ │ - 175 sep + │ │ │ │ │ - 176 separated_list(sep, t, access); │ │ │ │ │ - 177} │ │ │ │ │ - 178 │ │ │ │ │ - 179template< │ │ │ │ │ - 180 typename TUPLE, │ │ │ │ │ - 181 std::size_t INDEX=0, │ │ │ │ │ - 182 typename std::enable_if< │ │ │ │ │ - 183 (INDEX <= std::tuple_size::value), │ │ │ │ │ - 184 int │ │ │ │ │ - 185 >::type=0 │ │ │ │ │ - 186> │ │ │ │ │ - 187inline std::string │ │ │ │ │ -188separated_list(const std::string &sep, const TUPLE &t) │ │ │ │ │ - 189{ │ │ │ │ │ - 190 return separated_list(sep, t, [](const TUPLE &tup){return *tup;}); │ │ │ │ │ - 191} │ │ │ │ │ - 193 │ │ │ │ │ - 194 │ │ │ │ │ - 196 │ │ │ │ │ - 205namespace internal │ │ │ │ │ - 206{ │ │ │ │ │ - 207PQXX_LIBEXPORT void freepqmem(const void *) noexcept; │ │ │ │ │ -208template inline void freepqmem_templated(P *p) noexcept │ │ │ │ │ - 209{ │ │ │ │ │ - 210 freepqmem(p); │ │ │ │ │ - 211} │ │ │ │ │ - 212 │ │ │ │ │ - 213PQXX_LIBEXPORT void freemallocmem(const void *) noexcept; │ │ │ │ │ -214template inline void freemallocmem_templated(P *p) noexcept │ │ │ │ │ - 215{ │ │ │ │ │ - 216 freemallocmem(p); │ │ │ │ │ - 217} │ │ │ │ │ - 218 │ │ │ │ │ - 219 │ │ │ │ │ - 221 │ │ │ │ │ -233class PQXX_LIBEXPORT namedclass │ │ │ │ │ - 234{ │ │ │ │ │ - 235public: │ │ │ │ │ -236 explicit namedclass(const std::string &Classname) : │ │ │ │ │ - 237 m_classname{Classname}, │ │ │ │ │ - 238 m_name{} │ │ │ │ │ - 239 { │ │ │ │ │ - 240 } │ │ │ │ │ - 241 │ │ │ │ │ -242 namedclass(const std::string &Classname, const std::string &Name) : │ │ │ │ │ - 243 m_classname{Classname}, │ │ │ │ │ - 244 m_name{Name} │ │ │ │ │ - 245 { │ │ │ │ │ - 246 } │ │ │ │ │ - 247 │ │ │ │ │ -249 const std::string &name() const noexcept { return m_name; } //[t01] │ │ │ │ │ - 250 │ │ │ │ │ -252 const std::string &classname() const noexcept //[t73] │ │ │ │ │ - 253 { return m_classname; } │ │ │ │ │ - 254 │ │ │ │ │ - 256 std::string description() const; │ │ │ │ │ - 257 │ │ │ │ │ - 258private: │ │ │ │ │ - 259 std::string m_classname, m_name; │ │ │ │ │ - 260}; │ │ │ │ │ - 261 │ │ │ │ │ - 262 │ │ │ │ │ - 263PQXX_PRIVATE void CheckUniqueRegistration( │ │ │ │ │ - 264 const namedclass *New, const namedclass *Old); │ │ │ │ │ - 265PQXX_PRIVATE void CheckUniqueUnregistration( │ │ │ │ │ - 266 const namedclass *New, const namedclass *Old); │ │ │ │ │ - 267 │ │ │ │ │ - 268 │ │ │ │ │ - 270 │ │ │ │ │ - 273template │ │ │ │ │ -274class unique │ │ │ │ │ - 275{ │ │ │ │ │ - 276public: │ │ │ │ │ -277 unique() =default; │ │ │ │ │ -278 unique(const unique &) =delete; │ │ │ │ │ -279 unique &operator=(const unique &) =delete; │ │ │ │ │ - 280 │ │ │ │ │ -281 GUEST *get() const noexcept { return m_guest; } │ │ │ │ │ - 282 │ │ │ │ │ -283 void register_guest(GUEST *G) │ │ │ │ │ - 284 { │ │ │ │ │ - 285 CheckUniqueRegistration(G, m_guest); │ │ │ │ │ - 286 m_guest = G; │ │ │ │ │ - 287 } │ │ │ │ │ - 288 │ │ │ │ │ -289 void unregister_guest(GUEST *G) │ │ │ │ │ - 290 { │ │ │ │ │ - 291 CheckUniqueUnregistration(G, m_guest); │ │ │ │ │ - 292 m_guest = nullptr; │ │ │ │ │ - 293 } │ │ │ │ │ - 294 │ │ │ │ │ - 295private: │ │ │ │ │ - 296 GUEST *m_guest = nullptr; │ │ │ │ │ - 297}; │ │ │ │ │ - 298 │ │ │ │ │ - 299 │ │ │ │ │ - 301 │ │ │ │ │ - 304PQXX_LIBEXPORT void sleep_seconds(int); │ │ │ │ │ - 305 │ │ │ │ │ - 306} // namespace internal │ │ │ │ │ - 307} // namespace pqxx │ │ │ │ │ - 308 │ │ │ │ │ - 309#endif │ │ │ │ │ + 41 virtual handle do_startconnect(handle orig); │ │ │ │ │ + 42 virtual handle do_completeconnect(handle orig); │ │ │ │ │ + 43 virtual handle do_dropconnect(handle orig) noexcept; │ │ │ │ │ + 44 virtual handle do_disconnect(handle orig) noexcept; │ │ │ │ │ + 45 virtual bool is_ready(handle) const noexcept; │ │ │ │ │ + 46 │ │ │ │ │ + 47protected: │ │ │ │ │ + 48 handle normalconnect(handle); │ │ │ │ │ + 49 │ │ │ │ │ + 50private: │ │ │ │ │ + 51 std::string m_options; │ │ │ │ │ + 52}; │ │ │ │ │ + 53 │ │ │ │ │ + 55} // namespace │ │ │ │ │ + 56 │ │ │ │ │ + 57#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 58 │ │ │ │ │ + 59#endif │ │ │ │ │ std │ │ │ │ │ STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::describe_thread_safety │ │ │ │ │ -thread_safety_model describe_thread_safety() noexcept │ │ │ │ │ -Describe thread safety available in this build. │ │ │ │ │ -Definition: util.cxx:31 │ │ │ │ │ -pqxx::to_string │ │ │ │ │ -std::string to_string(const field &Obj) │ │ │ │ │ -Convert a field to a string. │ │ │ │ │ -Definition: result.cxx:451 │ │ │ │ │ -pqxx::ignore_unused │ │ │ │ │ -void ignore_unused(T) │ │ │ │ │ -Suppress compiler warning about an unused item. │ │ │ │ │ -Definition: util.hxx:38 │ │ │ │ │ -pqxx::separated_list │ │ │ │ │ -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 │ │ │ │ │ -pqxx::oid_none │ │ │ │ │ -constexpr oid oid_none │ │ │ │ │ -The "null" oid. │ │ │ │ │ -Definition: util.hxx:77 │ │ │ │ │ -pqxx::internal::freepqmem_templated │ │ │ │ │ -void freepqmem_templated(P *p) noexcept │ │ │ │ │ -Definition: util.hxx:208 │ │ │ │ │ -pqxx::internal::CheckUniqueUnregistration │ │ │ │ │ -void CheckUniqueUnregistration(const namedclass *New, const namedclass *Old) │ │ │ │ │ -Definition: util.cxx:88 │ │ │ │ │ -pqxx::internal::CheckUniqueRegistration │ │ │ │ │ -void CheckUniqueRegistration(const namedclass *New, const namedclass *Old) │ │ │ │ │ -Definition: util.cxx:72 │ │ │ │ │ -pqxx::internal::freemallocmem │ │ │ │ │ -void freemallocmem(const void *) noexcept │ │ │ │ │ -Definition: util.cxx:112 │ │ │ │ │ -pqxx::internal::freepqmem │ │ │ │ │ -void freepqmem(const void *) noexcept │ │ │ │ │ -Definition: util.cxx:106 │ │ │ │ │ -pqxx::internal::freemallocmem_templated │ │ │ │ │ -void freemallocmem_templated(P *p) noexcept │ │ │ │ │ -Definition: util.hxx:214 │ │ │ │ │ -pqxx::result │ │ │ │ │ -Result set containing data returned by a query or command. │ │ │ │ │ -Definition: result.hxx:70 │ │ │ │ │ -pqxx::thread_safety_model │ │ │ │ │ -Descriptor of library's thread-safety model. │ │ │ │ │ -Definition: util.hxx:45 │ │ │ │ │ -pqxx::thread_safety_model::safe_libpq │ │ │ │ │ -bool safe_libpq │ │ │ │ │ -Is the underlying libpq build thread-safe? │ │ │ │ │ -Definition: util.hxx:50 │ │ │ │ │ -pqxx::thread_safety_model::safe_kerberos │ │ │ │ │ -bool safe_kerberos │ │ │ │ │ -Is Kerberos thread-safe? │ │ │ │ │ -Definition: util.hxx:65 │ │ │ │ │ -pqxx::thread_safety_model::description │ │ │ │ │ -std::string description │ │ │ │ │ -A human-readable description of any thread-safety issues. │ │ │ │ │ -Definition: util.hxx:68 │ │ │ │ │ -pqxx::internal::namedclass │ │ │ │ │ -Helper base class: object descriptions for error messages and such. │ │ │ │ │ -Definition: util.hxx:234 │ │ │ │ │ -pqxx::internal::namedclass::classname │ │ │ │ │ -const std::string & classname() const noexcept │ │ │ │ │ -Class name. │ │ │ │ │ -Definition: util.hxx:252 │ │ │ │ │ -pqxx::internal::namedclass::namedclass │ │ │ │ │ -namedclass(const std::string &Classname, const std::string &Name) │ │ │ │ │ -Definition: util.hxx:242 │ │ │ │ │ -pqxx::internal::namedclass::namedclass │ │ │ │ │ -namedclass(const std::string &Classname) │ │ │ │ │ -Definition: util.hxx:236 │ │ │ │ │ -pqxx::internal::namedclass::name │ │ │ │ │ -const std::string & name() const noexcept │ │ │ │ │ -Object name, or the empty string if no name was given. │ │ │ │ │ -Definition: util.hxx:249 │ │ │ │ │ -pqxx::internal::unique │ │ │ │ │ -Ensure proper opening/closing of GUEST objects related to a "host" object. │ │ │ │ │ -Definition: util.hxx:275 │ │ │ │ │ -pqxx::internal::unique::unique │ │ │ │ │ -unique()=default │ │ │ │ │ -pqxx::internal::unique::unique │ │ │ │ │ -unique(const unique &)=delete │ │ │ │ │ -pqxx::internal::unique::get │ │ │ │ │ -GUEST * get() const noexcept │ │ │ │ │ -Definition: util.hxx:281 │ │ │ │ │ -pqxx::internal::unique::unregister_guest │ │ │ │ │ -void unregister_guest(GUEST *G) │ │ │ │ │ -Definition: util.hxx:289 │ │ │ │ │ -pqxx::internal::unique::register_guest │ │ │ │ │ -void register_guest(GUEST *G) │ │ │ │ │ -Definition: util.hxx:283 │ │ │ │ │ -pqxx::internal::unique::operator= │ │ │ │ │ -unique & operator=(const unique &)=delete │ │ │ │ │ +pqxx::connectionpolicy │ │ │ │ │ +Definition: connectionpolicy.hxx:32 │ │ │ │ │ +pqxx::connectionpolicy::handle │ │ │ │ │ +internal::pq::PGconn * handle │ │ │ │ │ +Definition: connectionpolicy.hxx:34 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * util.hxx │ │ │ │ │ + * connectionpolicy.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00017_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: compiler-internal-pre.hxx Source File │ │ │ │ +libpqxx: basic_connection.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,43 +55,110 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
compiler-internal-pre.hxx
│ │ │ │ +
basic_connection.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
15// NO GUARDS HERE! This code should be executed every time!
│ │ │ │ -
16
│ │ │ │ -
17#ifdef _WIN32
│ │ │ │ -
18#ifdef _MSC_VER
│ │ │ │ -
19
│ │ │ │ -
20// Save client program warning state, and set warning level 4.
│ │ │ │ -
21// Setting the warning level explicitly ensures that libpqxx
│ │ │ │ -
22// headers will work with this warning level as well.
│ │ │ │ -
23#pragma warning (push,4)
│ │ │ │ +
13#ifndef PQXX_H_BASIC_CONNECTION
│ │ │ │ +
14#define PQXX_H_BASIC_CONNECTION
│ │ │ │ +
15
│ │ │ │ +
16#include "pqxx/compiler-public.hxx"
│ │ │ │ +
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
18
│ │ │ │ +
19#include <cstddef>
│ │ │ │ +
20#include <memory>
│ │ │ │ +
21#include <string>
│ │ │ │ +
22
│ │ │ │ +
23#include "pqxx/connection_base.hxx"
│ │ │ │
24
│ │ │ │ -
25#pragma warning (disable: 4251)
│ │ │ │ -
26#pragma warning (disable: 4273)
│ │ │ │ -
27#pragma warning (disable: 4275)
│ │ │ │ -
28#pragma warning (disable: 4355)
│ │ │ │ -
29#pragma warning (disable: 4511) // Copy constructor could not be generated.
│ │ │ │ -
30#pragma warning (disable: 4512) // Assignment operator could not be generated.
│ │ │ │ -
31#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy().
│ │ │ │ -
32
│ │ │ │ -
33#endif // _MSC_VER
│ │ │ │ -
34#endif // _WIN32
│ │ │ │ -
35
│ │ │ │ +
25
│ │ │ │ +
26namespace pqxx
│ │ │ │ +
27{
│ │ │ │ +
28
│ │ │ │ +
30
│ │ │ │ +
45template<typename CONNECTPOLICY> class basic_connection_base :
│ │ │ │ +
46 public connection_base
│ │ │ │ +
47{
│ │ │ │ +
48public:
│ │ │ │ + │ │ │ │ +
50 connection_base(m_policy),
│ │ │ │ +
51 m_options(std::string{}),
│ │ │ │ +
52 m_policy(m_options)
│ │ │ │ +
53 { init(); }
│ │ │ │ +
54
│ │ │ │ +
57 explicit basic_connection_base(const std::string &opt) :
│ │ │ │ +
58 connection_base(m_policy),
│ │ │ │ +
59 m_options(opt),
│ │ │ │ +
60 m_policy(m_options)
│ │ │ │ +
61 {init();}
│ │ │ │ +
62
│ │ │ │ +
64 explicit basic_connection_base(const char opt[]) :
│ │ │ │ +
65 basic_connection_base(opt ? std::string{opt} : std::string{}) {}
│ │ │ │ +
66
│ │ │ │ +
67 explicit basic_connection_base(std::nullptr_t) : basic_connection_base() {}
│ │ │ │ +
68
│ │ │ │ + │ │ │ │ +
70 { close(); }
│ │ │ │ +
71
│ │ │ │ +
72 const std::string &options() const noexcept //[t01]
│ │ │ │ +
73 {return m_policy.options();}
│ │ │ │ +
74
│ │ │ │ +
75private:
│ │ │ │ +
77 std::string m_options;
│ │ │ │ +
79 CONNECTPOLICY m_policy;
│ │ │ │ +
80};
│ │ │ │ +
81
│ │ │ │ +
82
│ │ │ │ +
84
│ │ │ │ +
88template<typename CONNECTPOLICY> struct basic_connection :
│ │ │ │ +
89 basic_connection_base<CONNECTPOLICY>
│ │ │ │ +
90{
│ │ │ │ +
91 PQXX_DEPRECATED basic_connection() =default;
│ │ │ │ +
92 PQXX_DEPRECATED explicit basic_connection(const std::string &opt) :
│ │ │ │ +
93 basic_connection(opt) {}
│ │ │ │ +
94 PQXX_DEPRECATED explicit basic_connection(const char opt[]) :
│ │ │ │ +
95 basic_connection(opt) {}
│ │ │ │ +
96
│ │ │ │ +
97 PQXX_DEPRECATED explicit basic_connection(std::nullptr_t) :
│ │ │ │ + │ │ │ │ +
99
│ │ │ │ +
100 using basic_connection_base<CONNECTPOLICY>::options;
│ │ │ │ +
101};
│ │ │ │ +
102
│ │ │ │ +
103} // namespace
│ │ │ │ +
104
│ │ │ │ +
105#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
106
│ │ │ │ +
107#endif
│ │ │ │ +
STL namespace.
│ │ │ │ +
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ +
Base-class template for all libpqxx connection types.
Definition: basic_connection.hxx:47
│ │ │ │ +
basic_connection_base(const std::string &opt)
Definition: basic_connection.hxx:57
│ │ │ │ +
const std::string & options() const noexcept
Definition: basic_connection.hxx:72
│ │ │ │ +
basic_connection_base(std::nullptr_t)
Definition: basic_connection.hxx:67
│ │ │ │ +
~basic_connection_base() noexcept
Definition: basic_connection.hxx:69
│ │ │ │ +
basic_connection_base(const char opt[])
See: basic_connection(const std::string &opt)
Definition: basic_connection.hxx:64
│ │ │ │ +
basic_connection_base()
Definition: basic_connection.hxx:49
│ │ │ │ +
Concrete connection type template.
Definition: basic_connection.hxx:90
│ │ │ │ +
basic_connection(const std::string &opt)
Definition: basic_connection.hxx:92
│ │ │ │ +
basic_connection(std::nullptr_t)
Definition: basic_connection.hxx:97
│ │ │ │ +
basic_connection(const char opt[])
Definition: basic_connection.hxx:94
│ │ │ │ + │ │ │ │ +
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ +
void init()
Definition: connection_base.cxx:99
│ │ │ │ +
void close() noexcept
Definition: connection_base.cxx:902
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,36 +1,134 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -compiler-internal-pre.hxx │ │ │ │ │ +basic_connection.hxx │ │ │ │ │ 1 │ │ │ │ │ - 15// NO GUARDS HERE! This code should be executed every time! │ │ │ │ │ - 16 │ │ │ │ │ - 17#ifdef _WIN32 │ │ │ │ │ - 18#ifdef _MSC_VER │ │ │ │ │ - 19 │ │ │ │ │ - 20// Save client program warning state, and set warning level 4. │ │ │ │ │ - 21// Setting the warning level explicitly ensures that libpqxx │ │ │ │ │ - 22// headers will work with this warning level as well. │ │ │ │ │ - 23#pragma warning (push,4) │ │ │ │ │ + 13#ifndef PQXX_H_BASIC_CONNECTION │ │ │ │ │ + 14#define PQXX_H_BASIC_CONNECTION │ │ │ │ │ + 15 │ │ │ │ │ + 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 18 │ │ │ │ │ + 19#include │ │ │ │ │ + 20#include │ │ │ │ │ + 21#include │ │ │ │ │ + 22 │ │ │ │ │ + 23#include "pqxx/connection_base.hxx" │ │ │ │ │ 24 │ │ │ │ │ - 25#pragma warning (disable: 4251) │ │ │ │ │ - 26#pragma warning (disable: 4273) │ │ │ │ │ - 27#pragma warning (disable: 4275) │ │ │ │ │ - 28#pragma warning (disable: 4355) │ │ │ │ │ - 29#pragma warning (disable: 4511) // Copy constructor could not be generated. │ │ │ │ │ - 30#pragma warning (disable: 4512) // Assignment operator could not be │ │ │ │ │ -generated. │ │ │ │ │ - 31#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy │ │ │ │ │ -(). │ │ │ │ │ - 32 │ │ │ │ │ - 33#endif // _MSC_VER │ │ │ │ │ - 34#endif // _WIN32 │ │ │ │ │ - 35 │ │ │ │ │ + 25 │ │ │ │ │ + 26namespace pqxx │ │ │ │ │ + 27{ │ │ │ │ │ + 28 │ │ │ │ │ + 30 │ │ │ │ │ +45template class basic_connection_base : │ │ │ │ │ + 46 public connection_base │ │ │ │ │ + 47{ │ │ │ │ │ + 48public: │ │ │ │ │ +49 basic_connection_base() : │ │ │ │ │ + 50 connection_base(m_policy), │ │ │ │ │ + 51 m_options(std::string{}), │ │ │ │ │ + 52 m_policy(m_options) │ │ │ │ │ + 53 { init(); } │ │ │ │ │ + 54 │ │ │ │ │ +57 explicit basic_connection_base(const std::string &opt) : │ │ │ │ │ + 58 connection_base(m_policy), │ │ │ │ │ + 59 m_options(opt), │ │ │ │ │ + 60 m_policy(m_options) │ │ │ │ │ + 61 {init();} │ │ │ │ │ + 62 │ │ │ │ │ +64 explicit basic_connection_base(const char opt[]) : │ │ │ │ │ + 65 basic_connection_base(opt ? std::string{opt} : std::string{}) {} │ │ │ │ │ + 66 │ │ │ │ │ +67 explicit basic_connection_base(std::nullptr_t) : basic_connection_base() {} │ │ │ │ │ + 68 │ │ │ │ │ +69 ~basic_connection_base() noexcept │ │ │ │ │ + 70 { close(); } │ │ │ │ │ + 71 │ │ │ │ │ +72 const std::string &options() const noexcept //[t01] │ │ │ │ │ + 73 {return m_policy.options();} │ │ │ │ │ + 74 │ │ │ │ │ + 75private: │ │ │ │ │ + 77 std::string m_options; │ │ │ │ │ + 79 CONNECTPOLICY m_policy; │ │ │ │ │ + 80}; │ │ │ │ │ + 81 │ │ │ │ │ + 82 │ │ │ │ │ + 84 │ │ │ │ │ +88template struct basic_connection : │ │ │ │ │ + 89 basic_connection_base │ │ │ │ │ + 90{ │ │ │ │ │ +91 PQXX_DEPRECATED basic_connection() =default; │ │ │ │ │ +92 PQXX_DEPRECATED explicit basic_connection(const std::string &opt) : │ │ │ │ │ + 93 basic_connection(opt) {} │ │ │ │ │ +94 PQXX_DEPRECATED explicit basic_connection(const char opt[]) : │ │ │ │ │ + 95 basic_connection(opt) {} │ │ │ │ │ + 96 │ │ │ │ │ +97 PQXX_DEPRECATED explicit basic_connection(std::nullptr_t) : │ │ │ │ │ + 98 basic_connection() {} │ │ │ │ │ + 99 │ │ │ │ │ + 100 using basic_connection_base::options; │ │ │ │ │ + 101}; │ │ │ │ │ + 102 │ │ │ │ │ + 103} // namespace │ │ │ │ │ + 104 │ │ │ │ │ + 105#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 106 │ │ │ │ │ + 107#endif │ │ │ │ │ +std │ │ │ │ │ +STL namespace. │ │ │ │ │ +pqxx │ │ │ │ │ +The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ +Definition: array.hxx:26 │ │ │ │ │ +pqxx::basic_connection_base │ │ │ │ │ +Base-class template for all libpqxx connection types. │ │ │ │ │ +Definition: basic_connection.hxx:47 │ │ │ │ │ +pqxx::basic_connection_base::basic_connection_base │ │ │ │ │ +basic_connection_base(const std::string &opt) │ │ │ │ │ +Definition: basic_connection.hxx:57 │ │ │ │ │ +pqxx::basic_connection_base::options │ │ │ │ │ +const std::string & options() const noexcept │ │ │ │ │ +Definition: basic_connection.hxx:72 │ │ │ │ │ +pqxx::basic_connection_base::basic_connection_base │ │ │ │ │ +basic_connection_base(std::nullptr_t) │ │ │ │ │ +Definition: basic_connection.hxx:67 │ │ │ │ │ +pqxx::basic_connection_base::~basic_connection_base │ │ │ │ │ +~basic_connection_base() noexcept │ │ │ │ │ +Definition: basic_connection.hxx:69 │ │ │ │ │ +pqxx::basic_connection_base::basic_connection_base │ │ │ │ │ +basic_connection_base(const char opt[]) │ │ │ │ │ +See: basic_connection(const std::string &opt) │ │ │ │ │ +Definition: basic_connection.hxx:64 │ │ │ │ │ +pqxx::basic_connection_base::basic_connection_base │ │ │ │ │ +basic_connection_base() │ │ │ │ │ +Definition: basic_connection.hxx:49 │ │ │ │ │ +pqxx::basic_connection │ │ │ │ │ +Concrete connection type template. │ │ │ │ │ +Definition: basic_connection.hxx:90 │ │ │ │ │ +pqxx::basic_connection::basic_connection │ │ │ │ │ +basic_connection(const std::string &opt) │ │ │ │ │ +Definition: basic_connection.hxx:92 │ │ │ │ │ +pqxx::basic_connection::basic_connection │ │ │ │ │ +basic_connection(std::nullptr_t) │ │ │ │ │ +Definition: basic_connection.hxx:97 │ │ │ │ │ +pqxx::basic_connection::basic_connection │ │ │ │ │ +basic_connection(const char opt[]) │ │ │ │ │ +Definition: basic_connection.hxx:94 │ │ │ │ │ +pqxx::basic_connection::basic_connection │ │ │ │ │ +basic_connection()=default │ │ │ │ │ +pqxx::connection_base │ │ │ │ │ +connection_base abstract base class; represents a connection to a database. │ │ │ │ │ +Definition: connection_base.hxx:140 │ │ │ │ │ +pqxx::connection_base::init │ │ │ │ │ +void init() │ │ │ │ │ +Definition: connection_base.cxx:99 │ │ │ │ │ +pqxx::connection_base::close │ │ │ │ │ +void close() noexcept │ │ │ │ │ +Definition: connection_base.cxx:902 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * compiler-internal-pre.hxx │ │ │ │ │ + * basic_connection.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00020_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: notification.hxx Source File │ │ │ │ +libpqxx: stream_base.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,69 +55,80 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
notification.hxx
│ │ │ │ +
stream_base.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_NOTIFICATION
│ │ │ │ -
14#define PQXX_H_NOTIFICATION
│ │ │ │ +
13#ifndef PQXX_H_STREAM_BASE
│ │ │ │ +
14#define PQXX_H_STREAM_BASE
│ │ │ │
15
│ │ │ │
16#include "pqxx/compiler-public.hxx"
│ │ │ │
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include <string>
│ │ │ │ +
18#include "pqxx/transaction_base.hxx"
│ │ │ │ +
19#include "pqxx/util.hxx"
│ │ │ │
20
│ │ │ │ -
21#include "pqxx/types.hxx"
│ │ │ │ +
21#include <string>
│ │ │ │
22
│ │ │ │
23
│ │ │ │
24namespace pqxx
│ │ │ │
25{
│ │ │ │ -
27
│ │ │ │ -
55class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver
│ │ │ │ -
56{
│ │ │ │ -
57public:
│ │ │ │ +
26
│ │ │ │ +
27class PQXX_LIBEXPORT PQXX_NOVTABLE stream_base :
│ │ │ │ + │ │ │ │ +
29{
│ │ │ │ +
30public:
│ │ │ │ +
31 explicit stream_base(transaction_base &);
│ │ │ │ +
32 // TODO: Can we get rid of the vtable?
│ │ │ │ +
33 virtual ~stream_base() noexcept =default;
│ │ │ │ +
34 virtual void complete() = 0;
│ │ │ │ +
35 operator bool() const noexcept;
│ │ │ │ +
36 bool operator!() const noexcept;
│ │ │ │ +
37protected:
│ │ │ │ +
38 bool m_finished;
│ │ │ │ +
39 virtual void close();
│ │ │ │ +
40 template<typename C> static std::string columnlist(const C &);
│ │ │ │ +
41 template<typename I> static std::string columnlist(I begin, I end);
│ │ │ │ +
42private:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
45 stream_base & operator=(const stream_base &);
│ │ │ │ +
46};
│ │ │ │ +
47
│ │ │ │ +
48template<typename C> std::string stream_base::columnlist(const C &c)
│ │ │ │ +
49{
│ │ │ │ +
50 return columnlist(std::begin(c), std::end(c));
│ │ │ │ +
51}
│ │ │ │ +
52
│ │ │ │ +
53template<typename I> std::string stream_base::columnlist(I begin, I end)
│ │ │ │ +
54{
│ │ │ │ +
55 return separated_list(",", begin, end);
│ │ │ │ +
56}
│ │ │ │ +
57
│ │ │ │ +
58} // namespace pqxx
│ │ │ │
59
│ │ │ │ -
63 notification_receiver(connection_base &c, const std::string &channel);
│ │ │ │ - │ │ │ │ - │ │ │ │ -
66 virtual ~notification_receiver();
│ │ │ │ -
67
│ │ │ │ -
69 const std::string &channel() const { return m_channel; }
│ │ │ │ -
70
│ │ │ │ -
72
│ │ │ │ -
79 virtual void operator()(const std::string &payload, int backend_pid) =0;
│ │ │ │ -
80
│ │ │ │ -
81protected:
│ │ │ │ -
82 connection_base &conn() const noexcept { return m_conn; }
│ │ │ │ -
83
│ │ │ │ -
84private:
│ │ │ │ -
85 connection_base &m_conn;
│ │ │ │ -
86 std::string m_channel;
│ │ │ │ -
87};
│ │ │ │ -
88}
│ │ │ │ -
89
│ │ │ │ -
90#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
91#endif
│ │ │ │ +
60
│ │ │ │ +
61#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
62#endif
│ │ │ │ +
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ -
Definition: notification.hxx:56
│ │ │ │ -
notification_receiver(const notification_receiver &)=delete
│ │ │ │ -
connection_base & conn() const noexcept
Definition: notification.hxx:82
│ │ │ │ -
const std::string & channel() const
The channel that this receiver listens on.
Definition: notification.hxx:69
│ │ │ │ -
virtual void operator()(const std::string &payload, int backend_pid)=0
Overridable: action to invoke when notification arrives.
│ │ │ │ -
notification_receiver & operator=(const notification_receiver &)=delete
│ │ │ │ +
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
│ │ │ │ +
Definition: stream_base.hxx:29
│ │ │ │ +
virtual ~stream_base() noexcept=default
│ │ │ │ +
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
│ │ │ │ +
Definition: transaction_base.hxx:44
│ │ │ │ +
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,74 +1,85 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -notification.hxx │ │ │ │ │ +stream_base.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_NOTIFICATION │ │ │ │ │ - 14#define PQXX_H_NOTIFICATION │ │ │ │ │ + 13#ifndef PQXX_H_STREAM_BASE │ │ │ │ │ + 14#define PQXX_H_STREAM_BASE │ │ │ │ │ 15 │ │ │ │ │ 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include │ │ │ │ │ + 18#include "pqxx/transaction_base.hxx" │ │ │ │ │ + 19#include "pqxx/util.hxx" │ │ │ │ │ 20 │ │ │ │ │ - 21#include "pqxx/types.hxx" │ │ │ │ │ + 21#include │ │ │ │ │ 22 │ │ │ │ │ 23 │ │ │ │ │ 24namespace pqxx │ │ │ │ │ 25{ │ │ │ │ │ - 27 │ │ │ │ │ -55class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver │ │ │ │ │ - 56{ │ │ │ │ │ - 57public: │ │ │ │ │ + 26 │ │ │ │ │ +27class PQXX_LIBEXPORT PQXX_NOVTABLE stream_base : │ │ │ │ │ + 28 public internal::transactionfocus │ │ │ │ │ + 29{ │ │ │ │ │ + 30public: │ │ │ │ │ + 31 explicit stream_base(transaction_base &); │ │ │ │ │ + 32 // TODO: Can we get rid of the vtable? │ │ │ │ │ +33 virtual ~stream_base() noexcept =default; │ │ │ │ │ +34 virtual void complete() = 0; │ │ │ │ │ + 35 operator bool() const noexcept; │ │ │ │ │ + 36 bool operator!() const noexcept; │ │ │ │ │ + 37protected: │ │ │ │ │ +38 bool m_finished; │ │ │ │ │ + 39 virtual void close(); │ │ │ │ │ + 40 template static std::string columnlist(const C &); │ │ │ │ │ + 41 template static std::string columnlist(I begin, I end); │ │ │ │ │ + 42private: │ │ │ │ │ + 43 stream_base(); │ │ │ │ │ + 44 stream_base(const stream_base&); │ │ │ │ │ + 45 stream_base & operator=(const stream_base &); │ │ │ │ │ + 46}; │ │ │ │ │ + 47 │ │ │ │ │ +48template std::string stream_base::columnlist(const C &c) │ │ │ │ │ + 49{ │ │ │ │ │ + 50 return columnlist(std::begin(c), std::end(c)); │ │ │ │ │ + 51} │ │ │ │ │ + 52 │ │ │ │ │ +53template std::string stream_base::columnlist(I begin, I end) │ │ │ │ │ + 54{ │ │ │ │ │ + 55 return separated_list(",", begin, end); │ │ │ │ │ + 56} │ │ │ │ │ + 57 │ │ │ │ │ + 58} // namespace pqxx │ │ │ │ │ 59 │ │ │ │ │ - 63 notification_receiver(connection_base &c, const std::string &channel); │ │ │ │ │ -64 notification_receiver(const notification_receiver &) =delete; │ │ │ │ │ -65 notification_receiver &operator=(const notification_receiver &) =delete; │ │ │ │ │ - 66 virtual ~notification_receiver(); │ │ │ │ │ - 67 │ │ │ │ │ -69 const std::string &channel() const { return m_channel; } │ │ │ │ │ - 70 │ │ │ │ │ - 72 │ │ │ │ │ -79 virtual void operator()(const std::string &payload, int backend_pid) =0; │ │ │ │ │ - 80 │ │ │ │ │ - 81protected: │ │ │ │ │ -82 connection_base &conn() const noexcept { return m_conn; } │ │ │ │ │ - 83 │ │ │ │ │ - 84private: │ │ │ │ │ - 85 connection_base &m_conn; │ │ │ │ │ - 86 std::string m_channel; │ │ │ │ │ - 87}; │ │ │ │ │ - 88} │ │ │ │ │ - 89 │ │ │ │ │ - 90#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 91#endif │ │ │ │ │ + 60 │ │ │ │ │ + 61#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 62#endif │ │ │ │ │ +std │ │ │ │ │ +STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::connection_base │ │ │ │ │ -connection_base abstract base class; represents a connection to a database. │ │ │ │ │ -Definition: connection_base.hxx:140 │ │ │ │ │ -pqxx::notification_receiver │ │ │ │ │ -Definition: notification.hxx:56 │ │ │ │ │ -pqxx::notification_receiver::notification_receiver │ │ │ │ │ -notification_receiver(const notification_receiver &)=delete │ │ │ │ │ -pqxx::notification_receiver::conn │ │ │ │ │ -connection_base & conn() const noexcept │ │ │ │ │ -Definition: notification.hxx:82 │ │ │ │ │ -pqxx::notification_receiver::channel │ │ │ │ │ -const std::string & channel() const │ │ │ │ │ -The channel that this receiver listens on. │ │ │ │ │ -Definition: notification.hxx:69 │ │ │ │ │ -pqxx::notification_receiver::operator() │ │ │ │ │ -virtual void operator()(const std::string &payload, int backend_pid)=0 │ │ │ │ │ -Overridable: action to invoke when notification arrives. │ │ │ │ │ -pqxx::notification_receiver::operator= │ │ │ │ │ -notification_receiver & operator=(const notification_receiver &)=delete │ │ │ │ │ +pqxx::separated_list │ │ │ │ │ +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 │ │ │ │ │ +pqxx::stream_base │ │ │ │ │ +Definition: stream_base.hxx:29 │ │ │ │ │ +pqxx::stream_base::~stream_base │ │ │ │ │ +virtual ~stream_base() noexcept=default │ │ │ │ │ +pqxx::stream_base::columnlist │ │ │ │ │ +static std::string columnlist(const C &) │ │ │ │ │ +Definition: stream_base.hxx:48 │ │ │ │ │ +pqxx::internal::transactionfocus │ │ │ │ │ +Definition: transaction_base.hxx:44 │ │ │ │ │ +pqxx::transaction_base │ │ │ │ │ +Interface definition (and common code) for "transaction" classes. │ │ │ │ │ +Definition: transaction_base.hxx:138 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * notification.hxx │ │ │ │ │ + * stream_base.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00023_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: row.hxx Source File │ │ │ │ +libpqxx: config-public-compiler.h Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,353 +55,27 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
row.hxx
│ │ │ │ +
config-public-compiler.h
│ │ │ │
│ │ │ │
│ │ │ │ -
1
│ │ │ │ -
13#ifndef PQXX_H_ROW
│ │ │ │ -
14#define PQXX_H_ROW
│ │ │ │ -
15
│ │ │ │ -
16#include "pqxx/compiler-public.hxx"
│ │ │ │ -
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include "pqxx/except.hxx"
│ │ │ │ -
20#include "pqxx/field.hxx"
│ │ │ │ -
21#include "pqxx/result.hxx"
│ │ │ │ -
22
│ │ │ │ -
23
│ │ │ │ -
24// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ -
25
│ │ │ │ -
26namespace pqxx
│ │ │ │ -
27{
│ │ │ │ -
29
│ │ │ │ -
40class PQXX_LIBEXPORT row
│ │ │ │ -
41{
│ │ │ │ -
42public:
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
51
│ │ │ │ -
52 row() =default;
│ │ │ │ -
53
│ │ │ │ -
55 row(result r, size_t i) noexcept;
│ │ │ │ -
56
│ │ │ │ -
57 ~row() noexcept =default; // Yes Scott Meyers, you're absolutely right[1]
│ │ │ │ -
58
│ │ │ │ -
63 PQXX_PURE bool operator==(const row &) const noexcept; //[t75]
│ │ │ │ -
64 bool operator!=(const row &rhs) const noexcept //[t75]
│ │ │ │ -
65 { return not operator==(rhs); }
│ │ │ │ -
67
│ │ │ │ -
68 const_iterator begin() const noexcept; //[t82]
│ │ │ │ -
69 const_iterator cbegin() const noexcept;
│ │ │ │ -
70 const_iterator end() const noexcept; //[t82]
│ │ │ │ -
71 const_iterator cend() const noexcept;
│ │ │ │ -
72
│ │ │ │ -
77 reference front() const noexcept; //[t74]
│ │ │ │ -
78 reference back() const noexcept; //[t75]
│ │ │ │ -
79
│ │ │ │ -
80 const_reverse_row_iterator rbegin() const; //[t82]
│ │ │ │ -
81 const_reverse_row_iterator crbegin() const;
│ │ │ │ -
82 const_reverse_row_iterator rend() const; //[t82]
│ │ │ │ -
83 const_reverse_row_iterator crend() const;
│ │ │ │ -
84
│ │ │ │ -
85 reference operator[](size_type) const noexcept; //[t11]
│ │ │ │ -
86 reference operator[](int) const noexcept; //[t02]
│ │ │ │ -
90 reference operator[](const char[]) const; //[t11]
│ │ │ │ -
94 reference operator[](const std::string &) const; //[t11]
│ │ │ │ -
95 reference at(size_type) const; //[t11]
│ │ │ │ -
96 reference at(int) const; //[t11]
│ │ │ │ -
100 reference at(const char[]) const; //[t11]
│ │ │ │ -
104 reference at(const std::string &) const; //[t11]
│ │ │ │ -
106
│ │ │ │ -
107 size_type size() const noexcept //[t11]
│ │ │ │ -
108 { return m_end-m_begin; }
│ │ │ │ -
109
│ │ │ │ -
110 void swap(row &) noexcept; //[t11]
│ │ │ │ -
111
│ │ │ │ -
113 size_t rownumber() const noexcept { return size_t(m_index); } //[t11]
│ │ │ │ -
114
│ │ │ │ -
120 size_type column_number(const std::string &ColName) const //[t30]
│ │ │ │ -
121 { return column_number(ColName.c_str()); }
│ │ │ │ -
122
│ │ │ │ -
124 size_type column_number(const char[]) const; //[t30]
│ │ │ │ -
125
│ │ │ │ -
127 oid column_type(size_type) const; //[t07]
│ │ │ │ -
128
│ │ │ │ -
130 oid column_type(int ColNum) const //[t07]
│ │ │ │ -
131 { return column_type(size_type(ColNum)); }
│ │ │ │ -
132
│ │ │ │ -
134 oid column_type(const std::string &ColName) const //[t07]
│ │ │ │ -
135 { return column_type(column_number(ColName)); }
│ │ │ │ -
136
│ │ │ │ -
138 oid column_type(const char ColName[]) const //[t07]
│ │ │ │ -
139 { return column_type(column_number(ColName)); }
│ │ │ │ -
140
│ │ │ │ -
142 oid column_table(size_type ColNum) const; //[t02]
│ │ │ │ -
143
│ │ │ │ -
145 oid column_table(int ColNum) const //[t02]
│ │ │ │ -
146 { return column_table(size_type(ColNum)); }
│ │ │ │ -
148 oid column_table(const std::string &ColName) const //[t02]
│ │ │ │ -
149 { return column_table(column_number(ColName)); }
│ │ │ │ -
150
│ │ │ │ -
152
│ │ │ │ -
159 size_type table_column(size_type) const; //[t93]
│ │ │ │ -
160
│ │ │ │ -
162 size_type table_column(int ColNum) const //[t93]
│ │ │ │ -
163 { return table_column(size_type(ColNum)); }
│ │ │ │ -
164
│ │ │ │ -
166 size_type table_column(const std::string &ColName) const //[t93]
│ │ │ │ -
167 { return table_column(column_number(ColName)); }
│ │ │ │ -
169
│ │ │ │ -
170 size_t num() const { return rownumber(); } //[t01]
│ │ │ │ -
171
│ │ │ │ -
184 row slice(size_type Begin, size_type End) const;
│ │ │ │ -
185
│ │ │ │ -
186 // Is this an empty slice?
│ │ │ │ -
187 PQXX_PURE bool empty() const noexcept;
│ │ │ │ -
188
│ │ │ │ -
189protected:
│ │ │ │ -
190 friend class field;
│ │ │ │ -
192 result m_result;
│ │ │ │ -
194
│ │ │ │ -
198 long m_index = 0;
│ │ │ │ -
200 size_type m_begin = 0;
│ │ │ │ -
202 size_type m_end = 0;
│ │ │ │ -
203};
│ │ │ │ -
204
│ │ │ │ -
205
│ │ │ │ -
207class PQXX_LIBEXPORT const_row_iterator : public field
│ │ │ │ -
208{
│ │ │ │ -
209public:
│ │ │ │ -
210 using iterator_category = std::random_access_iterator_tag;
│ │ │ │ -
211 using value_type = const field;
│ │ │ │ -
212 using pointer = const field *;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
216
│ │ │ │ -
217 const_row_iterator(const row &T, row_size_type C) noexcept : //[t82]
│ │ │ │ -
218 field{T, C} {}
│ │ │ │ -
219 const_row_iterator(const field &F) noexcept : field{F} {} //[t82]
│ │ │ │ -
220
│ │ │ │ -
225 pointer operator->() const { return this; } //[t82]
│ │ │ │ -
226 reference operator*() const { return field{*this}; } //[t82]
│ │ │ │ -
228
│ │ │ │ -
233 const_row_iterator operator++(int); //[t82]
│ │ │ │ -
234 const_row_iterator &operator++() { ++m_col; return *this; } //[t82]
│ │ │ │ -
235 const_row_iterator operator--(int); //[t82]
│ │ │ │ -
236 const_row_iterator &operator--() { --m_col; return *this; } //[t82]
│ │ │ │ -
237
│ │ │ │ - │ │ │ │ -
239 { m_col = size_type(difference_type(m_col) + i); return *this; }
│ │ │ │ - │ │ │ │ -
241 { m_col = size_type(difference_type(m_col) - i); return *this; }
│ │ │ │ -
243
│ │ │ │ -
248 bool operator==(const const_row_iterator &i) const //[t82]
│ │ │ │ -
249 {return col()==i.col();}
│ │ │ │ -
250 bool operator!=(const const_row_iterator &i) const //[t82]
│ │ │ │ -
251 {return col()!=i.col();}
│ │ │ │ -
252 bool operator<(const const_row_iterator &i) const //[t82]
│ │ │ │ -
253 {return col()<i.col();}
│ │ │ │ -
254 bool operator<=(const const_row_iterator &i) const //[t82]
│ │ │ │ -
255 {return col()<=i.col();}
│ │ │ │ -
256 bool operator>(const const_row_iterator &i) const //[t82]
│ │ │ │ -
257 {return col()>i.col();}
│ │ │ │ -
258 bool operator>=(const const_row_iterator &i) const //[t82]
│ │ │ │ -
259 {return col()>=i.col();}
│ │ │ │ -
261
│ │ │ │ -
266 inline const_row_iterator operator+(difference_type) const; //[t82]
│ │ │ │ -
267
│ │ │ │ -
268 friend const_row_iterator operator+( //[t82]
│ │ │ │ -
269 difference_type,
│ │ │ │ - │ │ │ │ -
271
│ │ │ │ -
272 inline const_row_iterator operator-(difference_type) const; //[t82]
│ │ │ │ -
273 inline difference_type operator-(const_row_iterator) const; //[t82]
│ │ │ │ -
275};
│ │ │ │ -
276
│ │ │ │ -
277
│ │ │ │ -
279class PQXX_LIBEXPORT const_reverse_row_iterator : private const_row_iterator
│ │ │ │ -
280{
│ │ │ │ -
281public:
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
289
│ │ │ │ - │ │ │ │ - │ │ │ │ -
292 explicit
│ │ │ │ -
293 const_reverse_row_iterator(const super &rhs) noexcept : //[t82]
│ │ │ │ -
294 const_row_iterator{rhs} { super::operator--(); }
│ │ │ │ -
295
│ │ │ │ -
296 PQXX_PURE iterator_type base() const noexcept; //[t82]
│ │ │ │ -
297
│ │ │ │ -
302 using iterator_type::operator->; //[t82]
│ │ │ │ -
303 using iterator_type::operator*; //[t82]
│ │ │ │ -
305
│ │ │ │ -
310 const_reverse_row_iterator &
│ │ │ │ -
311 operator=(const const_reverse_row_iterator &r) //[t82]
│ │ │ │ -
312 { iterator_type::operator=(r); return *this; }
│ │ │ │ - │ │ │ │ -
314 { iterator_type::operator--(); return *this; }
│ │ │ │ -
315 const_reverse_row_iterator operator++(int); //[t82]
│ │ │ │ - │ │ │ │ -
317 { iterator_type::operator++(); return *this; }
│ │ │ │ -
318 const_reverse_row_iterator operator--(int); //[t82]
│ │ │ │ - │ │ │ │ -
320 { iterator_type::operator-=(i); return *this; }
│ │ │ │ - │ │ │ │ -
322 { iterator_type::operator+=(i); return *this; }
│ │ │ │ -
324
│ │ │ │ - │ │ │ │ -
330 { return const_reverse_row_iterator{base()-i}; }
│ │ │ │ - │ │ │ │ -
332 { return const_reverse_row_iterator{base()+i}; }
│ │ │ │ -
333 difference_type
│ │ │ │ -
334 operator-(const const_reverse_row_iterator &rhs) const //[t82]
│ │ │ │ -
335 { return rhs.const_row_iterator::operator-(*this); }
│ │ │ │ -
337
│ │ │ │ -
342 bool operator==(const const_reverse_row_iterator &rhs) const noexcept //[t82]
│ │ │ │ -
343 { return iterator_type::operator==(rhs); }
│ │ │ │ -
344 bool operator!=(const const_reverse_row_iterator &rhs) const noexcept //[t82]
│ │ │ │ -
345 { return !operator==(rhs); }
│ │ │ │ -
346
│ │ │ │ -
347 bool operator<(const const_reverse_row_iterator &rhs) const //[t82]
│ │ │ │ -
348 { return iterator_type::operator>(rhs); }
│ │ │ │ -
349 bool operator<=(const const_reverse_row_iterator &rhs) const //[t82]
│ │ │ │ -
350 { return iterator_type::operator>=(rhs); }
│ │ │ │ -
351 bool operator>(const const_reverse_row_iterator &rhs) const //[t82]
│ │ │ │ -
352 { return iterator_type::operator<(rhs); }
│ │ │ │ -
353 bool operator>=(const const_reverse_row_iterator &rhs) const //[t82]
│ │ │ │ -
354 { return iterator_type::operator<=(rhs); }
│ │ │ │ -
356};
│ │ │ │ -
357
│ │ │ │ -
358
│ │ │ │ -
359inline const_row_iterator
│ │ │ │ - │ │ │ │ -
361{
│ │ │ │ -
362 return const_row_iterator{
│ │ │ │ -
363 row(home(), idx()),
│ │ │ │ -
364 size_type(difference_type(col()) + o)};
│ │ │ │ -
365}
│ │ │ │ -
366
│ │ │ │ - │ │ │ │ - │ │ │ │ -
369 { return i + o; }
│ │ │ │ -
370
│ │ │ │ - │ │ │ │ - │ │ │ │ -
373{
│ │ │ │ -
374 return const_row_iterator{
│ │ │ │ -
375 row(home(), idx()),
│ │ │ │ -
376 size_type(difference_type(col()) - o)};
│ │ │ │ -
377}
│ │ │ │ -
378
│ │ │ │ - │ │ │ │ - │ │ │ │ -
381 { return difference_type(num() - i.num()); }
│ │ │ │ -
382
│ │ │ │ -
383
│ │ │ │ -
384} // namespace pqxx
│ │ │ │ -
385
│ │ │ │ -
386
│ │ │ │ -
387/*
│ │ │ │ -
388[1] Scott Meyers, in one of his essential books, "Effective C++" and "More
│ │ │ │ -
389Effective C++", points out that it is good style to have any class containing
│ │ │ │ -
390a member of pointer type define a destructor--just to show that it knows what
│ │ │ │ -
391it is doing with the pointer. This helps prevent nasty memory leak / double
│ │ │ │ -
392deletion bugs typically resulting from programmers' omission to deal with such
│ │ │ │ -
393issues in their destructors.
│ │ │ │ -
394
│ │ │ │ -
395The @c -Weffc++ option in gcc generates warnings for noncompliance with Scott's
│ │ │ │ -
396style guidelines, and hence necessitates the definition of this destructor,
│ │ │ │ -
397trivial as it may be.
│ │ │ │ -
398*/
│ │ │ │ -
399
│ │ │ │ -
400
│ │ │ │ -
401#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
402
│ │ │ │ -
403#endif
│ │ │ │ -
STL namespace.
│ │ │ │ -
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
const_result_iterator operator+(result::difference_type o, const_result_iterator i)
Definition: result_iterator.hxx:212
│ │ │ │ -
signed int row_difference_type
Difference between row sizes.
Definition: types.hxx:27
│ │ │ │ -
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
│ │ │ │ -
Reference to a field in a result set.
Definition: field.hxx:50
│ │ │ │ -
row_size_type num() const
Definition: field.hxx:104
│ │ │ │ -
field_size_type size_type
Definition: field.hxx:52
│ │ │ │ -
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ -
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │ -
size_t rownumber() const noexcept
Row number, assuming this is a real row and not end()/rend().
Definition: row.hxx:113
│ │ │ │ -
oid column_type(const std::string &ColName) const
Type of given column.
Definition: row.hxx:134
│ │ │ │ -
oid column_table(const std::string &ColName) const
What table did this column come from?
Definition: row.hxx:148
│ │ │ │ -
row_size_type size_type
Definition: row.hxx:43
│ │ │ │ -
row_difference_type difference_type
Definition: row.hxx:44
│ │ │ │ -
row()=default
│ │ │ │ -
size_t num() const
Definition: row.hxx:170
│ │ │ │ -
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
│ │ │ │ -
size_type column_number(const std::string &ColName) const
Number of given column (throws exception if it doesn't exist)
Definition: row.hxx:120
│ │ │ │ -
~row() noexcept=default
│ │ │ │ -
oid column_table(int ColNum) const
What table did this column come from?
Definition: row.hxx:145
│ │ │ │ -
oid column_type(const char ColName[]) const
Type of given column.
Definition: row.hxx:138
│ │ │ │ -
size_type table_column(int ColNum) const
What column number in its table did this result column come from?
Definition: row.hxx:162
│ │ │ │ -
oid column_type(int ColNum) const
Type of given column.
Definition: row.hxx:130
│ │ │ │ -
Iterator for fields in a row. Use as row::const_iterator.
Definition: row.hxx:208
│ │ │ │ -
bool operator!=(const const_row_iterator &i) const
Definition: row.hxx:250
│ │ │ │ -
const_row_iterator & operator++()
Definition: row.hxx:234
│ │ │ │ -
const_row_iterator & operator--()
Definition: row.hxx:236
│ │ │ │ -
bool operator<=(const const_row_iterator &i) const
Definition: row.hxx:254
│ │ │ │ -
std::random_access_iterator_tag iterator_category
Definition: row.hxx:210
│ │ │ │ -
const_row_iterator & operator-=(difference_type i)
Definition: row.hxx:240
│ │ │ │ -
const_row_iterator operator-(difference_type) const
Definition: row.hxx:372
│ │ │ │ -
const_row_iterator operator+(difference_type) const
Definition: row.hxx:360
│ │ │ │ -
bool operator==(const const_row_iterator &i) const
Definition: row.hxx:248
│ │ │ │ -
bool operator>=(const const_row_iterator &i) const
Definition: row.hxx:258
│ │ │ │ -
reference operator*() const
Definition: row.hxx:226
│ │ │ │ -
const_row_iterator(const row &T, row_size_type C) noexcept
Definition: row.hxx:217
│ │ │ │ -
row_difference_type difference_type
Definition: row.hxx:214
│ │ │ │ -
pointer operator->() const
Definition: row.hxx:225
│ │ │ │ -
bool operator<(const const_row_iterator &i) const
Definition: row.hxx:252
│ │ │ │ -
const_row_iterator & operator+=(difference_type i)
Definition: row.hxx:238
│ │ │ │ -
bool operator>(const const_row_iterator &i) const
Definition: row.hxx:256
│ │ │ │ -
const_row_iterator(const field &F) noexcept
Definition: row.hxx:219
│ │ │ │ -
Reverse iterator for a row. Use as row::const_reverse_iterator.
Definition: row.hxx:280
│ │ │ │ -
const_reverse_row_iterator & operator+=(difference_type i)
Definition: row.hxx:319
│ │ │ │ -
const_reverse_row_iterator(const const_reverse_row_iterator &r)
Definition: row.hxx:290
│ │ │ │ -
const_reverse_row_iterator & operator-=(difference_type i)
Definition: row.hxx:321
│ │ │ │ -
bool operator!=(const const_reverse_row_iterator &rhs) const noexcept
Definition: row.hxx:344
│ │ │ │ -
const_reverse_row_iterator operator+(difference_type i) const
Definition: row.hxx:329
│ │ │ │ -
bool operator<(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:347
│ │ │ │ -
const_reverse_row_iterator operator-(difference_type i)
Definition: row.hxx:331
│ │ │ │ -
bool operator<=(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:349
│ │ │ │ -
bool operator>=(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:353
│ │ │ │ -
bool operator>(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:351
│ │ │ │ -
bool operator==(const const_reverse_row_iterator &rhs) const noexcept
Definition: row.hxx:342
│ │ │ │ -
const_reverse_row_iterator & operator--()
Definition: row.hxx:316
│ │ │ │ -
difference_type operator-(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:334
│ │ │ │ -
const_reverse_row_iterator operator++()
Definition: row.hxx:313
│ │ │ │ -
const_reverse_row_iterator(const super &rhs) noexcept
Definition: row.hxx:293
│ │ │ │ +
1/* Automatically generated from config.h: public/compiler config. */
│ │ │ │ +
2
│ │ │ │ +
3#define PQXX_HAVE_DEPRECATED 1
│ │ │ │ +
4#define PQXX_HAVE_GCC_CONST 1
│ │ │ │ +
5#define PQXX_HAVE_GCC_DEPRECATED 1
│ │ │ │ +
6#define PQXX_HAVE_GCC_PURE 1
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,477 +1,18 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -row.hxx │ │ │ │ │ - 1 │ │ │ │ │ - 13#ifndef PQXX_H_ROW │ │ │ │ │ - 14#define PQXX_H_ROW │ │ │ │ │ - 15 │ │ │ │ │ - 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include "pqxx/except.hxx" │ │ │ │ │ - 20#include "pqxx/field.hxx" │ │ │ │ │ - 21#include "pqxx/result.hxx" │ │ │ │ │ - 22 │ │ │ │ │ - 23 │ │ │ │ │ - 24// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ - 25 │ │ │ │ │ - 26namespace pqxx │ │ │ │ │ - 27{ │ │ │ │ │ - 29 │ │ │ │ │ -40class PQXX_LIBEXPORT row │ │ │ │ │ - 41{ │ │ │ │ │ - 42public: │ │ │ │ │ -43 using size_type = row_size_type; │ │ │ │ │ -44 using difference_type = row_difference_type; │ │ │ │ │ -45 using const_iterator = const_row_iterator; │ │ │ │ │ -46 using iterator = const_iterator; │ │ │ │ │ -47 using reference = field; │ │ │ │ │ -48 using pointer = const_row_iterator; │ │ │ │ │ -49 using const_reverse_iterator = const_reverse_row_iterator; │ │ │ │ │ -50 using reverse_iterator = const_reverse_iterator; │ │ │ │ │ - 51 │ │ │ │ │ -52 row() =default; │ │ │ │ │ - 53 │ │ │ │ │ - 55 row(result r, size_t i) noexcept; │ │ │ │ │ - 56 │ │ │ │ │ -57 ~row() noexcept =default; // Yes Scott Meyers, you're absolutely right[1] │ │ │ │ │ - 58 │ │ │ │ │ - 63 PQXX_PURE bool operator==(const row &) const noexcept; //[t75] │ │ │ │ │ -64 bool operator!=(const row &rhs) const noexcept //[t75] │ │ │ │ │ - 65 { return not operator==(rhs); } │ │ │ │ │ - 67 │ │ │ │ │ - 68 const_iterator begin() const noexcept; //[t82] │ │ │ │ │ - 69 const_iterator cbegin() const noexcept; │ │ │ │ │ - 70 const_iterator end() const noexcept; //[t82] │ │ │ │ │ - 71 const_iterator cend() const noexcept; │ │ │ │ │ - 72 │ │ │ │ │ - 77 reference front() const noexcept; //[t74] │ │ │ │ │ - 78 reference back() const noexcept; //[t75] │ │ │ │ │ - 79 │ │ │ │ │ - 80 const_reverse_row_iterator rbegin() const; //[t82] │ │ │ │ │ - 81 const_reverse_row_iterator crbegin() const; │ │ │ │ │ - 82 const_reverse_row_iterator rend() const; //[t82] │ │ │ │ │ - 83 const_reverse_row_iterator crend() const; │ │ │ │ │ - 84 │ │ │ │ │ - 85 reference operator[](size_type) const noexcept; //[t11] │ │ │ │ │ - 86 reference operator[](int) const noexcept; //[t02] │ │ │ │ │ - 90 reference operator[](const char[]) const; //[t11] │ │ │ │ │ - 94 reference operator[](const std::string &) const; //[t11] │ │ │ │ │ - 95 reference at(size_type) const; //[t11] │ │ │ │ │ - 96 reference at(int) const; //[t11] │ │ │ │ │ - 100 reference at(const char[]) const; //[t11] │ │ │ │ │ - 104 reference at(const std::string &) const; //[t11] │ │ │ │ │ - 106 │ │ │ │ │ -107 size_type size() const noexcept //[t11] │ │ │ │ │ - 108 { return m_end-m_begin; } │ │ │ │ │ - 109 │ │ │ │ │ - 110 void swap(row &) noexcept; //[t11] │ │ │ │ │ - 111 │ │ │ │ │ -113 size_t rownumber() const noexcept { return size_t(m_index); } //[t11] │ │ │ │ │ - 114 │ │ │ │ │ -120 size_type column_number(const std::string &ColName) const //[t30] │ │ │ │ │ - 121 { return column_number(ColName.c_str()); } │ │ │ │ │ - 122 │ │ │ │ │ - 124 size_type column_number(const char[]) const; //[t30] │ │ │ │ │ - 125 │ │ │ │ │ - 127 oid column_type(size_type) const; //[t07] │ │ │ │ │ - 128 │ │ │ │ │ -130 oid column_type(int ColNum) const //[t07] │ │ │ │ │ - 131 { return column_type(size_type(ColNum)); } │ │ │ │ │ - 132 │ │ │ │ │ -134 oid column_type(const std::string &ColName) const //[t07] │ │ │ │ │ - 135 { return column_type(column_number(ColName)); } │ │ │ │ │ - 136 │ │ │ │ │ -138 oid column_type(const char ColName[]) const //[t07] │ │ │ │ │ - 139 { return column_type(column_number(ColName)); } │ │ │ │ │ - 140 │ │ │ │ │ - 142 oid column_table(size_type ColNum) const; //[t02] │ │ │ │ │ - 143 │ │ │ │ │ -145 oid column_table(int ColNum) const //[t02] │ │ │ │ │ - 146 { return column_table(size_type(ColNum)); } │ │ │ │ │ -148 oid column_table(const std::string &ColName) const //[t02] │ │ │ │ │ - 149 { return column_table(column_number(ColName)); } │ │ │ │ │ - 150 │ │ │ │ │ - 152 │ │ │ │ │ - 159 size_type table_column(size_type) const; //[t93] │ │ │ │ │ - 160 │ │ │ │ │ -162 size_type table_column(int ColNum) const //[t93] │ │ │ │ │ - 163 { return table_column(size_type(ColNum)); } │ │ │ │ │ - 164 │ │ │ │ │ -166 size_type table_column(const std::string &ColName) const //[t93] │ │ │ │ │ - 167 { return table_column(column_number(ColName)); } │ │ │ │ │ - 169 │ │ │ │ │ -170 size_t num() const { return rownumber(); } //[t01] │ │ │ │ │ - 171 │ │ │ │ │ - 184 row slice(size_type Begin, size_type End) const; │ │ │ │ │ - 185 │ │ │ │ │ - 186 // Is this an empty slice? │ │ │ │ │ - 187 PQXX_PURE bool empty() const noexcept; │ │ │ │ │ - 188 │ │ │ │ │ - 189protected: │ │ │ │ │ -190 friend class field; │ │ │ │ │ -192 result m_result; │ │ │ │ │ - 194 │ │ │ │ │ -198 long m_index = 0; │ │ │ │ │ -200 size_type m_begin = 0; │ │ │ │ │ -202 size_type m_end = 0; │ │ │ │ │ - 203}; │ │ │ │ │ - 204 │ │ │ │ │ - 205 │ │ │ │ │ -207class PQXX_LIBEXPORT const_row_iterator : public field │ │ │ │ │ - 208{ │ │ │ │ │ - 209public: │ │ │ │ │ -210 using iterator_category = std::random_access_iterator_tag; │ │ │ │ │ -211 using value_type = const field; │ │ │ │ │ -212 using pointer = const field *; │ │ │ │ │ -213 using size_type = row_size_type; │ │ │ │ │ -214 using difference_type = row_difference_type; │ │ │ │ │ -215 using reference = field; │ │ │ │ │ - 216 │ │ │ │ │ -217 const_row_iterator(const row &T, row_size_type C) noexcept : //[t82] │ │ │ │ │ - 218 field{T, C} {} │ │ │ │ │ -219 const_row_iterator(const field &F) noexcept : field{F} {} //[t82] │ │ │ │ │ - 220 │ │ │ │ │ -225 pointer operator->() const { return this; } //[t82] │ │ │ │ │ -226 reference operator*() const { return field{*this}; } //[t82] │ │ │ │ │ - 228 │ │ │ │ │ - 233 const_row_iterator operator++(int); //[t82] │ │ │ │ │ -234 const_row_iterator &operator++() { ++m_col; return *this; } //[t82] │ │ │ │ │ - 235 const_row_iterator operator--(int); //[t82] │ │ │ │ │ -236 const_row_iterator &operator--() { --m_col; return *this; } //[t82] │ │ │ │ │ - 237 │ │ │ │ │ -238 const_row_iterator &operator+=(difference_type i) //[t82] │ │ │ │ │ - 239 { m_col = size_type(difference_type(m_col) + i); return *this; } │ │ │ │ │ -240 const_row_iterator &operator-=(difference_type i) //[t82] │ │ │ │ │ - 241 { m_col = size_type(difference_type(m_col) - i); return *this; } │ │ │ │ │ - 243 │ │ │ │ │ -248 bool operator==(const const_row_iterator &i) const //[t82] │ │ │ │ │ - 249 {return col()==i.col();} │ │ │ │ │ -250 bool operator!=(const const_row_iterator &i) const //[t82] │ │ │ │ │ - 251 {return col()!=i.col();} │ │ │ │ │ -252 bool operator<(const const_row_iterator &i) const //[t82] │ │ │ │ │ - 253 {return col()(const const_row_iterator &i) const //[t82] │ │ │ │ │ - 257 {return col()>i.col();} │ │ │ │ │ -258 bool operator>=(const const_row_iterator &i) const //[t82] │ │ │ │ │ - 259 {return col()>=i.col();} │ │ │ │ │ - 261 │ │ │ │ │ - 266 inline const_row_iterator operator+(difference_type) const; //[t82] │ │ │ │ │ - 267 │ │ │ │ │ - 268 friend const_row_iterator operator+( //[t82] │ │ │ │ │ - 269 difference_type, │ │ │ │ │ - 270 const_row_iterator); │ │ │ │ │ - 271 │ │ │ │ │ -272 inline const_row_iterator operator-(difference_type) const; //[t82] │ │ │ │ │ -273 inline difference_type operator-(const_row_iterator) const; //[t82] │ │ │ │ │ - 275}; │ │ │ │ │ - 276 │ │ │ │ │ - 277 │ │ │ │ │ -279class PQXX_LIBEXPORT const_reverse_row_iterator : private const_row_iterator │ │ │ │ │ - 280{ │ │ │ │ │ - 281public: │ │ │ │ │ -282 using super = const_row_iterator; │ │ │ │ │ -283 using iterator_type = const_row_iterator; │ │ │ │ │ - 284 using iterator_type::iterator_category; │ │ │ │ │ - 285 using iterator_type::difference_type; │ │ │ │ │ - 286 using iterator_type::pointer; │ │ │ │ │ -287 using value_type = iterator_type::value_type; │ │ │ │ │ -288 using reference = iterator_type::reference; │ │ │ │ │ - 289 │ │ │ │ │ -290 const_reverse_row_iterator(const const_reverse_row_iterator &r) : //[t82] │ │ │ │ │ - 291 const_row_iterator{r} {} │ │ │ │ │ - 292 explicit │ │ │ │ │ -293 const_reverse_row_iterator(const super &rhs) noexcept : //[t82] │ │ │ │ │ - 294 const_row_iterator{rhs} { super::operator--(); } │ │ │ │ │ - 295 │ │ │ │ │ - 296 PQXX_PURE iterator_type base() const noexcept; //[t82] │ │ │ │ │ - 297 │ │ │ │ │ - 302 using iterator_type::operator->; //[t82] │ │ │ │ │ - 303 using iterator_type::operator*; //[t82] │ │ │ │ │ - 305 │ │ │ │ │ - 310 const_reverse_row_iterator & │ │ │ │ │ -311 operator=(const const_reverse_row_iterator &r) //[t82] │ │ │ │ │ - 312 { iterator_type::operator=(r); return *this; } │ │ │ │ │ -313 const_reverse_row_iterator operator++() //[t82] │ │ │ │ │ - 314 { iterator_type::operator--(); return *this; } │ │ │ │ │ - 315 const_reverse_row_iterator operator++(int); //[t82] │ │ │ │ │ -316 const_reverse_row_iterator &operator--() //[t82] │ │ │ │ │ - 317 { iterator_type::operator++(); return *this; } │ │ │ │ │ - 318 const_reverse_row_iterator operator--(int); //[t82] │ │ │ │ │ -319 const_reverse_row_iterator &operator+=(difference_type i) //[t82] │ │ │ │ │ - 320 { iterator_type::operator-=(i); return *this; } │ │ │ │ │ -321 const_reverse_row_iterator &operator-=(difference_type i) //[t82] │ │ │ │ │ - 322 { iterator_type::operator+=(i); return *this; } │ │ │ │ │ - 324 │ │ │ │ │ -329 const_reverse_row_iterator operator+(difference_type i) const //[t82] │ │ │ │ │ - 330 { return const_reverse_row_iterator{base()-i}; } │ │ │ │ │ -331 const_reverse_row_iterator operator-(difference_type i) //[t82] │ │ │ │ │ - 332 { return const_reverse_row_iterator{base()+i}; } │ │ │ │ │ - 333 difference_type │ │ │ │ │ -334 operator-(const const_reverse_row_iterator &rhs) const //[t82] │ │ │ │ │ - 335 { return rhs.const_row_iterator::operator-(*this); } │ │ │ │ │ - 337 │ │ │ │ │ -342 bool operator==(const const_reverse_row_iterator &rhs) const noexcept // │ │ │ │ │ -[t82] │ │ │ │ │ - 343 { return iterator_type::operator==(rhs); } │ │ │ │ │ -344 bool operator!=(const const_reverse_row_iterator &rhs) const noexcept // │ │ │ │ │ -[t82] │ │ │ │ │ - 345 { return !operator==(rhs); } │ │ │ │ │ - 346 │ │ │ │ │ -347 bool operator<(const const_reverse_row_iterator &rhs) const //[t82] │ │ │ │ │ - 348 { return iterator_type::operator>(rhs); } │ │ │ │ │ -349 bool operator<=(const const_reverse_row_iterator &rhs) const //[t82] │ │ │ │ │ - 350 { return iterator_type::operator>=(rhs); } │ │ │ │ │ -351 bool operator>(const const_reverse_row_iterator &rhs) const //[t82] │ │ │ │ │ - 352 { return iterator_type::operator<(rhs); } │ │ │ │ │ -353 bool operator>=(const const_reverse_row_iterator &rhs) const //[t82] │ │ │ │ │ - 354 { return iterator_type::operator<=(rhs); } │ │ │ │ │ - 356}; │ │ │ │ │ - 357 │ │ │ │ │ - 358 │ │ │ │ │ - 359inline const_row_iterator │ │ │ │ │ -360const_row_iterator::operator+(difference_type o) const │ │ │ │ │ - 361{ │ │ │ │ │ - 362 return const_row_iterator{ │ │ │ │ │ - 363 row(home(), idx()), │ │ │ │ │ - 364 size_type(difference_type(col()) + o)}; │ │ │ │ │ - 365} │ │ │ │ │ - 366 │ │ │ │ │ - 367inline const_row_iterator │ │ │ │ │ -368operator+(const_row_iterator::difference_type o, const_row_iterator i) │ │ │ │ │ - 369 { return i + o; } │ │ │ │ │ - 370 │ │ │ │ │ - 371inline const_row_iterator │ │ │ │ │ -372const_row_iterator::operator-(difference_type o) const │ │ │ │ │ - 373{ │ │ │ │ │ - 374 return const_row_iterator{ │ │ │ │ │ - 375 row(home(), idx()), │ │ │ │ │ - 376 size_type(difference_type(col()) - o)}; │ │ │ │ │ - 377} │ │ │ │ │ - 378 │ │ │ │ │ - 379inline const_row_iterator::difference_type │ │ │ │ │ -380const_row_iterator::operator-(const_row_iterator i) const │ │ │ │ │ - 381 { return difference_type(num() - i.num()); } │ │ │ │ │ - 382 │ │ │ │ │ - 383 │ │ │ │ │ - 384} // namespace pqxx │ │ │ │ │ - 385 │ │ │ │ │ - 386 │ │ │ │ │ - 387/* │ │ │ │ │ - 388[1] Scott Meyers, in one of his essential books, "Effective C++" and "More │ │ │ │ │ - 389Effective C++", points out that it is good style to have any class │ │ │ │ │ -containing │ │ │ │ │ - 390a member of pointer type define a destructor--just to show that it knows │ │ │ │ │ -what │ │ │ │ │ - 391it is doing with the pointer. This helps prevent nasty memory leak / double │ │ │ │ │ - 392deletion bugs typically resulting from programmers' omission to deal with │ │ │ │ │ -such │ │ │ │ │ - 393issues in their destructors. │ │ │ │ │ - 394 │ │ │ │ │ - 395The @c -Weffc++ option in gcc generates warnings for noncompliance with │ │ │ │ │ -Scott's │ │ │ │ │ - 396style guidelines, and hence necessitates the definition of this destructor, │ │ │ │ │ - 397trivial as it may be. │ │ │ │ │ - 398*/ │ │ │ │ │ - 399 │ │ │ │ │ - 400 │ │ │ │ │ - 401#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 402 │ │ │ │ │ - 403#endif │ │ │ │ │ -std │ │ │ │ │ -STL namespace. │ │ │ │ │ -pqxx │ │ │ │ │ -The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ -Definition: array.hxx:26 │ │ │ │ │ -pqxx::operator+ │ │ │ │ │ -const_result_iterator operator+(result::difference_type o, │ │ │ │ │ -const_result_iterator i) │ │ │ │ │ -Definition: result_iterator.hxx:212 │ │ │ │ │ -pqxx::row_difference_type │ │ │ │ │ -signed int row_difference_type │ │ │ │ │ -Difference between row sizes. │ │ │ │ │ -Definition: types.hxx:27 │ │ │ │ │ -pqxx::row_size_type │ │ │ │ │ -unsigned int row_size_type │ │ │ │ │ -Number of fields in a row of database data. │ │ │ │ │ -Definition: types.hxx:24 │ │ │ │ │ -pqxx::field │ │ │ │ │ -Reference to a field in a result set. │ │ │ │ │ -Definition: field.hxx:50 │ │ │ │ │ -pqxx::field::num │ │ │ │ │ -row_size_type num() const │ │ │ │ │ -Definition: field.hxx:104 │ │ │ │ │ -pqxx::field::size_type │ │ │ │ │ -field_size_type size_type │ │ │ │ │ -Definition: field.hxx:52 │ │ │ │ │ -pqxx::result │ │ │ │ │ -Result set containing data returned by a query or command. │ │ │ │ │ -Definition: result.hxx:70 │ │ │ │ │ -pqxx::row │ │ │ │ │ -Reference to one row in a result. │ │ │ │ │ -Definition: row.hxx:41 │ │ │ │ │ -pqxx::row::rownumber │ │ │ │ │ -size_t rownumber() const noexcept │ │ │ │ │ -Row number, assuming this is a real row and not end()/rend(). │ │ │ │ │ -Definition: row.hxx:113 │ │ │ │ │ -pqxx::row::column_type │ │ │ │ │ -oid column_type(const std::string &ColName) const │ │ │ │ │ -Type of given column. │ │ │ │ │ -Definition: row.hxx:134 │ │ │ │ │ -pqxx::row::column_table │ │ │ │ │ -oid column_table(const std::string &ColName) const │ │ │ │ │ -What table did this column come from? │ │ │ │ │ -Definition: row.hxx:148 │ │ │ │ │ -pqxx::row::size_type │ │ │ │ │ -row_size_type size_type │ │ │ │ │ -Definition: row.hxx:43 │ │ │ │ │ -pqxx::row::difference_type │ │ │ │ │ -row_difference_type difference_type │ │ │ │ │ -Definition: row.hxx:44 │ │ │ │ │ -pqxx::row::row │ │ │ │ │ -row()=default │ │ │ │ │ -pqxx::row::num │ │ │ │ │ -size_t num() const │ │ │ │ │ -Definition: row.hxx:170 │ │ │ │ │ -pqxx::row::table_column │ │ │ │ │ -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 │ │ │ │ │ -pqxx::row::column_number │ │ │ │ │ -size_type column_number(const std::string &ColName) const │ │ │ │ │ -Number of given column (throws exception if it doesn't exist) │ │ │ │ │ -Definition: row.hxx:120 │ │ │ │ │ -pqxx::row::~row │ │ │ │ │ -~row() noexcept=default │ │ │ │ │ -pqxx::row::column_table │ │ │ │ │ -oid column_table(int ColNum) const │ │ │ │ │ -What table did this column come from? │ │ │ │ │ -Definition: row.hxx:145 │ │ │ │ │ -pqxx::row::column_type │ │ │ │ │ -oid column_type(const char ColName[]) const │ │ │ │ │ -Type of given column. │ │ │ │ │ -Definition: row.hxx:138 │ │ │ │ │ -pqxx::row::table_column │ │ │ │ │ -size_type table_column(int ColNum) const │ │ │ │ │ -What column number in its table did this result column come from? │ │ │ │ │ -Definition: row.hxx:162 │ │ │ │ │ -pqxx::row::column_type │ │ │ │ │ -oid column_type(int ColNum) const │ │ │ │ │ -Type of given column. │ │ │ │ │ -Definition: row.hxx:130 │ │ │ │ │ -pqxx::const_row_iterator │ │ │ │ │ -Iterator for fields in a row. Use as row::const_iterator. │ │ │ │ │ -Definition: row.hxx:208 │ │ │ │ │ -pqxx::const_row_iterator::operator!= │ │ │ │ │ -bool operator!=(const const_row_iterator &i) const │ │ │ │ │ -Definition: row.hxx:250 │ │ │ │ │ -pqxx::const_row_iterator::operator++ │ │ │ │ │ -const_row_iterator & operator++() │ │ │ │ │ -Definition: row.hxx:234 │ │ │ │ │ -pqxx::const_row_iterator::operator-- │ │ │ │ │ -const_row_iterator & operator--() │ │ │ │ │ -Definition: row.hxx:236 │ │ │ │ │ -pqxx::const_row_iterator::operator<= │ │ │ │ │ -bool operator<=(const const_row_iterator &i) const │ │ │ │ │ -Definition: row.hxx:254 │ │ │ │ │ -pqxx::const_row_iterator::iterator_category │ │ │ │ │ -std::random_access_iterator_tag iterator_category │ │ │ │ │ -Definition: row.hxx:210 │ │ │ │ │ -pqxx::const_row_iterator::operator-= │ │ │ │ │ -const_row_iterator & operator-=(difference_type i) │ │ │ │ │ -Definition: row.hxx:240 │ │ │ │ │ -pqxx::const_row_iterator::operator- │ │ │ │ │ -const_row_iterator operator-(difference_type) const │ │ │ │ │ -Definition: row.hxx:372 │ │ │ │ │ -pqxx::const_row_iterator::operator+ │ │ │ │ │ -const_row_iterator operator+(difference_type) const │ │ │ │ │ -Definition: row.hxx:360 │ │ │ │ │ -pqxx::const_row_iterator::operator== │ │ │ │ │ -bool operator==(const const_row_iterator &i) const │ │ │ │ │ -Definition: row.hxx:248 │ │ │ │ │ -pqxx::const_row_iterator::operator>= │ │ │ │ │ -bool operator>=(const const_row_iterator &i) const │ │ │ │ │ -Definition: row.hxx:258 │ │ │ │ │ -pqxx::const_row_iterator::operator* │ │ │ │ │ -reference operator*() const │ │ │ │ │ -Definition: row.hxx:226 │ │ │ │ │ -pqxx::const_row_iterator::const_row_iterator │ │ │ │ │ -const_row_iterator(const row &T, row_size_type C) noexcept │ │ │ │ │ -Definition: row.hxx:217 │ │ │ │ │ -pqxx::const_row_iterator::difference_type │ │ │ │ │ -row_difference_type difference_type │ │ │ │ │ -Definition: row.hxx:214 │ │ │ │ │ -pqxx::const_row_iterator::operator-> │ │ │ │ │ -pointer operator->() const │ │ │ │ │ -Definition: row.hxx:225 │ │ │ │ │ -pqxx::const_row_iterator::operator< │ │ │ │ │ -bool operator<(const const_row_iterator &i) const │ │ │ │ │ -Definition: row.hxx:252 │ │ │ │ │ -pqxx::const_row_iterator::operator+= │ │ │ │ │ -const_row_iterator & operator+=(difference_type i) │ │ │ │ │ -Definition: row.hxx:238 │ │ │ │ │ -pqxx::const_row_iterator::operator> │ │ │ │ │ -bool operator>(const const_row_iterator &i) const │ │ │ │ │ -Definition: row.hxx:256 │ │ │ │ │ -pqxx::const_row_iterator::const_row_iterator │ │ │ │ │ -const_row_iterator(const field &F) noexcept │ │ │ │ │ -Definition: row.hxx:219 │ │ │ │ │ -pqxx::const_reverse_row_iterator │ │ │ │ │ -Reverse iterator for a row. Use as row::const_reverse_iterator. │ │ │ │ │ -Definition: row.hxx:280 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator+= │ │ │ │ │ -const_reverse_row_iterator & operator+=(difference_type i) │ │ │ │ │ -Definition: row.hxx:319 │ │ │ │ │ -pqxx::const_reverse_row_iterator::const_reverse_row_iterator │ │ │ │ │ -const_reverse_row_iterator(const const_reverse_row_iterator &r) │ │ │ │ │ -Definition: row.hxx:290 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator-= │ │ │ │ │ -const_reverse_row_iterator & operator-=(difference_type i) │ │ │ │ │ -Definition: row.hxx:321 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator!= │ │ │ │ │ -bool operator!=(const const_reverse_row_iterator &rhs) const noexcept │ │ │ │ │ -Definition: row.hxx:344 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator+ │ │ │ │ │ -const_reverse_row_iterator operator+(difference_type i) const │ │ │ │ │ -Definition: row.hxx:329 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator< │ │ │ │ │ -bool operator<(const const_reverse_row_iterator &rhs) const │ │ │ │ │ -Definition: row.hxx:347 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator- │ │ │ │ │ -const_reverse_row_iterator operator-(difference_type i) │ │ │ │ │ -Definition: row.hxx:331 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator<= │ │ │ │ │ -bool operator<=(const const_reverse_row_iterator &rhs) const │ │ │ │ │ -Definition: row.hxx:349 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator>= │ │ │ │ │ -bool operator>=(const const_reverse_row_iterator &rhs) const │ │ │ │ │ -Definition: row.hxx:353 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator> │ │ │ │ │ -bool operator>(const const_reverse_row_iterator &rhs) const │ │ │ │ │ -Definition: row.hxx:351 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator== │ │ │ │ │ -bool operator==(const const_reverse_row_iterator &rhs) const noexcept │ │ │ │ │ -Definition: row.hxx:342 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator-- │ │ │ │ │ -const_reverse_row_iterator & operator--() │ │ │ │ │ -Definition: row.hxx:316 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator- │ │ │ │ │ -difference_type operator-(const const_reverse_row_iterator &rhs) const │ │ │ │ │ -Definition: row.hxx:334 │ │ │ │ │ -pqxx::const_reverse_row_iterator::operator++ │ │ │ │ │ -const_reverse_row_iterator operator++() │ │ │ │ │ -Definition: row.hxx:313 │ │ │ │ │ -pqxx::const_reverse_row_iterator::const_reverse_row_iterator │ │ │ │ │ -const_reverse_row_iterator(const super &rhs) noexcept │ │ │ │ │ -Definition: row.hxx:293 │ │ │ │ │ +config-public-compiler.h │ │ │ │ │ + 1/* Automatically generated from config.h: public/compiler config. */ │ │ │ │ │ + 2 │ │ │ │ │ + 3#define PQXX_HAVE_DEPRECATED 1 │ │ │ │ │ + 4#define PQXX_HAVE_GCC_CONST 1 │ │ │ │ │ + 5#define PQXX_HAVE_GCC_DEPRECATED 1 │ │ │ │ │ + 6#define PQXX_HAVE_GCC_PURE 1 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * row.hxx │ │ │ │ │ + * config-public-compiler.h │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00026_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: dbtransaction.hxx Source File │ │ │ │ +libpqxx: except.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,88 +55,500 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
dbtransaction.hxx
│ │ │ │ +
except.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_DBTRANSACTION
│ │ │ │ -
14#define PQXX_H_DBTRANSACTION
│ │ │ │ +
13#ifndef PQXX_H_EXCEPT
│ │ │ │ +
14#define PQXX_H_EXCEPT
│ │ │ │
15
│ │ │ │
16#include "pqxx/compiler-public.hxx"
│ │ │ │
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │
18
│ │ │ │ -
19#include "pqxx/transaction_base.hxx"
│ │ │ │ +
19#include <stdexcept>
│ │ │ │
20
│ │ │ │ -
21namespace pqxx
│ │ │ │ -
22{
│ │ │ │ +
21#include "pqxx/util.hxx"
│ │ │ │ +
22
│ │ │ │
23
│ │ │ │ - │ │ │ │ +
24namespace pqxx
│ │ │ │
25{
│ │ │ │ - │ │ │ │ - │ │ │ │ -
28};
│ │ │ │ -
29
│ │ │ │ -
30
│ │ │ │ -
32
│ │ │ │ -
62class PQXX_LIBEXPORT PQXX_NOVTABLE dbtransaction : public transaction_base
│ │ │ │ -
63{
│ │ │ │ -
64public:
│ │ │ │ -
65 virtual ~dbtransaction();
│ │ │ │ -
66
│ │ │ │ -
67protected:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
70 const std::string &IsolationString,
│ │ │ │ - │ │ │ │ -
72
│ │ │ │ -
73 explicit dbtransaction(
│ │ │ │ - │ │ │ │ -
75 bool direct=true,
│ │ │ │ - │ │ │ │ -
77
│ │ │ │ -
78
│ │ │ │ - │ │ │ │ -
81
│ │ │ │ -
83 virtual void do_begin() override; //[t01]
│ │ │ │ -
85 virtual result do_exec(const char Query[]) override;
│ │ │ │ -
87 virtual void do_commit() override =0;
│ │ │ │ -
89
│ │ │ │ -
95 virtual void do_abort() override; //[t13]
│ │ │ │ -
96
│ │ │ │ -
97 static std::string fullname(const std::string &ttype,
│ │ │ │ -
98 const std::string &isolation);
│ │ │ │ -
99
│ │ │ │ -
100private:
│ │ │ │ -
102 std::string m_start_cmd;
│ │ │ │ -
103};
│ │ │ │ -
104
│ │ │ │ -
105} // namespace pqxx
│ │ │ │ -
106
│ │ │ │ -
107#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
108
│ │ │ │ -
109#endif
│ │ │ │ +
26
│ │ │ │ +
44
│ │ │ │ +
55class PQXX_LIBEXPORT PQXX_NOVTABLE pqxx_exception
│ │ │ │ +
56{
│ │ │ │ +
57public:
│ │ │ │ +
59 virtual ~pqxx_exception() noexcept =0;
│ │ │ │ +
60
│ │ │ │ +
62
│ │ │ │ +
84 PQXX_CONST virtual const std::exception &base() const noexcept =0; //[t00]
│ │ │ │ +
85};
│ │ │ │ +
86
│ │ │ │ +
87
│ │ │ │ +
89class PQXX_LIBEXPORT failure :
│ │ │ │ +
90 public pqxx_exception, public std::runtime_error
│ │ │ │ +
91{
│ │ │ │ +
92 virtual const std::exception &base() const noexcept override
│ │ │ │ +
93 { return *this; }
│ │ │ │ +
94public:
│ │ │ │ +
95 explicit failure(const std::string &);
│ │ │ │ +
96};
│ │ │ │ +
97
│ │ │ │ +
98
│ │ │ │ +
100
│ │ │ │ +
118class PQXX_LIBEXPORT broken_connection : public failure
│ │ │ │ +
119{
│ │ │ │ +
120public:
│ │ │ │ + │ │ │ │ +
122 explicit broken_connection(const std::string &);
│ │ │ │ +
123};
│ │ │ │ +
124
│ │ │ │ +
125
│ │ │ │ +
127
│ │ │ │ +
130class PQXX_LIBEXPORT sql_error : public failure
│ │ │ │ +
131{
│ │ │ │ +
133 const std::string m_query;
│ │ │ │ +
135 const std::string m_sqlstate;
│ │ │ │ +
136
│ │ │ │ +
137public:
│ │ │ │ +
138 explicit sql_error(
│ │ │ │ +
139 const std::string &msg="",
│ │ │ │ +
140 const std::string &Q="",
│ │ │ │ +
141 const char sqlstate[]=nullptr);
│ │ │ │ +
142 virtual ~sql_error() noexcept;
│ │ │ │ +
143
│ │ │ │ +
145 PQXX_PURE const std::string &query() const noexcept; //[t56]
│ │ │ │ +
146
│ │ │ │ +
148 PQXX_PURE const std::string &sqlstate() const noexcept;
│ │ │ │ +
149};
│ │ │ │ +
150
│ │ │ │ +
151
│ │ │ │ +
153
│ │ │ │ +
159class PQXX_LIBEXPORT in_doubt_error : public failure
│ │ │ │ +
160{
│ │ │ │ +
161public:
│ │ │ │ +
162 explicit in_doubt_error(const std::string &);
│ │ │ │ +
163};
│ │ │ │ +
164
│ │ │ │ +
165
│ │ │ │ +
167class PQXX_LIBEXPORT transaction_rollback : public failure
│ │ │ │ +
168{
│ │ │ │ +
169public:
│ │ │ │ +
170 explicit transaction_rollback(const std::string &);
│ │ │ │ +
171};
│ │ │ │ +
172
│ │ │ │ +
173
│ │ │ │ +
175
│ │ │ │ +
183class PQXX_LIBEXPORT serialization_failure : public transaction_rollback
│ │ │ │ +
184{
│ │ │ │ +
185public:
│ │ │ │ +
186 explicit serialization_failure(const std::string &);
│ │ │ │ +
187};
│ │ │ │ +
188
│ │ │ │ +
189
│ │ │ │ + │ │ │ │ +
192{
│ │ │ │ +
193public:
│ │ │ │ +
194 explicit statement_completion_unknown(const std::string &);
│ │ │ │ +
195};
│ │ │ │ +
196
│ │ │ │ +
197
│ │ │ │ +
199class PQXX_LIBEXPORT deadlock_detected : public transaction_rollback
│ │ │ │ +
200{
│ │ │ │ +
201public:
│ │ │ │ +
202 explicit deadlock_detected(const std::string &);
│ │ │ │ +
203};
│ │ │ │ +
204
│ │ │ │ +
205
│ │ │ │ +
207class PQXX_LIBEXPORT internal_error :
│ │ │ │ +
208 public pqxx_exception, public std::logic_error
│ │ │ │ +
209{
│ │ │ │ +
210 virtual const std::exception &base() const noexcept override
│ │ │ │ +
211 { return *this; }
│ │ │ │ +
212public:
│ │ │ │ +
213 explicit internal_error(const std::string &);
│ │ │ │ +
214};
│ │ │ │ +
215
│ │ │ │ +
216
│ │ │ │ +
218class PQXX_LIBEXPORT usage_error :
│ │ │ │ +
219 public pqxx_exception, public std::logic_error
│ │ │ │ +
220{
│ │ │ │ +
221 virtual const std::exception &base() const noexcept override
│ │ │ │ +
222 { return *this; }
│ │ │ │ +
223public:
│ │ │ │ +
224 explicit usage_error(const std::string &);
│ │ │ │ +
225};
│ │ │ │ +
226
│ │ │ │ +
227
│ │ │ │ +
229class PQXX_LIBEXPORT argument_error :
│ │ │ │ +
230 public pqxx_exception, public std::invalid_argument
│ │ │ │ +
231{
│ │ │ │ +
232 virtual const std::exception &base() const noexcept override
│ │ │ │ +
233 { return *this; }
│ │ │ │ +
234public:
│ │ │ │ +
235 explicit argument_error(const std::string &);
│ │ │ │ +
236};
│ │ │ │ +
237
│ │ │ │ +
238
│ │ │ │ +
240class PQXX_LIBEXPORT conversion_error :
│ │ │ │ +
241 public pqxx_exception, public std::domain_error
│ │ │ │ +
242{
│ │ │ │ +
243 virtual const std::exception &base() const noexcept override
│ │ │ │ +
244 { return *this; }
│ │ │ │ +
245public:
│ │ │ │ +
246 explicit conversion_error(const std::string &);
│ │ │ │ +
247};
│ │ │ │ +
248
│ │ │ │ +
249
│ │ │ │ +
251class PQXX_LIBEXPORT range_error :
│ │ │ │ +
252 public pqxx_exception, public std::out_of_range
│ │ │ │ +
253{
│ │ │ │ +
254 virtual const std::exception &base() const noexcept override
│ │ │ │ +
255 { return *this; }
│ │ │ │ +
256public:
│ │ │ │ +
257 explicit range_error(const std::string &);
│ │ │ │ +
258};
│ │ │ │ +
259
│ │ │ │ +
260
│ │ │ │ +
262class PQXX_LIBEXPORT unexpected_rows : public range_error
│ │ │ │ +
263{
│ │ │ │ +
264 virtual const std::exception &base() const noexcept override
│ │ │ │ +
265 { return *this; }
│ │ │ │ +
266public:
│ │ │ │ +
267 explicit unexpected_rows(const std::string &msg) : range_error{msg} {}
│ │ │ │ +
268};
│ │ │ │ +
269
│ │ │ │ +
270
│ │ │ │ +
272class PQXX_LIBEXPORT feature_not_supported : public sql_error
│ │ │ │ +
273{
│ │ │ │ +
274public:
│ │ │ │ + │ │ │ │ +
276 const std::string &err,
│ │ │ │ +
277 const std::string &Q="",
│ │ │ │ +
278 const char sqlstate[]=nullptr) :
│ │ │ │ +
279 sql_error{err, Q, sqlstate} {}
│ │ │ │ +
280};
│ │ │ │ +
281
│ │ │ │ +
283class PQXX_LIBEXPORT data_exception : public sql_error
│ │ │ │ +
284{
│ │ │ │ +
285public:
│ │ │ │ + │ │ │ │ +
287 const std::string &err,
│ │ │ │ +
288 const std::string &Q="",
│ │ │ │ +
289 const char sqlstate[]=nullptr) :
│ │ │ │ +
290 sql_error{err, Q, sqlstate} {}
│ │ │ │ +
291};
│ │ │ │ +
292
│ │ │ │ +
293class PQXX_LIBEXPORT integrity_constraint_violation : public sql_error
│ │ │ │ +
294{
│ │ │ │ +
295public:
│ │ │ │ + │ │ │ │ +
297 const std::string &err,
│ │ │ │ +
298 const std::string &Q="",
│ │ │ │ +
299 const char sqlstate[]=nullptr) :
│ │ │ │ +
300 sql_error{err, Q, sqlstate} {}
│ │ │ │ +
301};
│ │ │ │ +
302
│ │ │ │ +
303class PQXX_LIBEXPORT restrict_violation :
│ │ │ │ + │ │ │ │ +
305{
│ │ │ │ +
306public:
│ │ │ │ + │ │ │ │ +
308 const std::string &err,
│ │ │ │ +
309 const std::string &Q="",
│ │ │ │ +
310 const char sqlstate[]=nullptr) :
│ │ │ │ +
311 integrity_constraint_violation{err, Q, sqlstate} {}
│ │ │ │ +
312};
│ │ │ │ +
313
│ │ │ │ +
314class PQXX_LIBEXPORT not_null_violation :
│ │ │ │ + │ │ │ │ +
316{
│ │ │ │ +
317public:
│ │ │ │ + │ │ │ │ +
319 const std::string &err,
│ │ │ │ +
320 const std::string &Q="",
│ │ │ │ +
321 const char sqlstate[]=nullptr) :
│ │ │ │ +
322 integrity_constraint_violation{err, Q, sqlstate} {}
│ │ │ │ +
323};
│ │ │ │ +
324
│ │ │ │ +
325class PQXX_LIBEXPORT foreign_key_violation :
│ │ │ │ + │ │ │ │ +
327{
│ │ │ │ +
328public:
│ │ │ │ + │ │ │ │ +
330 const std::string &err,
│ │ │ │ +
331 const std::string &Q="",
│ │ │ │ +
332 const char sqlstate[]=nullptr) :
│ │ │ │ +
333 integrity_constraint_violation{err, Q, sqlstate} {}
│ │ │ │ +
334};
│ │ │ │ +
335
│ │ │ │ +
336class PQXX_LIBEXPORT unique_violation :
│ │ │ │ + │ │ │ │ +
338{
│ │ │ │ +
339public:
│ │ │ │ + │ │ │ │ +
341 const std::string &err,
│ │ │ │ +
342 const std::string &Q="",
│ │ │ │ +
343 const char sqlstate[]=nullptr) :
│ │ │ │ +
344 integrity_constraint_violation{err, Q, sqlstate} {}
│ │ │ │ +
345};
│ │ │ │ +
346
│ │ │ │ +
347class PQXX_LIBEXPORT check_violation :
│ │ │ │ + │ │ │ │ +
349{
│ │ │ │ +
350public:
│ │ │ │ + │ │ │ │ +
352 const std::string &err,
│ │ │ │ +
353 const std::string &Q="",
│ │ │ │ +
354 const char sqlstate[]=nullptr) :
│ │ │ │ +
355 integrity_constraint_violation{err, Q, sqlstate} {}
│ │ │ │ +
356};
│ │ │ │ +
357
│ │ │ │ +
358class PQXX_LIBEXPORT invalid_cursor_state : public sql_error
│ │ │ │ +
359{
│ │ │ │ +
360public:
│ │ │ │ + │ │ │ │ +
362 const std::string &err,
│ │ │ │ +
363 const std::string &Q="",
│ │ │ │ +
364 const char sqlstate[]=nullptr) :
│ │ │ │ +
365 sql_error{err, Q, sqlstate} {}
│ │ │ │ +
366};
│ │ │ │ +
367
│ │ │ │ +
368class PQXX_LIBEXPORT invalid_sql_statement_name : public sql_error
│ │ │ │ +
369{
│ │ │ │ +
370public:
│ │ │ │ + │ │ │ │ +
372 const std::string &err,
│ │ │ │ +
373 const std::string &Q="",
│ │ │ │ +
374 const char sqlstate[]=nullptr) :
│ │ │ │ +
375 sql_error{err, Q, sqlstate} {}
│ │ │ │ +
376};
│ │ │ │ +
377
│ │ │ │ +
378class PQXX_LIBEXPORT invalid_cursor_name : public sql_error
│ │ │ │ +
379{
│ │ │ │ +
380public:
│ │ │ │ + │ │ │ │ +
382 const std::string &err,
│ │ │ │ +
383 const std::string &Q="",
│ │ │ │ +
384 const char sqlstate[]=nullptr) :
│ │ │ │ +
385 sql_error{err, Q, sqlstate} {}
│ │ │ │ +
386};
│ │ │ │ +
387
│ │ │ │ +
388class PQXX_LIBEXPORT syntax_error : public sql_error
│ │ │ │ +
389{
│ │ │ │ +
390public:
│ │ │ │ +
392 const int error_position;
│ │ │ │ +
393
│ │ │ │ +
394 explicit syntax_error(
│ │ │ │ +
395 const std::string &err,
│ │ │ │ +
396 const std::string &Q="",
│ │ │ │ +
397 const char sqlstate[]=nullptr,
│ │ │ │ +
398 int pos=-1) :
│ │ │ │ +
399 sql_error{err, Q, sqlstate}, error_position{pos} {}
│ │ │ │ +
400};
│ │ │ │ +
401
│ │ │ │ +
402class PQXX_LIBEXPORT undefined_column : public syntax_error
│ │ │ │ +
403{
│ │ │ │ +
404public:
│ │ │ │ + │ │ │ │ +
406 const std::string &err,
│ │ │ │ +
407 const std::string &Q="",
│ │ │ │ +
408 const char sqlstate[]=nullptr) :
│ │ │ │ +
409 syntax_error{err, Q, sqlstate} {}
│ │ │ │ +
410};
│ │ │ │ +
411
│ │ │ │ +
412class PQXX_LIBEXPORT undefined_function : public syntax_error
│ │ │ │ +
413{
│ │ │ │ +
414public:
│ │ │ │ + │ │ │ │ +
416 const std::string &err,
│ │ │ │ +
417 const std::string &Q="",
│ │ │ │ +
418 const char sqlstate[]=nullptr) :
│ │ │ │ +
419 syntax_error{err, Q, sqlstate} {}
│ │ │ │ +
420};
│ │ │ │ +
421
│ │ │ │ +
422class PQXX_LIBEXPORT undefined_table : public syntax_error
│ │ │ │ +
423{
│ │ │ │ +
424public:
│ │ │ │ + │ │ │ │ +
426 const std::string &err,
│ │ │ │ +
427 const std::string &Q="",
│ │ │ │ +
428 const char sqlstate[]=nullptr) :
│ │ │ │ +
429 syntax_error{err, Q, sqlstate} {}
│ │ │ │ +
430};
│ │ │ │ +
431
│ │ │ │ +
432class PQXX_LIBEXPORT insufficient_privilege : public sql_error
│ │ │ │ +
433{
│ │ │ │ +
434public:
│ │ │ │ + │ │ │ │ +
436 const std::string &err,
│ │ │ │ +
437 const std::string &Q="",
│ │ │ │ +
438 const char sqlstate[]=nullptr) :
│ │ │ │ +
439 sql_error{err, Q, sqlstate} {}
│ │ │ │ +
440};
│ │ │ │ +
441
│ │ │ │ +
443class PQXX_LIBEXPORT insufficient_resources : public sql_error
│ │ │ │ +
444{
│ │ │ │ +
445public:
│ │ │ │ + │ │ │ │ +
447 const std::string &err,
│ │ │ │ +
448 const std::string &Q="",
│ │ │ │ +
449 const char sqlstate[]=nullptr) :
│ │ │ │ +
450 sql_error{err,Q, sqlstate} {}
│ │ │ │ +
451};
│ │ │ │ +
452
│ │ │ │ +
453class PQXX_LIBEXPORT disk_full : public insufficient_resources
│ │ │ │ +
454{
│ │ │ │ +
455public:
│ │ │ │ +
456 explicit disk_full(
│ │ │ │ +
457 const std::string &err,
│ │ │ │ +
458 const std::string &Q="",
│ │ │ │ +
459 const char sqlstate[]=nullptr) :
│ │ │ │ +
460 insufficient_resources{err, Q, sqlstate} {}
│ │ │ │ +
461};
│ │ │ │ +
462
│ │ │ │ +
463class PQXX_LIBEXPORT out_of_memory : public insufficient_resources
│ │ │ │ +
464{
│ │ │ │ +
465public:
│ │ │ │ + │ │ │ │ +
467 const std::string &err,
│ │ │ │ +
468 const std::string &Q="",
│ │ │ │ +
469 const char sqlstate[]=nullptr) :
│ │ │ │ +
470 insufficient_resources{err, Q, sqlstate} {}
│ │ │ │ +
471};
│ │ │ │ +
472
│ │ │ │ +
473class PQXX_LIBEXPORT too_many_connections : public broken_connection
│ │ │ │ +
474{
│ │ │ │ +
475public:
│ │ │ │ +
476 explicit too_many_connections(const std::string &err) :
│ │ │ │ +
477 broken_connection{err} {}
│ │ │ │ +
478};
│ │ │ │ +
479
│ │ │ │ +
481
│ │ │ │ +
483class PQXX_LIBEXPORT plpgsql_error : public sql_error
│ │ │ │ +
484{
│ │ │ │ +
485public:
│ │ │ │ + │ │ │ │ +
487 const std::string &err,
│ │ │ │ +
488 const std::string &Q="",
│ │ │ │ +
489 const char sqlstate[]=nullptr) :
│ │ │ │ +
490 sql_error{err, Q, sqlstate} {}
│ │ │ │ +
491};
│ │ │ │ +
492
│ │ │ │ +
494class PQXX_LIBEXPORT plpgsql_raise : public plpgsql_error
│ │ │ │ +
495{
│ │ │ │ +
496public:
│ │ │ │ + │ │ │ │ +
498 const std::string &err,
│ │ │ │ +
499 const std::string &Q="",
│ │ │ │ +
500 const char sqlstate[]=nullptr) :
│ │ │ │ +
501 plpgsql_error{err, Q, sqlstate} {}
│ │ │ │ +
502};
│ │ │ │ +
503
│ │ │ │ +
504class PQXX_LIBEXPORT plpgsql_no_data_found : public plpgsql_error
│ │ │ │ +
505{
│ │ │ │ +
506public:
│ │ │ │ + │ │ │ │ +
508 const std::string &err,
│ │ │ │ +
509 const std::string &Q="",
│ │ │ │ +
510 const char sqlstate[]=nullptr) :
│ │ │ │ +
511 plpgsql_error{err, Q, sqlstate} {}
│ │ │ │ +
512};
│ │ │ │ +
513
│ │ │ │ +
514class PQXX_LIBEXPORT plpgsql_too_many_rows : public plpgsql_error
│ │ │ │ +
515{
│ │ │ │ +
516public:
│ │ │ │ + │ │ │ │ +
518 const std::string &err,
│ │ │ │ +
519 const std::string &Q="",
│ │ │ │ +
520 const char sqlstate[]=nullptr) :
│ │ │ │ +
521 plpgsql_error{err, Q, sqlstate} {}
│ │ │ │ +
522};
│ │ │ │ +
523
│ │ │ │ +
528}
│ │ │ │ +
529
│ │ │ │ +
530#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
531
│ │ │ │ +
532#endif
│ │ │ │ +
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
readwrite_policy
Definition: dbtransaction.hxx:25
│ │ │ │ -
@ read_only
Definition: dbtransaction.hxx:26
│ │ │ │ -
@ read_write
Definition: dbtransaction.hxx:27
│ │ │ │ -
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ -
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ -
void start_backend_transaction()
Start a transaction on the backend and set desired isolation level.
│ │ │ │ -
virtual void do_commit() override=0
To be implemented by derived class: commit backend transaction.
│ │ │ │ -
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ -
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │ +
Mixin base class to identify libpqxx-specific exception types.
Definition: except.hxx:56
│ │ │ │ +
virtual PQXX_CONST const std::exception & base() const noexcept=0
Return std::exception base-class object.
│ │ │ │ +
Run-time failure encountered by libpqxx, similar to std::runtime_error.
Definition: except.hxx:91
│ │ │ │ +
Exception class for lost or failed backend connection.
Definition: except.hxx:119
│ │ │ │ +
Exception class for failed queries.
Definition: except.hxx:131
│ │ │ │ +
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:160
│ │ │ │ +
The backend saw itself forced to roll back the ongoing transaction.
Definition: except.hxx:168
│ │ │ │ +
Transaction failed to serialize. Please retry it.
Definition: except.hxx:184
│ │ │ │ +
We can't tell whether our last statement succeeded.
Definition: except.hxx:192
│ │ │ │ +
The ongoing transaction has deadlocked. Retrying it may help.
Definition: except.hxx:200
│ │ │ │ +
Internal error in libpqxx library.
Definition: except.hxx:209
│ │ │ │ +
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:220
│ │ │ │ +
Invalid argument passed to libpqxx, similar to std::invalid_argument.
Definition: except.hxx:231
│ │ │ │ +
Value conversion failed, e.g. when converting "Hello" to int.
Definition: except.hxx:242
│ │ │ │ +
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:253
│ │ │ │ +
Query returned an unexpected number of rows.
Definition: except.hxx:263
│ │ │ │ +
unexpected_rows(const std::string &msg)
Definition: except.hxx:267
│ │ │ │ +
Database feature not supported in current setup.
Definition: except.hxx:273
│ │ │ │ +
feature_not_supported(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:275
│ │ │ │ +
Error in data provided to SQL statement.
Definition: except.hxx:284
│ │ │ │ +
data_exception(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:286
│ │ │ │ +
Definition: except.hxx:294
│ │ │ │ +
integrity_constraint_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:296
│ │ │ │ +
Definition: except.hxx:305
│ │ │ │ +
restrict_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:307
│ │ │ │ +
Definition: except.hxx:316
│ │ │ │ +
not_null_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:318
│ │ │ │ +
Definition: except.hxx:327
│ │ │ │ +
foreign_key_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:329
│ │ │ │ +
Definition: except.hxx:338
│ │ │ │ +
unique_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:340
│ │ │ │ +
Definition: except.hxx:349
│ │ │ │ +
check_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:351
│ │ │ │ +
Definition: except.hxx:359
│ │ │ │ +
invalid_cursor_state(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:361
│ │ │ │ +
Definition: except.hxx:369
│ │ │ │ +
invalid_sql_statement_name(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:371
│ │ │ │ +
Definition: except.hxx:379
│ │ │ │ +
invalid_cursor_name(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:381
│ │ │ │ +
Definition: except.hxx:389
│ │ │ │ +
const int error_position
Approximate position in string where error occurred, or -1 if unknown.
Definition: except.hxx:392
│ │ │ │ +
syntax_error(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr, int pos=-1)
Definition: except.hxx:394
│ │ │ │ +
Definition: except.hxx:403
│ │ │ │ +
undefined_column(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:405
│ │ │ │ +
Definition: except.hxx:413
│ │ │ │ +
undefined_function(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:415
│ │ │ │ +
Definition: except.hxx:423
│ │ │ │ +
undefined_table(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:425
│ │ │ │ +
Definition: except.hxx:433
│ │ │ │ +
insufficient_privilege(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:435
│ │ │ │ +
Resource shortage on the server.
Definition: except.hxx:444
│ │ │ │ +
insufficient_resources(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:446
│ │ │ │ +
Definition: except.hxx:454
│ │ │ │ +
disk_full(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:456
│ │ │ │ +
Definition: except.hxx:464
│ │ │ │ +
out_of_memory(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:466
│ │ │ │ +
Definition: except.hxx:474
│ │ │ │ +
too_many_connections(const std::string &err)
Definition: except.hxx:476
│ │ │ │ +
PL/pgSQL error.
Definition: except.hxx:484
│ │ │ │ +
plpgsql_error(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:486
│ │ │ │ +
Exception raised in PL/pgSQL procedure.
Definition: except.hxx:495
│ │ │ │ +
plpgsql_raise(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:497
│ │ │ │ +
Definition: except.hxx:505
│ │ │ │ +
plpgsql_no_data_found(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:507
│ │ │ │ +
Definition: except.hxx:515
│ │ │ │ +
plpgsql_too_many_rows(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:517
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,99 +1,632 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -dbtransaction.hxx │ │ │ │ │ +except.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_DBTRANSACTION │ │ │ │ │ - 14#define PQXX_H_DBTRANSACTION │ │ │ │ │ + 13#ifndef PQXX_H_EXCEPT │ │ │ │ │ + 14#define PQXX_H_EXCEPT │ │ │ │ │ 15 │ │ │ │ │ 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ 18 │ │ │ │ │ - 19#include "pqxx/transaction_base.hxx" │ │ │ │ │ + 19#include │ │ │ │ │ 20 │ │ │ │ │ - 21namespace pqxx │ │ │ │ │ - 22{ │ │ │ │ │ + 21#include "pqxx/util.hxx" │ │ │ │ │ + 22 │ │ │ │ │ 23 │ │ │ │ │ -24enum readwrite_policy │ │ │ │ │ + 24namespace pqxx │ │ │ │ │ 25{ │ │ │ │ │ -26 read_only, │ │ │ │ │ - 27 read_write │ │ │ │ │ -28}; │ │ │ │ │ - 29 │ │ │ │ │ - 30 │ │ │ │ │ - 32 │ │ │ │ │ -62class PQXX_LIBEXPORT PQXX_NOVTABLE dbtransaction : public transaction_base │ │ │ │ │ - 63{ │ │ │ │ │ - 64public: │ │ │ │ │ - 65 virtual ~dbtransaction(); │ │ │ │ │ - 66 │ │ │ │ │ - 67protected: │ │ │ │ │ - 68 dbtransaction( │ │ │ │ │ - 69 connection_base &, │ │ │ │ │ - 70 const std::string &IsolationString, │ │ │ │ │ - 71 readwrite_policy rw=read_write); │ │ │ │ │ - 72 │ │ │ │ │ - 73 explicit dbtransaction( │ │ │ │ │ - 74 connection_base &, │ │ │ │ │ - 75 bool direct=true, │ │ │ │ │ - 76 readwrite_policy rw=read_write); │ │ │ │ │ - 77 │ │ │ │ │ - 78 │ │ │ │ │ -80 void start_backend_transaction(); │ │ │ │ │ - 81 │ │ │ │ │ - 83 virtual void do_begin() override; //[t01] │ │ │ │ │ - 85 virtual result do_exec(const char Query[]) override; │ │ │ │ │ -87 virtual void do_commit() override =0; │ │ │ │ │ - 89 │ │ │ │ │ - 95 virtual void do_abort() override; //[t13] │ │ │ │ │ - 96 │ │ │ │ │ - 97 static std::string fullname(const std::string &ttype, │ │ │ │ │ - 98 const std::string &isolation); │ │ │ │ │ - 99 │ │ │ │ │ - 100private: │ │ │ │ │ - 102 std::string m_start_cmd; │ │ │ │ │ - 103}; │ │ │ │ │ - 104 │ │ │ │ │ - 105} // namespace pqxx │ │ │ │ │ - 106 │ │ │ │ │ - 107#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 108 │ │ │ │ │ - 109#endif │ │ │ │ │ + 26 │ │ │ │ │ + 44 │ │ │ │ │ +55class PQXX_LIBEXPORT PQXX_NOVTABLE pqxx_exception │ │ │ │ │ + 56{ │ │ │ │ │ + 57public: │ │ │ │ │ + 59 virtual ~pqxx_exception() noexcept =0; │ │ │ │ │ + 60 │ │ │ │ │ + 62 │ │ │ │ │ +84 PQXX_CONST virtual const std::exception &base() const noexcept =0; //[t00] │ │ │ │ │ + 85}; │ │ │ │ │ + 86 │ │ │ │ │ + 87 │ │ │ │ │ +89class PQXX_LIBEXPORT failure : │ │ │ │ │ + 90 public pqxx_exception, public std::runtime_error │ │ │ │ │ + 91{ │ │ │ │ │ + 92 virtual const std::exception &base() const noexcept override │ │ │ │ │ + 93 { return *this; } │ │ │ │ │ + 94public: │ │ │ │ │ + 95 explicit failure(const std::string &); │ │ │ │ │ + 96}; │ │ │ │ │ + 97 │ │ │ │ │ + 98 │ │ │ │ │ + 100 │ │ │ │ │ +118class PQXX_LIBEXPORT broken_connection : public failure │ │ │ │ │ + 119{ │ │ │ │ │ + 120public: │ │ │ │ │ + 121 broken_connection(); │ │ │ │ │ + 122 explicit broken_connection(const std::string &); │ │ │ │ │ + 123}; │ │ │ │ │ + 124 │ │ │ │ │ + 125 │ │ │ │ │ + 127 │ │ │ │ │ +130class PQXX_LIBEXPORT sql_error : public failure │ │ │ │ │ + 131{ │ │ │ │ │ + 133 const std::string m_query; │ │ │ │ │ + 135 const std::string m_sqlstate; │ │ │ │ │ + 136 │ │ │ │ │ + 137public: │ │ │ │ │ + 138 explicit sql_error( │ │ │ │ │ + 139 const std::string &msg="", │ │ │ │ │ + 140 const std::string &Q="", │ │ │ │ │ + 141 const char sqlstate[]=nullptr); │ │ │ │ │ + 142 virtual ~sql_error() noexcept; │ │ │ │ │ + 143 │ │ │ │ │ + 145 PQXX_PURE const std::string &query() const noexcept; //[t56] │ │ │ │ │ + 146 │ │ │ │ │ + 148 PQXX_PURE const std::string &sqlstate() const noexcept; │ │ │ │ │ + 149}; │ │ │ │ │ + 150 │ │ │ │ │ + 151 │ │ │ │ │ + 153 │ │ │ │ │ +159class PQXX_LIBEXPORT in_doubt_error : public failure │ │ │ │ │ + 160{ │ │ │ │ │ + 161public: │ │ │ │ │ + 162 explicit in_doubt_error(const std::string &); │ │ │ │ │ + 163}; │ │ │ │ │ + 164 │ │ │ │ │ + 165 │ │ │ │ │ +167class PQXX_LIBEXPORT transaction_rollback : public failure │ │ │ │ │ + 168{ │ │ │ │ │ + 169public: │ │ │ │ │ + 170 explicit transaction_rollback(const std::string &); │ │ │ │ │ + 171}; │ │ │ │ │ + 172 │ │ │ │ │ + 173 │ │ │ │ │ + 175 │ │ │ │ │ +183class PQXX_LIBEXPORT serialization_failure : public transaction_rollback │ │ │ │ │ + 184{ │ │ │ │ │ + 185public: │ │ │ │ │ + 186 explicit serialization_failure(const std::string &); │ │ │ │ │ + 187}; │ │ │ │ │ + 188 │ │ │ │ │ + 189 │ │ │ │ │ +191class PQXX_LIBEXPORT statement_completion_unknown : public │ │ │ │ │ +transaction_rollback │ │ │ │ │ + 192{ │ │ │ │ │ + 193public: │ │ │ │ │ + 194 explicit statement_completion_unknown(const std::string &); │ │ │ │ │ + 195}; │ │ │ │ │ + 196 │ │ │ │ │ + 197 │ │ │ │ │ +199class PQXX_LIBEXPORT deadlock_detected : public transaction_rollback │ │ │ │ │ + 200{ │ │ │ │ │ + 201public: │ │ │ │ │ + 202 explicit deadlock_detected(const std::string &); │ │ │ │ │ + 203}; │ │ │ │ │ + 204 │ │ │ │ │ + 205 │ │ │ │ │ +207class PQXX_LIBEXPORT internal_error : │ │ │ │ │ + 208 public pqxx_exception, public std::logic_error │ │ │ │ │ + 209{ │ │ │ │ │ + 210 virtual const std::exception &base() const noexcept override │ │ │ │ │ + 211 { return *this; } │ │ │ │ │ + 212public: │ │ │ │ │ + 213 explicit internal_error(const std::string &); │ │ │ │ │ + 214}; │ │ │ │ │ + 215 │ │ │ │ │ + 216 │ │ │ │ │ +218class PQXX_LIBEXPORT usage_error : │ │ │ │ │ + 219 public pqxx_exception, public std::logic_error │ │ │ │ │ + 220{ │ │ │ │ │ + 221 virtual const std::exception &base() const noexcept override │ │ │ │ │ + 222 { return *this; } │ │ │ │ │ + 223public: │ │ │ │ │ + 224 explicit usage_error(const std::string &); │ │ │ │ │ + 225}; │ │ │ │ │ + 226 │ │ │ │ │ + 227 │ │ │ │ │ +229class PQXX_LIBEXPORT argument_error : │ │ │ │ │ + 230 public pqxx_exception, public std::invalid_argument │ │ │ │ │ + 231{ │ │ │ │ │ + 232 virtual const std::exception &base() const noexcept override │ │ │ │ │ + 233 { return *this; } │ │ │ │ │ + 234public: │ │ │ │ │ + 235 explicit argument_error(const std::string &); │ │ │ │ │ + 236}; │ │ │ │ │ + 237 │ │ │ │ │ + 238 │ │ │ │ │ +240class PQXX_LIBEXPORT conversion_error : │ │ │ │ │ + 241 public pqxx_exception, public std::domain_error │ │ │ │ │ + 242{ │ │ │ │ │ + 243 virtual const std::exception &base() const noexcept override │ │ │ │ │ + 244 { return *this; } │ │ │ │ │ + 245public: │ │ │ │ │ + 246 explicit conversion_error(const std::string &); │ │ │ │ │ + 247}; │ │ │ │ │ + 248 │ │ │ │ │ + 249 │ │ │ │ │ +251class PQXX_LIBEXPORT range_error : │ │ │ │ │ + 252 public pqxx_exception, public std::out_of_range │ │ │ │ │ + 253{ │ │ │ │ │ + 254 virtual const std::exception &base() const noexcept override │ │ │ │ │ + 255 { return *this; } │ │ │ │ │ + 256public: │ │ │ │ │ + 257 explicit range_error(const std::string &); │ │ │ │ │ + 258}; │ │ │ │ │ + 259 │ │ │ │ │ + 260 │ │ │ │ │ +262class PQXX_LIBEXPORT unexpected_rows : public range_error │ │ │ │ │ + 263{ │ │ │ │ │ + 264 virtual const std::exception &base() const noexcept override │ │ │ │ │ + 265 { return *this; } │ │ │ │ │ + 266public: │ │ │ │ │ +267 explicit unexpected_rows(const std::string &msg) : range_error{msg} {} │ │ │ │ │ + 268}; │ │ │ │ │ + 269 │ │ │ │ │ + 270 │ │ │ │ │ +272class PQXX_LIBEXPORT feature_not_supported : public sql_error │ │ │ │ │ + 273{ │ │ │ │ │ + 274public: │ │ │ │ │ +275 explicit feature_not_supported( │ │ │ │ │ + 276 const std::string &err, │ │ │ │ │ + 277 const std::string &Q="", │ │ │ │ │ + 278 const char sqlstate[]=nullptr) : │ │ │ │ │ + 279 sql_error{err, Q, sqlstate} {} │ │ │ │ │ + 280}; │ │ │ │ │ + 281 │ │ │ │ │ +283class PQXX_LIBEXPORT data_exception : public sql_error │ │ │ │ │ + 284{ │ │ │ │ │ + 285public: │ │ │ │ │ +286 explicit data_exception( │ │ │ │ │ + 287 const std::string &err, │ │ │ │ │ + 288 const std::string &Q="", │ │ │ │ │ + 289 const char sqlstate[]=nullptr) : │ │ │ │ │ + 290 sql_error{err, Q, sqlstate} {} │ │ │ │ │ + 291}; │ │ │ │ │ + 292 │ │ │ │ │ +293class PQXX_LIBEXPORT integrity_constraint_violation : public sql_error │ │ │ │ │ + 294{ │ │ │ │ │ + 295public: │ │ │ │ │ +296 explicit integrity_constraint_violation( │ │ │ │ │ + 297 const std::string &err, │ │ │ │ │ + 298 const std::string &Q="", │ │ │ │ │ + 299 const char sqlstate[]=nullptr) : │ │ │ │ │ + 300 sql_error{err, Q, sqlstate} {} │ │ │ │ │ + 301}; │ │ │ │ │ + 302 │ │ │ │ │ +303class PQXX_LIBEXPORT restrict_violation : │ │ │ │ │ + 304 public integrity_constraint_violation │ │ │ │ │ + 305{ │ │ │ │ │ + 306public: │ │ │ │ │ +307 explicit restrict_violation( │ │ │ │ │ + 308 const std::string &err, │ │ │ │ │ + 309 const std::string &Q="", │ │ │ │ │ + 310 const char sqlstate[]=nullptr) : │ │ │ │ │ + 311 integrity_constraint_violation{err, Q, sqlstate} {} │ │ │ │ │ + 312}; │ │ │ │ │ + 313 │ │ │ │ │ +314class PQXX_LIBEXPORT not_null_violation : │ │ │ │ │ + 315 public integrity_constraint_violation │ │ │ │ │ + 316{ │ │ │ │ │ + 317public: │ │ │ │ │ +318 explicit not_null_violation( │ │ │ │ │ + 319 const std::string &err, │ │ │ │ │ + 320 const std::string &Q="", │ │ │ │ │ + 321 const char sqlstate[]=nullptr) : │ │ │ │ │ + 322 integrity_constraint_violation{err, Q, sqlstate} {} │ │ │ │ │ + 323}; │ │ │ │ │ + 324 │ │ │ │ │ +325class PQXX_LIBEXPORT foreign_key_violation : │ │ │ │ │ + 326 public integrity_constraint_violation │ │ │ │ │ + 327{ │ │ │ │ │ + 328public: │ │ │ │ │ +329 explicit foreign_key_violation( │ │ │ │ │ + 330 const std::string &err, │ │ │ │ │ + 331 const std::string &Q="", │ │ │ │ │ + 332 const char sqlstate[]=nullptr) : │ │ │ │ │ + 333 integrity_constraint_violation{err, Q, sqlstate} {} │ │ │ │ │ + 334}; │ │ │ │ │ + 335 │ │ │ │ │ +336class PQXX_LIBEXPORT unique_violation : │ │ │ │ │ + 337 public integrity_constraint_violation │ │ │ │ │ + 338{ │ │ │ │ │ + 339public: │ │ │ │ │ +340 explicit unique_violation( │ │ │ │ │ + 341 const std::string &err, │ │ │ │ │ + 342 const std::string &Q="", │ │ │ │ │ + 343 const char sqlstate[]=nullptr) : │ │ │ │ │ + 344 integrity_constraint_violation{err, Q, sqlstate} {} │ │ │ │ │ + 345}; │ │ │ │ │ + 346 │ │ │ │ │ +347class PQXX_LIBEXPORT check_violation : │ │ │ │ │ + 348 public integrity_constraint_violation │ │ │ │ │ + 349{ │ │ │ │ │ + 350public: │ │ │ │ │ +351 explicit check_violation( │ │ │ │ │ + 352 const std::string &err, │ │ │ │ │ + 353 const std::string &Q="", │ │ │ │ │ + 354 const char sqlstate[]=nullptr) : │ │ │ │ │ + 355 integrity_constraint_violation{err, Q, sqlstate} {} │ │ │ │ │ + 356}; │ │ │ │ │ + 357 │ │ │ │ │ +358class PQXX_LIBEXPORT invalid_cursor_state : public sql_error │ │ │ │ │ + 359{ │ │ │ │ │ + 360public: │ │ │ │ │ +361 explicit invalid_cursor_state( │ │ │ │ │ + 362 const std::string &err, │ │ │ │ │ + 363 const std::string &Q="", │ │ │ │ │ + 364 const char sqlstate[]=nullptr) : │ │ │ │ │ + 365 sql_error{err, Q, sqlstate} {} │ │ │ │ │ + 366}; │ │ │ │ │ + 367 │ │ │ │ │ +368class PQXX_LIBEXPORT invalid_sql_statement_name : public sql_error │ │ │ │ │ + 369{ │ │ │ │ │ + 370public: │ │ │ │ │ +371 explicit invalid_sql_statement_name( │ │ │ │ │ + 372 const std::string &err, │ │ │ │ │ + 373 const std::string &Q="", │ │ │ │ │ + 374 const char sqlstate[]=nullptr) : │ │ │ │ │ + 375 sql_error{err, Q, sqlstate} {} │ │ │ │ │ + 376}; │ │ │ │ │ + 377 │ │ │ │ │ +378class PQXX_LIBEXPORT invalid_cursor_name : public sql_error │ │ │ │ │ + 379{ │ │ │ │ │ + 380public: │ │ │ │ │ +381 explicit invalid_cursor_name( │ │ │ │ │ + 382 const std::string &err, │ │ │ │ │ + 383 const std::string &Q="", │ │ │ │ │ + 384 const char sqlstate[]=nullptr) : │ │ │ │ │ + 385 sql_error{err, Q, sqlstate} {} │ │ │ │ │ + 386}; │ │ │ │ │ + 387 │ │ │ │ │ +388class PQXX_LIBEXPORT syntax_error : public sql_error │ │ │ │ │ + 389{ │ │ │ │ │ + 390public: │ │ │ │ │ +392 const int error_position; │ │ │ │ │ + 393 │ │ │ │ │ +394 explicit syntax_error( │ │ │ │ │ + 395 const std::string &err, │ │ │ │ │ + 396 const std::string &Q="", │ │ │ │ │ + 397 const char sqlstate[]=nullptr, │ │ │ │ │ + 398 int pos=-1) : │ │ │ │ │ + 399 sql_error{err, Q, sqlstate}, error_position{pos} {} │ │ │ │ │ + 400}; │ │ │ │ │ + 401 │ │ │ │ │ +402class PQXX_LIBEXPORT undefined_column : public syntax_error │ │ │ │ │ + 403{ │ │ │ │ │ + 404public: │ │ │ │ │ +405 explicit undefined_column( │ │ │ │ │ + 406 const std::string &err, │ │ │ │ │ + 407 const std::string &Q="", │ │ │ │ │ + 408 const char sqlstate[]=nullptr) : │ │ │ │ │ + 409 syntax_error{err, Q, sqlstate} {} │ │ │ │ │ + 410}; │ │ │ │ │ + 411 │ │ │ │ │ +412class PQXX_LIBEXPORT undefined_function : public syntax_error │ │ │ │ │ + 413{ │ │ │ │ │ + 414public: │ │ │ │ │ +415 explicit undefined_function( │ │ │ │ │ + 416 const std::string &err, │ │ │ │ │ + 417 const std::string &Q="", │ │ │ │ │ + 418 const char sqlstate[]=nullptr) : │ │ │ │ │ + 419 syntax_error{err, Q, sqlstate} {} │ │ │ │ │ + 420}; │ │ │ │ │ + 421 │ │ │ │ │ +422class PQXX_LIBEXPORT undefined_table : public syntax_error │ │ │ │ │ + 423{ │ │ │ │ │ + 424public: │ │ │ │ │ +425 explicit undefined_table( │ │ │ │ │ + 426 const std::string &err, │ │ │ │ │ + 427 const std::string &Q="", │ │ │ │ │ + 428 const char sqlstate[]=nullptr) : │ │ │ │ │ + 429 syntax_error{err, Q, sqlstate} {} │ │ │ │ │ + 430}; │ │ │ │ │ + 431 │ │ │ │ │ +432class PQXX_LIBEXPORT insufficient_privilege : public sql_error │ │ │ │ │ + 433{ │ │ │ │ │ + 434public: │ │ │ │ │ +435 explicit insufficient_privilege( │ │ │ │ │ + 436 const std::string &err, │ │ │ │ │ + 437 const std::string &Q="", │ │ │ │ │ + 438 const char sqlstate[]=nullptr) : │ │ │ │ │ + 439 sql_error{err, Q, sqlstate} {} │ │ │ │ │ + 440}; │ │ │ │ │ + 441 │ │ │ │ │ +443class PQXX_LIBEXPORT insufficient_resources : public sql_error │ │ │ │ │ + 444{ │ │ │ │ │ + 445public: │ │ │ │ │ +446 explicit insufficient_resources( │ │ │ │ │ + 447 const std::string &err, │ │ │ │ │ + 448 const std::string &Q="", │ │ │ │ │ + 449 const char sqlstate[]=nullptr) : │ │ │ │ │ + 450 sql_error{err,Q, sqlstate} {} │ │ │ │ │ + 451}; │ │ │ │ │ + 452 │ │ │ │ │ +453class PQXX_LIBEXPORT disk_full : public insufficient_resources │ │ │ │ │ + 454{ │ │ │ │ │ + 455public: │ │ │ │ │ +456 explicit disk_full( │ │ │ │ │ + 457 const std::string &err, │ │ │ │ │ + 458 const std::string &Q="", │ │ │ │ │ + 459 const char sqlstate[]=nullptr) : │ │ │ │ │ + 460 insufficient_resources{err, Q, sqlstate} {} │ │ │ │ │ + 461}; │ │ │ │ │ + 462 │ │ │ │ │ +463class PQXX_LIBEXPORT out_of_memory : public insufficient_resources │ │ │ │ │ + 464{ │ │ │ │ │ + 465public: │ │ │ │ │ +466 explicit out_of_memory( │ │ │ │ │ + 467 const std::string &err, │ │ │ │ │ + 468 const std::string &Q="", │ │ │ │ │ + 469 const char sqlstate[]=nullptr) : │ │ │ │ │ + 470 insufficient_resources{err, Q, sqlstate} {} │ │ │ │ │ + 471}; │ │ │ │ │ + 472 │ │ │ │ │ +473class PQXX_LIBEXPORT too_many_connections : public broken_connection │ │ │ │ │ + 474{ │ │ │ │ │ + 475public: │ │ │ │ │ +476 explicit too_many_connections(const std::string &err) : │ │ │ │ │ + 477 broken_connection{err} {} │ │ │ │ │ + 478}; │ │ │ │ │ + 479 │ │ │ │ │ + 481 │ │ │ │ │ +483class PQXX_LIBEXPORT plpgsql_error : public sql_error │ │ │ │ │ + 484{ │ │ │ │ │ + 485public: │ │ │ │ │ +486 explicit plpgsql_error( │ │ │ │ │ + 487 const std::string &err, │ │ │ │ │ + 488 const std::string &Q="", │ │ │ │ │ + 489 const char sqlstate[]=nullptr) : │ │ │ │ │ + 490 sql_error{err, Q, sqlstate} {} │ │ │ │ │ + 491}; │ │ │ │ │ + 492 │ │ │ │ │ +494class PQXX_LIBEXPORT plpgsql_raise : public plpgsql_error │ │ │ │ │ + 495{ │ │ │ │ │ + 496public: │ │ │ │ │ +497 explicit plpgsql_raise( │ │ │ │ │ + 498 const std::string &err, │ │ │ │ │ + 499 const std::string &Q="", │ │ │ │ │ + 500 const char sqlstate[]=nullptr) : │ │ │ │ │ + 501 plpgsql_error{err, Q, sqlstate} {} │ │ │ │ │ + 502}; │ │ │ │ │ + 503 │ │ │ │ │ +504class PQXX_LIBEXPORT plpgsql_no_data_found : public plpgsql_error │ │ │ │ │ + 505{ │ │ │ │ │ + 506public: │ │ │ │ │ +507 explicit plpgsql_no_data_found( │ │ │ │ │ + 508 const std::string &err, │ │ │ │ │ + 509 const std::string &Q="", │ │ │ │ │ + 510 const char sqlstate[]=nullptr) : │ │ │ │ │ + 511 plpgsql_error{err, Q, sqlstate} {} │ │ │ │ │ + 512}; │ │ │ │ │ + 513 │ │ │ │ │ +514class PQXX_LIBEXPORT plpgsql_too_many_rows : public plpgsql_error │ │ │ │ │ + 515{ │ │ │ │ │ + 516public: │ │ │ │ │ +517 explicit plpgsql_too_many_rows( │ │ │ │ │ + 518 const std::string &err, │ │ │ │ │ + 519 const std::string &Q="", │ │ │ │ │ + 520 const char sqlstate[]=nullptr) : │ │ │ │ │ + 521 plpgsql_error{err, Q, sqlstate} {} │ │ │ │ │ + 522}; │ │ │ │ │ + 523 │ │ │ │ │ + 528} │ │ │ │ │ + 529 │ │ │ │ │ + 530#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 531 │ │ │ │ │ + 532#endif │ │ │ │ │ +std │ │ │ │ │ +STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::readwrite_policy │ │ │ │ │ -readwrite_policy │ │ │ │ │ -Definition: dbtransaction.hxx:25 │ │ │ │ │ -pqxx::read_only │ │ │ │ │ -@ read_only │ │ │ │ │ -Definition: dbtransaction.hxx:26 │ │ │ │ │ -pqxx::read_write │ │ │ │ │ -@ read_write │ │ │ │ │ -Definition: dbtransaction.hxx:27 │ │ │ │ │ -pqxx::connection_base │ │ │ │ │ -connection_base abstract base class; represents a connection to a database. │ │ │ │ │ -Definition: connection_base.hxx:140 │ │ │ │ │ -pqxx::dbtransaction │ │ │ │ │ -Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ -Definition: dbtransaction.hxx:63 │ │ │ │ │ -pqxx::dbtransaction::start_backend_transaction │ │ │ │ │ -void start_backend_transaction() │ │ │ │ │ -Start a transaction on the backend and set desired isolation level. │ │ │ │ │ -pqxx::dbtransaction::do_commit │ │ │ │ │ -virtual void do_commit() override=0 │ │ │ │ │ -To be implemented by derived class: commit backend transaction. │ │ │ │ │ -pqxx::result │ │ │ │ │ -Result set containing data returned by a query or command. │ │ │ │ │ -Definition: result.hxx:70 │ │ │ │ │ -pqxx::transaction_base │ │ │ │ │ -Interface definition (and common code) for "transaction" classes. │ │ │ │ │ -Definition: transaction_base.hxx:138 │ │ │ │ │ +pqxx::pqxx_exception │ │ │ │ │ +Mixin base class to identify libpqxx-specific exception types. │ │ │ │ │ +Definition: except.hxx:56 │ │ │ │ │ +pqxx::pqxx_exception::base │ │ │ │ │ +virtual PQXX_CONST const std::exception & base() const noexcept=0 │ │ │ │ │ +Return std::exception base-class object. │ │ │ │ │ +pqxx::failure │ │ │ │ │ +Run-time failure encountered by libpqxx, similar to std::runtime_error. │ │ │ │ │ +Definition: except.hxx:91 │ │ │ │ │ +pqxx::broken_connection │ │ │ │ │ +Exception class for lost or failed backend connection. │ │ │ │ │ +Definition: except.hxx:119 │ │ │ │ │ +pqxx::sql_error │ │ │ │ │ +Exception class for failed queries. │ │ │ │ │ +Definition: except.hxx:131 │ │ │ │ │ +pqxx::in_doubt_error │ │ │ │ │ +"Help, I don't know whether transaction was committed successfully!" │ │ │ │ │ +Definition: except.hxx:160 │ │ │ │ │ +pqxx::transaction_rollback │ │ │ │ │ +The backend saw itself forced to roll back the ongoing transaction. │ │ │ │ │ +Definition: except.hxx:168 │ │ │ │ │ +pqxx::serialization_failure │ │ │ │ │ +Transaction failed to serialize. Please retry it. │ │ │ │ │ +Definition: except.hxx:184 │ │ │ │ │ +pqxx::statement_completion_unknown │ │ │ │ │ +We can't tell whether our last statement succeeded. │ │ │ │ │ +Definition: except.hxx:192 │ │ │ │ │ +pqxx::deadlock_detected │ │ │ │ │ +The ongoing transaction has deadlocked. Retrying it may help. │ │ │ │ │ +Definition: except.hxx:200 │ │ │ │ │ +pqxx::internal_error │ │ │ │ │ +Internal error in libpqxx library. │ │ │ │ │ +Definition: except.hxx:209 │ │ │ │ │ +pqxx::usage_error │ │ │ │ │ +Error in usage of libpqxx library, similar to std::logic_error. │ │ │ │ │ +Definition: except.hxx:220 │ │ │ │ │ +pqxx::argument_error │ │ │ │ │ +Invalid argument passed to libpqxx, similar to std::invalid_argument. │ │ │ │ │ +Definition: except.hxx:231 │ │ │ │ │ +pqxx::conversion_error │ │ │ │ │ +Value conversion failed, e.g. when converting "Hello" to int. │ │ │ │ │ +Definition: except.hxx:242 │ │ │ │ │ +pqxx::range_error │ │ │ │ │ +Something is out of range, similar to std::out_of_range. │ │ │ │ │ +Definition: except.hxx:253 │ │ │ │ │ +pqxx::unexpected_rows │ │ │ │ │ +Query returned an unexpected number of rows. │ │ │ │ │ +Definition: except.hxx:263 │ │ │ │ │ +pqxx::unexpected_rows::unexpected_rows │ │ │ │ │ +unexpected_rows(const std::string &msg) │ │ │ │ │ +Definition: except.hxx:267 │ │ │ │ │ +pqxx::feature_not_supported │ │ │ │ │ +Database feature not supported in current setup. │ │ │ │ │ +Definition: except.hxx:273 │ │ │ │ │ +pqxx::feature_not_supported::feature_not_supported │ │ │ │ │ +feature_not_supported(const std::string &err, const std::string &Q="", const │ │ │ │ │ +char sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:275 │ │ │ │ │ +pqxx::data_exception │ │ │ │ │ +Error in data provided to SQL statement. │ │ │ │ │ +Definition: except.hxx:284 │ │ │ │ │ +pqxx::data_exception::data_exception │ │ │ │ │ +data_exception(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:286 │ │ │ │ │ +pqxx::integrity_constraint_violation │ │ │ │ │ +Definition: except.hxx:294 │ │ │ │ │ +pqxx::integrity_constraint_violation::integrity_constraint_violation │ │ │ │ │ +integrity_constraint_violation(const std::string &err, const std::string &Q="", │ │ │ │ │ +const char sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:296 │ │ │ │ │ +pqxx::restrict_violation │ │ │ │ │ +Definition: except.hxx:305 │ │ │ │ │ +pqxx::restrict_violation::restrict_violation │ │ │ │ │ +restrict_violation(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:307 │ │ │ │ │ +pqxx::not_null_violation │ │ │ │ │ +Definition: except.hxx:316 │ │ │ │ │ +pqxx::not_null_violation::not_null_violation │ │ │ │ │ +not_null_violation(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:318 │ │ │ │ │ +pqxx::foreign_key_violation │ │ │ │ │ +Definition: except.hxx:327 │ │ │ │ │ +pqxx::foreign_key_violation::foreign_key_violation │ │ │ │ │ +foreign_key_violation(const std::string &err, const std::string &Q="", const │ │ │ │ │ +char sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:329 │ │ │ │ │ +pqxx::unique_violation │ │ │ │ │ +Definition: except.hxx:338 │ │ │ │ │ +pqxx::unique_violation::unique_violation │ │ │ │ │ +unique_violation(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:340 │ │ │ │ │ +pqxx::check_violation │ │ │ │ │ +Definition: except.hxx:349 │ │ │ │ │ +pqxx::check_violation::check_violation │ │ │ │ │ +check_violation(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:351 │ │ │ │ │ +pqxx::invalid_cursor_state │ │ │ │ │ +Definition: except.hxx:359 │ │ │ │ │ +pqxx::invalid_cursor_state::invalid_cursor_state │ │ │ │ │ +invalid_cursor_state(const std::string &err, const std::string &Q="", const │ │ │ │ │ +char sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:361 │ │ │ │ │ +pqxx::invalid_sql_statement_name │ │ │ │ │ +Definition: except.hxx:369 │ │ │ │ │ +pqxx::invalid_sql_statement_name::invalid_sql_statement_name │ │ │ │ │ +invalid_sql_statement_name(const std::string &err, const std::string &Q="", │ │ │ │ │ +const char sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:371 │ │ │ │ │ +pqxx::invalid_cursor_name │ │ │ │ │ +Definition: except.hxx:379 │ │ │ │ │ +pqxx::invalid_cursor_name::invalid_cursor_name │ │ │ │ │ +invalid_cursor_name(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:381 │ │ │ │ │ +pqxx::syntax_error │ │ │ │ │ +Definition: except.hxx:389 │ │ │ │ │ +pqxx::syntax_error::error_position │ │ │ │ │ +const int error_position │ │ │ │ │ +Approximate position in string where error occurred, or -1 if unknown. │ │ │ │ │ +Definition: except.hxx:392 │ │ │ │ │ +pqxx::syntax_error::syntax_error │ │ │ │ │ +syntax_error(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr, int pos=-1) │ │ │ │ │ +Definition: except.hxx:394 │ │ │ │ │ +pqxx::undefined_column │ │ │ │ │ +Definition: except.hxx:403 │ │ │ │ │ +pqxx::undefined_column::undefined_column │ │ │ │ │ +undefined_column(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:405 │ │ │ │ │ +pqxx::undefined_function │ │ │ │ │ +Definition: except.hxx:413 │ │ │ │ │ +pqxx::undefined_function::undefined_function │ │ │ │ │ +undefined_function(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:415 │ │ │ │ │ +pqxx::undefined_table │ │ │ │ │ +Definition: except.hxx:423 │ │ │ │ │ +pqxx::undefined_table::undefined_table │ │ │ │ │ +undefined_table(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:425 │ │ │ │ │ +pqxx::insufficient_privilege │ │ │ │ │ +Definition: except.hxx:433 │ │ │ │ │ +pqxx::insufficient_privilege::insufficient_privilege │ │ │ │ │ +insufficient_privilege(const std::string &err, const std::string &Q="", const │ │ │ │ │ +char sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:435 │ │ │ │ │ +pqxx::insufficient_resources │ │ │ │ │ +Resource shortage on the server. │ │ │ │ │ +Definition: except.hxx:444 │ │ │ │ │ +pqxx::insufficient_resources::insufficient_resources │ │ │ │ │ +insufficient_resources(const std::string &err, const std::string &Q="", const │ │ │ │ │ +char sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:446 │ │ │ │ │ +pqxx::disk_full │ │ │ │ │ +Definition: except.hxx:454 │ │ │ │ │ +pqxx::disk_full::disk_full │ │ │ │ │ +disk_full(const std::string &err, const std::string &Q="", const char sqlstate │ │ │ │ │ +[]=nullptr) │ │ │ │ │ +Definition: except.hxx:456 │ │ │ │ │ +pqxx::out_of_memory │ │ │ │ │ +Definition: except.hxx:464 │ │ │ │ │ +pqxx::out_of_memory::out_of_memory │ │ │ │ │ +out_of_memory(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:466 │ │ │ │ │ +pqxx::too_many_connections │ │ │ │ │ +Definition: except.hxx:474 │ │ │ │ │ +pqxx::too_many_connections::too_many_connections │ │ │ │ │ +too_many_connections(const std::string &err) │ │ │ │ │ +Definition: except.hxx:476 │ │ │ │ │ +pqxx::plpgsql_error │ │ │ │ │ +PL/pgSQL error. │ │ │ │ │ +Definition: except.hxx:484 │ │ │ │ │ +pqxx::plpgsql_error::plpgsql_error │ │ │ │ │ +plpgsql_error(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:486 │ │ │ │ │ +pqxx::plpgsql_raise │ │ │ │ │ +Exception raised in PL/pgSQL procedure. │ │ │ │ │ +Definition: except.hxx:495 │ │ │ │ │ +pqxx::plpgsql_raise::plpgsql_raise │ │ │ │ │ +plpgsql_raise(const std::string &err, const std::string &Q="", const char │ │ │ │ │ +sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:497 │ │ │ │ │ +pqxx::plpgsql_no_data_found │ │ │ │ │ +Definition: except.hxx:505 │ │ │ │ │ +pqxx::plpgsql_no_data_found::plpgsql_no_data_found │ │ │ │ │ +plpgsql_no_data_found(const std::string &err, const std::string &Q="", const │ │ │ │ │ +char sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:507 │ │ │ │ │ +pqxx::plpgsql_too_many_rows │ │ │ │ │ +Definition: except.hxx:515 │ │ │ │ │ +pqxx::plpgsql_too_many_rows::plpgsql_too_many_rows │ │ │ │ │ +plpgsql_too_many_rows(const std::string &err, const std::string &Q="", const │ │ │ │ │ +char sqlstate[]=nullptr) │ │ │ │ │ +Definition: except.hxx:517 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * dbtransaction.hxx │ │ │ │ │ + * except.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00029_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: isolation.hxx Source File │ │ │ │ +libpqxx: transaction_base.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,73 +55,461 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
isolation.hxx
│ │ │ │ +
transaction_base.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_ISOLATION
│ │ │ │ -
14#define PQXX_H_ISOLATION
│ │ │ │ -
15
│ │ │ │ -
16#include "pqxx/compiler-public.hxx"
│ │ │ │ -
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include "pqxx/util.hxx"
│ │ │ │ -
20
│ │ │ │ -
21namespace pqxx
│ │ │ │ -
22{
│ │ │ │ -
23
│ │ │ │ -
25
│ │ │ │ - │ │ │ │ -
57{
│ │ │ │ -
58 // read_uncommitted,
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
62};
│ │ │ │ -
63
│ │ │ │ -
65template<isolation_level LEVEL> struct isolation_traits
│ │ │ │ -
66{
│ │ │ │ -
67 static constexpr isolation_level level() noexcept { return LEVEL; }
│ │ │ │ -
68 static constexpr const char *name() noexcept;
│ │ │ │ -
69};
│ │ │ │ -
70
│ │ │ │ +
14#ifndef PQXX_H_TRANSACTION_BASE
│ │ │ │ +
15#define PQXX_H_TRANSACTION_BASE
│ │ │ │ +
16
│ │ │ │ +
17#include "pqxx/compiler-public.hxx"
│ │ │ │ +
18#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
19
│ │ │ │ +
20/* End-user programs need not include this file, unless they define their own
│ │ │ │ +
21 * transaction classes. This is not something the typical program should want
│ │ │ │ +
22 * to do.
│ │ │ │ +
23 *
│ │ │ │ +
24 * However, reading this file is worthwhile because it defines the public
│ │ │ │ +
25 * interface for the available transaction classes such as transaction and
│ │ │ │ +
26 * nontransaction.
│ │ │ │ +
27 */
│ │ │ │ +
28
│ │ │ │ +
29#include "pqxx/connection_base.hxx"
│ │ │ │ +
30#include "pqxx/internal/encoding_group.hxx"
│ │ │ │ +
31#include "pqxx/isolation.hxx"
│ │ │ │ +
32#include "pqxx/result.hxx"
│ │ │ │ +
33#include "pqxx/row.hxx"
│ │ │ │ +
34
│ │ │ │ +
35// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ +
36
│ │ │ │ +
37namespace pqxx
│ │ │ │ +
38{
│ │ │ │ +
39namespace internal
│ │ │ │ +
40{
│ │ │ │ +
41class sql_cursor;
│ │ │ │ +
42
│ │ │ │ +
43class PQXX_LIBEXPORT transactionfocus : public virtual namedclass
│ │ │ │ +
44{
│ │ │ │ +
45public:
│ │ │ │ + │ │ │ │ +
47 namedclass{"transactionfocus"},
│ │ │ │ +
48 m_trans{t},
│ │ │ │ +
49 m_registered{false}
│ │ │ │ +
50 {
│ │ │ │ +
51 }
│ │ │ │ +
52
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
56
│ │ │ │ +
57protected:
│ │ │ │ +
58 void register_me();
│ │ │ │ +
59 void unregister_me() noexcept;
│ │ │ │ +
60 void reg_pending_error(const std::string &) noexcept;
│ │ │ │ +
61 bool registered() const noexcept { return m_registered; }
│ │ │ │ +
62
│ │ │ │ + │ │ │ │ +
64
│ │ │ │ +
65private:
│ │ │ │ +
66 bool m_registered;
│ │ │ │ +
67};
│ │ │ │ +
68
│ │ │ │ +
69
│ │ │ │
71
│ │ │ │ -
72template<>
│ │ │ │ -
73inline constexpr const char *isolation_traits<read_committed>::name() noexcept
│ │ │ │ -
74 { return "READ COMMITTED"; }
│ │ │ │ -
75
│ │ │ │ -
76template<>
│ │ │ │ -
77inline constexpr const char *isolation_traits<repeatable_read>::name() noexcept
│ │ │ │ -
78 { return "REPEATABLE READ"; }
│ │ │ │ -
79
│ │ │ │ -
80template<>
│ │ │ │ -
81inline constexpr const char *isolation_traits<serializable>::name() noexcept
│ │ │ │ -
82 { return "SERIALIZABLE"; }
│ │ │ │ -
83
│ │ │ │ -
84}
│ │ │ │ -
85
│ │ │ │ -
86#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
87#endif
│ │ │ │ +
73class PQXX_LIBEXPORT parameterized_invocation : statement_parameters
│ │ │ │ +
74{
│ │ │ │ +
75public:
│ │ │ │ +
76 PQXX_DEPRECATED parameterized_invocation(
│ │ │ │ +
77 connection_base &, const std::string &query);
│ │ │ │ +
78
│ │ │ │ +
79 parameterized_invocation &operator()() { add_param(); return *this; }
│ │ │ │ + │ │ │ │ +
81 { add_binary_param(v, true); return *this; }
│ │ │ │ +
82 template<typename T> parameterized_invocation &operator()(const T &v)
│ │ │ │ +
83 { add_param(v, true); return *this; }
│ │ │ │ + │ │ │ │ +
85 { add_binary_param(v, nonnull); return *this; }
│ │ │ │ +
86 template<typename T>
│ │ │ │ +
87 parameterized_invocation &operator()(const T &v, bool nonnull)
│ │ │ │ +
88 { add_param(v, nonnull); return *this; }
│ │ │ │ +
89
│ │ │ │ +
90 result exec();
│ │ │ │ +
91
│ │ │ │ +
92private:
│ │ │ │ + │ │ │ │ +
95 =delete;
│ │ │ │ +
96
│ │ │ │ +
97 connection_base &m_home;
│ │ │ │ +
98 const std::string m_query;
│ │ │ │ +
99};
│ │ │ │ +
100} // namespace internal
│ │ │ │ +
101
│ │ │ │ +
102
│ │ │ │ +
103namespace internal
│ │ │ │ +
104{
│ │ │ │ +
105namespace gate
│ │ │ │ +
106{
│ │ │ │ +
107class transaction_subtransaction;
│ │ │ │ +
108class transaction_tablereader;
│ │ │ │ +
109class transaction_sql_cursor;
│ │ │ │ +
110class transaction_stream_from;
│ │ │ │ +
111class transaction_tablewriter;
│ │ │ │ +
112class transaction_stream_to;
│ │ │ │ +
113class transaction_transactionfocus;
│ │ │ │ +
114} // namespace internal::gate
│ │ │ │ +
115} // namespace internal
│ │ │ │ +
116
│ │ │ │ +
117
│ │ │ │ +
131
│ │ │ │ +
136class PQXX_LIBEXPORT PQXX_NOVTABLE transaction_base :
│ │ │ │ +
137 public virtual internal::namedclass
│ │ │ │ +
138{
│ │ │ │ +
139public:
│ │ │ │ + │ │ │ │ +
142
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
146
│ │ │ │ +
147 virtual ~transaction_base() =0; //[t01]
│ │ │ │ +
148
│ │ │ │ +
150
│ │ │ │ +
162 void commit(); //[t01]
│ │ │ │ +
163
│ │ │ │ +
165
│ │ │ │ +
168 void abort(); //[t10]
│ │ │ │ +
169
│ │ │ │ +
175 std::string esc(const char str[]) const { return conn().esc(str); }
│ │ │ │ +
177 std::string esc(const char str[], size_t maxlen) const
│ │ │ │ +
178 { return conn().esc(str, maxlen); }
│ │ │ │ +
180 std::string esc(const std::string &str) const { return conn().esc(str); }
│ │ │ │ +
181
│ │ │ │ +
183
│ │ │ │ +
194 std::string esc_raw(const unsigned char data[], size_t len) const //[t62]
│ │ │ │ +
195 { return conn().esc_raw(data, len); }
│ │ │ │ +
197 std::string esc_raw(const std::string &) const; //[t62]
│ │ │ │ +
198
│ │ │ │ +
200
│ │ │ │ +
203 std::string unesc_raw(const std::string &text) const
│ │ │ │ +
204 { return conn().unesc_raw(text); }
│ │ │ │ +
205
│ │ │ │ +
207
│ │ │ │ +
210 std::string unesc_raw(const char *text) const
│ │ │ │ +
211 { return conn().unesc_raw(text); }
│ │ │ │ +
212
│ │ │ │ +
214
│ │ │ │ +
215 template<typename T> std::string quote(const T &t) const
│ │ │ │ +
216 { return conn().quote(t); }
│ │ │ │ +
217
│ │ │ │ +
219 std::string quote_raw(const unsigned char str[], size_t len) const
│ │ │ │ +
220 { return conn().quote_raw(str, len); }
│ │ │ │ +
221
│ │ │ │ +
222 std::string quote_raw(const std::string &str) const;
│ │ │ │ +
223
│ │ │ │ +
225 std::string quote_name(const std::string &identifier) const
│ │ │ │ +
226 { return conn().quote_name(identifier); }
│ │ │ │ +
227
│ │ │ │ +
229 std::string esc_like(const std::string &str, char escape_char='\\') const
│ │ │ │ +
230 { return conn().esc_like(str, escape_char); }
│ │ │ │ +
232
│ │ │ │ +
234
│ │ │ │ +
249 result exec(
│ │ │ │ +
250 const std::string &Query,
│ │ │ │ +
251 const std::string &Desc=std::string{}); //[t01]
│ │ │ │ +
252
│ │ │ │ + │ │ │ │ +
254 const std::stringstream &Query,
│ │ │ │ +
255 const std::string &Desc=std::string{})
│ │ │ │ +
256 { return exec(Query.str(), Desc); }
│ │ │ │ +
257
│ │ │ │ +
259
│ │ │ │ + │ │ │ │ +
265 const std::string &Query,
│ │ │ │ +
266 const std::string &Desc=std::string{})
│ │ │ │ +
267 { return exec_n(0, Query, Desc); }
│ │ │ │ +
268
│ │ │ │ +
270
│ │ │ │ +
276 row exec1(const std::string &Query, const std::string &Desc=std::string{})
│ │ │ │ +
277 { return exec_n(1, Query, Desc).front(); }
│ │ │ │ +
278
│ │ │ │ +
280
│ │ │ │ +
285 result exec_n(
│ │ │ │ +
286 size_t rows,
│ │ │ │ +
287 const std::string &Query,
│ │ │ │ +
288 const std::string &Desc=std::string{});
│ │ │ │ +
289
│ │ │ │ +
320 template<typename ...Args>
│ │ │ │ +
321 result exec_params(const std::string &query, Args &&...args)
│ │ │ │ +
322 {
│ │ │ │ +
323 return internal_exec_params(
│ │ │ │ +
324 query, internal::params(std::forward<Args>(args)...));
│ │ │ │ +
325 }
│ │ │ │ +
326
│ │ │ │ +
327 // Execute parameterised statement, expect a single-row result.
│ │ │ │ +
330 template<typename ...Args>
│ │ │ │ +
331 row exec_params1(const std::string &query, Args&&... args)
│ │ │ │ +
332 {
│ │ │ │ +
333 return exec_params_n(1, query, std::forward<Args>(args)...).front();
│ │ │ │ +
334 }
│ │ │ │ +
335
│ │ │ │ +
336 // Execute parameterised statement, expect a result with zero rows.
│ │ │ │ +
339 template<typename ...Args>
│ │ │ │ +
340 result exec_params0(const std::string &query, Args &&...args)
│ │ │ │ +
341 {
│ │ │ │ +
342 return exec_params_n(0, query, std::forward<Args>(args)...);
│ │ │ │ +
343 }
│ │ │ │ +
344
│ │ │ │ +
345 // Execute parameterised statement, expect exactly a given number of rows.
│ │ │ │ +
348 template<typename ...Args>
│ │ │ │ +
349 result exec_params_n(size_t rows, const std::string &query, Args &&...args)
│ │ │ │ +
350 {
│ │ │ │ +
351 const auto r = exec_params(query, std::forward<Args>(args)...);
│ │ │ │ +
352 check_rowcount_params(rows, r.size());
│ │ │ │ +
353 return r;
│ │ │ │ +
354 }
│ │ │ │ +
355
│ │ │ │ +
357 /* Use this to build up a parameterized statement invocation, then invoke it
│ │ │ │ +
358 * using @c exec()
│ │ │ │ +
359 *
│ │ │ │ +
360 * Example: @c trans.parameterized("SELECT $1 + 1")(1).exec();
│ │ │ │ +
361 *
│ │ │ │ +
362 * This is the old, pre-C++11 way of handling parameterised statements. As
│ │ │ │ +
363 * of libpqxx 6.0, it's made much easier using variadic templates.
│ │ │ │ +
364 */
│ │ │ │ + │ │ │ │ +
366 parameterized(const std::string &query);
│ │ │ │ +
368
│ │ │ │ +
393
│ │ │ │ +
395 template<typename ...Args>
│ │ │ │ +
396 result exec_prepared(const std::string &statement, Args&&... args)
│ │ │ │ +
397 {
│ │ │ │ +
398 return internal_exec_prepared(
│ │ │ │ +
399 statement, internal::params(std::forward<Args>(args)...));
│ │ │ │ +
400 }
│ │ │ │ +
401
│ │ │ │ +
403
│ │ │ │ +
405 template<typename ...Args>
│ │ │ │ +
406 row exec_prepared1(const std::string &statement, Args&&... args)
│ │ │ │ +
407 {
│ │ │ │ +
408 return exec_prepared_n(1, statement, std::forward<Args>(args)...).front();
│ │ │ │ +
409 }
│ │ │ │ +
410
│ │ │ │ +
412
│ │ │ │ +
414 template<typename ...Args>
│ │ │ │ +
415 result exec_prepared0(const std::string &statement, Args&&... args)
│ │ │ │ +
416 {
│ │ │ │ +
417 return exec_prepared_n(0, statement, std::forward<Args>(args)...);
│ │ │ │ +
418 }
│ │ │ │ +
419
│ │ │ │ +
421
│ │ │ │ +
424 template<typename ...Args>
│ │ │ │ + │ │ │ │ +
426 size_t rows,
│ │ │ │ +
427 const std::string &statement,
│ │ │ │ +
428 Args&&... args)
│ │ │ │ +
429 {
│ │ │ │ +
430 const auto r = exec_prepared(statement, std::forward<Args>(args)...);
│ │ │ │ +
431 check_rowcount_prepared(statement, rows, r.size());
│ │ │ │ +
432 return r;
│ │ │ │ +
433 }
│ │ │ │ +
434
│ │ │ │ +
436
│ │ │ │ +
474 PQXX_DEPRECATED prepare::invocation
│ │ │ │ +
475 prepared(const std::string &statement=std::string{});
│ │ │ │ +
476
│ │ │ │ +
478
│ │ │ │ +
484 void process_notice(const char Msg[]) const //[t14]
│ │ │ │ +
485 { m_conn.process_notice(Msg); }
│ │ │ │ +
487 void process_notice(const std::string &Msg) const //[t14]
│ │ │ │ +
488 { m_conn.process_notice(Msg); }
│ │ │ │ +
490
│ │ │ │ +
492 connection_base &conn() const { return m_conn; } //[t04]
│ │ │ │ +
493
│ │ │ │ +
495
│ │ │ │ +
502 void set_variable(const std::string &Var, const std::string &Val); //[t61]
│ │ │ │ +
503
│ │ │ │ +
505
│ │ │ │ +
514 std::string get_variable(const std::string &); //[t61]
│ │ │ │ +
515
│ │ │ │ +
516protected:
│ │ │ │ +
518
│ │ │ │ +
524 explicit transaction_base(connection_base &c, bool direct=true);
│ │ │ │ +
525
│ │ │ │ +
527
│ │ │ │ +
529 void Begin();
│ │ │ │ +
530
│ │ │ │ +
532 void End() noexcept;
│ │ │ │ +
533
│ │ │ │ +
535 virtual void do_begin() =0;
│ │ │ │ +
537 virtual result do_exec(const char Query[]) =0;
│ │ │ │ +
539 virtual void do_commit() =0;
│ │ │ │ +
541 virtual void do_abort() =0;
│ │ │ │ +
542
│ │ │ │ +
543 // For use by implementing class:
│ │ │ │ +
544
│ │ │ │ +
546
│ │ │ │ +
554 result direct_exec(const char C[], int Retries=0);
│ │ │ │ +
555
│ │ │ │ +
557 void reactivation_avoidance_clear() noexcept
│ │ │ │ +
558 {m_reactivation_avoidance.clear();}
│ │ │ │ +
559
│ │ │ │ +
560protected:
│ │ │ │ +
562
│ │ │ │ + │ │ │ │ +
565
│ │ │ │ +
566private:
│ │ │ │ +
567 /* A transaction goes through the following stages in its lifecycle:
│ │ │ │ +
568 * <ul>
│ │ │ │ +
569 * <li> nascent: the transaction hasn't actually begun yet. If our connection
│ │ │ │ +
570 * fails at this stage, it may recover and the transaction can attempt to
│ │ │ │ +
571 * establish itself again.
│ │ │ │ +
572 * <li> active: the transaction has begun. Since no commit command has been
│ │ │ │ +
573 * issued, abortion is implicit if the connection fails now.
│ │ │ │ +
574 * <li> aborted: an abort has been issued; the transaction is terminated and
│ │ │ │ +
575 * its changes to the database rolled back. It will accept no further
│ │ │ │ +
576 * commands.
│ │ │ │ +
577 * <li> committed: the transaction has completed successfully, meaning that a
│ │ │ │ +
578 * commit has been issued. No further commands are accepted.
│ │ │ │ +
579 * <li> in_doubt: the connection was lost at the exact wrong time, and there
│ │ │ │ +
580 * is no way of telling whether the transaction was committed or aborted.
│ │ │ │ +
581 * </ul>
│ │ │ │ +
582 *
│ │ │ │ +
583 * Checking and maintaining state machine logic is the responsibility of the
│ │ │ │ +
584 * base class (ie., this one).
│ │ │ │ +
585 */
│ │ │ │ +
586 enum Status
│ │ │ │ +
587 {
│ │ │ │ +
588 st_nascent,
│ │ │ │ +
589 st_active,
│ │ │ │ +
590 st_aborted,
│ │ │ │ +
591 st_committed,
│ │ │ │ +
592 st_in_doubt
│ │ │ │ +
593 };
│ │ │ │ +
594
│ │ │ │ +
596 PQXX_PRIVATE void activate();
│ │ │ │ +
597
│ │ │ │ +
598 PQXX_PRIVATE void CheckPendingError();
│ │ │ │ +
599
│ │ │ │ +
600 template<typename T> bool parm_is_null(T *p) const noexcept
│ │ │ │ +
601 { return p == nullptr; }
│ │ │ │ +
602 template<typename T> bool parm_is_null(T) const noexcept
│ │ │ │ +
603 { return false; }
│ │ │ │ +
604
│ │ │ │ +
605 result internal_exec_prepared(
│ │ │ │ +
606 const std::string &statement,
│ │ │ │ +
607 const internal::params &args);
│ │ │ │ +
608
│ │ │ │ +
609 result internal_exec_params(
│ │ │ │ +
610 const std::string &query,
│ │ │ │ +
611 const internal::params &args);
│ │ │ │ +
612
│ │ │ │ +
614 void check_rowcount_prepared(
│ │ │ │ +
615 const std::string &statement,
│ │ │ │ +
616 size_t expected_rows,
│ │ │ │ +
617 size_t actual_rows);
│ │ │ │ +
618
│ │ │ │ +
620 void check_rowcount_params(
│ │ │ │ +
621 size_t expected_rows, size_t actual_rows);
│ │ │ │ +
622
│ │ │ │ +
623 friend class pqxx::internal::gate::transaction_transactionfocus;
│ │ │ │ +
624 PQXX_PRIVATE void register_focus(internal::transactionfocus *);
│ │ │ │ +
625 PQXX_PRIVATE void unregister_focus(internal::transactionfocus *) noexcept;
│ │ │ │ +
626 PQXX_PRIVATE void register_pending_error(const std::string &) noexcept;
│ │ │ │ +
627
│ │ │ │ +
628 friend class pqxx::internal::gate::transaction_tablereader;
│ │ │ │ +
629 friend class pqxx::internal::gate::transaction_stream_from;
│ │ │ │ +
630 PQXX_PRIVATE void BeginCopyRead(const std::string &, const std::string &);
│ │ │ │ +
631 bool read_copy_line(std::string &);
│ │ │ │ +
632
│ │ │ │ +
633 friend class pqxx::internal::gate::transaction_tablewriter;
│ │ │ │ +
634 friend class pqxx::internal::gate::transaction_stream_to;
│ │ │ │ +
635 PQXX_PRIVATE void BeginCopyWrite(
│ │ │ │ +
636 const std::string &Table,
│ │ │ │ +
637 const std::string &Columns);
│ │ │ │ +
638 void write_copy_line(const std::string &);
│ │ │ │ +
639 void end_copy_write();
│ │ │ │ +
640
│ │ │ │ +
641 friend class pqxx::internal::gate::transaction_subtransaction;
│ │ │ │ +
642
│ │ │ │ +
643 connection_base &m_conn;
│ │ │ │ +
644
│ │ │ │ + │ │ │ │ +
646 Status m_status = st_nascent;
│ │ │ │ +
647 bool m_registered = false;
│ │ │ │ +
648 std::map<std::string, std::string> m_vars;
│ │ │ │ +
649 std::string m_pending_error;
│ │ │ │ +
650};
│ │ │ │ +
651
│ │ │ │ +
652} // namespace pqxx
│ │ │ │ +
653
│ │ │ │ +
654#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
655#endif
│ │ │ │ +
std::string esc(const char str[]) const
Escape string for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:175
│ │ │ │ +
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:57
│ │ │ │ -
@ serializable
Definition: isolation.hxx:61
│ │ │ │ -
@ read_committed
Definition: isolation.hxx:59
│ │ │ │ -
@ repeatable_read
Definition: isolation.hxx:60
│ │ │ │ +
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
│ │ │ │ +
Definition: connection_base.hxx:49
│ │ │ │ +
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
│ │ │ │ -
static constexpr const char * name() noexcept
│ │ │ │ -
static constexpr isolation_level level() noexcept
Definition: isolation.hxx:67
│ │ │ │ +
Helper class for passing parameters to, and executing, prepared statements.
Definition: prepared_statement.hxx:82
│ │ │ │ +
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ +
void clear() noexcept
Definition: result.hxx:121
│ │ │ │ +
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │ +
reference front() const noexcept
Definition: row.cxx:59
│ │ │ │ +
Definition: transaction_base.hxx:44
│ │ │ │ + │ │ │ │ +
transactionfocus(const transactionfocus &)=delete
│ │ │ │ +
transactionfocus & operator=(const transactionfocus &)=delete
│ │ │ │ +
transactionfocus(transaction_base &t)
Definition: transaction_base.hxx:46
│ │ │ │ +
transaction_base & m_trans
Definition: transaction_base.hxx:63
│ │ │ │ +
Helper class to construct an invocation of a parameterised statement.
Definition: transaction_base.hxx:74
│ │ │ │ +
parameterized_invocation & operator()(const binarystring &v, bool nonnull)
Definition: transaction_base.hxx:84
│ │ │ │ +
parameterized_invocation & operator()(const binarystring &v)
Definition: transaction_base.hxx:80
│ │ │ │ +
parameterized_invocation & operator()(const T &v)
Definition: transaction_base.hxx:82
│ │ │ │ +
parameterized_invocation & operator()()
Definition: transaction_base.hxx:79
│ │ │ │ +
parameterized_invocation & operator()(const T &v, bool nonnull)
Definition: transaction_base.hxx:87
│ │ │ │ +
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │ +
result exec_params(const std::string &query, Args &&...args)
Execute an SQL statement with parameters.
Definition: transaction_base.hxx:321
│ │ │ │ +
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
│ │ │ │ +
result exec_params_n(size_t rows, const std::string &query, Args &&...args)
Definition: transaction_base.hxx:349
│ │ │ │ +
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
│ │ │ │ +
result exec(const std::stringstream &Query, const std::string &Desc=std::string{})
Definition: transaction_base.hxx:253
│ │ │ │ +
std::string quote(const T &t) const
Represent object as SQL string, including quoting & escaping.
Definition: transaction_base.hxx:215
│ │ │ │ +
transaction_base(const transaction_base &)=delete
│ │ │ │ +
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
│ │ │ │ +
result exec_prepared(const std::string &statement, Args &&... args)
Execute a prepared statement, with optional arguments.
Definition: transaction_base.hxx:396
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │ +
transaction_base & operator=(const transaction_base &)=delete
│ │ │ │ +
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
│ │ │ │ +
connection_base & conn() const
Connection this transaction is running in.
Definition: transaction_base.hxx:492
│ │ │ │ +
void process_notice(const std::string &Msg) const
Have connection process warning message.
Definition: transaction_base.hxx:487
│ │ │ │ +
void process_notice(const char Msg[]) const
Have connection process warning message.
Definition: transaction_base.hxx:484
│ │ │ │ +
row exec_params1(const std::string &query, Args &&... args)
Definition: transaction_base.hxx:331
│ │ │ │ + │ │ │ │ +
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
│ │ │ │ +
result exec_params0(const std::string &query, Args &&...args)
Definition: transaction_base.hxx:340
│ │ │ │ +
std::string esc(const std::string &str) const
Escape string for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:180
│ │ │ │ +
std::string quote_name(const std::string &identifier) const
Escape an SQL identifier for use in a query.
Definition: transaction_base.hxx:225
│ │ │ │ +
row exec_prepared1(const std::string &statement, Args &&... args)
Execute a prepared statement, and expect a single-row result.
Definition: transaction_base.hxx:406
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │ +
internal::reactivation_avoidance_counter m_reactivation_avoidance
Resources allocated in this transaction that make reactivation impossible.
Definition: transaction_base.hxx:564
│ │ │ │ +
std::string esc_like(const std::string &str, char escape_char='\\') const
Escape string for literal LIKE match.
Definition: transaction_base.hxx:229
│ │ │ │ +
Helper base class: object descriptions for error messages and such.
Definition: util.hxx:234
│ │ │ │ +
Ensure proper opening/closing of GUEST objects related to a "host" object.
Definition: util.hxx:275
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,82 +1,582 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -isolation.hxx │ │ │ │ │ +transaction_base.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_ISOLATION │ │ │ │ │ - 14#define PQXX_H_ISOLATION │ │ │ │ │ - 15 │ │ │ │ │ - 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include "pqxx/util.hxx" │ │ │ │ │ - 20 │ │ │ │ │ - 21namespace pqxx │ │ │ │ │ - 22{ │ │ │ │ │ - 23 │ │ │ │ │ - 25 │ │ │ │ │ -56enum isolation_level │ │ │ │ │ - 57{ │ │ │ │ │ - 58 // read_uncommitted, │ │ │ │ │ -59 read_committed, │ │ │ │ │ -60 repeatable_read, │ │ │ │ │ - 61 serializable │ │ │ │ │ -62}; │ │ │ │ │ - 63 │ │ │ │ │ -65template struct isolation_traits │ │ │ │ │ - 66{ │ │ │ │ │ -67 static constexpr isolation_level level() noexcept { return LEVEL; } │ │ │ │ │ -68 static constexpr const char *name() noexcept; │ │ │ │ │ - 69}; │ │ │ │ │ - 70 │ │ │ │ │ + 14#ifndef PQXX_H_TRANSACTION_BASE │ │ │ │ │ + 15#define PQXX_H_TRANSACTION_BASE │ │ │ │ │ + 16 │ │ │ │ │ + 17#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 18#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 19 │ │ │ │ │ + 20/* End-user programs need not include this file, unless they define their │ │ │ │ │ +own │ │ │ │ │ + 21 * transaction classes. This is not something the typical program should │ │ │ │ │ +want │ │ │ │ │ + 22 * to do. │ │ │ │ │ + 23 * │ │ │ │ │ + 24 * However, reading this file is worthwhile because it defines the public │ │ │ │ │ + 25 * interface for the available transaction classes such as transaction and │ │ │ │ │ + 26 * nontransaction. │ │ │ │ │ + 27 */ │ │ │ │ │ + 28 │ │ │ │ │ + 29#include "pqxx/connection_base.hxx" │ │ │ │ │ + 30#include "pqxx/internal/encoding_group.hxx" │ │ │ │ │ + 31#include "pqxx/isolation.hxx" │ │ │ │ │ + 32#include "pqxx/result.hxx" │ │ │ │ │ + 33#include "pqxx/row.hxx" │ │ │ │ │ + 34 │ │ │ │ │ + 35// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ + 36 │ │ │ │ │ + 37namespace pqxx │ │ │ │ │ + 38{ │ │ │ │ │ + 39namespace internal │ │ │ │ │ + 40{ │ │ │ │ │ + 41class sql_cursor; │ │ │ │ │ + 42 │ │ │ │ │ +43class PQXX_LIBEXPORT transactionfocus : public virtual namedclass │ │ │ │ │ + 44{ │ │ │ │ │ + 45public: │ │ │ │ │ +46 explicit transactionfocus(transaction_base &t) : │ │ │ │ │ + 47 namedclass{"transactionfocus"}, │ │ │ │ │ + 48 m_trans{t}, │ │ │ │ │ + 49 m_registered{false} │ │ │ │ │ + 50 { │ │ │ │ │ + 51 } │ │ │ │ │ + 52 │ │ │ │ │ +53 transactionfocus() =delete; │ │ │ │ │ +54 transactionfocus(const transactionfocus &) =delete; │ │ │ │ │ +55 transactionfocus &operator=(const transactionfocus &) =delete; │ │ │ │ │ + 56 │ │ │ │ │ + 57protected: │ │ │ │ │ + 58 void register_me(); │ │ │ │ │ + 59 void unregister_me() noexcept; │ │ │ │ │ + 60 void reg_pending_error(const std::string &) noexcept; │ │ │ │ │ +61 bool registered() const noexcept { return m_registered; } │ │ │ │ │ + 62 │ │ │ │ │ +63 transaction_base &m_trans; │ │ │ │ │ + 64 │ │ │ │ │ + 65private: │ │ │ │ │ + 66 bool m_registered; │ │ │ │ │ + 67}; │ │ │ │ │ + 68 │ │ │ │ │ + 69 │ │ │ │ │ 71 │ │ │ │ │ - 72template<> │ │ │ │ │ -73inline constexpr const char *isolation_traits::name() │ │ │ │ │ -noexcept │ │ │ │ │ - 74 { return "READ COMMITTED"; } │ │ │ │ │ - 75 │ │ │ │ │ - 76template<> │ │ │ │ │ -77inline constexpr const char *isolation_traits::name() │ │ │ │ │ -noexcept │ │ │ │ │ - 78 { return "REPEATABLE READ"; } │ │ │ │ │ - 79 │ │ │ │ │ - 80template<> │ │ │ │ │ -81inline constexpr const char *isolation_traits::name() noexcept │ │ │ │ │ - 82 { return "SERIALIZABLE"; } │ │ │ │ │ - 83 │ │ │ │ │ - 84} │ │ │ │ │ - 85 │ │ │ │ │ - 86#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 87#endif │ │ │ │ │ +73class PQXX_LIBEXPORT parameterized_invocation : statement_parameters │ │ │ │ │ + 74{ │ │ │ │ │ + 75public: │ │ │ │ │ + 76 PQXX_DEPRECATED parameterized_invocation( │ │ │ │ │ + 77 connection_base &, const std::string &query); │ │ │ │ │ + 78 │ │ │ │ │ +79 parameterized_invocation &operator()() { add_param(); return *this; } │ │ │ │ │ +80 parameterized_invocation &operator()(const binarystring &v) │ │ │ │ │ + 81 { add_binary_param(v, true); return *this; } │ │ │ │ │ +82 template parameterized_invocation &operator()(const T &v) │ │ │ │ │ + 83 { add_param(v, true); return *this; } │ │ │ │ │ +84 parameterized_invocation &operator()(const binarystring &v, bool nonnull) │ │ │ │ │ + 85 { add_binary_param(v, nonnull); return *this; } │ │ │ │ │ + 86 template │ │ │ │ │ +87 parameterized_invocation &operator()(const T &v, bool nonnull) │ │ │ │ │ + 88 { add_param(v, nonnull); return *this; } │ │ │ │ │ + 89 │ │ │ │ │ + 90 result exec(); │ │ │ │ │ + 91 │ │ │ │ │ + 92private: │ │ │ │ │ + 94 parameterized_invocation &operator=(const parameterized_invocation &) │ │ │ │ │ + 95 =delete; │ │ │ │ │ + 96 │ │ │ │ │ + 97 connection_base &m_home; │ │ │ │ │ + 98 const std::string m_query; │ │ │ │ │ + 99}; │ │ │ │ │ + 100} // namespace internal │ │ │ │ │ + 101 │ │ │ │ │ + 102 │ │ │ │ │ + 103namespace internal │ │ │ │ │ + 104{ │ │ │ │ │ + 105namespace gate │ │ │ │ │ + 106{ │ │ │ │ │ + 107class transaction_subtransaction; │ │ │ │ │ + 108class transaction_tablereader; │ │ │ │ │ + 109class transaction_sql_cursor; │ │ │ │ │ + 110class transaction_stream_from; │ │ │ │ │ + 111class transaction_tablewriter; │ │ │ │ │ + 112class transaction_stream_to; │ │ │ │ │ + 113class transaction_transactionfocus; │ │ │ │ │ + 114} // namespace internal::gate │ │ │ │ │ + 115} // namespace internal │ │ │ │ │ + 116 │ │ │ │ │ + 117 │ │ │ │ │ + 131 │ │ │ │ │ +136class PQXX_LIBEXPORT PQXX_NOVTABLE transaction_base : │ │ │ │ │ + 137 public virtual internal::namedclass │ │ │ │ │ + 138{ │ │ │ │ │ + 139public: │ │ │ │ │ +141 using isolation_tag = isolation_traits; │ │ │ │ │ + 142 │ │ │ │ │ +143 transaction_base() =delete; │ │ │ │ │ +144 transaction_base(const transaction_base &) =delete; │ │ │ │ │ +145 transaction_base &operator=(const transaction_base &) =delete; │ │ │ │ │ + 146 │ │ │ │ │ + 147 virtual ~transaction_base() =0; //[t01] │ │ │ │ │ + 148 │ │ │ │ │ + 150 │ │ │ │ │ + 162 void commit(); //[t01] │ │ │ │ │ + 163 │ │ │ │ │ + 165 │ │ │ │ │ + 168 void abort(); //[t10] │ │ │ │ │ + 169 │ │ │ │ │ +175 std::string esc(const char str[]) const { return conn().esc(str); } │ │ │ │ │ +177 std::string esc(const char str[], size_t maxlen) const │ │ │ │ │ + 178 { return conn().esc(str, maxlen); } │ │ │ │ │ +180 std::string esc(const std::string &str) const { return conn().esc(str); } │ │ │ │ │ + 181 │ │ │ │ │ + 183 │ │ │ │ │ +194 std::string esc_raw(const unsigned char data[], size_t len) const //[t62] │ │ │ │ │ + 195 { return conn().esc_raw(data, len); } │ │ │ │ │ + 197 std::string esc_raw(const std::string &) const; //[t62] │ │ │ │ │ + 198 │ │ │ │ │ + 200 │ │ │ │ │ +203 std::string unesc_raw(const std::string &text) const │ │ │ │ │ + 204 { return conn().unesc_raw(text); } │ │ │ │ │ + 205 │ │ │ │ │ + 207 │ │ │ │ │ +210 std::string unesc_raw(const char *text) const │ │ │ │ │ + 211 { return conn().unesc_raw(text); } │ │ │ │ │ + 212 │ │ │ │ │ + 214 │ │ │ │ │ +215 template std::string quote(const T &t) const │ │ │ │ │ + 216 { return conn().quote(t); } │ │ │ │ │ + 217 │ │ │ │ │ +219 std::string quote_raw(const unsigned char str[], size_t len) const │ │ │ │ │ + 220 { return conn().quote_raw(str, len); } │ │ │ │ │ + 221 │ │ │ │ │ + 222 std::string quote_raw(const std::string &str) const; │ │ │ │ │ + 223 │ │ │ │ │ +225 std::string quote_name(const std::string &identifier) const │ │ │ │ │ + 226 { return conn().quote_name(identifier); } │ │ │ │ │ + 227 │ │ │ │ │ +229 std::string esc_like(const std::string &str, char escape_char='\\') const │ │ │ │ │ + 230 { return conn().esc_like(str, escape_char); } │ │ │ │ │ + 232 │ │ │ │ │ + 234 │ │ │ │ │ + 249 result exec( │ │ │ │ │ + 250 const std::string &Query, │ │ │ │ │ + 251 const std::string &Desc=std::string{}); //[t01] │ │ │ │ │ + 252 │ │ │ │ │ +253 result exec( │ │ │ │ │ + 254 const std::stringstream &Query, │ │ │ │ │ + 255 const std::string &Desc=std::string{}) │ │ │ │ │ + 256 { return exec(Query.str(), Desc); } │ │ │ │ │ + 257 │ │ │ │ │ + 259 │ │ │ │ │ +264 result exec0( │ │ │ │ │ + 265 const std::string &Query, │ │ │ │ │ + 266 const std::string &Desc=std::string{}) │ │ │ │ │ + 267 { return exec_n(0, Query, Desc); } │ │ │ │ │ + 268 │ │ │ │ │ + 270 │ │ │ │ │ +276 row exec1(const std::string &Query, const std::string &Desc=std::string{}) │ │ │ │ │ + 277 { return exec_n(1, Query, Desc).front(); } │ │ │ │ │ + 278 │ │ │ │ │ + 280 │ │ │ │ │ + 285 result exec_n( │ │ │ │ │ + 286 size_t rows, │ │ │ │ │ + 287 const std::string &Query, │ │ │ │ │ + 288 const std::string &Desc=std::string{}); │ │ │ │ │ + 289 │ │ │ │ │ + 320 template │ │ │ │ │ +321 result exec_params(const std::string &query, Args &&...args) │ │ │ │ │ + 322 { │ │ │ │ │ + 323 return internal_exec_params( │ │ │ │ │ + 324 query, internal::params(std::forward(args)...)); │ │ │ │ │ + 325 } │ │ │ │ │ + 326 │ │ │ │ │ + 327 // Execute parameterised statement, expect a single-row result. │ │ │ │ │ + 330 template │ │ │ │ │ +331 row exec_params1(const std::string &query, Args&&... args) │ │ │ │ │ + 332 { │ │ │ │ │ + 333 return exec_params_n(1, query, std::forward(args)...).front(); │ │ │ │ │ + 334 } │ │ │ │ │ + 335 │ │ │ │ │ + 336 // Execute parameterised statement, expect a result with zero rows. │ │ │ │ │ + 339 template │ │ │ │ │ +340 result exec_params0(const std::string &query, Args &&...args) │ │ │ │ │ + 341 { │ │ │ │ │ + 342 return exec_params_n(0, query, std::forward(args)...); │ │ │ │ │ + 343 } │ │ │ │ │ + 344 │ │ │ │ │ + 345 // Execute parameterised statement, expect exactly a given number of rows. │ │ │ │ │ + 348 template │ │ │ │ │ +349 result exec_params_n(size_t rows, const std::string &query, Args &&...args) │ │ │ │ │ + 350 { │ │ │ │ │ + 351 const auto r = exec_params(query, std::forward(args)...); │ │ │ │ │ + 352 check_rowcount_params(rows, r.size()); │ │ │ │ │ + 353 return r; │ │ │ │ │ + 354 } │ │ │ │ │ + 355 │ │ │ │ │ + 357 /* Use this to build up a parameterized statement invocation, then invoke │ │ │ │ │ +it │ │ │ │ │ + 358 * using @c exec() │ │ │ │ │ + 359 * │ │ │ │ │ + 360 * Example: @c trans.parameterized("SELECT $1 + 1")(1).exec(); │ │ │ │ │ + 361 * │ │ │ │ │ + 362 * This is the old, pre-C++11 way of handling parameterised statements. As │ │ │ │ │ + 363 * of libpqxx 6.0, it's made much easier using variadic templates. │ │ │ │ │ + 364 */ │ │ │ │ │ + 365 PQXX_DEPRECATED internal::parameterized_invocation │ │ │ │ │ + 366 parameterized(const std::string &query); │ │ │ │ │ + 368 │ │ │ │ │ + 393 │ │ │ │ │ + 395 template │ │ │ │ │ +396 result exec_prepared(const std::string &statement, Args&&... args) │ │ │ │ │ + 397 { │ │ │ │ │ + 398 return internal_exec_prepared( │ │ │ │ │ + 399 statement, internal::params(std::forward(args)...)); │ │ │ │ │ + 400 } │ │ │ │ │ + 401 │ │ │ │ │ + 403 │ │ │ │ │ + 405 template │ │ │ │ │ +406 row exec_prepared1(const std::string &statement, Args&&... args) │ │ │ │ │ + 407 { │ │ │ │ │ + 408 return exec_prepared_n(1, statement, std::forward(args)...).front(); │ │ │ │ │ + 409 } │ │ │ │ │ + 410 │ │ │ │ │ + 412 │ │ │ │ │ + 414 template │ │ │ │ │ +415 result exec_prepared0(const std::string &statement, Args&&... args) │ │ │ │ │ + 416 { │ │ │ │ │ + 417 return exec_prepared_n(0, statement, std::forward(args)...); │ │ │ │ │ + 418 } │ │ │ │ │ + 419 │ │ │ │ │ + 421 │ │ │ │ │ + 424 template │ │ │ │ │ +425 result exec_prepared_n( │ │ │ │ │ + 426 size_t rows, │ │ │ │ │ + 427 const std::string &statement, │ │ │ │ │ + 428 Args&&... args) │ │ │ │ │ + 429 { │ │ │ │ │ + 430 const auto r = exec_prepared(statement, std::forward(args)...); │ │ │ │ │ + 431 check_rowcount_prepared(statement, rows, r.size()); │ │ │ │ │ + 432 return r; │ │ │ │ │ + 433 } │ │ │ │ │ + 434 │ │ │ │ │ + 436 │ │ │ │ │ + 474 PQXX_DEPRECATED prepare::invocation │ │ │ │ │ + 475 prepared(const std::string &statement=std::string{}); │ │ │ │ │ + 476 │ │ │ │ │ + 478 │ │ │ │ │ +484 void process_notice(const char Msg[]) const //[t14] │ │ │ │ │ + 485 { m_conn.process_notice(Msg); } │ │ │ │ │ +487 void process_notice(const std::string &Msg) const //[t14] │ │ │ │ │ + 488 { m_conn.process_notice(Msg); } │ │ │ │ │ + 490 │ │ │ │ │ +492 connection_base &conn() const { return m_conn; } //[t04] │ │ │ │ │ + 493 │ │ │ │ │ + 495 │ │ │ │ │ + 502 void set_variable(const std::string &Var, const std::string &Val); //[t61] │ │ │ │ │ + 503 │ │ │ │ │ + 505 │ │ │ │ │ + 514 std::string get_variable(const std::string &); //[t61] │ │ │ │ │ + 515 │ │ │ │ │ + 516protected: │ │ │ │ │ + 518 │ │ │ │ │ + 524 explicit transaction_base(connection_base &c, bool direct=true); │ │ │ │ │ + 525 │ │ │ │ │ + 527 │ │ │ │ │ + 529 void Begin(); │ │ │ │ │ + 530 │ │ │ │ │ + 532 void End() noexcept; │ │ │ │ │ + 533 │ │ │ │ │ +535 virtual void do_begin() =0; │ │ │ │ │ +537 virtual result do_exec(const char Query[]) =0; │ │ │ │ │ +539 virtual void do_commit() =0; │ │ │ │ │ +541 virtual void do_abort() =0; │ │ │ │ │ + 542 │ │ │ │ │ + 543 // For use by implementing class: │ │ │ │ │ + 544 │ │ │ │ │ + 546 │ │ │ │ │ + 554 result direct_exec(const char C[], int Retries=0); │ │ │ │ │ + 555 │ │ │ │ │ +557 void reactivation_avoidance_clear() noexcept │ │ │ │ │ + 558 {m_reactivation_avoidance.clear();} │ │ │ │ │ + 559 │ │ │ │ │ + 560protected: │ │ │ │ │ + 562 │ │ │ │ │ +564 internal::reactivation_avoidance_counter m_reactivation_avoidance; │ │ │ │ │ + 565 │ │ │ │ │ + 566private: │ │ │ │ │ + 567 /* A transaction goes through the following stages in its lifecycle: │ │ │ │ │ + 568 *
    │ │ │ │ │ + 569 *
  • nascent: the transaction hasn't actually begun yet. If our │ │ │ │ │ +connection │ │ │ │ │ + 570 * fails at this stage, it may recover and the transaction can attempt to │ │ │ │ │ + 571 * establish itself again. │ │ │ │ │ + 572 *
  • active: the transaction has begun. Since no commit command has been │ │ │ │ │ + 573 * issued, abortion is implicit if the connection fails now. │ │ │ │ │ + 574 *
  • aborted: an abort has been issued; the transaction is terminated │ │ │ │ │ +and │ │ │ │ │ + 575 * its changes to the database rolled back. It will accept no further │ │ │ │ │ + 576 * commands. │ │ │ │ │ + 577 *
  • committed: the transaction has completed successfully, meaning that │ │ │ │ │ +a │ │ │ │ │ + 578 * commit has been issued. No further commands are accepted. │ │ │ │ │ + 579 *
  • in_doubt: the connection was lost at the exact wrong time, and │ │ │ │ │ +there │ │ │ │ │ + 580 * is no way of telling whether the transaction was committed or aborted. │ │ │ │ │ + 581 *
│ │ │ │ │ + 582 * │ │ │ │ │ + 583 * Checking and maintaining state machine logic is the responsibility of │ │ │ │ │ +the │ │ │ │ │ + 584 * base class (ie., this one). │ │ │ │ │ + 585 */ │ │ │ │ │ + 586 enum Status │ │ │ │ │ + 587 { │ │ │ │ │ + 588 st_nascent, │ │ │ │ │ + 589 st_active, │ │ │ │ │ + 590 st_aborted, │ │ │ │ │ + 591 st_committed, │ │ │ │ │ + 592 st_in_doubt │ │ │ │ │ + 593 }; │ │ │ │ │ + 594 │ │ │ │ │ + 596 PQXX_PRIVATE void activate(); │ │ │ │ │ + 597 │ │ │ │ │ + 598 PQXX_PRIVATE void CheckPendingError(); │ │ │ │ │ + 599 │ │ │ │ │ + 600 template bool parm_is_null(T *p) const noexcept │ │ │ │ │ + 601 { return p == nullptr; } │ │ │ │ │ + 602 template bool parm_is_null(T) const noexcept │ │ │ │ │ + 603 { return false; } │ │ │ │ │ + 604 │ │ │ │ │ + 605 result internal_exec_prepared( │ │ │ │ │ + 606 const std::string &statement, │ │ │ │ │ + 607 const internal::params &args); │ │ │ │ │ + 608 │ │ │ │ │ + 609 result internal_exec_params( │ │ │ │ │ + 610 const std::string &query, │ │ │ │ │ + 611 const internal::params &args); │ │ │ │ │ + 612 │ │ │ │ │ + 614 void check_rowcount_prepared( │ │ │ │ │ + 615 const std::string &statement, │ │ │ │ │ + 616 size_t expected_rows, │ │ │ │ │ + 617 size_t actual_rows); │ │ │ │ │ + 618 │ │ │ │ │ + 620 void check_rowcount_params( │ │ │ │ │ + 621 size_t expected_rows, size_t actual_rows); │ │ │ │ │ + 622 │ │ │ │ │ +623 friend class pqxx::internal::gate::transaction_transactionfocus; │ │ │ │ │ + 624 PQXX_PRIVATE void register_focus(internal::transactionfocus *); │ │ │ │ │ + 625 PQXX_PRIVATE void unregister_focus(internal::transactionfocus *) noexcept; │ │ │ │ │ + 626 PQXX_PRIVATE void register_pending_error(const std::string &) noexcept; │ │ │ │ │ + 627 │ │ │ │ │ +628 friend class pqxx::internal::gate::transaction_tablereader; │ │ │ │ │ +629 friend class pqxx::internal::gate::transaction_stream_from; │ │ │ │ │ + 630 PQXX_PRIVATE void BeginCopyRead(const std::string &, const std::string &); │ │ │ │ │ + 631 bool read_copy_line(std::string &); │ │ │ │ │ + 632 │ │ │ │ │ +633 friend class pqxx::internal::gate::transaction_tablewriter; │ │ │ │ │ +634 friend class pqxx::internal::gate::transaction_stream_to; │ │ │ │ │ + 635 PQXX_PRIVATE void BeginCopyWrite( │ │ │ │ │ + 636 const std::string &Table, │ │ │ │ │ + 637 const std::string &Columns); │ │ │ │ │ + 638 void write_copy_line(const std::string &); │ │ │ │ │ + 639 void end_copy_write(); │ │ │ │ │ + 640 │ │ │ │ │ +641 friend class pqxx::internal::gate::transaction_subtransaction; │ │ │ │ │ + 642 │ │ │ │ │ + 643 connection_base &m_conn; │ │ │ │ │ + 644 │ │ │ │ │ + 645 internal::unique m_focus; │ │ │ │ │ + 646 Status m_status = st_nascent; │ │ │ │ │ + 647 bool m_registered = false; │ │ │ │ │ + 648 std::map m_vars; │ │ │ │ │ + 649 std::string m_pending_error; │ │ │ │ │ + 650}; │ │ │ │ │ + 651 │ │ │ │ │ + 652} // namespace pqxx │ │ │ │ │ + 653 │ │ │ │ │ + 654#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 655#endif │ │ │ │ │ +pqxx::transaction_base::esc │ │ │ │ │ +std::string esc(const char str[]) const │ │ │ │ │ +Escape string for use as SQL string literal in this transaction. │ │ │ │ │ +Definition: transaction_base.hxx:175 │ │ │ │ │ +std │ │ │ │ │ +STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::isolation_level │ │ │ │ │ -isolation_level │ │ │ │ │ -Transaction isolation levels. │ │ │ │ │ -Definition: isolation.hxx:57 │ │ │ │ │ -pqxx::serializable │ │ │ │ │ -@ serializable │ │ │ │ │ -Definition: isolation.hxx:61 │ │ │ │ │ -pqxx::read_committed │ │ │ │ │ -@ read_committed │ │ │ │ │ -Definition: isolation.hxx:59 │ │ │ │ │ -pqxx::repeatable_read │ │ │ │ │ -@ repeatable_read │ │ │ │ │ -Definition: isolation.hxx:60 │ │ │ │ │ +pqxx::binarystring │ │ │ │ │ +Binary data corresponding to PostgreSQL's "BYTEA" binary-string type. │ │ │ │ │ +Definition: binarystring.hxx:54 │ │ │ │ │ +pqxx::internal::reactivation_avoidance_counter │ │ │ │ │ +Definition: connection_base.hxx:49 │ │ │ │ │ +pqxx::connection_base │ │ │ │ │ +connection_base abstract base class; represents a connection to a database. │ │ │ │ │ +Definition: connection_base.hxx:140 │ │ │ │ │ pqxx::isolation_traits │ │ │ │ │ Traits class to describe an isolation level; primarly for libpqxx's own use. │ │ │ │ │ Definition: isolation.hxx:66 │ │ │ │ │ -pqxx::isolation_traits::name │ │ │ │ │ -static constexpr const char * name() noexcept │ │ │ │ │ -pqxx::isolation_traits::level │ │ │ │ │ -static constexpr isolation_level level() noexcept │ │ │ │ │ -Definition: isolation.hxx:67 │ │ │ │ │ +pqxx::prepare::invocation │ │ │ │ │ +Helper class for passing parameters to, and executing, prepared statements. │ │ │ │ │ +Definition: prepared_statement.hxx:82 │ │ │ │ │ +pqxx::result │ │ │ │ │ +Result set containing data returned by a query or command. │ │ │ │ │ +Definition: result.hxx:70 │ │ │ │ │ +pqxx::result::clear │ │ │ │ │ +void clear() noexcept │ │ │ │ │ +Definition: result.hxx:121 │ │ │ │ │ +pqxx::row │ │ │ │ │ +Reference to one row in a result. │ │ │ │ │ +Definition: row.hxx:41 │ │ │ │ │ +pqxx::row::front │ │ │ │ │ +reference front() const noexcept │ │ │ │ │ +Definition: row.cxx:59 │ │ │ │ │ +pqxx::internal::transactionfocus │ │ │ │ │ +Definition: transaction_base.hxx:44 │ │ │ │ │ +pqxx::internal::transactionfocus::transactionfocus │ │ │ │ │ +transactionfocus()=delete │ │ │ │ │ +pqxx::internal::transactionfocus::transactionfocus │ │ │ │ │ +transactionfocus(const transactionfocus &)=delete │ │ │ │ │ +pqxx::internal::transactionfocus::operator= │ │ │ │ │ +transactionfocus & operator=(const transactionfocus &)=delete │ │ │ │ │ +pqxx::internal::transactionfocus::transactionfocus │ │ │ │ │ +transactionfocus(transaction_base &t) │ │ │ │ │ +Definition: transaction_base.hxx:46 │ │ │ │ │ +pqxx::internal::transactionfocus::m_trans │ │ │ │ │ +transaction_base & m_trans │ │ │ │ │ +Definition: transaction_base.hxx:63 │ │ │ │ │ +pqxx::internal::parameterized_invocation │ │ │ │ │ +Helper class to construct an invocation of a parameterised statement. │ │ │ │ │ +Definition: transaction_base.hxx:74 │ │ │ │ │ +pqxx::internal::parameterized_invocation::operator() │ │ │ │ │ +parameterized_invocation & operator()(const binarystring &v, bool nonnull) │ │ │ │ │ +Definition: transaction_base.hxx:84 │ │ │ │ │ +pqxx::internal::parameterized_invocation::operator() │ │ │ │ │ +parameterized_invocation & operator()(const binarystring &v) │ │ │ │ │ +Definition: transaction_base.hxx:80 │ │ │ │ │ +pqxx::internal::parameterized_invocation::operator() │ │ │ │ │ +parameterized_invocation & operator()(const T &v) │ │ │ │ │ +Definition: transaction_base.hxx:82 │ │ │ │ │ +pqxx::internal::parameterized_invocation::operator() │ │ │ │ │ +parameterized_invocation & operator()() │ │ │ │ │ +Definition: transaction_base.hxx:79 │ │ │ │ │ +pqxx::internal::parameterized_invocation::operator() │ │ │ │ │ +parameterized_invocation & operator()(const T &v, bool nonnull) │ │ │ │ │ +Definition: transaction_base.hxx:87 │ │ │ │ │ +pqxx::transaction_base │ │ │ │ │ +Interface definition (and common code) for "transaction" classes. │ │ │ │ │ +Definition: transaction_base.hxx:138 │ │ │ │ │ +pqxx::transaction_base::exec_params │ │ │ │ │ +result exec_params(const std::string &query, Args &&...args) │ │ │ │ │ +Execute an SQL statement with parameters. │ │ │ │ │ +Definition: transaction_base.hxx:321 │ │ │ │ │ +pqxx::transaction_base::quote_raw │ │ │ │ │ +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 │ │ │ │ │ +pqxx::transaction_base::exec_params_n │ │ │ │ │ +result exec_params_n(size_t rows, const std::string &query, Args &&...args) │ │ │ │ │ +Definition: transaction_base.hxx:349 │ │ │ │ │ +pqxx::transaction_base::esc │ │ │ │ │ +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 │ │ │ │ │ +pqxx::transaction_base::exec │ │ │ │ │ +result exec(const std::stringstream &Query, const std::string &Desc=std::string │ │ │ │ │ +{}) │ │ │ │ │ +Definition: transaction_base.hxx:253 │ │ │ │ │ +pqxx::transaction_base::quote │ │ │ │ │ +std::string quote(const T &t) const │ │ │ │ │ +Represent object as SQL string, including quoting & escaping. │ │ │ │ │ +Definition: transaction_base.hxx:215 │ │ │ │ │ +pqxx::transaction_base::transaction_base │ │ │ │ │ +transaction_base(const transaction_base &)=delete │ │ │ │ │ +pqxx::transaction_base::exec_prepared0 │ │ │ │ │ +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 │ │ │ │ │ +pqxx::transaction_base::exec_prepared │ │ │ │ │ +result exec_prepared(const std::string &statement, Args &&... args) │ │ │ │ │ +Execute a prepared statement, with optional arguments. │ │ │ │ │ +Definition: transaction_base.hxx:396 │ │ │ │ │ +pqxx::transaction_base::esc_raw │ │ │ │ │ +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 │ │ │ │ │ +pqxx::transaction_base::exec0 │ │ │ │ │ +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 │ │ │ │ │ +pqxx::transaction_base::operator= │ │ │ │ │ +transaction_base & operator=(const transaction_base &)=delete │ │ │ │ │ +pqxx::transaction_base::exec_prepared_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 │ │ │ │ │ +pqxx::transaction_base::conn │ │ │ │ │ +connection_base & conn() const │ │ │ │ │ +Connection this transaction is running in. │ │ │ │ │ +Definition: transaction_base.hxx:492 │ │ │ │ │ +pqxx::transaction_base::process_notice │ │ │ │ │ +void process_notice(const std::string &Msg) const │ │ │ │ │ +Have connection process warning message. │ │ │ │ │ +Definition: transaction_base.hxx:487 │ │ │ │ │ +pqxx::transaction_base::process_notice │ │ │ │ │ +void process_notice(const char Msg[]) const │ │ │ │ │ +Have connection process warning message. │ │ │ │ │ +Definition: transaction_base.hxx:484 │ │ │ │ │ +pqxx::transaction_base::exec_params1 │ │ │ │ │ +row exec_params1(const std::string &query, Args &&... args) │ │ │ │ │ +Definition: transaction_base.hxx:331 │ │ │ │ │ +pqxx::transaction_base::transaction_base │ │ │ │ │ +transaction_base()=delete │ │ │ │ │ +pqxx::transaction_base::unesc_raw │ │ │ │ │ +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 │ │ │ │ │ +pqxx::transaction_base::exec_params0 │ │ │ │ │ +result exec_params0(const std::string &query, Args &&...args) │ │ │ │ │ +Definition: transaction_base.hxx:340 │ │ │ │ │ +pqxx::transaction_base::esc │ │ │ │ │ +std::string esc(const std::string &str) const │ │ │ │ │ +Escape string for use as SQL string literal in this transaction. │ │ │ │ │ +Definition: transaction_base.hxx:180 │ │ │ │ │ +pqxx::transaction_base::quote_name │ │ │ │ │ +std::string quote_name(const std::string &identifier) const │ │ │ │ │ +Escape an SQL identifier for use in a query. │ │ │ │ │ +Definition: transaction_base.hxx:225 │ │ │ │ │ +pqxx::transaction_base::exec_prepared1 │ │ │ │ │ +row exec_prepared1(const std::string &statement, Args &&... args) │ │ │ │ │ +Execute a prepared statement, and expect a single-row result. │ │ │ │ │ +Definition: transaction_base.hxx:406 │ │ │ │ │ +pqxx::transaction_base::unesc_raw │ │ │ │ │ +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 │ │ │ │ │ +pqxx::transaction_base::exec1 │ │ │ │ │ +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 │ │ │ │ │ +pqxx::transaction_base::m_reactivation_avoidance │ │ │ │ │ +internal::reactivation_avoidance_counter m_reactivation_avoidance │ │ │ │ │ +Resources allocated in this transaction that make reactivation impossible. │ │ │ │ │ +Definition: transaction_base.hxx:564 │ │ │ │ │ +pqxx::transaction_base::esc_like │ │ │ │ │ +std::string esc_like(const std::string &str, char escape_char='\\') const │ │ │ │ │ +Escape string for literal LIKE match. │ │ │ │ │ +Definition: transaction_base.hxx:229 │ │ │ │ │ +pqxx::internal::namedclass │ │ │ │ │ +Helper base class: object descriptions for error messages and such. │ │ │ │ │ +Definition: util.hxx:234 │ │ │ │ │ +pqxx::internal::unique │ │ │ │ │ +Ensure proper opening/closing of GUEST objects related to a "host" object. │ │ │ │ │ +Definition: util.hxx:275 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * isolation.hxx │ │ │ │ │ + * transaction_base.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00032_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: config-internal-compiler.h Source File │ │ │ │ +libpqxx: version.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,28 +55,45 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
config-internal-compiler.h
│ │ │ │ +
version.hxx
│ │ │ │
│ │ │ │
│ │ │ │ -
1/* Automatically generated from config.h: internal/compiler config. */
│ │ │ │ -
2
│ │ │ │ -
3#define HAVE_POLL 1
│ │ │ │ -
4#define HAVE_SYS_TIME_H 1
│ │ │ │ -
5#define HAVE_SYS_TYPES_H 1
│ │ │ │ -
6#define HAVE_UNISTD_H 1
│ │ │ │ -
7#define PQXX_HAVE_GCC_VISIBILITY 1
│ │ │ │ +
1
│ │ │ │ +
11#ifndef PQXX_H_VERSION
│ │ │ │ +
12
│ │ │ │ +
13#include "pqxx/compiler-public.hxx"
│ │ │ │ +
14#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
15
│ │ │ │ +
17#define PQXX_VERSION "6.4.4"
│ │ │ │ +
19#define PQXX_ABI "6.4"
│ │ │ │ +
20
│ │ │ │ +
22#define PQXX_VERSION_MAJOR 6
│ │ │ │ +
24#define PQXX_VERSION_MINOR 4
│ │ │ │ +
25
│ │ │ │ +
26namespace pqxx
│ │ │ │ +
27{
│ │ │ │ +
28namespace internal
│ │ │ │ +
29{
│ │ │ │ +
31
│ │ │ │ +
53template<int, int> PQXX_LIBEXPORT int check_library_version() noexcept;
│ │ │ │ +
54}
│ │ │ │ +
55}
│ │ │ │ +
56#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
57#endif
│ │ │ │ +
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ +
int check_library_version() noexcept
Library version check stub.
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,19 +1,40 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -config-internal-compiler.h │ │ │ │ │ - 1/* Automatically generated from config.h: internal/compiler config. */ │ │ │ │ │ - 2 │ │ │ │ │ - 3#define HAVE_POLL 1 │ │ │ │ │ - 4#define HAVE_SYS_TIME_H 1 │ │ │ │ │ - 5#define HAVE_SYS_TYPES_H 1 │ │ │ │ │ - 6#define HAVE_UNISTD_H 1 │ │ │ │ │ - 7#define PQXX_HAVE_GCC_VISIBILITY 1 │ │ │ │ │ +version.hxx │ │ │ │ │ + 1 │ │ │ │ │ + 11#ifndef PQXX_H_VERSION │ │ │ │ │ + 12 │ │ │ │ │ + 13#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 14#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 15 │ │ │ │ │ + 17#define PQXX_VERSION "6.4.4" │ │ │ │ │ + 19#define PQXX_ABI "6.4" │ │ │ │ │ + 20 │ │ │ │ │ + 22#define PQXX_VERSION_MAJOR 6 │ │ │ │ │ + 24#define PQXX_VERSION_MINOR 4 │ │ │ │ │ + 25 │ │ │ │ │ + 26namespace pqxx │ │ │ │ │ + 27{ │ │ │ │ │ + 28namespace internal │ │ │ │ │ + 29{ │ │ │ │ │ + 31 │ │ │ │ │ +53template PQXX_LIBEXPORT int check_library_version() noexcept; │ │ │ │ │ + 54} │ │ │ │ │ + 55} │ │ │ │ │ + 56#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 57#endif │ │ │ │ │ +pqxx │ │ │ │ │ +The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ +Definition: array.hxx:26 │ │ │ │ │ +pqxx::internal::check_library_version │ │ │ │ │ +int check_library_version() noexcept │ │ │ │ │ +Library version check stub. │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * config-internal-compiler.h │ │ │ │ │ + * version.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00035_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: stream_base.hxx Source File │ │ │ │ +libpqxx: prepared_statement.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,80 +55,138 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
stream_base.hxx
│ │ │ │ +
prepared_statement.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_STREAM_BASE
│ │ │ │ -
14#define PQXX_H_STREAM_BASE
│ │ │ │ -
15
│ │ │ │ -
16#include "pqxx/compiler-public.hxx"
│ │ │ │ -
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18#include "pqxx/transaction_base.hxx"
│ │ │ │ -
19#include "pqxx/util.hxx"
│ │ │ │ +
11#ifndef PQXX_H_PREPARED_STATEMENT
│ │ │ │ +
12#define PQXX_H_PREPARED_STATEMENT
│ │ │ │ +
13
│ │ │ │ +
14#include "pqxx/compiler-public.hxx"
│ │ │ │ +
15#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
16
│ │ │ │ +
17#include "pqxx/types.hxx"
│ │ │ │ +
18#include "pqxx/internal/statement_parameters.hxx"
│ │ │ │ +
19
│ │ │ │
20
│ │ │ │ -
21#include <string>
│ │ │ │ -
22
│ │ │ │ -
23
│ │ │ │ -
24namespace pqxx
│ │ │ │ -
25{
│ │ │ │ -
26
│ │ │ │ -
27class PQXX_LIBEXPORT PQXX_NOVTABLE stream_base :
│ │ │ │ - │ │ │ │ -
29{
│ │ │ │ -
30public:
│ │ │ │ -
31 explicit stream_base(transaction_base &);
│ │ │ │ -
32 // TODO: Can we get rid of the vtable?
│ │ │ │ -
33 virtual ~stream_base() noexcept =default;
│ │ │ │ -
34 virtual void complete() = 0;
│ │ │ │ -
35 operator bool() const noexcept;
│ │ │ │ -
36 bool operator!() const noexcept;
│ │ │ │ -
37protected:
│ │ │ │ -
38 bool m_finished;
│ │ │ │ -
39 virtual void close();
│ │ │ │ -
40 template<typename C> static std::string columnlist(const C &);
│ │ │ │ -
41 template<typename I> static std::string columnlist(I begin, I end);
│ │ │ │ -
42private:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
45 stream_base & operator=(const stream_base &);
│ │ │ │ -
46};
│ │ │ │ -
47
│ │ │ │ -
48template<typename C> std::string stream_base::columnlist(const C &c)
│ │ │ │ -
49{
│ │ │ │ -
50 return columnlist(std::begin(c), std::end(c));
│ │ │ │ -
51}
│ │ │ │ -
52
│ │ │ │ -
53template<typename I> std::string stream_base::columnlist(I begin, I end)
│ │ │ │ -
54{
│ │ │ │ -
55 return separated_list(",", begin, end);
│ │ │ │ -
56}
│ │ │ │ -
57
│ │ │ │ -
58} // namespace pqxx
│ │ │ │ -
59
│ │ │ │ -
60
│ │ │ │ -
61#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
62#endif
│ │ │ │ -
STL namespace.
│ │ │ │ +
21
│ │ │ │ +
22namespace pqxx
│ │ │ │ +
23{
│ │ │ │ +
25namespace prepare
│ │ │ │ +
26{
│ │ │ │ +
28
│ │ │ │ +
43template<typename IT> inline pqxx::internal::dynamic_params<IT>
│ │ │ │ +
44make_dynamic_params(IT begin, IT end)
│ │ │ │ +
45{
│ │ │ │ +
46 return pqxx::internal::dynamic_params<IT>(begin, end);
│ │ │ │ +
47}
│ │ │ │ +
48
│ │ │ │ +
49
│ │ │ │ +
51
│ │ │ │ +
65template<typename C>
│ │ │ │ +
66inline pqxx::internal::dynamic_params<typename C::const_iterator>
│ │ │ │ +
67make_dynamic_params(const C &container)
│ │ │ │ +
68{
│ │ │ │ +
69 return pqxx::internal::dynamic_params<typename C::const_iterator>(container);
│ │ │ │ +
70}
│ │ │ │ +
71} // namespace prepare
│ │ │ │ +
72} // namespace pqxx
│ │ │ │ +
73
│ │ │ │ +
74namespace pqxx
│ │ │ │ +
75{
│ │ │ │ +
76namespace prepare
│ │ │ │ +
77{
│ │ │ │ +
79
│ │ │ │ +
81class PQXX_LIBEXPORT invocation : internal::statement_parameters
│ │ │ │ +
82{
│ │ │ │ +
83public:
│ │ │ │ +
84 PQXX_DEPRECATED invocation(transaction_base &, const std::string &statement);
│ │ │ │ +
85 invocation &operator=(const invocation &) =delete;
│ │ │ │ +
86
│ │ │ │ +
88 result exec() const;
│ │ │ │ +
89
│ │ │ │ +
91 bool exists() const;
│ │ │ │ +
92
│ │ │ │ +
94 invocation &operator()() { add_param(); return *this; }
│ │ │ │ +
95
│ │ │ │ +
97
│ │ │ │ +
100 template<typename T> invocation &operator()(const T &v)
│ │ │ │ +
101 { add_param(v, true); return *this; }
│ │ │ │ +
102
│ │ │ │ +
104
│ │ │ │ + │ │ │ │ +
108 { add_binary_param(v, true); return *this; }
│ │ │ │ +
109
│ │ │ │ +
111
│ │ │ │ +
115 template<typename T> invocation &operator()(const T &v, bool nonnull)
│ │ │ │ +
116 { add_param(v, nonnull); return *this; }
│ │ │ │ +
117
│ │ │ │ +
119
│ │ │ │ +
123 invocation &operator()(const binarystring &v, bool nonnull)
│ │ │ │ +
124 { add_binary_param(v, nonnull); return *this; }
│ │ │ │ +
125
│ │ │ │ +
127
│ │ │ │ +
134 template<typename T> invocation &operator()(T *v, bool nonnull=true)
│ │ │ │ +
135 { add_param(v, nonnull); return *this; }
│ │ │ │ +
136
│ │ │ │ +
138
│ │ │ │ +
142 invocation &operator()(const char *v, bool nonnull=true)
│ │ │ │ +
143 { add_param(v, nonnull); return *this; }
│ │ │ │ +
144
│ │ │ │ +
145private:
│ │ │ │ +
146 transaction_base &m_home;
│ │ │ │ +
147 const std::string m_statement;
│ │ │ │ +
148
│ │ │ │ +
149 invocation &setparam(const std::string &, bool nonnull);
│ │ │ │ +
150};
│ │ │ │ +
151
│ │ │ │ +
152
│ │ │ │ +
153namespace internal
│ │ │ │ +
154{
│ │ │ │ +
156struct PQXX_LIBEXPORT prepared_def
│ │ │ │ +
157{
│ │ │ │ +
159 std::string definition;
│ │ │ │ +
161 bool registered = false;
│ │ │ │ +
162
│ │ │ │ +
163 prepared_def() =default;
│ │ │ │ +
164 explicit prepared_def(const std::string &);
│ │ │ │ +
165};
│ │ │ │ +
166
│ │ │ │ +
167} // namespace pqxx::prepare::internal
│ │ │ │ +
168} // namespace pqxx::prepare
│ │ │ │ +
169} // namespace pqxx
│ │ │ │ +
170
│ │ │ │ +
171#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
172#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
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
│ │ │ │ -
Definition: stream_base.hxx:29
│ │ │ │ -
virtual ~stream_base() noexcept=default
│ │ │ │ -
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
│ │ │ │ -
Definition: transaction_base.hxx:44
│ │ │ │ +
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
│ │ │ │ +
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
│ │ │ │ +
Helper class for passing parameters to, and executing, prepared statements.
Definition: prepared_statement.hxx:82
│ │ │ │ +
invocation & operator()(const binarystring &v, bool nonnull)
Pass binary parameter value for a BYTEA field.
Definition: prepared_statement.hxx:123
│ │ │ │ +
invocation & operator()(const binarystring &v)
Pass binary parameter value for a BYTEA field.
Definition: prepared_statement.hxx:107
│ │ │ │ +
invocation & operator()(T *v, bool nonnull=true)
Pass C-style parameter string, or null if pointer is null.
Definition: prepared_statement.hxx:134
│ │ │ │ +
invocation & operator=(const invocation &)=delete
│ │ │ │ +
invocation & operator()(const char *v, bool nonnull=true)
Pass C-style string parameter, or null if pointer is null.
Definition: prepared_statement.hxx:142
│ │ │ │ +
invocation & operator()()
Pass null parameter.
Definition: prepared_statement.hxx:94
│ │ │ │ +
invocation & operator()(const T &v, bool nonnull)
Pass parameter value.
Definition: prepared_statement.hxx:115
│ │ │ │ +
invocation & operator()(const T &v)
Pass parameter value.
Definition: prepared_statement.hxx:100
│ │ │ │ +
Internal representation of a prepared statement definition.
Definition: prepared_statement.hxx:157
│ │ │ │ + │ │ │ │ +
std::string definition
Text of prepared query.
Definition: prepared_statement.hxx:159
│ │ │ │ +
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,85 +1,172 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -stream_base.hxx │ │ │ │ │ +prepared_statement.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_STREAM_BASE │ │ │ │ │ - 14#define PQXX_H_STREAM_BASE │ │ │ │ │ - 15 │ │ │ │ │ - 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18#include "pqxx/transaction_base.hxx" │ │ │ │ │ - 19#include "pqxx/util.hxx" │ │ │ │ │ + 11#ifndef PQXX_H_PREPARED_STATEMENT │ │ │ │ │ + 12#define PQXX_H_PREPARED_STATEMENT │ │ │ │ │ + 13 │ │ │ │ │ + 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 15#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 16 │ │ │ │ │ + 17#include "pqxx/types.hxx" │ │ │ │ │ + 18#include "pqxx/internal/statement_parameters.hxx" │ │ │ │ │ + 19 │ │ │ │ │ 20 │ │ │ │ │ - 21#include │ │ │ │ │ - 22 │ │ │ │ │ - 23 │ │ │ │ │ - 24namespace pqxx │ │ │ │ │ - 25{ │ │ │ │ │ - 26 │ │ │ │ │ -27class PQXX_LIBEXPORT PQXX_NOVTABLE stream_base : │ │ │ │ │ - 28 public internal::transactionfocus │ │ │ │ │ - 29{ │ │ │ │ │ - 30public: │ │ │ │ │ - 31 explicit stream_base(transaction_base &); │ │ │ │ │ - 32 // TODO: Can we get rid of the vtable? │ │ │ │ │ -33 virtual ~stream_base() noexcept =default; │ │ │ │ │ -34 virtual void complete() = 0; │ │ │ │ │ - 35 operator bool() const noexcept; │ │ │ │ │ - 36 bool operator!() const noexcept; │ │ │ │ │ - 37protected: │ │ │ │ │ -38 bool m_finished; │ │ │ │ │ - 39 virtual void close(); │ │ │ │ │ - 40 template static std::string columnlist(const C &); │ │ │ │ │ - 41 template static std::string columnlist(I begin, I end); │ │ │ │ │ - 42private: │ │ │ │ │ - 43 stream_base(); │ │ │ │ │ - 44 stream_base(const stream_base&); │ │ │ │ │ - 45 stream_base & operator=(const stream_base &); │ │ │ │ │ - 46}; │ │ │ │ │ - 47 │ │ │ │ │ -48template std::string stream_base::columnlist(const C &c) │ │ │ │ │ - 49{ │ │ │ │ │ - 50 return columnlist(std::begin(c), std::end(c)); │ │ │ │ │ - 51} │ │ │ │ │ - 52 │ │ │ │ │ -53template std::string stream_base::columnlist(I begin, I end) │ │ │ │ │ - 54{ │ │ │ │ │ - 55 return separated_list(",", begin, end); │ │ │ │ │ - 56} │ │ │ │ │ - 57 │ │ │ │ │ - 58} // namespace pqxx │ │ │ │ │ - 59 │ │ │ │ │ - 60 │ │ │ │ │ - 61#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 62#endif │ │ │ │ │ -std │ │ │ │ │ -STL namespace. │ │ │ │ │ + 21 │ │ │ │ │ + 22namespace pqxx │ │ │ │ │ + 23{ │ │ │ │ │ +25namespace prepare │ │ │ │ │ + 26{ │ │ │ │ │ + 28 │ │ │ │ │ + 43template inline pqxx::internal::dynamic_params │ │ │ │ │ +44make_dynamic_params(IT begin, IT end) │ │ │ │ │ + 45{ │ │ │ │ │ + 46 return pqxx::internal::dynamic_params(begin, end); │ │ │ │ │ + 47} │ │ │ │ │ + 48 │ │ │ │ │ + 49 │ │ │ │ │ + 51 │ │ │ │ │ + 65template │ │ │ │ │ + 66inline pqxx::internal::dynamic_params │ │ │ │ │ +67make_dynamic_params(const C &container) │ │ │ │ │ + 68{ │ │ │ │ │ + 69 return pqxx::internal::dynamic_params │ │ │ │ │ +(container); │ │ │ │ │ + 70} │ │ │ │ │ + 71} // namespace prepare │ │ │ │ │ + 72} // namespace pqxx │ │ │ │ │ + 73 │ │ │ │ │ + 74namespace pqxx │ │ │ │ │ + 75{ │ │ │ │ │ + 76namespace prepare │ │ │ │ │ + 77{ │ │ │ │ │ + 79 │ │ │ │ │ +81class PQXX_LIBEXPORT invocation : internal::statement_parameters │ │ │ │ │ + 82{ │ │ │ │ │ + 83public: │ │ │ │ │ + 84 PQXX_DEPRECATED invocation(transaction_base &, const std::string │ │ │ │ │ +&statement); │ │ │ │ │ +85 invocation &operator=(const invocation &) =delete; │ │ │ │ │ + 86 │ │ │ │ │ + 88 result exec() const; │ │ │ │ │ + 89 │ │ │ │ │ + 91 bool exists() const; │ │ │ │ │ + 92 │ │ │ │ │ +94 invocation &operator()() { add_param(); return *this; } │ │ │ │ │ + 95 │ │ │ │ │ + 97 │ │ │ │ │ +100 template invocation &operator()(const T &v) │ │ │ │ │ + 101 { add_param(v, true); return *this; } │ │ │ │ │ + 102 │ │ │ │ │ + 104 │ │ │ │ │ +107 invocation &operator()(const binarystring &v) │ │ │ │ │ + 108 { add_binary_param(v, true); return *this; } │ │ │ │ │ + 109 │ │ │ │ │ + 111 │ │ │ │ │ +115 template invocation &operator()(const T &v, bool nonnull) │ │ │ │ │ + 116 { add_param(v, nonnull); return *this; } │ │ │ │ │ + 117 │ │ │ │ │ + 119 │ │ │ │ │ +123 invocation &operator()(const binarystring &v, bool nonnull) │ │ │ │ │ + 124 { add_binary_param(v, nonnull); return *this; } │ │ │ │ │ + 125 │ │ │ │ │ + 127 │ │ │ │ │ +134 template invocation &operator()(T *v, bool nonnull=true) │ │ │ │ │ + 135 { add_param(v, nonnull); return *this; } │ │ │ │ │ + 136 │ │ │ │ │ + 138 │ │ │ │ │ +142 invocation &operator()(const char *v, bool nonnull=true) │ │ │ │ │ + 143 { add_param(v, nonnull); return *this; } │ │ │ │ │ + 144 │ │ │ │ │ + 145private: │ │ │ │ │ + 146 transaction_base &m_home; │ │ │ │ │ + 147 const std::string m_statement; │ │ │ │ │ + 148 │ │ │ │ │ + 149 invocation &setparam(const std::string &, bool nonnull); │ │ │ │ │ + 150}; │ │ │ │ │ + 151 │ │ │ │ │ + 152 │ │ │ │ │ +153namespace internal │ │ │ │ │ + 154{ │ │ │ │ │ +156struct PQXX_LIBEXPORT prepared_def │ │ │ │ │ + 157{ │ │ │ │ │ +159 std::string definition; │ │ │ │ │ +161 bool registered = false; │ │ │ │ │ + 162 │ │ │ │ │ +163 prepared_def() =default; │ │ │ │ │ + 164 explicit prepared_def(const std::string &); │ │ │ │ │ + 165}; │ │ │ │ │ + 166 │ │ │ │ │ + 167} // namespace pqxx::prepare::internal │ │ │ │ │ + 168} // namespace pqxx::prepare │ │ │ │ │ + 169} // namespace pqxx │ │ │ │ │ + 170 │ │ │ │ │ + 171#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 172#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::separated_list │ │ │ │ │ -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 │ │ │ │ │ -pqxx::stream_base │ │ │ │ │ -Definition: stream_base.hxx:29 │ │ │ │ │ -pqxx::stream_base::~stream_base │ │ │ │ │ -virtual ~stream_base() noexcept=default │ │ │ │ │ -pqxx::stream_base::columnlist │ │ │ │ │ -static std::string columnlist(const C &) │ │ │ │ │ -Definition: stream_base.hxx:48 │ │ │ │ │ -pqxx::internal::transactionfocus │ │ │ │ │ -Definition: transaction_base.hxx:44 │ │ │ │ │ +pqxx::prepare::make_dynamic_params │ │ │ │ │ +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 │ │ │ │ │ +pqxx::binarystring │ │ │ │ │ +Binary data corresponding to PostgreSQL's "BYTEA" binary-string type. │ │ │ │ │ +Definition: binarystring.hxx:54 │ │ │ │ │ +pqxx::prepare::invocation │ │ │ │ │ +Helper class for passing parameters to, and executing, prepared statements. │ │ │ │ │ +Definition: prepared_statement.hxx:82 │ │ │ │ │ +pqxx::prepare::invocation::operator() │ │ │ │ │ +invocation & operator()(const binarystring &v, bool nonnull) │ │ │ │ │ +Pass binary parameter value for a BYTEA field. │ │ │ │ │ +Definition: prepared_statement.hxx:123 │ │ │ │ │ +pqxx::prepare::invocation::operator() │ │ │ │ │ +invocation & operator()(const binarystring &v) │ │ │ │ │ +Pass binary parameter value for a BYTEA field. │ │ │ │ │ +Definition: prepared_statement.hxx:107 │ │ │ │ │ +pqxx::prepare::invocation::operator() │ │ │ │ │ +invocation & operator()(T *v, bool nonnull=true) │ │ │ │ │ +Pass C-style parameter string, or null if pointer is null. │ │ │ │ │ +Definition: prepared_statement.hxx:134 │ │ │ │ │ +pqxx::prepare::invocation::operator= │ │ │ │ │ +invocation & operator=(const invocation &)=delete │ │ │ │ │ +pqxx::prepare::invocation::operator() │ │ │ │ │ +invocation & operator()(const char *v, bool nonnull=true) │ │ │ │ │ +Pass C-style string parameter, or null if pointer is null. │ │ │ │ │ +Definition: prepared_statement.hxx:142 │ │ │ │ │ +pqxx::prepare::invocation::operator() │ │ │ │ │ +invocation & operator()() │ │ │ │ │ +Pass null parameter. │ │ │ │ │ +Definition: prepared_statement.hxx:94 │ │ │ │ │ +pqxx::prepare::invocation::operator() │ │ │ │ │ +invocation & operator()(const T &v, bool nonnull) │ │ │ │ │ +Pass parameter value. │ │ │ │ │ +Definition: prepared_statement.hxx:115 │ │ │ │ │ +pqxx::prepare::invocation::operator() │ │ │ │ │ +invocation & operator()(const T &v) │ │ │ │ │ +Pass parameter value. │ │ │ │ │ +Definition: prepared_statement.hxx:100 │ │ │ │ │ +pqxx::prepare::internal::prepared_def │ │ │ │ │ +Internal representation of a prepared statement definition. │ │ │ │ │ +Definition: prepared_statement.hxx:157 │ │ │ │ │ +pqxx::prepare::internal::prepared_def::prepared_def │ │ │ │ │ +prepared_def()=default │ │ │ │ │ +pqxx::prepare::internal::prepared_def::definition │ │ │ │ │ +std::string definition │ │ │ │ │ +Text of prepared query. │ │ │ │ │ +Definition: prepared_statement.hxx:159 │ │ │ │ │ +pqxx::result │ │ │ │ │ +Result set containing data returned by a query or command. │ │ │ │ │ +Definition: result.hxx:70 │ │ │ │ │ pqxx::transaction_base │ │ │ │ │ Interface definition (and common code) for "transaction" classes. │ │ │ │ │ Definition: transaction_base.hxx:138 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * stream_base.hxx │ │ │ │ │ + * prepared_statement.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00038_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: compiler-internal-post.hxx Source File │ │ │ │ +libpqxx: tablewriter.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,32 +55,245 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
compiler-internal-post.hxx
│ │ │ │ +
tablewriter.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
12// NO GUARDS HERE! This code should be executed every time!
│ │ │ │ -
13
│ │ │ │ -
14#ifdef _WIN32
│ │ │ │ +
13#ifndef PQXX_H_TABLEWRITER
│ │ │ │ +
14#define PQXX_H_TABLEWRITER
│ │ │ │
15
│ │ │ │ -
16#ifdef _MSC_VER
│ │ │ │ -
17#pragma warning (pop) // Restore client program's warning state
│ │ │ │ -
18#endif
│ │ │ │ -
19
│ │ │ │ -
20#endif
│ │ │ │ -
21
│ │ │ │ +
16#include <iterator>
│ │ │ │ +
17
│ │ │ │ +
18#include "pqxx/compiler-public.hxx"
│ │ │ │ +
19#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
20
│ │ │ │ +
21#include "pqxx/tablestream.hxx"
│ │ │ │ +
22
│ │ │ │ +
23
│ │ │ │ +
24namespace pqxx
│ │ │ │ +
25{
│ │ │ │ +
27
│ │ │ │ +
31class PQXX_LIBEXPORT tablewriter : public tablestream
│ │ │ │ +
32{
│ │ │ │ +
33public:
│ │ │ │ +
34 PQXX_DEPRECATED tablewriter(
│ │ │ │ + │ │ │ │ +
36 const std::string &WName,
│ │ │ │ +
37 const std::string &Null=std::string{});
│ │ │ │ +
38 template<typename ITER>
│ │ │ │ +
39 PQXX_DEPRECATED tablewriter(
│ │ │ │ + │ │ │ │ +
41 const std::string &WName,
│ │ │ │ +
42 ITER begincolumns,
│ │ │ │ +
43 ITER endcolumns);
│ │ │ │ +
44 template<typename ITER>
│ │ │ │ +
45 PQXX_DEPRECATED tablewriter(
│ │ │ │ + │ │ │ │ +
47 const std::string &WName,
│ │ │ │ +
48 ITER begincolumns,
│ │ │ │ +
49 ITER endcolumns,
│ │ │ │ +
50 const std::string &Null);
│ │ │ │ +
51 ~tablewriter() noexcept;
│ │ │ │ +
52 template<typename IT> void insert(IT Begin, IT End);
│ │ │ │ +
53 template<typename TUPLE> void insert(const TUPLE &);
│ │ │ │ +
54 template<typename IT> void push_back(IT Begin, IT End);
│ │ │ │ +
55 template<typename TUPLE> void push_back(const TUPLE &);
│ │ │ │ +
56 template<typename SIZE> void reserve(SIZE) {}
│ │ │ │ +
57 template<typename TUPLE> tablewriter &operator<<(const TUPLE &);
│ │ │ │ + │ │ │ │ +
59 template<typename IT> std::string generate(IT Begin, IT End) const;
│ │ │ │ +
60 template<typename TUPLE> std::string generate(const TUPLE &) const;
│ │ │ │ +
61 virtual void complete() override;
│ │ │ │ +
62 void write_raw_line(const std::string &);
│ │ │ │ +
63private:
│ │ │ │ +
64 void set_up(
│ │ │ │ + │ │ │ │ +
66 const std::string &WName,
│ │ │ │ +
67 const std::string &Columns = std::string{});
│ │ │ │ +
68 PQXX_PRIVATE void writer_close();
│ │ │ │ +
69};
│ │ │ │ +
70} // namespace pqxx
│ │ │ │ +
71
│ │ │ │ +
72
│ │ │ │ +
73namespace std
│ │ │ │ +
74{
│ │ │ │ +
75template<>
│ │ │ │ +
76 class back_insert_iterator<pqxx::tablewriter>
│ │ │ │ +
77{
│ │ │ │ +
78public:
│ │ │ │ +
79 using iterator_category = output_iterator_tag;
│ │ │ │ +
80
│ │ │ │ + │ │ │ │ +
82 m_writer{&W} {}
│ │ │ │ +
83
│ │ │ │ +
84 back_insert_iterator &
│ │ │ │ +
85 operator=(const back_insert_iterator &rhs) noexcept
│ │ │ │ +
86 {
│ │ │ │ +
87 m_writer = rhs.m_writer;
│ │ │ │ +
88 return *this;
│ │ │ │ +
89 }
│ │ │ │ +
90
│ │ │ │ +
91 template<typename TUPLE>
│ │ │ │ +
92 back_insert_iterator &operator=(const TUPLE &T)
│ │ │ │ +
93 {
│ │ │ │ +
94 m_writer->insert(T);
│ │ │ │ +
95 return *this;
│ │ │ │ +
96 }
│ │ │ │ +
97
│ │ │ │ +
98 back_insert_iterator &operator++() { return *this; }
│ │ │ │ +
99 back_insert_iterator &operator++(int) { return *this; }
│ │ │ │ +
100 back_insert_iterator &operator*() { return *this; }
│ │ │ │ +
101
│ │ │ │ +
102private:
│ │ │ │ +
103 pqxx::tablewriter *m_writer;
│ │ │ │ +
104};
│ │ │ │ +
105} // namespace std
│ │ │ │ +
106
│ │ │ │ +
107
│ │ │ │ +
108namespace pqxx
│ │ │ │ +
109{
│ │ │ │ +
110template<typename ITER> inline tablewriter::tablewriter(
│ │ │ │ + │ │ │ │ +
112 const std::string &WName,
│ │ │ │ +
113 ITER begincolumns,
│ │ │ │ +
114 ITER endcolumns) :
│ │ │ │ +
115 namedclass{"tablewriter", WName},
│ │ │ │ +
116 tablestream{T, std::string{}}
│ │ │ │ +
117{
│ │ │ │ +
118 set_up(T, WName, columnlist(begincolumns, endcolumns));
│ │ │ │ +
119}
│ │ │ │ +
120
│ │ │ │ +
121
│ │ │ │ +
122template<typename ITER> inline tablewriter::tablewriter(
│ │ │ │ + │ │ │ │ +
124 const std::string &WName,
│ │ │ │ +
125 ITER begincolumns,
│ │ │ │ +
126 ITER endcolumns,
│ │ │ │ +
127 const std::string &Null) :
│ │ │ │ +
128 namedclass{"tablewriter", WName},
│ │ │ │ +
129 tablestream{T, Null}
│ │ │ │ +
130{
│ │ │ │ +
131 set_up(T, WName, columnlist(begincolumns, endcolumns));
│ │ │ │ +
132}
│ │ │ │ +
133
│ │ │ │ +
134
│ │ │ │ +
135namespace internal
│ │ │ │ +
136{
│ │ │ │ +
137PQXX_LIBEXPORT std::string escape(
│ │ │ │ +
138 const std::string &s,
│ │ │ │ +
139 const std::string &null);
│ │ │ │ +
140
│ │ │ │ +
141inline std::string escape_any(
│ │ │ │ +
142 const std::string &s,
│ │ │ │ +
143 const std::string &null)
│ │ │ │ +
144{ return escape(s, null); }
│ │ │ │ +
145
│ │ │ │ +
146inline std::string escape_any(
│ │ │ │ +
147 const char s[],
│ │ │ │ +
148 const std::string &null)
│ │ │ │ +
149{ return s ? escape(std::string{s}, null) : "\\N"; }
│ │ │ │ +
150
│ │ │ │ +
151template<typename T> inline std::string escape_any(
│ │ │ │ +
152 const T &t,
│ │ │ │ +
153 const std::string &null)
│ │ │ │ +
154{ return escape(to_string(t), null); }
│ │ │ │ +
155
│ │ │ │ +
156
│ │ │ │ +
157template<typename IT> class Escaper
│ │ │ │ +
158{
│ │ │ │ +
159 const std::string &m_null;
│ │ │ │ +
160public:
│ │ │ │ +
161 explicit Escaper(const std::string &null) : m_null{null} {}
│ │ │ │ +
162 std::string operator()(IT i) const { return escape_any(*i, m_null); }
│ │ │ │ +
163};
│ │ │ │ +
164}
│ │ │ │ +
165
│ │ │ │ +
166
│ │ │ │ +
167template<typename IT>
│ │ │ │ +
168inline std::string tablewriter::generate(IT Begin, IT End) const
│ │ │ │ +
169{
│ │ │ │ +
170 return separated_list("\t", Begin, End, internal::Escaper<IT>{NullStr()});
│ │ │ │ +
171}
│ │ │ │ +
172template<typename TUPLE>
│ │ │ │ +
173inline std::string tablewriter::generate(const TUPLE &T) const
│ │ │ │ +
174{
│ │ │ │ +
175 return generate(std::begin(T), std::end(T));
│ │ │ │ +
176}
│ │ │ │ +
177
│ │ │ │ +
178template<typename IT> inline void tablewriter::insert(IT Begin, IT End)
│ │ │ │ +
179{
│ │ │ │ +
180 write_raw_line(generate(Begin, End));
│ │ │ │ +
181}
│ │ │ │ +
182
│ │ │ │ +
183template<typename TUPLE> inline void tablewriter::insert(const TUPLE &T)
│ │ │ │ +
184{
│ │ │ │ +
185 insert(std::begin(T), std::end(T));
│ │ │ │ +
186}
│ │ │ │ +
187
│ │ │ │ +
188template<typename IT>
│ │ │ │ +
189inline void tablewriter::push_back(IT Begin, IT End)
│ │ │ │ +
190{
│ │ │ │ +
191 insert(Begin, End);
│ │ │ │ +
192}
│ │ │ │ +
193
│ │ │ │ +
194template<typename TUPLE>
│ │ │ │ +
195inline void tablewriter::push_back(const TUPLE &T)
│ │ │ │ +
196{
│ │ │ │ +
197 insert(std::begin(T), std::end(T));
│ │ │ │ +
198}
│ │ │ │ +
199
│ │ │ │ +
200template<typename TUPLE>
│ │ │ │ + │ │ │ │ +
202{
│ │ │ │ +
203 insert(T);
│ │ │ │ +
204 return *this;
│ │ │ │ +
205}
│ │ │ │ +
206
│ │ │ │ +
207} // namespace pqxx
│ │ │ │ +
208#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
209#endif
│ │ │ │ +
STL namespace.
│ │ │ │ +
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ +
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
│ │ │ │ +
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
│ │ │ │ +
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
│ │ │ │ +
std::string escape(const std::string &s, const std::string &null)
Definition: tablewriter.cxx:131
│ │ │ │ +
std::string escape_any(const std::string &s, const std::string &null)
Definition: tablewriter.hxx:141
│ │ │ │ +
Definition: tablereader.hxx:30
│ │ │ │ +
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
│ │ │ │ +
const std::string & NullStr() const
Definition: tablestream.hxx:36
│ │ │ │ +
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
│ │ │ │ +
Definition: tablewriter.hxx:32
│ │ │ │ +
tablewriter(transaction_base &, const std::string &WName, const std::string &Null=std::string{})
Definition: tablewriter.cxx:22
│ │ │ │ +
void reserve(SIZE)
Definition: tablewriter.hxx:56
│ │ │ │ +
void insert(IT Begin, IT End)
Definition: tablewriter.hxx:178
│ │ │ │ +
std::string generate(IT Begin, IT End) const
Definition: tablewriter.hxx:168
│ │ │ │ +
void push_back(IT Begin, IT End)
Definition: tablewriter.hxx:189
│ │ │ │ +
tablewriter & operator<<(const TUPLE &)
Definition: tablewriter.hxx:201
│ │ │ │ +
void write_raw_line(const std::string &)
Definition: tablewriter.cxx:65
│ │ │ │ +
back_insert_iterator & operator*()
Definition: tablewriter.hxx:100
│ │ │ │ +
back_insert_iterator(pqxx::tablewriter &W) noexcept
Definition: tablewriter.hxx:81
│ │ │ │ +
back_insert_iterator & operator=(const back_insert_iterator &rhs) noexcept
Definition: tablewriter.hxx:85
│ │ │ │ +
back_insert_iterator & operator=(const TUPLE &T)
Definition: tablewriter.hxx:92
│ │ │ │ +
back_insert_iterator & operator++()
Definition: tablewriter.hxx:98
│ │ │ │ +
back_insert_iterator & operator++(int)
Definition: tablewriter.hxx:99
│ │ │ │ +
output_iterator_tag iterator_category
Definition: tablewriter.hxx:79
│ │ │ │ +
Definition: tablewriter.hxx:158
│ │ │ │ +
std::string operator()(IT i) const
Definition: tablewriter.hxx:162
│ │ │ │ +
Escaper(const std::string &null)
Definition: tablewriter.hxx:161
│ │ │ │ +
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,23 +1,298 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -compiler-internal-post.hxx │ │ │ │ │ +tablewriter.hxx │ │ │ │ │ 1 │ │ │ │ │ - 12// NO GUARDS HERE! This code should be executed every time! │ │ │ │ │ - 13 │ │ │ │ │ - 14#ifdef _WIN32 │ │ │ │ │ + 13#ifndef PQXX_H_TABLEWRITER │ │ │ │ │ + 14#define PQXX_H_TABLEWRITER │ │ │ │ │ 15 │ │ │ │ │ - 16#ifdef _MSC_VER │ │ │ │ │ - 17#pragma warning (pop) // Restore client program's warning state │ │ │ │ │ - 18#endif │ │ │ │ │ - 19 │ │ │ │ │ - 20#endif │ │ │ │ │ - 21 │ │ │ │ │ + 16#include │ │ │ │ │ + 17 │ │ │ │ │ + 18#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 19#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 20 │ │ │ │ │ + 21#include "pqxx/tablestream.hxx" │ │ │ │ │ + 22 │ │ │ │ │ + 23 │ │ │ │ │ + 24namespace pqxx │ │ │ │ │ + 25{ │ │ │ │ │ + 27 │ │ │ │ │ +31class PQXX_LIBEXPORT tablewriter : public tablestream │ │ │ │ │ + 32{ │ │ │ │ │ + 33public: │ │ │ │ │ + 34 PQXX_DEPRECATED tablewriter( │ │ │ │ │ + 35 transaction_base &, │ │ │ │ │ + 36 const std::string &WName, │ │ │ │ │ + 37 const std::string &Null=std::string{}); │ │ │ │ │ + 38 template │ │ │ │ │ + 39 PQXX_DEPRECATED tablewriter( │ │ │ │ │ + 40 transaction_base &, │ │ │ │ │ + 41 const std::string &WName, │ │ │ │ │ + 42 ITER begincolumns, │ │ │ │ │ + 43 ITER endcolumns); │ │ │ │ │ + 44 template │ │ │ │ │ + 45 PQXX_DEPRECATED tablewriter( │ │ │ │ │ + 46 transaction_base &T, │ │ │ │ │ + 47 const std::string &WName, │ │ │ │ │ + 48 ITER begincolumns, │ │ │ │ │ + 49 ITER endcolumns, │ │ │ │ │ + 50 const std::string &Null); │ │ │ │ │ + 51 ~tablewriter() noexcept; │ │ │ │ │ + 52 template void insert(IT Begin, IT End); │ │ │ │ │ + 53 template void insert(const TUPLE &); │ │ │ │ │ + 54 template void push_back(IT Begin, IT End); │ │ │ │ │ + 55 template void push_back(const TUPLE &); │ │ │ │ │ +56 template void reserve(SIZE) {} │ │ │ │ │ + 57 template tablewriter &operator<<(const TUPLE &); │ │ │ │ │ + 58 tablewriter &operator<<(tablereader &); │ │ │ │ │ + 59 template std::string generate(IT Begin, IT End) const; │ │ │ │ │ + 60 template std::string generate(const TUPLE &) const; │ │ │ │ │ + 61 virtual void complete() override; │ │ │ │ │ + 62 void write_raw_line(const std::string &); │ │ │ │ │ + 63private: │ │ │ │ │ + 64 void set_up( │ │ │ │ │ + 65 transaction_base &, │ │ │ │ │ + 66 const std::string &WName, │ │ │ │ │ + 67 const std::string &Columns = std::string{}); │ │ │ │ │ + 68 PQXX_PRIVATE void writer_close(); │ │ │ │ │ + 69}; │ │ │ │ │ + 70} // namespace pqxx │ │ │ │ │ + 71 │ │ │ │ │ + 72 │ │ │ │ │ + 73namespace std │ │ │ │ │ + 74{ │ │ │ │ │ + 75template<> │ │ │ │ │ +76 class back_insert_iterator │ │ │ │ │ + 77{ │ │ │ │ │ + 78public: │ │ │ │ │ +79 using iterator_category = output_iterator_tag; │ │ │ │ │ + 80 │ │ │ │ │ +81 explicit back_insert_iterator(pqxx::tablewriter &W) noexcept : │ │ │ │ │ + 82 m_writer{&W} {} │ │ │ │ │ + 83 │ │ │ │ │ + 84 back_insert_iterator & │ │ │ │ │ +85 operator=(const back_insert_iterator &rhs) noexcept │ │ │ │ │ + 86 { │ │ │ │ │ + 87 m_writer = rhs.m_writer; │ │ │ │ │ + 88 return *this; │ │ │ │ │ + 89 } │ │ │ │ │ + 90 │ │ │ │ │ + 91 template │ │ │ │ │ +92 back_insert_iterator &operator=(const TUPLE &T) │ │ │ │ │ + 93 { │ │ │ │ │ + 94 m_writer->insert(T); │ │ │ │ │ + 95 return *this; │ │ │ │ │ + 96 } │ │ │ │ │ + 97 │ │ │ │ │ +98 back_insert_iterator &operator++() { return *this; } │ │ │ │ │ +99 back_insert_iterator &operator++(int) { return *this; } │ │ │ │ │ +100 back_insert_iterator &operator*() { return *this; } │ │ │ │ │ + 101 │ │ │ │ │ + 102private: │ │ │ │ │ + 103 pqxx::tablewriter *m_writer; │ │ │ │ │ + 104}; │ │ │ │ │ + 105} // namespace std │ │ │ │ │ + 106 │ │ │ │ │ + 107 │ │ │ │ │ + 108namespace pqxx │ │ │ │ │ + 109{ │ │ │ │ │ +110template inline tablewriter::tablewriter( │ │ │ │ │ + 111 transaction_base &T, │ │ │ │ │ + 112 const std::string &WName, │ │ │ │ │ + 113 ITER begincolumns, │ │ │ │ │ + 114 ITER endcolumns) : │ │ │ │ │ + 115 namedclass{"tablewriter", WName}, │ │ │ │ │ + 116 tablestream{T, std::string{}} │ │ │ │ │ + 117{ │ │ │ │ │ + 118 set_up(T, WName, columnlist(begincolumns, endcolumns)); │ │ │ │ │ + 119} │ │ │ │ │ + 120 │ │ │ │ │ + 121 │ │ │ │ │ +122template inline tablewriter::tablewriter( │ │ │ │ │ + 123 transaction_base &T, │ │ │ │ │ + 124 const std::string &WName, │ │ │ │ │ + 125 ITER begincolumns, │ │ │ │ │ + 126 ITER endcolumns, │ │ │ │ │ + 127 const std::string &Null) : │ │ │ │ │ + 128 namedclass{"tablewriter", WName}, │ │ │ │ │ + 129 tablestream{T, Null} │ │ │ │ │ + 130{ │ │ │ │ │ + 131 set_up(T, WName, columnlist(begincolumns, endcolumns)); │ │ │ │ │ + 132} │ │ │ │ │ + 133 │ │ │ │ │ + 134 │ │ │ │ │ + 135namespace internal │ │ │ │ │ + 136{ │ │ │ │ │ + 137PQXX_LIBEXPORT std::string escape( │ │ │ │ │ + 138 const std::string &s, │ │ │ │ │ + 139 const std::string &null); │ │ │ │ │ + 140 │ │ │ │ │ +141inline std::string escape_any( │ │ │ │ │ + 142 const std::string &s, │ │ │ │ │ + 143 const std::string &null) │ │ │ │ │ + 144{ return escape(s, null); } │ │ │ │ │ + 145 │ │ │ │ │ +146inline std::string escape_any( │ │ │ │ │ + 147 const char s[], │ │ │ │ │ + 148 const std::string &null) │ │ │ │ │ + 149{ return s ? escape(std::string{s}, null) : "\\N"; } │ │ │ │ │ + 150 │ │ │ │ │ +151template inline std::string escape_any( │ │ │ │ │ + 152 const T &t, │ │ │ │ │ + 153 const std::string &null) │ │ │ │ │ + 154{ return escape(to_string(t), null); } │ │ │ │ │ + 155 │ │ │ │ │ + 156 │ │ │ │ │ +157template class Escaper │ │ │ │ │ + 158{ │ │ │ │ │ + 159 const std::string &m_null; │ │ │ │ │ + 160public: │ │ │ │ │ +161 explicit Escaper(const std::string &null) : m_null{null} {} │ │ │ │ │ +162 std::string operator()(IT i) const { return escape_any(*i, m_null); } │ │ │ │ │ + 163}; │ │ │ │ │ + 164} │ │ │ │ │ + 165 │ │ │ │ │ + 166 │ │ │ │ │ + 167template │ │ │ │ │ +168inline std::string tablewriter::generate(IT Begin, IT End) const │ │ │ │ │ + 169{ │ │ │ │ │ + 170 return separated_list("\t", Begin, End, internal::Escaper{NullStr()}); │ │ │ │ │ + 171} │ │ │ │ │ + 172template │ │ │ │ │ +173inline std::string tablewriter::generate(const TUPLE &T) const │ │ │ │ │ + 174{ │ │ │ │ │ + 175 return generate(std::begin(T), std::end(T)); │ │ │ │ │ + 176} │ │ │ │ │ + 177 │ │ │ │ │ +178template inline void tablewriter::insert(IT Begin, IT End) │ │ │ │ │ + 179{ │ │ │ │ │ + 180 write_raw_line(generate(Begin, End)); │ │ │ │ │ + 181} │ │ │ │ │ + 182 │ │ │ │ │ +183template inline void tablewriter::insert(const TUPLE &T) │ │ │ │ │ + 184{ │ │ │ │ │ + 185 insert(std::begin(T), std::end(T)); │ │ │ │ │ + 186} │ │ │ │ │ + 187 │ │ │ │ │ + 188template │ │ │ │ │ +189inline void tablewriter::push_back(IT Begin, IT End) │ │ │ │ │ + 190{ │ │ │ │ │ + 191 insert(Begin, End); │ │ │ │ │ + 192} │ │ │ │ │ + 193 │ │ │ │ │ + 194template │ │ │ │ │ +195inline void tablewriter::push_back(const TUPLE &T) │ │ │ │ │ + 196{ │ │ │ │ │ + 197 insert(std::begin(T), std::end(T)); │ │ │ │ │ + 198} │ │ │ │ │ + 199 │ │ │ │ │ + 200template │ │ │ │ │ +201inline tablewriter &tablewriter::operator<<(const TUPLE &T) │ │ │ │ │ + 202{ │ │ │ │ │ + 203 insert(T); │ │ │ │ │ + 204 return *this; │ │ │ │ │ + 205} │ │ │ │ │ + 206 │ │ │ │ │ + 207} // namespace pqxx │ │ │ │ │ + 208#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 209#endif │ │ │ │ │ +std │ │ │ │ │ +STL namespace. │ │ │ │ │ +pqxx │ │ │ │ │ +The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ +Definition: array.hxx:26 │ │ │ │ │ +pqxx::operator<< │ │ │ │ │ +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 │ │ │ │ │ +pqxx::to_string │ │ │ │ │ +std::string to_string(const field &Obj) │ │ │ │ │ +Convert a field to a string. │ │ │ │ │ +Definition: result.cxx:451 │ │ │ │ │ +pqxx::separated_list │ │ │ │ │ +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 │ │ │ │ │ +pqxx::internal::escape │ │ │ │ │ +std::string escape(const std::string &s, const std::string &null) │ │ │ │ │ +Definition: tablewriter.cxx:131 │ │ │ │ │ +pqxx::internal::escape_any │ │ │ │ │ +std::string escape_any(const std::string &s, const std::string &null) │ │ │ │ │ +Definition: tablewriter.hxx:141 │ │ │ │ │ +pqxx::tablereader │ │ │ │ │ +Definition: tablereader.hxx:30 │ │ │ │ │ +pqxx::tablestream │ │ │ │ │ +Base class for obsolete tablereader/tablewriter classes. │ │ │ │ │ +Definition: tablestream.hxx:28 │ │ │ │ │ +pqxx::tablestream::NullStr │ │ │ │ │ +const std::string & NullStr() const │ │ │ │ │ +Definition: tablestream.hxx:36 │ │ │ │ │ +pqxx::tablestream::columnlist │ │ │ │ │ +static std::string columnlist(ITER colbegin, ITER colend) │ │ │ │ │ +Definition: tablestream.hxx:52 │ │ │ │ │ +pqxx::tablewriter │ │ │ │ │ +Definition: tablewriter.hxx:32 │ │ │ │ │ +pqxx::tablewriter::tablewriter │ │ │ │ │ +tablewriter(transaction_base &, const std::string &WName, const std::string │ │ │ │ │ +&Null=std::string{}) │ │ │ │ │ +Definition: tablewriter.cxx:22 │ │ │ │ │ +pqxx::tablewriter::reserve │ │ │ │ │ +void reserve(SIZE) │ │ │ │ │ +Definition: tablewriter.hxx:56 │ │ │ │ │ +pqxx::tablewriter::insert │ │ │ │ │ +void insert(IT Begin, IT End) │ │ │ │ │ +Definition: tablewriter.hxx:178 │ │ │ │ │ +pqxx::tablewriter::generate │ │ │ │ │ +std::string generate(IT Begin, IT End) const │ │ │ │ │ +Definition: tablewriter.hxx:168 │ │ │ │ │ +pqxx::tablewriter::push_back │ │ │ │ │ +void push_back(IT Begin, IT End) │ │ │ │ │ +Definition: tablewriter.hxx:189 │ │ │ │ │ +pqxx::tablewriter::operator<< │ │ │ │ │ +tablewriter & operator<<(const TUPLE &) │ │ │ │ │ +Definition: tablewriter.hxx:201 │ │ │ │ │ +pqxx::tablewriter::write_raw_line │ │ │ │ │ +void write_raw_line(const std::string &) │ │ │ │ │ +Definition: tablewriter.cxx:65 │ │ │ │ │ +std::back_insert_iterator<_pqxx::tablewriter_>::operator* │ │ │ │ │ +back_insert_iterator & operator*() │ │ │ │ │ +Definition: tablewriter.hxx:100 │ │ │ │ │ +std::back_insert_iterator<_pqxx::tablewriter_>::back_insert_iterator │ │ │ │ │ +back_insert_iterator(pqxx::tablewriter &W) noexcept │ │ │ │ │ +Definition: tablewriter.hxx:81 │ │ │ │ │ +std::back_insert_iterator<_pqxx::tablewriter_>::operator= │ │ │ │ │ +back_insert_iterator & operator=(const back_insert_iterator &rhs) noexcept │ │ │ │ │ +Definition: tablewriter.hxx:85 │ │ │ │ │ +std::back_insert_iterator<_pqxx::tablewriter_>::operator= │ │ │ │ │ +back_insert_iterator & operator=(const TUPLE &T) │ │ │ │ │ +Definition: tablewriter.hxx:92 │ │ │ │ │ +std::back_insert_iterator<_pqxx::tablewriter_>::operator++ │ │ │ │ │ +back_insert_iterator & operator++() │ │ │ │ │ +Definition: tablewriter.hxx:98 │ │ │ │ │ +std::back_insert_iterator<_pqxx::tablewriter_>::operator++ │ │ │ │ │ +back_insert_iterator & operator++(int) │ │ │ │ │ +Definition: tablewriter.hxx:99 │ │ │ │ │ +std::back_insert_iterator<_pqxx::tablewriter_>::iterator_category │ │ │ │ │ +output_iterator_tag iterator_category │ │ │ │ │ +Definition: tablewriter.hxx:79 │ │ │ │ │ +pqxx::internal::Escaper │ │ │ │ │ +Definition: tablewriter.hxx:158 │ │ │ │ │ +pqxx::internal::Escaper::operator() │ │ │ │ │ +std::string operator()(IT i) const │ │ │ │ │ +Definition: tablewriter.hxx:162 │ │ │ │ │ +pqxx::internal::Escaper::Escaper │ │ │ │ │ +Escaper(const std::string &null) │ │ │ │ │ +Definition: tablewriter.hxx:161 │ │ │ │ │ +pqxx::transaction_base │ │ │ │ │ +Interface definition (and common code) for "transaction" classes. │ │ │ │ │ +Definition: transaction_base.hxx:138 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * compiler-internal-post.hxx │ │ │ │ │ + * tablewriter.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00041_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: result_iterator.hxx Source File │ │ │ │ +libpqxx: transactor.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,249 +55,190 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
result_iterator.hxx
│ │ │ │ +
transactor.hxx
│ │ │ │
│ │ │ │
│ │ │ │ -
1
│ │ │ │ -
13#ifndef PQXX_H_RESULT_ITERATOR
│ │ │ │ -
14#define PQXX_H_RESULT_ITERATOR
│ │ │ │ -
15
│ │ │ │ -
16#include "pqxx/compiler-public.hxx"
│ │ │ │ -
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include "pqxx/row.hxx"
│ │ │ │ +
1/* Transactor framework, a wrapper for safely retryable transactions.
│ │ │ │ +
2 *
│ │ │ │ +
3 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transactor instead.
│ │ │ │ +
4 *
│ │ │ │ +
5 * Copyright (c) 2000-2019, Jeroen T. Vermeulen.
│ │ │ │ +
6 *
│ │ │ │ +
7 * See COPYING for copyright license. If you did not receive a file called
│ │ │ │ +
8 * COPYING with this source code, please notify the distributor of this mistake,
│ │ │ │ +
9 * or contact the author.
│ │ │ │ +
10 */
│ │ │ │ +
11#ifndef PQXX_H_TRANSACTOR
│ │ │ │ +
12#define PQXX_H_TRANSACTOR
│ │ │ │ +
13
│ │ │ │ +
14#include "pqxx/compiler-public.hxx"
│ │ │ │ +
15#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
16
│ │ │ │ +
17#include "pqxx/connection_base.hxx"
│ │ │ │ +
18#include "pqxx/transaction.hxx"
│ │ │ │ +
19
│ │ │ │
20
│ │ │ │ -
21
│ │ │ │ -
22/* Result iterator.
│ │ │ │ -
23 *
│ │ │ │ -
24 * Don't include this header from your own application; it is included for you
│ │ │ │ -
25 * by other libpqxx headers.
│ │ │ │ -
26 */
│ │ │ │ -
27
│ │ │ │ -
28namespace pqxx
│ │ │ │ -
29{
│ │ │ │ -
31
│ │ │ │ -
35class PQXX_LIBEXPORT const_result_iterator : public row
│ │ │ │ -
36{
│ │ │ │ -
37public:
│ │ │ │ -
38 using iterator_category = std::random_access_iterator_tag;
│ │ │ │ -
39 using value_type = const row;
│ │ │ │ -
40 using pointer = const row *;
│ │ │ │ -
41 using reference = row;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
44
│ │ │ │ -
45 const_result_iterator() noexcept : row{result(), 0} {}
│ │ │ │ -
46 const_result_iterator(const row &t) noexcept : row{t} {}
│ │ │ │ -
47
│ │ │ │ -
63 pointer operator->() const { return this; } //[t12]
│ │ │ │ -
64 reference operator*() const { return row{*this}; } //[t12]
│ │ │ │ -
66
│ │ │ │ -
71 const_result_iterator operator++(int); //[t12]
│ │ │ │ -
72 const_result_iterator &operator++() { ++m_index; return *this; } //[t01]
│ │ │ │ -
73 const_result_iterator operator--(int); //[t12]
│ │ │ │ -
74 const_result_iterator &operator--() { --m_index; return *this; } //[t12]
│ │ │ │ -
75
│ │ │ │ - │ │ │ │ -
77 { m_index += i; return *this; }
│ │ │ │ - │ │ │ │ -
79 { m_index -= i; return *this; }
│ │ │ │ -
81
│ │ │ │ -
86 bool operator==(const const_result_iterator &i) const //[t12]
│ │ │ │ -
87 {return m_index==i.m_index;}
│ │ │ │ -
88 bool operator!=(const const_result_iterator &i) const //[t12]
│ │ │ │ -
89 {return m_index!=i.m_index;}
│ │ │ │ -
90 bool operator<(const const_result_iterator &i) const //[t12]
│ │ │ │ -
91 {return m_index<i.m_index;}
│ │ │ │ -
92 bool operator<=(const const_result_iterator &i) const //[t12]
│ │ │ │ -
93 {return m_index<=i.m_index;}
│ │ │ │ -
94 bool operator>(const const_result_iterator &i) const //[t12]
│ │ │ │ -
95 {return m_index>i.m_index;}
│ │ │ │ -
96 bool operator>=(const const_result_iterator &i) const //[t12]
│ │ │ │ -
97 {return m_index>=i.m_index;}
│ │ │ │ -
99
│ │ │ │ -
104 inline const_result_iterator operator+(difference_type) const; //[t12]
│ │ │ │ -
105 friend const_result_iterator operator+( //[t12]
│ │ │ │ -
106 difference_type,
│ │ │ │ - │ │ │ │ -
108 inline const_result_iterator operator-(difference_type) const; //[t12]
│ │ │ │ -
109 inline difference_type operator-(const_result_iterator) const; //[t12]
│ │ │ │ -
111
│ │ │ │ -
112private:
│ │ │ │ -
113 friend class pqxx::result;
│ │ │ │ - │ │ │ │ -
115 row{*r, i} {}
│ │ │ │ -
116};
│ │ │ │ -
117
│ │ │ │ -
118
│ │ │ │ -
120class PQXX_LIBEXPORT const_reverse_result_iterator :
│ │ │ │ - │ │ │ │ -
122{
│ │ │ │ -
123public:
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
131
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
136 const const_result_iterator &rhs) :
│ │ │ │ -
137 const_result_iterator{rhs} { super::operator--(); }
│ │ │ │ -
138
│ │ │ │ -
139 PQXX_PURE const_result_iterator base() const noexcept; //[t75]
│ │ │ │ +
21// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ +
22
│ │ │ │ +
23namespace pqxx
│ │ │ │ +
24{
│ │ │ │ +
67
│ │ │ │ +
69
│ │ │ │ +
98template<typename TRANSACTION_CALLBACK>
│ │ │ │ +
99inline auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3)
│ │ │ │ +
100 -> decltype(callback())
│ │ │ │ +
101{
│ │ │ │ +
102 if (attempts <= 0)
│ │ │ │ +
103 throw std::invalid_argument{
│ │ │ │ +
104 "Zero or negative number of attempts passed to pqxx::perform()."};
│ │ │ │ +
105
│ │ │ │ +
106 for (; attempts > 0; --attempts)
│ │ │ │ +
107 {
│ │ │ │ +
108 try
│ │ │ │ +
109 {
│ │ │ │ +
110 return callback();
│ │ │ │ +
111 }
│ │ │ │ +
112 catch (const in_doubt_error &)
│ │ │ │ +
113 {
│ │ │ │ +
114 // Not sure whether transaction went through or not. The last thing in
│ │ │ │ +
115 // the world that we should do now is try again!
│ │ │ │ +
116 throw;
│ │ │ │ +
117 }
│ │ │ │ +
118 catch (const statement_completion_unknown &)
│ │ │ │ +
119 {
│ │ │ │ +
120 // Not sure whether our last statement succeeded. Don't risk running it
│ │ │ │ +
121 // again.
│ │ │ │ +
122 throw;
│ │ │ │ +
123 }
│ │ │ │ +
124 catch (const broken_connection &)
│ │ │ │ +
125 {
│ │ │ │ +
126 // Connection failed. Definitely worth retrying.
│ │ │ │ +
127 if (attempts <= 1) throw;
│ │ │ │ +
128 continue;
│ │ │ │ +
129 }
│ │ │ │ +
130 catch (const transaction_rollback &)
│ │ │ │ +
131 {
│ │ │ │ +
132 // Some error that may well be transient, such as serialization failure
│ │ │ │ +
133 // or deadlock. Worth retrying.
│ │ │ │ +
134 if (attempts <= 1) throw;
│ │ │ │ +
135 continue;
│ │ │ │ +
136 }
│ │ │ │ +
137 }
│ │ │ │ +
138 throw pqxx::internal_error{"No outcome reached on perform()."};
│ │ │ │ +
139}
│ │ │ │
140
│ │ │ │ -
145 using const_result_iterator::operator->; //[t75]
│ │ │ │ -
146 using const_result_iterator::operator*; //[t75]
│ │ │ │ -
148
│ │ │ │ - │ │ │ │ - │ │ │ │ -
155 { iterator_type::operator=(r); return *this; }
│ │ │ │ - │ │ │ │ -
157 { iterator_type::operator--(); return *this; }
│ │ │ │ -
158 const_reverse_result_iterator operator++(int); //[t75]
│ │ │ │ - │ │ │ │ -
160 { iterator_type::operator++(); return *this; }
│ │ │ │ -
161 const_reverse_result_iterator operator--(int); //[t75]
│ │ │ │ - │ │ │ │ -
163 { iterator_type::operator-=(i); return *this; }
│ │ │ │ - │ │ │ │ -
165 { iterator_type::operator+=(i); return *this; }
│ │ │ │ -
167
│ │ │ │ - │ │ │ │ -
173 { return const_reverse_result_iterator(base() - i); }
│ │ │ │ - │ │ │ │ -
175 { return const_reverse_result_iterator(base() + i); }
│ │ │ │ - │ │ │ │ -
177 const const_reverse_result_iterator &rhs) const
│ │ │ │ -
178 { return rhs.const_result_iterator::operator-(*this); }
│ │ │ │ -
180
│ │ │ │ -
185 bool operator==( //[t75]
│ │ │ │ -
186 const const_reverse_result_iterator &rhs) const noexcept
│ │ │ │ -
187 { return iterator_type::operator==(rhs); }
│ │ │ │ -
188 bool operator!=( //[t75]
│ │ │ │ -
189 const const_reverse_result_iterator &rhs) const noexcept
│ │ │ │ -
190 { return not operator==(rhs); }
│ │ │ │ -
191
│ │ │ │ -
192 bool operator<(const const_reverse_result_iterator &rhs) const //[t75]
│ │ │ │ -
193 { return iterator_type::operator>(rhs); }
│ │ │ │ -
194 bool operator<=(const const_reverse_result_iterator &rhs) const //[t75]
│ │ │ │ -
195 { return iterator_type::operator>=(rhs); }
│ │ │ │ -
196 bool operator>(const const_reverse_result_iterator &rhs) const //[t75]
│ │ │ │ -
197 { return iterator_type::operator<(rhs); }
│ │ │ │ -
198 bool operator>=(const const_reverse_result_iterator &rhs) const //[t75]
│ │ │ │ -
199 { return iterator_type::operator<=(rhs); }
│ │ │ │ -
201};
│ │ │ │ -
202
│ │ │ │ +
142
│ │ │ │ +
156template<typename TRANSACTION=transaction<read_committed>> class transactor
│ │ │ │ +
157{
│ │ │ │ +
158public:
│ │ │ │ +
159 using argument_type = TRANSACTION;
│ │ │ │ +
160 PQXX_DEPRECATED explicit transactor( //[t04]
│ │ │ │ +
161 const std::string &TName="transactor") :
│ │ │ │ +
162 m_name{TName} { }
│ │ │ │ +
163
│ │ │ │ +
165
│ │ │ │ +
176 void operator()(TRANSACTION &T); //[t04]
│ │ │ │ +
177
│ │ │ │ +
178 // Overridable member functions, called by connection_base::perform() if an
│ │ │ │ +
179 // attempt to run transaction fails/succeeds, respectively, or if the
│ │ │ │ +
180 // connection is lost at just the wrong moment, goes into an indeterminate
│ │ │ │ +
181 // state. Use these to patch up runtime state to match events, if needed, or
│ │ │ │ +
182 // to report failure conditions.
│ │ │ │ +
183
│ │ │ │ +
185
│ │ │ │ +
193 void on_abort(const char[]) noexcept {} //[t13]
│ │ │ │ +
194
│ │ │ │ +
196
│ │ │ │ +
200 void on_commit() {} //[t07]
│ │ │ │ +
201
│ │ │ │
203
│ │ │ │ -
204inline const_result_iterator
│ │ │ │ - │ │ │ │ -
206{
│ │ │ │ - │ │ │ │ - │ │ │ │ -
209}
│ │ │ │ -
210
│ │ │ │ - │ │ │ │ - │ │ │ │ -
213 { return i + o; }
│ │ │ │ -
214
│ │ │ │ - │ │ │ │ - │ │ │ │ -
217{
│ │ │ │ - │ │ │ │ -
219 &m_result,
│ │ │ │ - │ │ │ │ -
221}
│ │ │ │ +
214 void on_doubt() noexcept {} //[t13]
│ │ │ │ +
215
│ │ │ │ +
217 std::string name() const { return m_name; } //[t13]
│ │ │ │ +
218
│ │ │ │ +
219private:
│ │ │ │ +
220 std::string m_name;
│ │ │ │ +
221};
│ │ │ │
222
│ │ │ │ - │ │ │ │ - │ │ │ │ -
225 { return result::difference_type(num() - i.num()); }
│ │ │ │ -
226
│ │ │ │ -
227inline const_result_iterator result::end() const noexcept
│ │ │ │ -
228 { return const_result_iterator{this, size()}; }
│ │ │ │ -
229
│ │ │ │ +
223
│ │ │ │ +
224template<typename TRANSACTOR>
│ │ │ │ + │ │ │ │ +
226 const TRANSACTOR &T,
│ │ │ │ +
227 int Attempts)
│ │ │ │ +
228{
│ │ │ │ +
229 if (Attempts <= 0) return;
│ │ │ │
230
│ │ │ │ -
231inline const_result_iterator result::cend() const noexcept
│ │ │ │ -
232 { return end(); }
│ │ │ │ -
233
│ │ │ │ -
234
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
239 { return const_reverse_result_iterator{i.base() - n}; }
│ │ │ │ -
240
│ │ │ │ -
241} // namespace pqxx
│ │ │ │ -
242
│ │ │ │ -
243#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
244
│ │ │ │ -
245#endif
│ │ │ │ +
231 bool Done = false;
│ │ │ │ +
232
│ │ │ │ +
233 // Make attempts to perform T
│ │ │ │ +
234 do
│ │ │ │ +
235 {
│ │ │ │ +
236 --Attempts;
│ │ │ │ +
237
│ │ │ │ +
238 // Work on a copy of T2 so we can restore the starting situation if need be
│ │ │ │ +
239 TRANSACTOR T2{T};
│ │ │ │ +
240 try
│ │ │ │ +
241 {
│ │ │ │ +
242 typename TRANSACTOR::argument_type X{*this, T2.name()};
│ │ │ │ +
243 T2(X);
│ │ │ │ +
244 X.commit();
│ │ │ │ +
245 Done = true;
│ │ │ │ +
246 }
│ │ │ │ +
247 catch (const in_doubt_error &)
│ │ │ │ +
248 {
│ │ │ │ +
249 // Not sure whether transaction went through or not. The last thing in
│ │ │ │ +
250 // the world that we should do now is retry.
│ │ │ │ +
251 T2.on_doubt();
│ │ │ │ +
252 throw;
│ │ │ │ +
253 }
│ │ │ │ +
254 catch (const std::exception &e)
│ │ │ │ +
255 {
│ │ │ │ +
256 // Could be any kind of error.
│ │ │ │ +
257 T2.on_abort(e.what());
│ │ │ │ +
258 if (Attempts <= 0) throw;
│ │ │ │ +
259 continue;
│ │ │ │ +
260 }
│ │ │ │ +
261 catch (...)
│ │ │ │ +
262 {
│ │ │ │ +
263 // Don't try to forge ahead if we don't even know what happened
│ │ │ │ +
264 T2.on_abort("Unknown exception");
│ │ │ │ +
265 throw;
│ │ │ │ +
266 }
│ │ │ │ +
267
│ │ │ │ +
268 T2.on_commit();
│ │ │ │ +
269 } while (not Done);
│ │ │ │ +
270}
│ │ │ │ +
271} // namespace pqxx
│ │ │ │ +
273#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
274#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
const_result_iterator operator+(result::difference_type o, const_result_iterator i)
Definition: result_iterator.hxx:212
│ │ │ │ -
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
│ │ │ │ -
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
│ │ │ │ -
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ -
const_iterator end() const noexcept
Definition: result_iterator.hxx:227
│ │ │ │ -
result_difference_type difference_type
Definition: result.hxx:73
│ │ │ │ -
PQXX_PURE size_type size() const noexcept
Definition: result.cxx:94
│ │ │ │ -
const_iterator cend() const noexcept
Definition: result_iterator.hxx:231
│ │ │ │ -
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
│ │ │ │ -
bool operator!=(const const_result_iterator &i) const
Definition: result_iterator.hxx:88
│ │ │ │ -
const_result_iterator & operator-=(difference_type i)
Definition: result_iterator.hxx:78
│ │ │ │ -
const_result_iterator & operator++()
Definition: result_iterator.hxx:72
│ │ │ │ -
const_result_iterator(const row &t) noexcept
Definition: result_iterator.hxx:46
│ │ │ │ -
const_result_iterator operator+(difference_type) const
Definition: result_iterator.hxx:205
│ │ │ │ -
std::random_access_iterator_tag iterator_category
Definition: result_iterator.hxx:38
│ │ │ │ -
const_result_iterator operator-(difference_type) const
Definition: result_iterator.hxx:216
│ │ │ │ -
bool operator<(const const_result_iterator &i) const
Definition: result_iterator.hxx:90
│ │ │ │ -
bool operator>(const const_result_iterator &i) const
Definition: result_iterator.hxx:94
│ │ │ │ -
bool operator==(const const_result_iterator &i) const
Definition: result_iterator.hxx:86
│ │ │ │ -
const_result_iterator & operator+=(difference_type i)
Definition: result_iterator.hxx:76
│ │ │ │ -
pointer operator->() const
Definition: result_iterator.hxx:63
│ │ │ │ -
bool operator<=(const const_result_iterator &i) const
Definition: result_iterator.hxx:92
│ │ │ │ -
result_difference_type difference_type
Definition: result_iterator.hxx:43
│ │ │ │ -
result_size_type size_type
Definition: result_iterator.hxx:42
│ │ │ │ -
bool operator>=(const const_result_iterator &i) const
Definition: result_iterator.hxx:96
│ │ │ │ -
reference operator*() const
Definition: result_iterator.hxx:64
│ │ │ │ -
const_result_iterator & operator--()
Definition: result_iterator.hxx:74
│ │ │ │ -
const_result_iterator() noexcept
Definition: result_iterator.hxx:45
│ │ │ │ -
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:122
│ │ │ │ -
PQXX_PURE const_result_iterator base() const noexcept
Definition: result.cxx:425
│ │ │ │ -
bool operator>=(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:198
│ │ │ │ -
const_reverse_result_iterator operator+(difference_type i) const
Definition: result_iterator.hxx:172
│ │ │ │ -
bool operator!=(const const_reverse_result_iterator &rhs) const noexcept
Definition: result_iterator.hxx:188
│ │ │ │ -
const_reverse_result_iterator & operator-=(difference_type i)
Definition: result_iterator.hxx:164
│ │ │ │ -
const_reverse_result_iterator & operator+=(difference_type i)
Definition: result_iterator.hxx:162
│ │ │ │ -
bool operator==(const const_reverse_result_iterator &rhs) const noexcept
Definition: result_iterator.hxx:185
│ │ │ │ -
bool operator<(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:192
│ │ │ │ -
const_reverse_result_iterator(const const_reverse_result_iterator &rhs)
Definition: result_iterator.hxx:132
│ │ │ │ -
const_reverse_result_iterator operator-(difference_type i)
Definition: result_iterator.hxx:174
│ │ │ │ -
const_reverse_result_iterator(const const_result_iterator &rhs)
Definition: result_iterator.hxx:135
│ │ │ │ -
bool operator>(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:196
│ │ │ │ -
difference_type operator-(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:176
│ │ │ │ -
bool operator<=(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:194
│ │ │ │ -
const_reverse_result_iterator & operator--()
Definition: result_iterator.hxx:159
│ │ │ │ -
const_reverse_result_iterator & operator++()
Definition: result_iterator.hxx:156
│ │ │ │ -
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │ -
size_t num() const
Definition: row.hxx:170
│ │ │ │ -
result m_result
Result set of which this is one row.
Definition: row.hxx:192
│ │ │ │ -
long m_index
Row number.
Definition: row.hxx:198
│ │ │ │ +
auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype(callback())
Simple way to execute a transaction with automatic retry.
Definition: transactor.hxx:99
│ │ │ │ +
void perform(const TRANSACTOR &T, int Attempts)
Definition: transactor.hxx:225
│ │ │ │ +
Exception class for lost or failed backend connection.
Definition: except.hxx:119
│ │ │ │ +
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:160
│ │ │ │ +
The backend saw itself forced to roll back the ongoing transaction.
Definition: except.hxx:168
│ │ │ │ +
We can't tell whether our last statement succeeded.
Definition: except.hxx:192
│ │ │ │ +
Internal error in libpqxx library.
Definition: except.hxx:209
│ │ │ │ +
Definition: transactor.hxx:157
│ │ │ │ +
void on_doubt() noexcept
Overridable function to be called when "in doubt" about outcome.
Definition: transactor.hxx:214
│ │ │ │ +
transactor(const std::string &TName="transactor")
Definition: transactor.hxx:160
│ │ │ │ +
void on_commit()
Optional overridable function to be called after successful commit.
Definition: transactor.hxx:200
│ │ │ │ +
void operator()(TRANSACTION &T)
Overridable transaction definition; insert your database code here.
│ │ │ │ +
void on_abort(const char[]) noexcept
Optional overridable function to be called if transaction is aborted.
Definition: transactor.hxx:193
│ │ │ │ +
TRANSACTION argument_type
Definition: transactor.hxx:159
│ │ │ │ +
std::string name() const
The transactor's name.
Definition: transactor.hxx:217
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,347 +1,222 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -result_iterator.hxx │ │ │ │ │ - 1 │ │ │ │ │ - 13#ifndef PQXX_H_RESULT_ITERATOR │ │ │ │ │ - 14#define PQXX_H_RESULT_ITERATOR │ │ │ │ │ - 15 │ │ │ │ │ - 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include "pqxx/row.hxx" │ │ │ │ │ +transactor.hxx │ │ │ │ │ + 1/* Transactor framework, a wrapper for safely retryable transactions. │ │ │ │ │ + 2 * │ │ │ │ │ + 3 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transactor instead. │ │ │ │ │ + 4 * │ │ │ │ │ + 5 * Copyright (c) 2000-2019, Jeroen T. Vermeulen. │ │ │ │ │ + 6 * │ │ │ │ │ + 7 * See COPYING for copyright license. If you did not receive a file called │ │ │ │ │ + 8 * COPYING with this source code, please notify the distributor of this │ │ │ │ │ +mistake, │ │ │ │ │ + 9 * or contact the author. │ │ │ │ │ + 10 */ │ │ │ │ │ + 11#ifndef PQXX_H_TRANSACTOR │ │ │ │ │ + 12#define PQXX_H_TRANSACTOR │ │ │ │ │ + 13 │ │ │ │ │ + 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 15#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 16 │ │ │ │ │ + 17#include "pqxx/connection_base.hxx" │ │ │ │ │ + 18#include "pqxx/transaction.hxx" │ │ │ │ │ + 19 │ │ │ │ │ 20 │ │ │ │ │ - 21 │ │ │ │ │ - 22/* Result iterator. │ │ │ │ │ - 23 * │ │ │ │ │ - 24 * Don't include this header from your own application; it is included for │ │ │ │ │ -you │ │ │ │ │ - 25 * by other libpqxx headers. │ │ │ │ │ - 26 */ │ │ │ │ │ - 27 │ │ │ │ │ - 28namespace pqxx │ │ │ │ │ - 29{ │ │ │ │ │ - 31 │ │ │ │ │ -35class PQXX_LIBEXPORT const_result_iterator : public row │ │ │ │ │ - 36{ │ │ │ │ │ - 37public: │ │ │ │ │ -38 using iterator_category = std::random_access_iterator_tag; │ │ │ │ │ -39 using value_type = const row; │ │ │ │ │ -40 using pointer = const row *; │ │ │ │ │ -41 using reference = row; │ │ │ │ │ -42 using size_type = result_size_type; │ │ │ │ │ -43 using difference_type = result_difference_type; │ │ │ │ │ - 44 │ │ │ │ │ -45 const_result_iterator() noexcept : row{result(), 0} {} │ │ │ │ │ -46 const_result_iterator(const row &t) noexcept : row{t} {} │ │ │ │ │ - 47 │ │ │ │ │ -63 pointer operator->() const { return this; } //[t12] │ │ │ │ │ -64 reference operator*() const { return row{*this}; } //[t12] │ │ │ │ │ - 66 │ │ │ │ │ - 71 const_result_iterator operator++(int); //[t12] │ │ │ │ │ -72 const_result_iterator &operator++() { ++m_index; return *this; } //[t01] │ │ │ │ │ - 73 const_result_iterator operator--(int); //[t12] │ │ │ │ │ -74 const_result_iterator &operator--() { --m_index; return *this; } //[t12] │ │ │ │ │ - 75 │ │ │ │ │ -76 const_result_iterator &operator+=(difference_type i) //[t12] │ │ │ │ │ - 77 { m_index += i; return *this; } │ │ │ │ │ -78 const_result_iterator &operator-=(difference_type i) //[t12] │ │ │ │ │ - 79 { m_index -= i; return *this; } │ │ │ │ │ - 81 │ │ │ │ │ -86 bool operator==(const const_result_iterator &i) const //[t12] │ │ │ │ │ - 87 {return m_index==i.m_index;} │ │ │ │ │ -88 bool operator!=(const const_result_iterator &i) const //[t12] │ │ │ │ │ - 89 {return m_index!=i.m_index;} │ │ │ │ │ -90 bool operator<(const const_result_iterator &i) const //[t12] │ │ │ │ │ - 91 {return m_index(const const_result_iterator &i) const //[t12] │ │ │ │ │ - 95 {return m_index>i.m_index;} │ │ │ │ │ -96 bool operator>=(const const_result_iterator &i) const //[t12] │ │ │ │ │ - 97 {return m_index>=i.m_index;} │ │ │ │ │ - 99 │ │ │ │ │ - 104 inline const_result_iterator operator+(difference_type) const; //[t12] │ │ │ │ │ - 105 friend const_result_iterator operator+( //[t12] │ │ │ │ │ - 106 difference_type, │ │ │ │ │ - 107 const_result_iterator); │ │ │ │ │ -108 inline const_result_iterator operator-(difference_type) const; //[t12] │ │ │ │ │ -109 inline difference_type operator-(const_result_iterator) const; //[t12] │ │ │ │ │ - 111 │ │ │ │ │ - 112private: │ │ │ │ │ -113 friend class pqxx::result; │ │ │ │ │ - 114 const_result_iterator(const pqxx::result *r, result_size_type i) noexcept │ │ │ │ │ -: │ │ │ │ │ - 115 row{*r, i} {} │ │ │ │ │ - 116}; │ │ │ │ │ - 117 │ │ │ │ │ - 118 │ │ │ │ │ -120class PQXX_LIBEXPORT const_reverse_result_iterator : │ │ │ │ │ - 121 private const_result_iterator │ │ │ │ │ - 122{ │ │ │ │ │ - 123public: │ │ │ │ │ -124 using super = const_result_iterator; │ │ │ │ │ -125 using iterator_type = const_result_iterator; │ │ │ │ │ - 126 using iterator_type::iterator_category; │ │ │ │ │ - 127 using iterator_type::difference_type; │ │ │ │ │ - 128 using iterator_type::pointer; │ │ │ │ │ -129 using value_type = iterator_type::value_type; │ │ │ │ │ -130 using reference = iterator_type::reference; │ │ │ │ │ - 131 │ │ │ │ │ -132 const_reverse_result_iterator( //[t75] │ │ │ │ │ - 133 const const_reverse_result_iterator &rhs) : │ │ │ │ │ - 134 const_result_iterator{rhs} {} │ │ │ │ │ -135 explicit const_reverse_result_iterator( //[t75] │ │ │ │ │ - 136 const const_result_iterator &rhs) : │ │ │ │ │ - 137 const_result_iterator{rhs} { super::operator--(); } │ │ │ │ │ - 138 │ │ │ │ │ - 139 PQXX_PURE const_result_iterator base() const noexcept; //[t75] │ │ │ │ │ + 21// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ + 22 │ │ │ │ │ + 23namespace pqxx │ │ │ │ │ + 24{ │ │ │ │ │ + 67 │ │ │ │ │ + 69 │ │ │ │ │ + 98template │ │ │ │ │ +99inline auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) │ │ │ │ │ + 100 -> decltype(callback()) │ │ │ │ │ + 101{ │ │ │ │ │ + 102 if (attempts <= 0) │ │ │ │ │ + 103 throw std::invalid_argument{ │ │ │ │ │ + 104 "Zero or negative number of attempts passed to pqxx::perform()."}; │ │ │ │ │ + 105 │ │ │ │ │ + 106 for (; attempts > 0; --attempts) │ │ │ │ │ + 107 { │ │ │ │ │ + 108 try │ │ │ │ │ + 109 { │ │ │ │ │ + 110 return callback(); │ │ │ │ │ + 111 } │ │ │ │ │ + 112 catch (const in_doubt_error &) │ │ │ │ │ + 113 { │ │ │ │ │ + 114 // Not sure whether transaction went through or not. The last thing in │ │ │ │ │ + 115 // the world that we should do now is try again! │ │ │ │ │ + 116 throw; │ │ │ │ │ + 117 } │ │ │ │ │ + 118 catch (const statement_completion_unknown &) │ │ │ │ │ + 119 { │ │ │ │ │ + 120 // Not sure whether our last statement succeeded. Don't risk running it │ │ │ │ │ + 121 // again. │ │ │ │ │ + 122 throw; │ │ │ │ │ + 123 } │ │ │ │ │ + 124 catch (const broken_connection &) │ │ │ │ │ + 125 { │ │ │ │ │ + 126 // Connection failed. Definitely worth retrying. │ │ │ │ │ + 127 if (attempts <= 1) throw; │ │ │ │ │ + 128 continue; │ │ │ │ │ + 129 } │ │ │ │ │ + 130 catch (const transaction_rollback &) │ │ │ │ │ + 131 { │ │ │ │ │ + 132 // Some error that may well be transient, such as serialization failure │ │ │ │ │ + 133 // or deadlock. Worth retrying. │ │ │ │ │ + 134 if (attempts <= 1) throw; │ │ │ │ │ + 135 continue; │ │ │ │ │ + 136 } │ │ │ │ │ + 137 } │ │ │ │ │ + 138 throw pqxx::internal_error{"No outcome reached on perform()."}; │ │ │ │ │ + 139} │ │ │ │ │ 140 │ │ │ │ │ - 145 using const_result_iterator::operator->; //[t75] │ │ │ │ │ - 146 using const_result_iterator::operator*; //[t75] │ │ │ │ │ - 148 │ │ │ │ │ -153 const_reverse_result_iterator &operator=( //[t75] │ │ │ │ │ - 154 const const_reverse_result_iterator &r) │ │ │ │ │ - 155 { iterator_type::operator=(r); return *this; } │ │ │ │ │ -156 const_reverse_result_iterator &operator++() //[t75] │ │ │ │ │ - 157 { iterator_type::operator--(); return *this; } │ │ │ │ │ - 158 const_reverse_result_iterator operator++(int); //[t75] │ │ │ │ │ -159 const_reverse_result_iterator &operator--() //[t75] │ │ │ │ │ - 160 { iterator_type::operator++(); return *this; } │ │ │ │ │ - 161 const_reverse_result_iterator operator--(int); //[t75] │ │ │ │ │ -162 const_reverse_result_iterator &operator+=(difference_type i) //[t75] │ │ │ │ │ - 163 { iterator_type::operator-=(i); return *this; } │ │ │ │ │ -164 const_reverse_result_iterator &operator-=(difference_type i) //[t75] │ │ │ │ │ - 165 { iterator_type::operator+=(i); return *this; } │ │ │ │ │ - 167 │ │ │ │ │ -172 const_reverse_result_iterator operator+(difference_type i) const //[t75] │ │ │ │ │ - 173 { return const_reverse_result_iterator(base() - i); } │ │ │ │ │ -174 const_reverse_result_iterator operator-(difference_type i) //[t75] │ │ │ │ │ - 175 { return const_reverse_result_iterator(base() + i); } │ │ │ │ │ -176 difference_type operator-( //[t75] │ │ │ │ │ - 177 const const_reverse_result_iterator &rhs) const │ │ │ │ │ - 178 { return rhs.const_result_iterator::operator-(*this); } │ │ │ │ │ - 180 │ │ │ │ │ -185 bool operator==( //[t75] │ │ │ │ │ - 186 const const_reverse_result_iterator &rhs) const noexcept │ │ │ │ │ - 187 { return iterator_type::operator==(rhs); } │ │ │ │ │ -188 bool operator!=( //[t75] │ │ │ │ │ - 189 const const_reverse_result_iterator &rhs) const noexcept │ │ │ │ │ - 190 { return not operator==(rhs); } │ │ │ │ │ - 191 │ │ │ │ │ -192 bool operator<(const const_reverse_result_iterator &rhs) const //[t75] │ │ │ │ │ - 193 { return iterator_type::operator>(rhs); } │ │ │ │ │ -194 bool operator<=(const const_reverse_result_iterator &rhs) const //[t75] │ │ │ │ │ - 195 { return iterator_type::operator>=(rhs); } │ │ │ │ │ -196 bool operator>(const const_reverse_result_iterator &rhs) const //[t75] │ │ │ │ │ - 197 { return iterator_type::operator<(rhs); } │ │ │ │ │ -198 bool operator>=(const const_reverse_result_iterator &rhs) const //[t75] │ │ │ │ │ - 199 { return iterator_type::operator<=(rhs); } │ │ │ │ │ - 201}; │ │ │ │ │ - 202 │ │ │ │ │ + 142 │ │ │ │ │ +156template> class transactor │ │ │ │ │ + 157{ │ │ │ │ │ + 158public: │ │ │ │ │ +159 using argument_type = TRANSACTION; │ │ │ │ │ +160 PQXX_DEPRECATED explicit transactor( //[t04] │ │ │ │ │ + 161 const std::string &TName="transactor") : │ │ │ │ │ + 162 m_name{TName} { } │ │ │ │ │ + 163 │ │ │ │ │ + 165 │ │ │ │ │ +176 void operator()(TRANSACTION &T); //[t04] │ │ │ │ │ + 177 │ │ │ │ │ + 178 // Overridable member functions, called by connection_base::perform() if │ │ │ │ │ +an │ │ │ │ │ + 179 // attempt to run transaction fails/succeeds, respectively, or if the │ │ │ │ │ + 180 // connection is lost at just the wrong moment, goes into an indeterminate │ │ │ │ │ + 181 // state. Use these to patch up runtime state to match events, if needed, │ │ │ │ │ +or │ │ │ │ │ + 182 // to report failure conditions. │ │ │ │ │ + 183 │ │ │ │ │ + 185 │ │ │ │ │ +193 void on_abort(const char[]) noexcept {} //[t13] │ │ │ │ │ + 194 │ │ │ │ │ + 196 │ │ │ │ │ +200 void on_commit() {} //[t07] │ │ │ │ │ + 201 │ │ │ │ │ 203 │ │ │ │ │ - 204inline const_result_iterator │ │ │ │ │ -205const_result_iterator::operator+(result::difference_type o) const │ │ │ │ │ - 206{ │ │ │ │ │ - 207 return const_result_iterator{ │ │ │ │ │ - 208 &m_result, size_type(result::difference_type(m_index) + o)}; │ │ │ │ │ - 209} │ │ │ │ │ - 210 │ │ │ │ │ - 211inline const_result_iterator │ │ │ │ │ -212operator+(result::difference_type o, const_result_iterator i) │ │ │ │ │ - 213 { return i + o; } │ │ │ │ │ - 214 │ │ │ │ │ - 215inline const_result_iterator │ │ │ │ │ -216const_result_iterator::operator-(result::difference_type o) const │ │ │ │ │ - 217{ │ │ │ │ │ - 218 return const_result_iterator{ │ │ │ │ │ - 219 &m_result, │ │ │ │ │ - 220 result_size_type(result::difference_type(m_index) - o)}; │ │ │ │ │ - 221} │ │ │ │ │ +214 void on_doubt() noexcept {} //[t13] │ │ │ │ │ + 215 │ │ │ │ │ +217 std::string name() const { return m_name; } //[t13] │ │ │ │ │ + 218 │ │ │ │ │ + 219private: │ │ │ │ │ + 220 std::string m_name; │ │ │ │ │ + 221}; │ │ │ │ │ 222 │ │ │ │ │ - 223inline result::difference_type │ │ │ │ │ -224const_result_iterator::operator-(const_result_iterator i) const │ │ │ │ │ - 225 { return result::difference_type(num() - i.num()); } │ │ │ │ │ - 226 │ │ │ │ │ -227inline const_result_iterator result::end() const noexcept │ │ │ │ │ - 228 { return const_result_iterator{this, size()}; } │ │ │ │ │ - 229 │ │ │ │ │ + 223 │ │ │ │ │ + 224template │ │ │ │ │ +225inline void connection_base::perform( │ │ │ │ │ + 226 const TRANSACTOR &T, │ │ │ │ │ + 227 int Attempts) │ │ │ │ │ + 228{ │ │ │ │ │ + 229 if (Attempts <= 0) return; │ │ │ │ │ 230 │ │ │ │ │ -231inline const_result_iterator result::cend() const noexcept │ │ │ │ │ - 232 { return end(); } │ │ │ │ │ - 233 │ │ │ │ │ - 234 │ │ │ │ │ - 235inline const_reverse_result_iterator │ │ │ │ │ -236operator+( │ │ │ │ │ - 237 result::difference_type n, │ │ │ │ │ - 238 const const_reverse_result_iterator &i) │ │ │ │ │ - 239 { return const_reverse_result_iterator{i.base() - n}; } │ │ │ │ │ - 240 │ │ │ │ │ - 241} // namespace pqxx │ │ │ │ │ - 242 │ │ │ │ │ - 243#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 244 │ │ │ │ │ - 245#endif │ │ │ │ │ + 231 bool Done = false; │ │ │ │ │ + 232 │ │ │ │ │ + 233 // Make attempts to perform T │ │ │ │ │ + 234 do │ │ │ │ │ + 235 { │ │ │ │ │ + 236 --Attempts; │ │ │ │ │ + 237 │ │ │ │ │ + 238 // Work on a copy of T2 so we can restore the starting situation if need │ │ │ │ │ +be │ │ │ │ │ + 239 TRANSACTOR T2{T}; │ │ │ │ │ + 240 try │ │ │ │ │ + 241 { │ │ │ │ │ + 242 typename TRANSACTOR::argument_type X{*this, T2.name()}; │ │ │ │ │ + 243 T2(X); │ │ │ │ │ + 244 X.commit(); │ │ │ │ │ + 245 Done = true; │ │ │ │ │ + 246 } │ │ │ │ │ + 247 catch (const in_doubt_error &) │ │ │ │ │ + 248 { │ │ │ │ │ + 249 // Not sure whether transaction went through or not. The last thing in │ │ │ │ │ + 250 // the world that we should do now is retry. │ │ │ │ │ + 251 T2.on_doubt(); │ │ │ │ │ + 252 throw; │ │ │ │ │ + 253 } │ │ │ │ │ + 254 catch (const std::exception &e) │ │ │ │ │ + 255 { │ │ │ │ │ + 256 // Could be any kind of error. │ │ │ │ │ + 257 T2.on_abort(e.what()); │ │ │ │ │ + 258 if (Attempts <= 0) throw; │ │ │ │ │ + 259 continue; │ │ │ │ │ + 260 } │ │ │ │ │ + 261 catch (...) │ │ │ │ │ + 262 { │ │ │ │ │ + 263 // Don't try to forge ahead if we don't even know what happened │ │ │ │ │ + 264 T2.on_abort("Unknown exception"); │ │ │ │ │ + 265 throw; │ │ │ │ │ + 266 } │ │ │ │ │ + 267 │ │ │ │ │ + 268 T2.on_commit(); │ │ │ │ │ + 269 } while (not Done); │ │ │ │ │ + 270} │ │ │ │ │ + 271} // namespace pqxx │ │ │ │ │ + 273#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 274#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::operator+ │ │ │ │ │ -const_result_iterator operator+(result::difference_type o, │ │ │ │ │ -const_result_iterator i) │ │ │ │ │ -Definition: result_iterator.hxx:212 │ │ │ │ │ -pqxx::result_difference_type │ │ │ │ │ -signed long result_difference_type │ │ │ │ │ -Difference between result sizes. │ │ │ │ │ -Definition: types.hxx:21 │ │ │ │ │ -pqxx::result_size_type │ │ │ │ │ -unsigned long result_size_type │ │ │ │ │ -Number of rows in a result set. │ │ │ │ │ -Definition: types.hxx:18 │ │ │ │ │ -pqxx::result │ │ │ │ │ -Result set containing data returned by a query or command. │ │ │ │ │ -Definition: result.hxx:70 │ │ │ │ │ -pqxx::result::end │ │ │ │ │ -const_iterator end() const noexcept │ │ │ │ │ -Definition: result_iterator.hxx:227 │ │ │ │ │ -pqxx::result::difference_type │ │ │ │ │ -result_difference_type difference_type │ │ │ │ │ -Definition: result.hxx:73 │ │ │ │ │ -pqxx::result::size │ │ │ │ │ -PQXX_PURE size_type size() const noexcept │ │ │ │ │ -Definition: result.cxx:94 │ │ │ │ │ -pqxx::result::cend │ │ │ │ │ -const_iterator cend() const noexcept │ │ │ │ │ -Definition: result_iterator.hxx:231 │ │ │ │ │ -pqxx::const_result_iterator │ │ │ │ │ -Iterator for rows in a result. Use as result::const_iterator. │ │ │ │ │ -Definition: result_iterator.hxx:36 │ │ │ │ │ -pqxx::const_result_iterator::operator!= │ │ │ │ │ -bool operator!=(const const_result_iterator &i) const │ │ │ │ │ -Definition: result_iterator.hxx:88 │ │ │ │ │ -pqxx::const_result_iterator::operator-= │ │ │ │ │ -const_result_iterator & operator-=(difference_type i) │ │ │ │ │ -Definition: result_iterator.hxx:78 │ │ │ │ │ -pqxx::const_result_iterator::operator++ │ │ │ │ │ -const_result_iterator & operator++() │ │ │ │ │ -Definition: result_iterator.hxx:72 │ │ │ │ │ -pqxx::const_result_iterator::const_result_iterator │ │ │ │ │ -const_result_iterator(const row &t) noexcept │ │ │ │ │ -Definition: result_iterator.hxx:46 │ │ │ │ │ -pqxx::const_result_iterator::operator+ │ │ │ │ │ -const_result_iterator operator+(difference_type) const │ │ │ │ │ -Definition: result_iterator.hxx:205 │ │ │ │ │ -pqxx::const_result_iterator::iterator_category │ │ │ │ │ -std::random_access_iterator_tag iterator_category │ │ │ │ │ -Definition: result_iterator.hxx:38 │ │ │ │ │ -pqxx::const_result_iterator::operator- │ │ │ │ │ -const_result_iterator operator-(difference_type) const │ │ │ │ │ -Definition: result_iterator.hxx:216 │ │ │ │ │ -pqxx::const_result_iterator::operator< │ │ │ │ │ -bool operator<(const const_result_iterator &i) const │ │ │ │ │ -Definition: result_iterator.hxx:90 │ │ │ │ │ -pqxx::const_result_iterator::operator> │ │ │ │ │ -bool operator>(const const_result_iterator &i) const │ │ │ │ │ -Definition: result_iterator.hxx:94 │ │ │ │ │ -pqxx::const_result_iterator::operator== │ │ │ │ │ -bool operator==(const const_result_iterator &i) const │ │ │ │ │ -Definition: result_iterator.hxx:86 │ │ │ │ │ -pqxx::const_result_iterator::operator+= │ │ │ │ │ -const_result_iterator & operator+=(difference_type i) │ │ │ │ │ -Definition: result_iterator.hxx:76 │ │ │ │ │ -pqxx::const_result_iterator::operator-> │ │ │ │ │ -pointer operator->() const │ │ │ │ │ -Definition: result_iterator.hxx:63 │ │ │ │ │ -pqxx::const_result_iterator::operator<= │ │ │ │ │ -bool operator<=(const const_result_iterator &i) const │ │ │ │ │ -Definition: result_iterator.hxx:92 │ │ │ │ │ -pqxx::const_result_iterator::difference_type │ │ │ │ │ -result_difference_type difference_type │ │ │ │ │ -Definition: result_iterator.hxx:43 │ │ │ │ │ -pqxx::const_result_iterator::size_type │ │ │ │ │ -result_size_type size_type │ │ │ │ │ -Definition: result_iterator.hxx:42 │ │ │ │ │ -pqxx::const_result_iterator::operator>= │ │ │ │ │ -bool operator>=(const const_result_iterator &i) const │ │ │ │ │ -Definition: result_iterator.hxx:96 │ │ │ │ │ -pqxx::const_result_iterator::operator* │ │ │ │ │ -reference operator*() const │ │ │ │ │ -Definition: result_iterator.hxx:64 │ │ │ │ │ -pqxx::const_result_iterator::operator-- │ │ │ │ │ -const_result_iterator & operator--() │ │ │ │ │ -Definition: result_iterator.hxx:74 │ │ │ │ │ -pqxx::const_result_iterator::const_result_iterator │ │ │ │ │ -const_result_iterator() noexcept │ │ │ │ │ -Definition: result_iterator.hxx:45 │ │ │ │ │ -pqxx::const_reverse_result_iterator │ │ │ │ │ -Reverse iterator for result. Use as result::const_reverse_iterator. │ │ │ │ │ -Definition: result_iterator.hxx:122 │ │ │ │ │ -pqxx::const_reverse_result_iterator::base │ │ │ │ │ -PQXX_PURE const_result_iterator base() const noexcept │ │ │ │ │ -Definition: result.cxx:425 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator>= │ │ │ │ │ -bool operator>=(const const_reverse_result_iterator &rhs) const │ │ │ │ │ -Definition: result_iterator.hxx:198 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator+ │ │ │ │ │ -const_reverse_result_iterator operator+(difference_type i) const │ │ │ │ │ -Definition: result_iterator.hxx:172 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator!= │ │ │ │ │ -bool operator!=(const const_reverse_result_iterator &rhs) const noexcept │ │ │ │ │ -Definition: result_iterator.hxx:188 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator-= │ │ │ │ │ -const_reverse_result_iterator & operator-=(difference_type i) │ │ │ │ │ -Definition: result_iterator.hxx:164 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator+= │ │ │ │ │ -const_reverse_result_iterator & operator+=(difference_type i) │ │ │ │ │ -Definition: result_iterator.hxx:162 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator== │ │ │ │ │ -bool operator==(const const_reverse_result_iterator &rhs) const noexcept │ │ │ │ │ -Definition: result_iterator.hxx:185 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator< │ │ │ │ │ -bool operator<(const const_reverse_result_iterator &rhs) const │ │ │ │ │ -Definition: result_iterator.hxx:192 │ │ │ │ │ -pqxx::const_reverse_result_iterator::const_reverse_result_iterator │ │ │ │ │ -const_reverse_result_iterator(const const_reverse_result_iterator &rhs) │ │ │ │ │ -Definition: result_iterator.hxx:132 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator- │ │ │ │ │ -const_reverse_result_iterator operator-(difference_type i) │ │ │ │ │ -Definition: result_iterator.hxx:174 │ │ │ │ │ -pqxx::const_reverse_result_iterator::const_reverse_result_iterator │ │ │ │ │ -const_reverse_result_iterator(const const_result_iterator &rhs) │ │ │ │ │ -Definition: result_iterator.hxx:135 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator> │ │ │ │ │ -bool operator>(const const_reverse_result_iterator &rhs) const │ │ │ │ │ -Definition: result_iterator.hxx:196 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator- │ │ │ │ │ -difference_type operator-(const const_reverse_result_iterator &rhs) const │ │ │ │ │ -Definition: result_iterator.hxx:176 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator<= │ │ │ │ │ -bool operator<=(const const_reverse_result_iterator &rhs) const │ │ │ │ │ -Definition: result_iterator.hxx:194 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator-- │ │ │ │ │ -const_reverse_result_iterator & operator--() │ │ │ │ │ -Definition: result_iterator.hxx:159 │ │ │ │ │ -pqxx::const_reverse_result_iterator::operator++ │ │ │ │ │ -const_reverse_result_iterator & operator++() │ │ │ │ │ -Definition: result_iterator.hxx:156 │ │ │ │ │ -pqxx::row │ │ │ │ │ -Reference to one row in a result. │ │ │ │ │ -Definition: row.hxx:41 │ │ │ │ │ -pqxx::row::num │ │ │ │ │ -size_t num() const │ │ │ │ │ -Definition: row.hxx:170 │ │ │ │ │ -pqxx::row::m_result │ │ │ │ │ -result m_result │ │ │ │ │ -Result set of which this is one row. │ │ │ │ │ -Definition: row.hxx:192 │ │ │ │ │ -pqxx::row::m_index │ │ │ │ │ -long m_index │ │ │ │ │ -Row number. │ │ │ │ │ -Definition: row.hxx:198 │ │ │ │ │ +pqxx::perform │ │ │ │ │ +auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype │ │ │ │ │ +(callback()) │ │ │ │ │ +Simple way to execute a transaction with automatic retry. │ │ │ │ │ +Definition: transactor.hxx:99 │ │ │ │ │ +pqxx::connection_base::perform │ │ │ │ │ +void perform(const TRANSACTOR &T, int Attempts) │ │ │ │ │ +Definition: transactor.hxx:225 │ │ │ │ │ +pqxx::broken_connection │ │ │ │ │ +Exception class for lost or failed backend connection. │ │ │ │ │ +Definition: except.hxx:119 │ │ │ │ │ +pqxx::in_doubt_error │ │ │ │ │ +"Help, I don't know whether transaction was committed successfully!" │ │ │ │ │ +Definition: except.hxx:160 │ │ │ │ │ +pqxx::transaction_rollback │ │ │ │ │ +The backend saw itself forced to roll back the ongoing transaction. │ │ │ │ │ +Definition: except.hxx:168 │ │ │ │ │ +pqxx::statement_completion_unknown │ │ │ │ │ +We can't tell whether our last statement succeeded. │ │ │ │ │ +Definition: except.hxx:192 │ │ │ │ │ +pqxx::internal_error │ │ │ │ │ +Internal error in libpqxx library. │ │ │ │ │ +Definition: except.hxx:209 │ │ │ │ │ +pqxx::transactor │ │ │ │ │ +Definition: transactor.hxx:157 │ │ │ │ │ +pqxx::transactor::on_doubt │ │ │ │ │ +void on_doubt() noexcept │ │ │ │ │ +Overridable function to be called when "in doubt" about outcome. │ │ │ │ │ +Definition: transactor.hxx:214 │ │ │ │ │ +pqxx::transactor::transactor │ │ │ │ │ +transactor(const std::string &TName="transactor") │ │ │ │ │ +Definition: transactor.hxx:160 │ │ │ │ │ +pqxx::transactor::on_commit │ │ │ │ │ +void on_commit() │ │ │ │ │ +Optional overridable function to be called after successful commit. │ │ │ │ │ +Definition: transactor.hxx:200 │ │ │ │ │ +pqxx::transactor::operator() │ │ │ │ │ +void operator()(TRANSACTION &T) │ │ │ │ │ +Overridable transaction definition; insert your database code here. │ │ │ │ │ +pqxx::transactor::on_abort │ │ │ │ │ +void on_abort(const char[]) noexcept │ │ │ │ │ +Optional overridable function to be called if transaction is aborted. │ │ │ │ │ +Definition: transactor.hxx:193 │ │ │ │ │ +pqxx::transactor::argument_type │ │ │ │ │ +TRANSACTION argument_type │ │ │ │ │ +Definition: transactor.hxx:159 │ │ │ │ │ +pqxx::transactor::name │ │ │ │ │ +std::string name() const │ │ │ │ │ +The transactor's name. │ │ │ │ │ +Definition: transactor.hxx:217 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * result_iterator.hxx │ │ │ │ │ + * transactor.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00044_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: config.h Source File │ │ │ │ +libpqxx: result_iterator.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,130 +55,249 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
config.h
│ │ │ │ +
result_iterator.hxx
│ │ │ │
│ │ │ │
│ │ │ │ -
1/* include/pqxx/config.h. Generated from config.h.in by configure. */
│ │ │ │ -
2/* include/pqxx/config.h.in. Generated from configure.ac by autoheader. */
│ │ │ │ -
3
│ │ │ │ -
4/* most gcc compilers know a function __attribute__((__const__)) */
│ │ │ │ -
5#define GCC_CONST_CALL __attribute__((__const__))
│ │ │ │ -
6
│ │ │ │ -
7/* define if the compiler supports basic C++11 syntax */
│ │ │ │ -
8#define HAVE_CXX11 1
│ │ │ │ -
9
│ │ │ │ -
10/* Define to 1 if you have the <dlfcn.h> header file. */
│ │ │ │ -
11#define HAVE_DLFCN_H 1
│ │ │ │ -
12
│ │ │ │ -
13/* Define to 1 if you have the <inttypes.h> header file. */
│ │ │ │ -
14#define HAVE_INTTYPES_H 1
│ │ │ │ +
1
│ │ │ │ +
13#ifndef PQXX_H_RESULT_ITERATOR
│ │ │ │ +
14#define PQXX_H_RESULT_ITERATOR
│ │ │ │
15
│ │ │ │ -
16/* Define to 1 if you have the `pq' library (-lpq). */
│ │ │ │ -
17#define HAVE_LIBPQ 1
│ │ │ │ +
16#include "pqxx/compiler-public.hxx"
│ │ │ │ +
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │
18
│ │ │ │ -
19/* System supports poll(). */
│ │ │ │ -
20#define HAVE_POLL 1
│ │ │ │ +
19#include "pqxx/row.hxx"
│ │ │ │ +
20
│ │ │ │
21
│ │ │ │ -
22/* Define to 1 if you have the <stdint.h> header file. */
│ │ │ │ -
23#define HAVE_STDINT_H 1
│ │ │ │ -
24
│ │ │ │ -
25/* Define to 1 if you have the <stdio.h> header file. */
│ │ │ │ -
26#define HAVE_STDIO_H 1
│ │ │ │ +
22/* Result iterator.
│ │ │ │ +
23 *
│ │ │ │ +
24 * Don't include this header from your own application; it is included for you
│ │ │ │ +
25 * by other libpqxx headers.
│ │ │ │ +
26 */
│ │ │ │
27
│ │ │ │ -
28/* Define to 1 if you have the <stdlib.h> header file. */
│ │ │ │ -
29#define HAVE_STDLIB_H 1
│ │ │ │ -
30
│ │ │ │ -
31/* Define to 1 if you have the <strings.h> header file. */
│ │ │ │ -
32#define HAVE_STRINGS_H 1
│ │ │ │ -
33
│ │ │ │ -
34/* Define to 1 if you have the <string.h> header file. */
│ │ │ │ -
35#define HAVE_STRING_H 1
│ │ │ │ -
36
│ │ │ │ -
37/* Define to 1 if you have the <sys/select.h> header file. */
│ │ │ │ -
38/* #undef HAVE_SYS_SELECT_H */
│ │ │ │ -
39
│ │ │ │ -
40/* Define to 1 if you have the <sys/stat.h> header file. */
│ │ │ │ -
41#define HAVE_SYS_STAT_H 1
│ │ │ │ -
42
│ │ │ │ -
43/* Define to 1 if you have the <sys/time.h> header file. */
│ │ │ │ -
44#define HAVE_SYS_TIME_H 1
│ │ │ │ -
45
│ │ │ │ -
46/* Define to 1 if you have the <sys/types.h> header file. */
│ │ │ │ -
47#define HAVE_SYS_TYPES_H 1
│ │ │ │ -
48
│ │ │ │ -
49/* Define to 1 if you have the <unistd.h> header file. */
│ │ │ │ -
50#define HAVE_UNISTD_H 1
│ │ │ │ -
51
│ │ │ │ -
52/* Define to the sub-directory where libtool stores uninstalled libraries. */
│ │ │ │ -
53#define LT_OBJDIR ".libs/"
│ │ │ │ -
54
│ │ │ │ -
55/* Name of package */
│ │ │ │ -
56#define PACKAGE "libpqxx"
│ │ │ │ -
57
│ │ │ │ -
58/* Define to the address where bug reports for this package should be sent. */
│ │ │ │ -
59#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen"
│ │ │ │ -
60
│ │ │ │ -
61/* Define to the full name of this package. */
│ │ │ │ -
62#define PACKAGE_NAME "libpqxx"
│ │ │ │ -
63
│ │ │ │ -
64/* Define to the full name and version of this package. */
│ │ │ │ -
65#define PACKAGE_STRING "libpqxx 6.4.5"
│ │ │ │ -
66
│ │ │ │ -
67/* Define to the one symbol short name of this package. */
│ │ │ │ -
68#define PACKAGE_TARNAME "libpqxx"
│ │ │ │ -
69
│ │ │ │ -
70/* Define to the home page for this package. */
│ │ │ │ -
71#define PACKAGE_URL ""
│ │ │ │ -
72
│ │ │ │ -
73/* Define to the version of this package. */
│ │ │ │ -
74#define PACKAGE_VERSION "6.4.5"
│ │ │ │ +
28namespace pqxx
│ │ │ │ +
29{
│ │ │ │ +
31
│ │ │ │ +
35class PQXX_LIBEXPORT const_result_iterator : public row
│ │ │ │ +
36{
│ │ │ │ +
37public:
│ │ │ │ +
38 using iterator_category = std::random_access_iterator_tag;
│ │ │ │ +
39 using value_type = const row;
│ │ │ │ +
40 using pointer = const row *;
│ │ │ │ +
41 using reference = row;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
44
│ │ │ │ +
45 const_result_iterator() noexcept : row{result(), 0} {}
│ │ │ │ +
46 const_result_iterator(const row &t) noexcept : row{t} {}
│ │ │ │ +
47
│ │ │ │ +
63 pointer operator->() const { return this; } //[t12]
│ │ │ │ +
64 reference operator*() const { return row{*this}; } //[t12]
│ │ │ │ +
66
│ │ │ │ +
71 const_result_iterator operator++(int); //[t12]
│ │ │ │ +
72 const_result_iterator &operator++() { ++m_index; return *this; } //[t01]
│ │ │ │ +
73 const_result_iterator operator--(int); //[t12]
│ │ │ │ +
74 const_result_iterator &operator--() { --m_index; return *this; } //[t12]
│ │ │ │
75
│ │ │ │ -
76/* Define if <charconv> supports floating-point conversion. */
│ │ │ │ -
77/* #undef PQXX_HAVE_CHARCONV_FLOAT */
│ │ │ │ -
78
│ │ │ │ -
79/* Define if <charconv> supports integer conversion. */
│ │ │ │ -
80/* #undef PQXX_HAVE_CHARCONV_INT */
│ │ │ │ + │ │ │ │ +
77 { m_index += i; return *this; }
│ │ │ │ + │ │ │ │ +
79 { m_index -= i; return *this; }
│ │ │ │
81
│ │ │ │ -
82/* Define if compiler supports [[deprecated]] attribute */
│ │ │ │ -
83#define PQXX_HAVE_DEPRECATED 1
│ │ │ │ -
84
│ │ │ │ -
85/* Define if the compiler supports std::experimental::optional. */
│ │ │ │ -
86/* #undef PQXX_HAVE_EXP_OPTIONAL */
│ │ │ │ -
87
│ │ │ │ -
88/* Define if g++ supports const attribute. */
│ │ │ │ -
89#define PQXX_HAVE_GCC_CONST 1
│ │ │ │ -
90
│ │ │ │ -
91/* Define if g++ supports deprecated attribute. */
│ │ │ │ -
92#define PQXX_HAVE_GCC_DEPRECATED 1
│ │ │ │ -
93
│ │ │ │ -
94/* Define if g++ supports pure attribute */
│ │ │ │ -
95#define PQXX_HAVE_GCC_PURE 1
│ │ │ │ -
96
│ │ │ │ -
97/* Define if g++ supports visibility attribute. */
│ │ │ │ -
98#define PQXX_HAVE_GCC_VISIBILITY 1
│ │ │ │ +
86 bool operator==(const const_result_iterator &i) const //[t12]
│ │ │ │ +
87 {return m_index==i.m_index;}
│ │ │ │ +
88 bool operator!=(const const_result_iterator &i) const //[t12]
│ │ │ │ +
89 {return m_index!=i.m_index;}
│ │ │ │ +
90 bool operator<(const const_result_iterator &i) const //[t12]
│ │ │ │ +
91 {return m_index<i.m_index;}
│ │ │ │ +
92 bool operator<=(const const_result_iterator &i) const //[t12]
│ │ │ │ +
93 {return m_index<=i.m_index;}
│ │ │ │ +
94 bool operator>(const const_result_iterator &i) const //[t12]
│ │ │ │ +
95 {return m_index>i.m_index;}
│ │ │ │ +
96 bool operator>=(const const_result_iterator &i) const //[t12]
│ │ │ │ +
97 {return m_index>=i.m_index;}
│ │ │ │
99
│ │ │ │ -
100/* Define if the compiler supports std::optional. */
│ │ │ │ -
101/* #undef PQXX_HAVE_OPTIONAL */
│ │ │ │ -
102
│ │ │ │ -
103/* Define to 1 if all of the C90 standard headers exist (not just the ones
│ │ │ │ -
104 required in a freestanding environment). This macro is provided for
│ │ │ │ -
105 backward compatibility; new code need not use it. */
│ │ │ │ -
106#define STDC_HEADERS 1
│ │ │ │ -
107
│ │ │ │ -
108/* Version number of package */
│ │ │ │ -
109#define VERSION "6.4.5"
│ │ │ │ +
104 inline const_result_iterator operator+(difference_type) const; //[t12]
│ │ │ │ +
105 friend const_result_iterator operator+( //[t12]
│ │ │ │ +
106 difference_type,
│ │ │ │ + │ │ │ │ +
108 inline const_result_iterator operator-(difference_type) const; //[t12]
│ │ │ │ +
109 inline difference_type operator-(const_result_iterator) const; //[t12]
│ │ │ │ +
111
│ │ │ │ +
112private:
│ │ │ │ +
113 friend class pqxx::result;
│ │ │ │ + │ │ │ │ +
115 row{*r, i} {}
│ │ │ │ +
116};
│ │ │ │ +
117
│ │ │ │ +
118
│ │ │ │ +
120class PQXX_LIBEXPORT const_reverse_result_iterator :
│ │ │ │ + │ │ │ │ +
122{
│ │ │ │ +
123public:
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
131
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
136 const const_result_iterator &rhs) :
│ │ │ │ +
137 const_result_iterator{rhs} { super::operator--(); }
│ │ │ │ +
138
│ │ │ │ +
139 PQXX_PURE const_result_iterator base() const noexcept; //[t75]
│ │ │ │ +
140
│ │ │ │ +
145 using const_result_iterator::operator->; //[t75]
│ │ │ │ +
146 using const_result_iterator::operator*; //[t75]
│ │ │ │ +
148
│ │ │ │ + │ │ │ │ + │ │ │ │ +
155 { iterator_type::operator=(r); return *this; }
│ │ │ │ + │ │ │ │ +
157 { iterator_type::operator--(); return *this; }
│ │ │ │ +
158 const_reverse_result_iterator operator++(int); //[t75]
│ │ │ │ + │ │ │ │ +
160 { iterator_type::operator++(); return *this; }
│ │ │ │ +
161 const_reverse_result_iterator operator--(int); //[t75]
│ │ │ │ + │ │ │ │ +
163 { iterator_type::operator-=(i); return *this; }
│ │ │ │ + │ │ │ │ +
165 { iterator_type::operator+=(i); return *this; }
│ │ │ │ +
167
│ │ │ │ + │ │ │ │ +
173 { return const_reverse_result_iterator(base() - i); }
│ │ │ │ + │ │ │ │ +
175 { return const_reverse_result_iterator(base() + i); }
│ │ │ │ + │ │ │ │ +
177 const const_reverse_result_iterator &rhs) const
│ │ │ │ +
178 { return rhs.const_result_iterator::operator-(*this); }
│ │ │ │ +
180
│ │ │ │ +
185 bool operator==( //[t75]
│ │ │ │ +
186 const const_reverse_result_iterator &rhs) const noexcept
│ │ │ │ +
187 { return iterator_type::operator==(rhs); }
│ │ │ │ +
188 bool operator!=( //[t75]
│ │ │ │ +
189 const const_reverse_result_iterator &rhs) const noexcept
│ │ │ │ +
190 { return not operator==(rhs); }
│ │ │ │ +
191
│ │ │ │ +
192 bool operator<(const const_reverse_result_iterator &rhs) const //[t75]
│ │ │ │ +
193 { return iterator_type::operator>(rhs); }
│ │ │ │ +
194 bool operator<=(const const_reverse_result_iterator &rhs) const //[t75]
│ │ │ │ +
195 { return iterator_type::operator>=(rhs); }
│ │ │ │ +
196 bool operator>(const const_reverse_result_iterator &rhs) const //[t75]
│ │ │ │ +
197 { return iterator_type::operator<(rhs); }
│ │ │ │ +
198 bool operator>=(const const_reverse_result_iterator &rhs) const //[t75]
│ │ │ │ +
199 { return iterator_type::operator<=(rhs); }
│ │ │ │ +
201};
│ │ │ │ +
202
│ │ │ │ +
203
│ │ │ │ +
204inline const_result_iterator
│ │ │ │ + │ │ │ │ +
206{
│ │ │ │ + │ │ │ │ + │ │ │ │ +
209}
│ │ │ │ +
210
│ │ │ │ + │ │ │ │ + │ │ │ │ +
213 { return i + o; }
│ │ │ │ +
214
│ │ │ │ + │ │ │ │ + │ │ │ │ +
217{
│ │ │ │ + │ │ │ │ +
219 &m_result,
│ │ │ │ + │ │ │ │ +
221}
│ │ │ │ +
222
│ │ │ │ + │ │ │ │ + │ │ │ │ +
225 { return result::difference_type(num() - i.num()); }
│ │ │ │ +
226
│ │ │ │ +
227inline const_result_iterator result::end() const noexcept
│ │ │ │ +
228 { return const_result_iterator{this, size()}; }
│ │ │ │ +
229
│ │ │ │ +
230
│ │ │ │ +
231inline const_result_iterator result::cend() const noexcept
│ │ │ │ +
232 { return end(); }
│ │ │ │ +
233
│ │ │ │ +
234
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
239 { return const_reverse_result_iterator{i.base() - n}; }
│ │ │ │ +
240
│ │ │ │ +
241} // namespace pqxx
│ │ │ │ +
242
│ │ │ │ +
243#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
244
│ │ │ │ +
245#endif
│ │ │ │ +
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ +
const_result_iterator operator+(result::difference_type o, const_result_iterator i)
Definition: result_iterator.hxx:212
│ │ │ │ +
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
│ │ │ │ +
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
│ │ │ │ +
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ +
const_iterator end() const noexcept
Definition: result_iterator.hxx:227
│ │ │ │ +
result_difference_type difference_type
Definition: result.hxx:73
│ │ │ │ +
PQXX_PURE size_type size() const noexcept
Definition: result.cxx:94
│ │ │ │ +
const_iterator cend() const noexcept
Definition: result_iterator.hxx:231
│ │ │ │ +
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
│ │ │ │ +
bool operator!=(const const_result_iterator &i) const
Definition: result_iterator.hxx:88
│ │ │ │ +
const_result_iterator & operator-=(difference_type i)
Definition: result_iterator.hxx:78
│ │ │ │ +
const_result_iterator & operator++()
Definition: result_iterator.hxx:72
│ │ │ │ +
const_result_iterator(const row &t) noexcept
Definition: result_iterator.hxx:46
│ │ │ │ +
const_result_iterator operator+(difference_type) const
Definition: result_iterator.hxx:205
│ │ │ │ +
std::random_access_iterator_tag iterator_category
Definition: result_iterator.hxx:38
│ │ │ │ +
const_result_iterator operator-(difference_type) const
Definition: result_iterator.hxx:216
│ │ │ │ +
bool operator<(const const_result_iterator &i) const
Definition: result_iterator.hxx:90
│ │ │ │ +
bool operator>(const const_result_iterator &i) const
Definition: result_iterator.hxx:94
│ │ │ │ +
bool operator==(const const_result_iterator &i) const
Definition: result_iterator.hxx:86
│ │ │ │ +
const_result_iterator & operator+=(difference_type i)
Definition: result_iterator.hxx:76
│ │ │ │ +
pointer operator->() const
Definition: result_iterator.hxx:63
│ │ │ │ +
bool operator<=(const const_result_iterator &i) const
Definition: result_iterator.hxx:92
│ │ │ │ +
result_difference_type difference_type
Definition: result_iterator.hxx:43
│ │ │ │ +
result_size_type size_type
Definition: result_iterator.hxx:42
│ │ │ │ +
bool operator>=(const const_result_iterator &i) const
Definition: result_iterator.hxx:96
│ │ │ │ +
reference operator*() const
Definition: result_iterator.hxx:64
│ │ │ │ +
const_result_iterator & operator--()
Definition: result_iterator.hxx:74
│ │ │ │ +
const_result_iterator() noexcept
Definition: result_iterator.hxx:45
│ │ │ │ +
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:122
│ │ │ │ +
PQXX_PURE const_result_iterator base() const noexcept
Definition: result.cxx:425
│ │ │ │ +
bool operator>=(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:198
│ │ │ │ +
const_reverse_result_iterator operator+(difference_type i) const
Definition: result_iterator.hxx:172
│ │ │ │ +
bool operator!=(const const_reverse_result_iterator &rhs) const noexcept
Definition: result_iterator.hxx:188
│ │ │ │ +
const_reverse_result_iterator & operator-=(difference_type i)
Definition: result_iterator.hxx:164
│ │ │ │ +
const_reverse_result_iterator & operator+=(difference_type i)
Definition: result_iterator.hxx:162
│ │ │ │ +
bool operator==(const const_reverse_result_iterator &rhs) const noexcept
Definition: result_iterator.hxx:185
│ │ │ │ +
bool operator<(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:192
│ │ │ │ +
const_reverse_result_iterator(const const_reverse_result_iterator &rhs)
Definition: result_iterator.hxx:132
│ │ │ │ +
const_reverse_result_iterator operator-(difference_type i)
Definition: result_iterator.hxx:174
│ │ │ │ +
const_reverse_result_iterator(const const_result_iterator &rhs)
Definition: result_iterator.hxx:135
│ │ │ │ +
bool operator>(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:196
│ │ │ │ +
difference_type operator-(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:176
│ │ │ │ +
bool operator<=(const const_reverse_result_iterator &rhs) const
Definition: result_iterator.hxx:194
│ │ │ │ +
const_reverse_result_iterator & operator--()
Definition: result_iterator.hxx:159
│ │ │ │ +
const_reverse_result_iterator & operator++()
Definition: result_iterator.hxx:156
│ │ │ │ +
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │ +
size_t num() const
Definition: row.hxx:170
│ │ │ │ +
result m_result
Result set of which this is one row.
Definition: row.hxx:192
│ │ │ │ +
long m_index
Row number.
Definition: row.hxx:198
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,123 +1,347 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -config.h │ │ │ │ │ - 1/* include/pqxx/config.h. Generated from config.h.in by configure. */ │ │ │ │ │ - 2/* include/pqxx/config.h.in. Generated from configure.ac by autoheader. */ │ │ │ │ │ - 3 │ │ │ │ │ - 4/* most gcc compilers know a function __attribute__((__const__)) */ │ │ │ │ │ - 5#define GCC_CONST_CALL __attribute__((__const__)) │ │ │ │ │ - 6 │ │ │ │ │ - 7/* define if the compiler supports basic C++11 syntax */ │ │ │ │ │ - 8#define HAVE_CXX11 1 │ │ │ │ │ - 9 │ │ │ │ │ - 10/* Define to 1 if you have the header file. */ │ │ │ │ │ - 11#define HAVE_DLFCN_H 1 │ │ │ │ │ - 12 │ │ │ │ │ - 13/* Define to 1 if you have the header file. */ │ │ │ │ │ - 14#define HAVE_INTTYPES_H 1 │ │ │ │ │ +result_iterator.hxx │ │ │ │ │ + 1 │ │ │ │ │ + 13#ifndef PQXX_H_RESULT_ITERATOR │ │ │ │ │ + 14#define PQXX_H_RESULT_ITERATOR │ │ │ │ │ 15 │ │ │ │ │ - 16/* Define to 1 if you have the `pq' library (-lpq). */ │ │ │ │ │ - 17#define HAVE_LIBPQ 1 │ │ │ │ │ + 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ 18 │ │ │ │ │ - 19/* System supports poll(). */ │ │ │ │ │ - 20#define HAVE_POLL 1 │ │ │ │ │ + 19#include "pqxx/row.hxx" │ │ │ │ │ + 20 │ │ │ │ │ 21 │ │ │ │ │ - 22/* Define to 1 if you have the header file. */ │ │ │ │ │ - 23#define HAVE_STDINT_H 1 │ │ │ │ │ - 24 │ │ │ │ │ - 25/* Define to 1 if you have the header file. */ │ │ │ │ │ - 26#define HAVE_STDIO_H 1 │ │ │ │ │ + 22/* Result iterator. │ │ │ │ │ + 23 * │ │ │ │ │ + 24 * Don't include this header from your own application; it is included for │ │ │ │ │ +you │ │ │ │ │ + 25 * by other libpqxx headers. │ │ │ │ │ + 26 */ │ │ │ │ │ 27 │ │ │ │ │ - 28/* Define to 1 if you have the header file. */ │ │ │ │ │ - 29#define HAVE_STDLIB_H 1 │ │ │ │ │ - 30 │ │ │ │ │ - 31/* Define to 1 if you have the header file. */ │ │ │ │ │ - 32#define HAVE_STRINGS_H 1 │ │ │ │ │ - 33 │ │ │ │ │ - 34/* Define to 1 if you have the header file. */ │ │ │ │ │ - 35#define HAVE_STRING_H 1 │ │ │ │ │ - 36 │ │ │ │ │ - 37/* Define to 1 if you have the header file. */ │ │ │ │ │ - 38/* #undef HAVE_SYS_SELECT_H */ │ │ │ │ │ - 39 │ │ │ │ │ - 40/* Define to 1 if you have the header file. */ │ │ │ │ │ - 41#define HAVE_SYS_STAT_H 1 │ │ │ │ │ - 42 │ │ │ │ │ - 43/* Define to 1 if you have the header file. */ │ │ │ │ │ - 44#define HAVE_SYS_TIME_H 1 │ │ │ │ │ - 45 │ │ │ │ │ - 46/* Define to 1 if you have the header file. */ │ │ │ │ │ - 47#define HAVE_SYS_TYPES_H 1 │ │ │ │ │ - 48 │ │ │ │ │ - 49/* Define to 1 if you have the header file. */ │ │ │ │ │ - 50#define HAVE_UNISTD_H 1 │ │ │ │ │ - 51 │ │ │ │ │ - 52/* Define to the sub-directory where libtool stores uninstalled libraries. │ │ │ │ │ -*/ │ │ │ │ │ - 53#define LT_OBJDIR ".libs/" │ │ │ │ │ - 54 │ │ │ │ │ - 55/* Name of package */ │ │ │ │ │ - 56#define PACKAGE "libpqxx" │ │ │ │ │ - 57 │ │ │ │ │ - 58/* Define to the address where bug reports for this package should be sent. │ │ │ │ │ -*/ │ │ │ │ │ - 59#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen" │ │ │ │ │ - 60 │ │ │ │ │ - 61/* Define to the full name of this package. */ │ │ │ │ │ - 62#define PACKAGE_NAME "libpqxx" │ │ │ │ │ - 63 │ │ │ │ │ - 64/* Define to the full name and version of this package. */ │ │ │ │ │ - 65#define PACKAGE_STRING "libpqxx 6.4.5" │ │ │ │ │ + 28namespace pqxx │ │ │ │ │ + 29{ │ │ │ │ │ + 31 │ │ │ │ │ +35class PQXX_LIBEXPORT const_result_iterator : public row │ │ │ │ │ + 36{ │ │ │ │ │ + 37public: │ │ │ │ │ +38 using iterator_category = std::random_access_iterator_tag; │ │ │ │ │ +39 using value_type = const row; │ │ │ │ │ +40 using pointer = const row *; │ │ │ │ │ +41 using reference = row; │ │ │ │ │ +42 using size_type = result_size_type; │ │ │ │ │ +43 using difference_type = result_difference_type; │ │ │ │ │ + 44 │ │ │ │ │ +45 const_result_iterator() noexcept : row{result(), 0} {} │ │ │ │ │ +46 const_result_iterator(const row &t) noexcept : row{t} {} │ │ │ │ │ + 47 │ │ │ │ │ +63 pointer operator->() const { return this; } //[t12] │ │ │ │ │ +64 reference operator*() const { return row{*this}; } //[t12] │ │ │ │ │ 66 │ │ │ │ │ - 67/* Define to the one symbol short name of this package. */ │ │ │ │ │ - 68#define PACKAGE_TARNAME "libpqxx" │ │ │ │ │ - 69 │ │ │ │ │ - 70/* Define to the home page for this package. */ │ │ │ │ │ - 71#define PACKAGE_URL "" │ │ │ │ │ - 72 │ │ │ │ │ - 73/* Define to the version of this package. */ │ │ │ │ │ - 74#define PACKAGE_VERSION "6.4.5" │ │ │ │ │ + 71 const_result_iterator operator++(int); //[t12] │ │ │ │ │ +72 const_result_iterator &operator++() { ++m_index; return *this; } //[t01] │ │ │ │ │ + 73 const_result_iterator operator--(int); //[t12] │ │ │ │ │ +74 const_result_iterator &operator--() { --m_index; return *this; } //[t12] │ │ │ │ │ 75 │ │ │ │ │ - 76/* Define if supports floating-point conversion. */ │ │ │ │ │ - 77/* #undef PQXX_HAVE_CHARCONV_FLOAT */ │ │ │ │ │ - 78 │ │ │ │ │ - 79/* Define if supports integer conversion. */ │ │ │ │ │ - 80/* #undef PQXX_HAVE_CHARCONV_INT */ │ │ │ │ │ +76 const_result_iterator &operator+=(difference_type i) //[t12] │ │ │ │ │ + 77 { m_index += i; return *this; } │ │ │ │ │ +78 const_result_iterator &operator-=(difference_type i) //[t12] │ │ │ │ │ + 79 { m_index -= i; return *this; } │ │ │ │ │ 81 │ │ │ │ │ - 82/* Define if compiler supports [[deprecated]] attribute */ │ │ │ │ │ - 83#define PQXX_HAVE_DEPRECATED 1 │ │ │ │ │ - 84 │ │ │ │ │ - 85/* Define if the compiler supports std::experimental::optional. */ │ │ │ │ │ - 86/* #undef PQXX_HAVE_EXP_OPTIONAL */ │ │ │ │ │ - 87 │ │ │ │ │ - 88/* Define if g++ supports const attribute. */ │ │ │ │ │ - 89#define PQXX_HAVE_GCC_CONST 1 │ │ │ │ │ - 90 │ │ │ │ │ - 91/* Define if g++ supports deprecated attribute. */ │ │ │ │ │ - 92#define PQXX_HAVE_GCC_DEPRECATED 1 │ │ │ │ │ - 93 │ │ │ │ │ - 94/* Define if g++ supports pure attribute */ │ │ │ │ │ - 95#define PQXX_HAVE_GCC_PURE 1 │ │ │ │ │ - 96 │ │ │ │ │ - 97/* Define if g++ supports visibility attribute. */ │ │ │ │ │ - 98#define PQXX_HAVE_GCC_VISIBILITY 1 │ │ │ │ │ +86 bool operator==(const const_result_iterator &i) const //[t12] │ │ │ │ │ + 87 {return m_index==i.m_index;} │ │ │ │ │ +88 bool operator!=(const const_result_iterator &i) const //[t12] │ │ │ │ │ + 89 {return m_index!=i.m_index;} │ │ │ │ │ +90 bool operator<(const const_result_iterator &i) const //[t12] │ │ │ │ │ + 91 {return m_index(const const_result_iterator &i) const //[t12] │ │ │ │ │ + 95 {return m_index>i.m_index;} │ │ │ │ │ +96 bool operator>=(const const_result_iterator &i) const //[t12] │ │ │ │ │ + 97 {return m_index>=i.m_index;} │ │ │ │ │ 99 │ │ │ │ │ - 100/* Define if the compiler supports std::optional. */ │ │ │ │ │ - 101/* #undef PQXX_HAVE_OPTIONAL */ │ │ │ │ │ - 102 │ │ │ │ │ - 103/* Define to 1 if all of the C90 standard headers exist (not just the ones │ │ │ │ │ - 104 required in a freestanding environment). This macro is provided for │ │ │ │ │ - 105 backward compatibility; new code need not use it. */ │ │ │ │ │ - 106#define STDC_HEADERS 1 │ │ │ │ │ - 107 │ │ │ │ │ - 108/* Version number of package */ │ │ │ │ │ - 109#define VERSION "6.4.5" │ │ │ │ │ + 104 inline const_result_iterator operator+(difference_type) const; //[t12] │ │ │ │ │ + 105 friend const_result_iterator operator+( //[t12] │ │ │ │ │ + 106 difference_type, │ │ │ │ │ + 107 const_result_iterator); │ │ │ │ │ +108 inline const_result_iterator operator-(difference_type) const; //[t12] │ │ │ │ │ +109 inline difference_type operator-(const_result_iterator) const; //[t12] │ │ │ │ │ + 111 │ │ │ │ │ + 112private: │ │ │ │ │ +113 friend class pqxx::result; │ │ │ │ │ + 114 const_result_iterator(const pqxx::result *r, result_size_type i) noexcept │ │ │ │ │ +: │ │ │ │ │ + 115 row{*r, i} {} │ │ │ │ │ + 116}; │ │ │ │ │ + 117 │ │ │ │ │ + 118 │ │ │ │ │ +120class PQXX_LIBEXPORT const_reverse_result_iterator : │ │ │ │ │ + 121 private const_result_iterator │ │ │ │ │ + 122{ │ │ │ │ │ + 123public: │ │ │ │ │ +124 using super = const_result_iterator; │ │ │ │ │ +125 using iterator_type = const_result_iterator; │ │ │ │ │ + 126 using iterator_type::iterator_category; │ │ │ │ │ + 127 using iterator_type::difference_type; │ │ │ │ │ + 128 using iterator_type::pointer; │ │ │ │ │ +129 using value_type = iterator_type::value_type; │ │ │ │ │ +130 using reference = iterator_type::reference; │ │ │ │ │ + 131 │ │ │ │ │ +132 const_reverse_result_iterator( //[t75] │ │ │ │ │ + 133 const const_reverse_result_iterator &rhs) : │ │ │ │ │ + 134 const_result_iterator{rhs} {} │ │ │ │ │ +135 explicit const_reverse_result_iterator( //[t75] │ │ │ │ │ + 136 const const_result_iterator &rhs) : │ │ │ │ │ + 137 const_result_iterator{rhs} { super::operator--(); } │ │ │ │ │ + 138 │ │ │ │ │ + 139 PQXX_PURE const_result_iterator base() const noexcept; //[t75] │ │ │ │ │ + 140 │ │ │ │ │ + 145 using const_result_iterator::operator->; //[t75] │ │ │ │ │ + 146 using const_result_iterator::operator*; //[t75] │ │ │ │ │ + 148 │ │ │ │ │ +153 const_reverse_result_iterator &operator=( //[t75] │ │ │ │ │ + 154 const const_reverse_result_iterator &r) │ │ │ │ │ + 155 { iterator_type::operator=(r); return *this; } │ │ │ │ │ +156 const_reverse_result_iterator &operator++() //[t75] │ │ │ │ │ + 157 { iterator_type::operator--(); return *this; } │ │ │ │ │ + 158 const_reverse_result_iterator operator++(int); //[t75] │ │ │ │ │ +159 const_reverse_result_iterator &operator--() //[t75] │ │ │ │ │ + 160 { iterator_type::operator++(); return *this; } │ │ │ │ │ + 161 const_reverse_result_iterator operator--(int); //[t75] │ │ │ │ │ +162 const_reverse_result_iterator &operator+=(difference_type i) //[t75] │ │ │ │ │ + 163 { iterator_type::operator-=(i); return *this; } │ │ │ │ │ +164 const_reverse_result_iterator &operator-=(difference_type i) //[t75] │ │ │ │ │ + 165 { iterator_type::operator+=(i); return *this; } │ │ │ │ │ + 167 │ │ │ │ │ +172 const_reverse_result_iterator operator+(difference_type i) const //[t75] │ │ │ │ │ + 173 { return const_reverse_result_iterator(base() - i); } │ │ │ │ │ +174 const_reverse_result_iterator operator-(difference_type i) //[t75] │ │ │ │ │ + 175 { return const_reverse_result_iterator(base() + i); } │ │ │ │ │ +176 difference_type operator-( //[t75] │ │ │ │ │ + 177 const const_reverse_result_iterator &rhs) const │ │ │ │ │ + 178 { return rhs.const_result_iterator::operator-(*this); } │ │ │ │ │ + 180 │ │ │ │ │ +185 bool operator==( //[t75] │ │ │ │ │ + 186 const const_reverse_result_iterator &rhs) const noexcept │ │ │ │ │ + 187 { return iterator_type::operator==(rhs); } │ │ │ │ │ +188 bool operator!=( //[t75] │ │ │ │ │ + 189 const const_reverse_result_iterator &rhs) const noexcept │ │ │ │ │ + 190 { return not operator==(rhs); } │ │ │ │ │ + 191 │ │ │ │ │ +192 bool operator<(const const_reverse_result_iterator &rhs) const //[t75] │ │ │ │ │ + 193 { return iterator_type::operator>(rhs); } │ │ │ │ │ +194 bool operator<=(const const_reverse_result_iterator &rhs) const //[t75] │ │ │ │ │ + 195 { return iterator_type::operator>=(rhs); } │ │ │ │ │ +196 bool operator>(const const_reverse_result_iterator &rhs) const //[t75] │ │ │ │ │ + 197 { return iterator_type::operator<(rhs); } │ │ │ │ │ +198 bool operator>=(const const_reverse_result_iterator &rhs) const //[t75] │ │ │ │ │ + 199 { return iterator_type::operator<=(rhs); } │ │ │ │ │ + 201}; │ │ │ │ │ + 202 │ │ │ │ │ + 203 │ │ │ │ │ + 204inline const_result_iterator │ │ │ │ │ +205const_result_iterator::operator+(result::difference_type o) const │ │ │ │ │ + 206{ │ │ │ │ │ + 207 return const_result_iterator{ │ │ │ │ │ + 208 &m_result, size_type(result::difference_type(m_index) + o)}; │ │ │ │ │ + 209} │ │ │ │ │ + 210 │ │ │ │ │ + 211inline const_result_iterator │ │ │ │ │ +212operator+(result::difference_type o, const_result_iterator i) │ │ │ │ │ + 213 { return i + o; } │ │ │ │ │ + 214 │ │ │ │ │ + 215inline const_result_iterator │ │ │ │ │ +216const_result_iterator::operator-(result::difference_type o) const │ │ │ │ │ + 217{ │ │ │ │ │ + 218 return const_result_iterator{ │ │ │ │ │ + 219 &m_result, │ │ │ │ │ + 220 result_size_type(result::difference_type(m_index) - o)}; │ │ │ │ │ + 221} │ │ │ │ │ + 222 │ │ │ │ │ + 223inline result::difference_type │ │ │ │ │ +224const_result_iterator::operator-(const_result_iterator i) const │ │ │ │ │ + 225 { return result::difference_type(num() - i.num()); } │ │ │ │ │ + 226 │ │ │ │ │ +227inline const_result_iterator result::end() const noexcept │ │ │ │ │ + 228 { return const_result_iterator{this, size()}; } │ │ │ │ │ + 229 │ │ │ │ │ + 230 │ │ │ │ │ +231inline const_result_iterator result::cend() const noexcept │ │ │ │ │ + 232 { return end(); } │ │ │ │ │ + 233 │ │ │ │ │ + 234 │ │ │ │ │ + 235inline const_reverse_result_iterator │ │ │ │ │ +236operator+( │ │ │ │ │ + 237 result::difference_type n, │ │ │ │ │ + 238 const const_reverse_result_iterator &i) │ │ │ │ │ + 239 { return const_reverse_result_iterator{i.base() - n}; } │ │ │ │ │ + 240 │ │ │ │ │ + 241} // namespace pqxx │ │ │ │ │ + 242 │ │ │ │ │ + 243#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 244 │ │ │ │ │ + 245#endif │ │ │ │ │ +pqxx │ │ │ │ │ +The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ +Definition: array.hxx:26 │ │ │ │ │ +pqxx::operator+ │ │ │ │ │ +const_result_iterator operator+(result::difference_type o, │ │ │ │ │ +const_result_iterator i) │ │ │ │ │ +Definition: result_iterator.hxx:212 │ │ │ │ │ +pqxx::result_difference_type │ │ │ │ │ +signed long result_difference_type │ │ │ │ │ +Difference between result sizes. │ │ │ │ │ +Definition: types.hxx:21 │ │ │ │ │ +pqxx::result_size_type │ │ │ │ │ +unsigned long result_size_type │ │ │ │ │ +Number of rows in a result set. │ │ │ │ │ +Definition: types.hxx:18 │ │ │ │ │ +pqxx::result │ │ │ │ │ +Result set containing data returned by a query or command. │ │ │ │ │ +Definition: result.hxx:70 │ │ │ │ │ +pqxx::result::end │ │ │ │ │ +const_iterator end() const noexcept │ │ │ │ │ +Definition: result_iterator.hxx:227 │ │ │ │ │ +pqxx::result::difference_type │ │ │ │ │ +result_difference_type difference_type │ │ │ │ │ +Definition: result.hxx:73 │ │ │ │ │ +pqxx::result::size │ │ │ │ │ +PQXX_PURE size_type size() const noexcept │ │ │ │ │ +Definition: result.cxx:94 │ │ │ │ │ +pqxx::result::cend │ │ │ │ │ +const_iterator cend() const noexcept │ │ │ │ │ +Definition: result_iterator.hxx:231 │ │ │ │ │ +pqxx::const_result_iterator │ │ │ │ │ +Iterator for rows in a result. Use as result::const_iterator. │ │ │ │ │ +Definition: result_iterator.hxx:36 │ │ │ │ │ +pqxx::const_result_iterator::operator!= │ │ │ │ │ +bool operator!=(const const_result_iterator &i) const │ │ │ │ │ +Definition: result_iterator.hxx:88 │ │ │ │ │ +pqxx::const_result_iterator::operator-= │ │ │ │ │ +const_result_iterator & operator-=(difference_type i) │ │ │ │ │ +Definition: result_iterator.hxx:78 │ │ │ │ │ +pqxx::const_result_iterator::operator++ │ │ │ │ │ +const_result_iterator & operator++() │ │ │ │ │ +Definition: result_iterator.hxx:72 │ │ │ │ │ +pqxx::const_result_iterator::const_result_iterator │ │ │ │ │ +const_result_iterator(const row &t) noexcept │ │ │ │ │ +Definition: result_iterator.hxx:46 │ │ │ │ │ +pqxx::const_result_iterator::operator+ │ │ │ │ │ +const_result_iterator operator+(difference_type) const │ │ │ │ │ +Definition: result_iterator.hxx:205 │ │ │ │ │ +pqxx::const_result_iterator::iterator_category │ │ │ │ │ +std::random_access_iterator_tag iterator_category │ │ │ │ │ +Definition: result_iterator.hxx:38 │ │ │ │ │ +pqxx::const_result_iterator::operator- │ │ │ │ │ +const_result_iterator operator-(difference_type) const │ │ │ │ │ +Definition: result_iterator.hxx:216 │ │ │ │ │ +pqxx::const_result_iterator::operator< │ │ │ │ │ +bool operator<(const const_result_iterator &i) const │ │ │ │ │ +Definition: result_iterator.hxx:90 │ │ │ │ │ +pqxx::const_result_iterator::operator> │ │ │ │ │ +bool operator>(const const_result_iterator &i) const │ │ │ │ │ +Definition: result_iterator.hxx:94 │ │ │ │ │ +pqxx::const_result_iterator::operator== │ │ │ │ │ +bool operator==(const const_result_iterator &i) const │ │ │ │ │ +Definition: result_iterator.hxx:86 │ │ │ │ │ +pqxx::const_result_iterator::operator+= │ │ │ │ │ +const_result_iterator & operator+=(difference_type i) │ │ │ │ │ +Definition: result_iterator.hxx:76 │ │ │ │ │ +pqxx::const_result_iterator::operator-> │ │ │ │ │ +pointer operator->() const │ │ │ │ │ +Definition: result_iterator.hxx:63 │ │ │ │ │ +pqxx::const_result_iterator::operator<= │ │ │ │ │ +bool operator<=(const const_result_iterator &i) const │ │ │ │ │ +Definition: result_iterator.hxx:92 │ │ │ │ │ +pqxx::const_result_iterator::difference_type │ │ │ │ │ +result_difference_type difference_type │ │ │ │ │ +Definition: result_iterator.hxx:43 │ │ │ │ │ +pqxx::const_result_iterator::size_type │ │ │ │ │ +result_size_type size_type │ │ │ │ │ +Definition: result_iterator.hxx:42 │ │ │ │ │ +pqxx::const_result_iterator::operator>= │ │ │ │ │ +bool operator>=(const const_result_iterator &i) const │ │ │ │ │ +Definition: result_iterator.hxx:96 │ │ │ │ │ +pqxx::const_result_iterator::operator* │ │ │ │ │ +reference operator*() const │ │ │ │ │ +Definition: result_iterator.hxx:64 │ │ │ │ │ +pqxx::const_result_iterator::operator-- │ │ │ │ │ +const_result_iterator & operator--() │ │ │ │ │ +Definition: result_iterator.hxx:74 │ │ │ │ │ +pqxx::const_result_iterator::const_result_iterator │ │ │ │ │ +const_result_iterator() noexcept │ │ │ │ │ +Definition: result_iterator.hxx:45 │ │ │ │ │ +pqxx::const_reverse_result_iterator │ │ │ │ │ +Reverse iterator for result. Use as result::const_reverse_iterator. │ │ │ │ │ +Definition: result_iterator.hxx:122 │ │ │ │ │ +pqxx::const_reverse_result_iterator::base │ │ │ │ │ +PQXX_PURE const_result_iterator base() const noexcept │ │ │ │ │ +Definition: result.cxx:425 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator>= │ │ │ │ │ +bool operator>=(const const_reverse_result_iterator &rhs) const │ │ │ │ │ +Definition: result_iterator.hxx:198 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator+ │ │ │ │ │ +const_reverse_result_iterator operator+(difference_type i) const │ │ │ │ │ +Definition: result_iterator.hxx:172 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator!= │ │ │ │ │ +bool operator!=(const const_reverse_result_iterator &rhs) const noexcept │ │ │ │ │ +Definition: result_iterator.hxx:188 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator-= │ │ │ │ │ +const_reverse_result_iterator & operator-=(difference_type i) │ │ │ │ │ +Definition: result_iterator.hxx:164 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator+= │ │ │ │ │ +const_reverse_result_iterator & operator+=(difference_type i) │ │ │ │ │ +Definition: result_iterator.hxx:162 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator== │ │ │ │ │ +bool operator==(const const_reverse_result_iterator &rhs) const noexcept │ │ │ │ │ +Definition: result_iterator.hxx:185 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator< │ │ │ │ │ +bool operator<(const const_reverse_result_iterator &rhs) const │ │ │ │ │ +Definition: result_iterator.hxx:192 │ │ │ │ │ +pqxx::const_reverse_result_iterator::const_reverse_result_iterator │ │ │ │ │ +const_reverse_result_iterator(const const_reverse_result_iterator &rhs) │ │ │ │ │ +Definition: result_iterator.hxx:132 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator- │ │ │ │ │ +const_reverse_result_iterator operator-(difference_type i) │ │ │ │ │ +Definition: result_iterator.hxx:174 │ │ │ │ │ +pqxx::const_reverse_result_iterator::const_reverse_result_iterator │ │ │ │ │ +const_reverse_result_iterator(const const_result_iterator &rhs) │ │ │ │ │ +Definition: result_iterator.hxx:135 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator> │ │ │ │ │ +bool operator>(const const_reverse_result_iterator &rhs) const │ │ │ │ │ +Definition: result_iterator.hxx:196 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator- │ │ │ │ │ +difference_type operator-(const const_reverse_result_iterator &rhs) const │ │ │ │ │ +Definition: result_iterator.hxx:176 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator<= │ │ │ │ │ +bool operator<=(const const_reverse_result_iterator &rhs) const │ │ │ │ │ +Definition: result_iterator.hxx:194 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator-- │ │ │ │ │ +const_reverse_result_iterator & operator--() │ │ │ │ │ +Definition: result_iterator.hxx:159 │ │ │ │ │ +pqxx::const_reverse_result_iterator::operator++ │ │ │ │ │ +const_reverse_result_iterator & operator++() │ │ │ │ │ +Definition: result_iterator.hxx:156 │ │ │ │ │ +pqxx::row │ │ │ │ │ +Reference to one row in a result. │ │ │ │ │ +Definition: row.hxx:41 │ │ │ │ │ +pqxx::row::num │ │ │ │ │ +size_t num() const │ │ │ │ │ +Definition: row.hxx:170 │ │ │ │ │ +pqxx::row::m_result │ │ │ │ │ +result m_result │ │ │ │ │ +Result set of which this is one row. │ │ │ │ │ +Definition: row.hxx:192 │ │ │ │ │ +pqxx::row::m_index │ │ │ │ │ +long m_index │ │ │ │ │ +Row number. │ │ │ │ │ +Definition: row.hxx:198 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * config.h │ │ │ │ │ + * result_iterator.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00047_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: tablewriter.hxx Source File │ │ │ │ +libpqxx: cursor.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,245 +55,318 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
tablewriter.hxx
│ │ │ │ +
cursor.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_TABLEWRITER
│ │ │ │ -
14#define PQXX_H_TABLEWRITER
│ │ │ │ +
13#ifndef PQXX_H_CURSOR
│ │ │ │ +
14#define PQXX_H_CURSOR
│ │ │ │
15
│ │ │ │ -
16#include <iterator>
│ │ │ │ -
17
│ │ │ │ -
18#include "pqxx/compiler-public.hxx"
│ │ │ │ -
19#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
20
│ │ │ │ -
21#include "pqxx/tablestream.hxx"
│ │ │ │ -
22
│ │ │ │ -
23
│ │ │ │ -
24namespace pqxx
│ │ │ │ -
25{
│ │ │ │ -
27
│ │ │ │ -
31class PQXX_LIBEXPORT tablewriter : public tablestream
│ │ │ │ -
32{
│ │ │ │ -
33public:
│ │ │ │ -
34 PQXX_DEPRECATED tablewriter(
│ │ │ │ - │ │ │ │ -
36 const std::string &WName,
│ │ │ │ -
37 const std::string &Null=std::string{});
│ │ │ │ -
38 template<typename ITER>
│ │ │ │ -
39 PQXX_DEPRECATED tablewriter(
│ │ │ │ - │ │ │ │ -
41 const std::string &WName,
│ │ │ │ -
42 ITER begincolumns,
│ │ │ │ -
43 ITER endcolumns);
│ │ │ │ -
44 template<typename ITER>
│ │ │ │ -
45 PQXX_DEPRECATED tablewriter(
│ │ │ │ - │ │ │ │ -
47 const std::string &WName,
│ │ │ │ -
48 ITER begincolumns,
│ │ │ │ -
49 ITER endcolumns,
│ │ │ │ -
50 const std::string &Null);
│ │ │ │ -
51 ~tablewriter() noexcept;
│ │ │ │ -
52 template<typename IT> void insert(IT Begin, IT End);
│ │ │ │ -
53 template<typename TUPLE> void insert(const TUPLE &);
│ │ │ │ -
54 template<typename IT> void push_back(IT Begin, IT End);
│ │ │ │ -
55 template<typename TUPLE> void push_back(const TUPLE &);
│ │ │ │ -
56 template<typename SIZE> void reserve(SIZE) {}
│ │ │ │ -
57 template<typename TUPLE> tablewriter &operator<<(const TUPLE &);
│ │ │ │ - │ │ │ │ -
59 template<typename IT> std::string generate(IT Begin, IT End) const;
│ │ │ │ -
60 template<typename TUPLE> std::string generate(const TUPLE &) const;
│ │ │ │ -
61 virtual void complete() override;
│ │ │ │ -
62 void write_raw_line(const std::string &);
│ │ │ │ -
63private:
│ │ │ │ -
64 void set_up(
│ │ │ │ - │ │ │ │ -
66 const std::string &WName,
│ │ │ │ -
67 const std::string &Columns = std::string{});
│ │ │ │ -
68 PQXX_PRIVATE void writer_close();
│ │ │ │ -
69};
│ │ │ │ -
70} // namespace pqxx
│ │ │ │ +
16#include "pqxx/compiler-public.hxx"
│ │ │ │ +
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
18
│ │ │ │ +
19#include <limits>
│ │ │ │ +
20#include <stdexcept>
│ │ │ │ +
21
│ │ │ │ +
22#include "pqxx/result.hxx"
│ │ │ │ +
23#include "pqxx/transaction_base.hxx"
│ │ │ │ +
24
│ │ │ │ +
25
│ │ │ │ +
26namespace pqxx
│ │ │ │ +
27{
│ │ │ │ +
29
│ │ │ │ +
40class PQXX_LIBEXPORT cursor_base
│ │ │ │ +
41{
│ │ │ │ +
42public:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
45
│ │ │ │ +
47
│ │ │ │ + │ │ │ │ +
51 {
│ │ │ │ + │ │ │ │ +
55 random_access
│ │ │ │ +
56 };
│ │ │ │ +
57
│ │ │ │ +
59
│ │ │ │ + │ │ │ │ +
63 {
│ │ │ │ + │ │ │ │ +
67 update
│ │ │ │ +
68 };
│ │ │ │ +
69
│ │ │ │
71
│ │ │ │ -
72
│ │ │ │ -
73namespace std
│ │ │ │ -
74{
│ │ │ │ -
75template<>
│ │ │ │ -
76 class back_insert_iterator<pqxx::tablewriter>
│ │ │ │ -
77{
│ │ │ │ -
78public:
│ │ │ │ -
79 using iterator_category = output_iterator_tag;
│ │ │ │ -
80
│ │ │ │ - │ │ │ │ -
82 m_writer{&W} {}
│ │ │ │ -
83
│ │ │ │ -
84 back_insert_iterator &
│ │ │ │ -
85 operator=(const back_insert_iterator &rhs) noexcept
│ │ │ │ -
86 {
│ │ │ │ -
87 m_writer = rhs.m_writer;
│ │ │ │ -
88 return *this;
│ │ │ │ -
89 }
│ │ │ │ -
90
│ │ │ │ -
91 template<typename TUPLE>
│ │ │ │ -
92 back_insert_iterator &operator=(const TUPLE &T)
│ │ │ │ -
93 {
│ │ │ │ -
94 m_writer->insert(T);
│ │ │ │ -
95 return *this;
│ │ │ │ -
96 }
│ │ │ │ -
97
│ │ │ │ -
98 back_insert_iterator &operator++() { return *this; }
│ │ │ │ -
99 back_insert_iterator &operator++(int) { return *this; }
│ │ │ │ -
100 back_insert_iterator &operator*() { return *this; }
│ │ │ │ -
101
│ │ │ │ -
102private:
│ │ │ │ -
103 pqxx::tablewriter *m_writer;
│ │ │ │ -
104};
│ │ │ │ -
105} // namespace std
│ │ │ │ -
106
│ │ │ │ + │ │ │ │ +
90 {
│ │ │ │ + │ │ │ │ +
94 loose
│ │ │ │ +
95 };
│ │ │ │ +
96
│ │ │ │ +
97 cursor_base() =delete;
│ │ │ │ +
98 cursor_base(const cursor_base &) =delete;
│ │ │ │ + │ │ │ │ +
100
│ │ │ │ +
105
│ │ │ │
107
│ │ │ │ -
108namespace pqxx
│ │ │ │ -
109{
│ │ │ │ -
110template<typename ITER> inline tablewriter::tablewriter(
│ │ │ │ - │ │ │ │ -
112 const std::string &WName,
│ │ │ │ -
113 ITER begincolumns,
│ │ │ │ -
114 ITER endcolumns) :
│ │ │ │ -
115 namedclass{"tablewriter", WName},
│ │ │ │ -
116 tablestream{T, std::string{}}
│ │ │ │ -
117{
│ │ │ │ -
118 set_up(T, WName, columnlist(begincolumns, endcolumns));
│ │ │ │ -
119}
│ │ │ │ -
120
│ │ │ │ +
110 static difference_type all() noexcept; //[t81]
│ │ │ │ +
111
│ │ │ │ +
113
│ │ │ │ +
115 static difference_type next() noexcept { return 1; } //[t81]
│ │ │ │ +
116
│ │ │ │ +
118
│ │ │ │ +
120 static difference_type prior() noexcept { return -1; } //[t00]
│ │ │ │
121
│ │ │ │ -
122template<typename ITER> inline tablewriter::tablewriter(
│ │ │ │ - │ │ │ │ -
124 const std::string &WName,
│ │ │ │ -
125 ITER begincolumns,
│ │ │ │ -
126 ITER endcolumns,
│ │ │ │ -
127 const std::string &Null) :
│ │ │ │ -
128 namedclass{"tablewriter", WName},
│ │ │ │ -
129 tablestream{T, Null}
│ │ │ │ -
130{
│ │ │ │ -
131 set_up(T, WName, columnlist(begincolumns, endcolumns));
│ │ │ │ -
132}
│ │ │ │ -
133
│ │ │ │ -
134
│ │ │ │ -
135namespace internal
│ │ │ │ -
136{
│ │ │ │ -
137PQXX_LIBEXPORT std::string escape(
│ │ │ │ -
138 const std::string &s,
│ │ │ │ -
139 const std::string &null);
│ │ │ │ -
140
│ │ │ │ -
141inline std::string escape_any(
│ │ │ │ -
142 const std::string &s,
│ │ │ │ -
143 const std::string &null)
│ │ │ │ -
144{ return escape(s, null); }
│ │ │ │ -
145
│ │ │ │ -
146inline std::string escape_any(
│ │ │ │ -
147 const char s[],
│ │ │ │ -
148 const std::string &null)
│ │ │ │ -
149{ return s ? escape(std::string{s}, null) : "\\N"; }
│ │ │ │ +
123
│ │ │ │ +
125 static difference_type backward_all() noexcept; //[t00]
│ │ │ │ +
126
│ │ │ │ +
128
│ │ │ │ +
130
│ │ │ │ +
135 const std::string &name() const noexcept { return m_name; } //[t81]
│ │ │ │ +
136
│ │ │ │ +
137protected:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
140 const std::string &Name,
│ │ │ │ +
141 bool embellish_name=true);
│ │ │ │ +
142
│ │ │ │ +
143 const std::string m_name;
│ │ │ │ +
144};
│ │ │ │ +
145} // namespace pqxx
│ │ │ │ +
146
│ │ │ │ +
147
│ │ │ │ +
148#include <pqxx/internal/sql_cursor.hxx>
│ │ │ │ +
149
│ │ │ │
150
│ │ │ │ -
151template<typename T> inline std::string escape_any(
│ │ │ │ -
152 const T &t,
│ │ │ │ -
153 const std::string &null)
│ │ │ │ -
154{ return escape(to_string(t), null); }
│ │ │ │ -
155
│ │ │ │ -
156
│ │ │ │ -
157template<typename IT> class Escaper
│ │ │ │ -
158{
│ │ │ │ -
159 const std::string &m_null;
│ │ │ │ -
160public:
│ │ │ │ -
161 explicit Escaper(const std::string &null) : m_null{null} {}
│ │ │ │ -
162 std::string operator()(IT i) const { return escape_any(*i, m_null); }
│ │ │ │ -
163};
│ │ │ │ -
164}
│ │ │ │ -
165
│ │ │ │ +
151namespace pqxx
│ │ │ │ +
152{
│ │ │ │ +
154
│ │ │ │ +
160template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
│ │ │ │ + │ │ │ │ +
162{
│ │ │ │ +
163public:
│ │ │ │ + │ │ │ │ + │ │ │ │
166
│ │ │ │ -
167template<typename IT>
│ │ │ │ -
168inline std::string tablewriter::generate(IT Begin, IT End) const
│ │ │ │ -
169{
│ │ │ │ -
170 return separated_list("\t", Begin, End, internal::Escaper<IT>{NullStr()});
│ │ │ │ -
171}
│ │ │ │ -
172template<typename TUPLE>
│ │ │ │ -
173inline std::string tablewriter::generate(const TUPLE &T) const
│ │ │ │ -
174{
│ │ │ │ -
175 return generate(std::begin(T), std::end(T));
│ │ │ │ -
176}
│ │ │ │ -
177
│ │ │ │ -
178template<typename IT> inline void tablewriter::insert(IT Begin, IT End)
│ │ │ │ -
179{
│ │ │ │ -
180 write_raw_line(generate(Begin, End));
│ │ │ │ -
181}
│ │ │ │ -
182
│ │ │ │ -
183template<typename TUPLE> inline void tablewriter::insert(const TUPLE &T)
│ │ │ │ -
184{
│ │ │ │ -
185 insert(std::begin(T), std::end(T));
│ │ │ │ -
186}
│ │ │ │ -
187
│ │ │ │ -
188template<typename IT>
│ │ │ │ -
189inline void tablewriter::push_back(IT Begin, IT End)
│ │ │ │ -
190{
│ │ │ │ -
191 insert(Begin, End);
│ │ │ │ -
192}
│ │ │ │ -
193
│ │ │ │ -
194template<typename TUPLE>
│ │ │ │ -
195inline void tablewriter::push_back(const TUPLE &T)
│ │ │ │ -
196{
│ │ │ │ -
197 insert(std::begin(T), std::end(T));
│ │ │ │ -
198}
│ │ │ │ -
199
│ │ │ │ -
200template<typename TUPLE>
│ │ │ │ - │ │ │ │ -
202{
│ │ │ │ -
203 insert(T);
│ │ │ │ -
204 return *this;
│ │ │ │ -
205}
│ │ │ │ -
206
│ │ │ │ -
207} // namespace pqxx
│ │ │ │ -
208#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
209#endif
│ │ │ │ + │ │ │ │ +
169 transaction_base &trans,
│ │ │ │ +
170 const std::string &query,
│ │ │ │ +
171 const std::string &cname,
│ │ │ │ +
172 bool hold) :
│ │ │ │ +
173 m_cur{trans, query, cname, cursor_base::random_access, up, op, hold}
│ │ │ │ +
174 {
│ │ │ │ +
175 }
│ │ │ │ +
176
│ │ │ │ + │ │ │ │ +
179 transaction_base &trans,
│ │ │ │ +
180 const std::string adopted_cursor) :
│ │ │ │ +
181 m_cur{trans, adopted_cursor, op}
│ │ │ │ +
182 {
│ │ │ │ +
183 // Put cursor in known position
│ │ │ │ +
184 m_cur.move(cursor_base::backward_all());
│ │ │ │ +
185 }
│ │ │ │ +
186
│ │ │ │ +
187 void close() noexcept { m_cur.close(); }
│ │ │ │ +
188
│ │ │ │ +
190
│ │ │ │ +
193 size_type size() { return internal::obtain_stateless_cursor_size(m_cur); }
│ │ │ │ +
194
│ │ │ │ +
196
│ │ │ │ + │ │ │ │ +
208 {
│ │ │ │ +
209 return internal::stateless_cursor_retrieve(
│ │ │ │ +
210 m_cur,
│ │ │ │ + │ │ │ │ +
212 begin_pos,
│ │ │ │ +
213 end_pos);
│ │ │ │ +
214 }
│ │ │ │ +
215
│ │ │ │ +
216 const std::string &name() const noexcept { return m_cur.name(); }
│ │ │ │ +
217
│ │ │ │ +
218private:
│ │ │ │ +
219 internal::sql_cursor m_cur;
│ │ │ │ +
220};
│ │ │ │ +
221
│ │ │ │ +
222
│ │ │ │ +
223class icursor_iterator;
│ │ │ │ +
224
│ │ │ │ +
225
│ │ │ │ +
226namespace internal
│ │ │ │ +
227{
│ │ │ │ +
228namespace gate
│ │ │ │ +
229{
│ │ │ │ +
230class icursor_iterator_icursorstream;
│ │ │ │ +
231class icursorstream_icursor_iterator;
│ │ │ │ +
232} // namespace internal::gate
│ │ │ │ +
233} // namespace internal
│ │ │ │ +
234
│ │ │ │ +
235
│ │ │ │ +
237
│ │ │ │ +
252class PQXX_LIBEXPORT icursorstream
│ │ │ │ +
253{
│ │ │ │ +
254public:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
257
│ │ │ │ +
259
│ │ │ │ + │ │ │ │ +
271 transaction_base &context,
│ │ │ │ +
272 const std::string &query,
│ │ │ │ +
273 const std::string &basename,
│ │ │ │ +
274 difference_type sstride=1); //[t81]
│ │ │ │ +
275
│ │ │ │ +
277
│ │ │ │ + │ │ │ │ +
302 transaction_base &context,
│ │ │ │ +
303 const field &cname,
│ │ │ │ +
304 difference_type sstride=1,
│ │ │ │ + │ │ │ │ +
306
│ │ │ │ +
307 operator bool() const noexcept { return not m_done; }
│ │ │ │ +
308
│ │ │ │ +
310
│ │ │ │ +
316 icursorstream &get(result &res) { res = fetchblock(); return *this; } //[t81]
│ │ │ │ +
318
│ │ │ │ +
324 icursorstream &operator>>(result &res) { return get(res); } //[t81]
│ │ │ │ +
325
│ │ │ │ +
327
│ │ │ │ +
331 icursorstream &ignore(std::streamsize n=1); //[t81]
│ │ │ │ +
332
│ │ │ │ +
334
│ │ │ │ +
337 void set_stride(difference_type stride); //[t81]
│ │ │ │ +
338 difference_type stride() const noexcept { return m_stride; } //[t81]
│ │ │ │ +
339
│ │ │ │ +
340private:
│ │ │ │ +
341 result fetchblock();
│ │ │ │ +
342
│ │ │ │ +
343 friend class internal::gate::icursorstream_icursor_iterator;
│ │ │ │ +
344 size_type forward(size_type n=1);
│ │ │ │ +
345 void insert_iterator(icursor_iterator *) noexcept;
│ │ │ │ +
346 void remove_iterator(icursor_iterator *) const noexcept;
│ │ │ │ +
347
│ │ │ │ +
348 void service_iterators(difference_type);
│ │ │ │ +
349
│ │ │ │ +
350 internal::sql_cursor m_cur;
│ │ │ │ +
351
│ │ │ │ +
352 difference_type m_stride;
│ │ │ │ +
353 difference_type m_realpos, m_reqpos;
│ │ │ │ +
354
│ │ │ │ +
355 mutable icursor_iterator *m_iterators;
│ │ │ │ +
356
│ │ │ │ +
357 bool m_done;
│ │ │ │ +
358};
│ │ │ │ +
359
│ │ │ │ +
360
│ │ │ │ +
362
│ │ │ │ +
388class PQXX_LIBEXPORT icursor_iterator
│ │ │ │ +
389{
│ │ │ │ +
390public:
│ │ │ │ +
391 using iterator_category = std::input_iterator_tag;
│ │ │ │ + │ │ │ │ +
393 using pointer = const result *;
│ │ │ │ +
394 using reference = const result &;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
398
│ │ │ │ +
399 icursor_iterator() noexcept; //[t84]
│ │ │ │ +
400 explicit icursor_iterator(istream_type &) noexcept; //[t84]
│ │ │ │ +
401 icursor_iterator(const icursor_iterator &) noexcept; //[t84]
│ │ │ │ +
402 ~icursor_iterator() noexcept;
│ │ │ │ +
403
│ │ │ │ +
404 const result &operator*() const { refresh(); return m_here; } //[t84]
│ │ │ │ +
405 const result *operator->() const { refresh(); return &m_here; } //[t84]
│ │ │ │ +
406 icursor_iterator &operator++(); //[t84]
│ │ │ │ +
407 icursor_iterator operator++(int); //[t84]
│ │ │ │ +
408 icursor_iterator &operator+=(difference_type); //[t84]
│ │ │ │ +
409 icursor_iterator &operator=(const icursor_iterator &) noexcept; //[t84]
│ │ │ │ +
410
│ │ │ │ +
411 bool operator==(const icursor_iterator &rhs) const; //[t84]
│ │ │ │ +
412 bool operator!=(const icursor_iterator &rhs) const noexcept //[t84]
│ │ │ │ +
413 { return not operator==(rhs); }
│ │ │ │ +
414 bool operator<(const icursor_iterator &rhs) const; //[t84]
│ │ │ │ +
415 bool operator>(const icursor_iterator &rhs) const //[t84]
│ │ │ │ +
416 { return rhs < *this; }
│ │ │ │ +
417 bool operator<=(const icursor_iterator &rhs) const //[t84]
│ │ │ │ +
418 { return not (*this > rhs); }
│ │ │ │ +
419 bool operator>=(const icursor_iterator &rhs) const //[t84]
│ │ │ │ +
420 { return not (*this < rhs); }
│ │ │ │ +
421
│ │ │ │ +
422private:
│ │ │ │ +
423 void refresh() const;
│ │ │ │ +
424
│ │ │ │ +
425 friend class internal::gate::icursor_iterator_icursorstream;
│ │ │ │ +
426 difference_type pos() const noexcept { return m_pos; }
│ │ │ │ +
427 void fill(const result &);
│ │ │ │ +
428
│ │ │ │ +
429 icursorstream *m_stream = nullptr;
│ │ │ │ +
430 result m_here;
│ │ │ │ +
431 difference_type m_pos;
│ │ │ │ +
432 icursor_iterator *m_prev = nullptr, *m_next = nullptr;
│ │ │ │ +
433};
│ │ │ │ +
434} // namespace pqxx
│ │ │ │ +
435
│ │ │ │ +
436#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
437#endif
│ │ │ │
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
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
│ │ │ │ -
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
│ │ │ │ -
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
│ │ │ │ -
std::string escape(const std::string &s, const std::string &null)
Definition: tablewriter.cxx:131
│ │ │ │ -
std::string escape_any(const std::string &s, const std::string &null)
Definition: tablewriter.hxx:141
│ │ │ │ -
Definition: tablereader.hxx:30
│ │ │ │ -
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
│ │ │ │ -
const std::string & NullStr() const
Definition: tablestream.hxx:36
│ │ │ │ -
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
│ │ │ │ -
Definition: tablewriter.hxx:32
│ │ │ │ -
tablewriter(transaction_base &, const std::string &WName, const std::string &Null=std::string{})
Definition: tablewriter.cxx:22
│ │ │ │ -
void reserve(SIZE)
Definition: tablewriter.hxx:56
│ │ │ │ -
void insert(IT Begin, IT End)
Definition: tablewriter.hxx:178
│ │ │ │ -
std::string generate(IT Begin, IT End) const
Definition: tablewriter.hxx:168
│ │ │ │ -
void push_back(IT Begin, IT End)
Definition: tablewriter.hxx:189
│ │ │ │ -
tablewriter & operator<<(const TUPLE &)
Definition: tablewriter.hxx:201
│ │ │ │ -
void write_raw_line(const std::string &)
Definition: tablewriter.cxx:65
│ │ │ │ -
back_insert_iterator & operator*()
Definition: tablewriter.hxx:100
│ │ │ │ -
back_insert_iterator(pqxx::tablewriter &W) noexcept
Definition: tablewriter.hxx:81
│ │ │ │ -
back_insert_iterator & operator=(const back_insert_iterator &rhs) noexcept
Definition: tablewriter.hxx:85
│ │ │ │ -
back_insert_iterator & operator=(const TUPLE &T)
Definition: tablewriter.hxx:92
│ │ │ │ -
back_insert_iterator & operator++()
Definition: tablewriter.hxx:98
│ │ │ │ -
back_insert_iterator & operator++(int)
Definition: tablewriter.hxx:99
│ │ │ │ -
output_iterator_tag iterator_category
Definition: tablewriter.hxx:79
│ │ │ │ -
Definition: tablewriter.hxx:158
│ │ │ │ -
std::string operator()(IT i) const
Definition: tablewriter.hxx:162
│ │ │ │ -
Escaper(const std::string &null)
Definition: tablewriter.hxx:161
│ │ │ │ +
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
│ │ │ │ +
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
│ │ │ │ +
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ +
Common definitions for cursor types.
Definition: cursor.hxx:41
│ │ │ │ +
static difference_type prior() noexcept
Special value: read backwards, one row only.
Definition: cursor.hxx:120
│ │ │ │ +
static difference_type backward_all() noexcept
Special value: read backwards from current position back to origin.
Definition: cursor.cxx:35
│ │ │ │ +
cursor_base(const cursor_base &)=delete
│ │ │ │ +
accesspolicy
Cursor access-pattern policy.
Definition: cursor.hxx:51
│ │ │ │ +
@ forward_only
Cursor can move forward only.
Definition: cursor.hxx:53
│ │ │ │ +
result_size_type size_type
Definition: cursor.hxx:43
│ │ │ │ +
ownershippolicy
Cursor destruction policy.
Definition: cursor.hxx:90
│ │ │ │ +
@ owned
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:92
│ │ │ │ +
const std::string m_name
Definition: cursor.hxx:143
│ │ │ │ +
cursor_base()=delete
│ │ │ │ +
updatepolicy
Cursor update policy.
Definition: cursor.hxx:63
│ │ │ │ +
@ read_only
Cursor can be used to read data but not to write.
Definition: cursor.hxx:65
│ │ │ │ +
cursor_base & operator=(const cursor_base &)=delete
│ │ │ │ +
result_difference_type difference_type
Definition: cursor.hxx:44
│ │ │ │ +
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:162
│ │ │ │ +
const std::string & name() const noexcept
Definition: cursor.hxx:216
│ │ │ │ +
void close() noexcept
Definition: cursor.hxx:187
│ │ │ │ +
stateless_cursor(transaction_base &trans, const std::string adopted_cursor)
Adopt existing scrolling SQL cursor.
Definition: cursor.hxx:178
│ │ │ │ +
result_size_type size_type
Definition: cursor.hxx:164
│ │ │ │ +
result_difference_type difference_type
Definition: cursor.hxx:165
│ │ │ │ +
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:207
│ │ │ │ +
stateless_cursor(transaction_base &trans, const std::string &query, const std::string &cname, bool hold)
Create cursor.
Definition: cursor.hxx:168
│ │ │ │ +
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:193
│ │ │ │ +
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:253
│ │ │ │ +
cursor_base::size_type size_type
Definition: cursor.hxx:255
│ │ │ │ +
icursorstream & get(result &res)
Read new value into given result object; same as operator >>
Definition: cursor.hxx:316
│ │ │ │ +
difference_type stride() const noexcept
Definition: cursor.hxx:338
│ │ │ │ +
cursor_base::difference_type difference_type
Definition: cursor.hxx:256
│ │ │ │ +
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result &)
Definition: cursor.hxx:324
│ │ │ │ +
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:389
│ │ │ │ +
bool operator<=(const icursor_iterator &rhs) const
Definition: cursor.hxx:417
│ │ │ │ +
bool operator!=(const icursor_iterator &rhs) const noexcept
Definition: cursor.hxx:412
│ │ │ │ +
bool operator>(const icursor_iterator &rhs) const
Definition: cursor.hxx:415
│ │ │ │ +
istream_type::difference_type difference_type
Definition: cursor.hxx:397
│ │ │ │ +
const result * operator->() const
Definition: cursor.hxx:405
│ │ │ │ +
std::input_iterator_tag iterator_category
Definition: cursor.hxx:391
│ │ │ │ +
bool operator>=(const icursor_iterator &rhs) const
Definition: cursor.hxx:419
│ │ │ │ +
istream_type::size_type size_type
Definition: cursor.hxx:396
│ │ │ │ +
Reference to a field in a result set.
Definition: field.hxx:50
│ │ │ │ +
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ +
result_difference_type difference_type
Definition: result.hxx:73
│ │ │ │
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,298 +1,419 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -tablewriter.hxx │ │ │ │ │ +cursor.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_TABLEWRITER │ │ │ │ │ - 14#define PQXX_H_TABLEWRITER │ │ │ │ │ + 13#ifndef PQXX_H_CURSOR │ │ │ │ │ + 14#define PQXX_H_CURSOR │ │ │ │ │ 15 │ │ │ │ │ - 16#include │ │ │ │ │ - 17 │ │ │ │ │ - 18#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 19#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 20 │ │ │ │ │ - 21#include "pqxx/tablestream.hxx" │ │ │ │ │ - 22 │ │ │ │ │ - 23 │ │ │ │ │ - 24namespace pqxx │ │ │ │ │ - 25{ │ │ │ │ │ - 27 │ │ │ │ │ -31class PQXX_LIBEXPORT tablewriter : public tablestream │ │ │ │ │ - 32{ │ │ │ │ │ - 33public: │ │ │ │ │ - 34 PQXX_DEPRECATED tablewriter( │ │ │ │ │ - 35 transaction_base &, │ │ │ │ │ - 36 const std::string &WName, │ │ │ │ │ - 37 const std::string &Null=std::string{}); │ │ │ │ │ - 38 template │ │ │ │ │ - 39 PQXX_DEPRECATED tablewriter( │ │ │ │ │ - 40 transaction_base &, │ │ │ │ │ - 41 const std::string &WName, │ │ │ │ │ - 42 ITER begincolumns, │ │ │ │ │ - 43 ITER endcolumns); │ │ │ │ │ - 44 template │ │ │ │ │ - 45 PQXX_DEPRECATED tablewriter( │ │ │ │ │ - 46 transaction_base &T, │ │ │ │ │ - 47 const std::string &WName, │ │ │ │ │ - 48 ITER begincolumns, │ │ │ │ │ - 49 ITER endcolumns, │ │ │ │ │ - 50 const std::string &Null); │ │ │ │ │ - 51 ~tablewriter() noexcept; │ │ │ │ │ - 52 template void insert(IT Begin, IT End); │ │ │ │ │ - 53 template void insert(const TUPLE &); │ │ │ │ │ - 54 template void push_back(IT Begin, IT End); │ │ │ │ │ - 55 template void push_back(const TUPLE &); │ │ │ │ │ -56 template void reserve(SIZE) {} │ │ │ │ │ - 57 template tablewriter &operator<<(const TUPLE &); │ │ │ │ │ - 58 tablewriter &operator<<(tablereader &); │ │ │ │ │ - 59 template std::string generate(IT Begin, IT End) const; │ │ │ │ │ - 60 template std::string generate(const TUPLE &) const; │ │ │ │ │ - 61 virtual void complete() override; │ │ │ │ │ - 62 void write_raw_line(const std::string &); │ │ │ │ │ - 63private: │ │ │ │ │ - 64 void set_up( │ │ │ │ │ - 65 transaction_base &, │ │ │ │ │ - 66 const std::string &WName, │ │ │ │ │ - 67 const std::string &Columns = std::string{}); │ │ │ │ │ - 68 PQXX_PRIVATE void writer_close(); │ │ │ │ │ - 69}; │ │ │ │ │ - 70} // namespace pqxx │ │ │ │ │ + 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 18 │ │ │ │ │ + 19#include │ │ │ │ │ + 20#include │ │ │ │ │ + 21 │ │ │ │ │ + 22#include "pqxx/result.hxx" │ │ │ │ │ + 23#include "pqxx/transaction_base.hxx" │ │ │ │ │ + 24 │ │ │ │ │ + 25 │ │ │ │ │ + 26namespace pqxx │ │ │ │ │ + 27{ │ │ │ │ │ + 29 │ │ │ │ │ +40class PQXX_LIBEXPORT cursor_base │ │ │ │ │ + 41{ │ │ │ │ │ + 42public: │ │ │ │ │ +43 using size_type = result_size_type; │ │ │ │ │ +44 using difference_type = result_difference_type; │ │ │ │ │ + 45 │ │ │ │ │ + 47 │ │ │ │ │ +50 enum accesspolicy │ │ │ │ │ + 51 { │ │ │ │ │ +53 forward_only, │ │ │ │ │ + 55 random_access │ │ │ │ │ +56 }; │ │ │ │ │ + 57 │ │ │ │ │ + 59 │ │ │ │ │ +62 enum updatepolicy │ │ │ │ │ + 63 { │ │ │ │ │ +65 read_only, │ │ │ │ │ + 67 update │ │ │ │ │ +68 }; │ │ │ │ │ + 69 │ │ │ │ │ 71 │ │ │ │ │ - 72 │ │ │ │ │ - 73namespace std │ │ │ │ │ - 74{ │ │ │ │ │ - 75template<> │ │ │ │ │ -76 class back_insert_iterator │ │ │ │ │ - 77{ │ │ │ │ │ - 78public: │ │ │ │ │ -79 using iterator_category = output_iterator_tag; │ │ │ │ │ - 80 │ │ │ │ │ -81 explicit back_insert_iterator(pqxx::tablewriter &W) noexcept : │ │ │ │ │ - 82 m_writer{&W} {} │ │ │ │ │ - 83 │ │ │ │ │ - 84 back_insert_iterator & │ │ │ │ │ -85 operator=(const back_insert_iterator &rhs) noexcept │ │ │ │ │ - 86 { │ │ │ │ │ - 87 m_writer = rhs.m_writer; │ │ │ │ │ - 88 return *this; │ │ │ │ │ - 89 } │ │ │ │ │ - 90 │ │ │ │ │ - 91 template │ │ │ │ │ -92 back_insert_iterator &operator=(const TUPLE &T) │ │ │ │ │ - 93 { │ │ │ │ │ - 94 m_writer->insert(T); │ │ │ │ │ - 95 return *this; │ │ │ │ │ - 96 } │ │ │ │ │ - 97 │ │ │ │ │ -98 back_insert_iterator &operator++() { return *this; } │ │ │ │ │ -99 back_insert_iterator &operator++(int) { return *this; } │ │ │ │ │ -100 back_insert_iterator &operator*() { return *this; } │ │ │ │ │ - 101 │ │ │ │ │ - 102private: │ │ │ │ │ - 103 pqxx::tablewriter *m_writer; │ │ │ │ │ - 104}; │ │ │ │ │ - 105} // namespace std │ │ │ │ │ - 106 │ │ │ │ │ +89 enum ownershippolicy │ │ │ │ │ + 90 { │ │ │ │ │ +92 owned, │ │ │ │ │ + 94 loose │ │ │ │ │ +95 }; │ │ │ │ │ + 96 │ │ │ │ │ +97 cursor_base() =delete; │ │ │ │ │ +98 cursor_base(const cursor_base &) =delete; │ │ │ │ │ +99 cursor_base &operator=(const cursor_base &) =delete; │ │ │ │ │ + 100 │ │ │ │ │ + 105 │ │ │ │ │ 107 │ │ │ │ │ - 108namespace pqxx │ │ │ │ │ - 109{ │ │ │ │ │ -110template inline tablewriter::tablewriter( │ │ │ │ │ - 111 transaction_base &T, │ │ │ │ │ - 112 const std::string &WName, │ │ │ │ │ - 113 ITER begincolumns, │ │ │ │ │ - 114 ITER endcolumns) : │ │ │ │ │ - 115 namedclass{"tablewriter", WName}, │ │ │ │ │ - 116 tablestream{T, std::string{}} │ │ │ │ │ - 117{ │ │ │ │ │ - 118 set_up(T, WName, columnlist(begincolumns, endcolumns)); │ │ │ │ │ - 119} │ │ │ │ │ - 120 │ │ │ │ │ + 110 static difference_type all() noexcept; //[t81] │ │ │ │ │ + 111 │ │ │ │ │ + 113 │ │ │ │ │ +115 static difference_type next() noexcept { return 1; } //[t81] │ │ │ │ │ + 116 │ │ │ │ │ + 118 │ │ │ │ │ +120 static difference_type prior() noexcept { return -1; } //[t00] │ │ │ │ │ 121 │ │ │ │ │ -122template inline tablewriter::tablewriter( │ │ │ │ │ - 123 transaction_base &T, │ │ │ │ │ - 124 const std::string &WName, │ │ │ │ │ - 125 ITER begincolumns, │ │ │ │ │ - 126 ITER endcolumns, │ │ │ │ │ - 127 const std::string &Null) : │ │ │ │ │ - 128 namedclass{"tablewriter", WName}, │ │ │ │ │ - 129 tablestream{T, Null} │ │ │ │ │ - 130{ │ │ │ │ │ - 131 set_up(T, WName, columnlist(begincolumns, endcolumns)); │ │ │ │ │ - 132} │ │ │ │ │ - 133 │ │ │ │ │ - 134 │ │ │ │ │ - 135namespace internal │ │ │ │ │ - 136{ │ │ │ │ │ - 137PQXX_LIBEXPORT std::string escape( │ │ │ │ │ - 138 const std::string &s, │ │ │ │ │ - 139 const std::string &null); │ │ │ │ │ - 140 │ │ │ │ │ -141inline std::string escape_any( │ │ │ │ │ - 142 const std::string &s, │ │ │ │ │ - 143 const std::string &null) │ │ │ │ │ - 144{ return escape(s, null); } │ │ │ │ │ - 145 │ │ │ │ │ -146inline std::string escape_any( │ │ │ │ │ - 147 const char s[], │ │ │ │ │ - 148 const std::string &null) │ │ │ │ │ - 149{ return s ? escape(std::string{s}, null) : "\\N"; } │ │ │ │ │ + 123 │ │ │ │ │ + 125 static difference_type backward_all() noexcept; //[t00] │ │ │ │ │ + 126 │ │ │ │ │ + 128 │ │ │ │ │ + 130 │ │ │ │ │ +135 const std::string &name() const noexcept { return m_name; } //[t81] │ │ │ │ │ + 136 │ │ │ │ │ + 137protected: │ │ │ │ │ + 138 cursor_base( │ │ │ │ │ + 139 connection_base &, │ │ │ │ │ + 140 const std::string &Name, │ │ │ │ │ + 141 bool embellish_name=true); │ │ │ │ │ + 142 │ │ │ │ │ +143 const std::string m_name; │ │ │ │ │ + 144}; │ │ │ │ │ + 145} // namespace pqxx │ │ │ │ │ + 146 │ │ │ │ │ + 147 │ │ │ │ │ + 148#include │ │ │ │ │ + 149 │ │ │ │ │ 150 │ │ │ │ │ -151template inline std::string escape_any( │ │ │ │ │ - 152 const T &t, │ │ │ │ │ - 153 const std::string &null) │ │ │ │ │ - 154{ return escape(to_string(t), null); } │ │ │ │ │ - 155 │ │ │ │ │ - 156 │ │ │ │ │ -157template class Escaper │ │ │ │ │ - 158{ │ │ │ │ │ - 159 const std::string &m_null; │ │ │ │ │ - 160public: │ │ │ │ │ -161 explicit Escaper(const std::string &null) : m_null{null} {} │ │ │ │ │ -162 std::string operator()(IT i) const { return escape_any(*i, m_null); } │ │ │ │ │ - 163}; │ │ │ │ │ - 164} │ │ │ │ │ - 165 │ │ │ │ │ + 151namespace pqxx │ │ │ │ │ + 152{ │ │ │ │ │ + 154 │ │ │ │ │ + 160template │ │ │ │ │ +161class stateless_cursor │ │ │ │ │ + 162{ │ │ │ │ │ + 163public: │ │ │ │ │ +164 using size_type = result_size_type; │ │ │ │ │ +165 using difference_type = result_difference_type; │ │ │ │ │ 166 │ │ │ │ │ - 167template │ │ │ │ │ -168inline std::string tablewriter::generate(IT Begin, IT End) const │ │ │ │ │ - 169{ │ │ │ │ │ - 170 return separated_list("\t", Begin, End, internal::Escaper{NullStr()}); │ │ │ │ │ - 171} │ │ │ │ │ - 172template │ │ │ │ │ -173inline std::string tablewriter::generate(const TUPLE &T) const │ │ │ │ │ - 174{ │ │ │ │ │ - 175 return generate(std::begin(T), std::end(T)); │ │ │ │ │ - 176} │ │ │ │ │ - 177 │ │ │ │ │ -178template inline void tablewriter::insert(IT Begin, IT End) │ │ │ │ │ - 179{ │ │ │ │ │ - 180 write_raw_line(generate(Begin, End)); │ │ │ │ │ - 181} │ │ │ │ │ - 182 │ │ │ │ │ -183template inline void tablewriter::insert(const TUPLE &T) │ │ │ │ │ - 184{ │ │ │ │ │ - 185 insert(std::begin(T), std::end(T)); │ │ │ │ │ - 186} │ │ │ │ │ - 187 │ │ │ │ │ - 188template │ │ │ │ │ -189inline void tablewriter::push_back(IT Begin, IT End) │ │ │ │ │ - 190{ │ │ │ │ │ - 191 insert(Begin, End); │ │ │ │ │ - 192} │ │ │ │ │ - 193 │ │ │ │ │ - 194template │ │ │ │ │ -195inline void tablewriter::push_back(const TUPLE &T) │ │ │ │ │ - 196{ │ │ │ │ │ - 197 insert(std::begin(T), std::end(T)); │ │ │ │ │ - 198} │ │ │ │ │ - 199 │ │ │ │ │ - 200template │ │ │ │ │ -201inline tablewriter &tablewriter::operator<<(const TUPLE &T) │ │ │ │ │ - 202{ │ │ │ │ │ - 203 insert(T); │ │ │ │ │ - 204 return *this; │ │ │ │ │ - 205} │ │ │ │ │ - 206 │ │ │ │ │ - 207} // namespace pqxx │ │ │ │ │ - 208#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 209#endif │ │ │ │ │ +168 stateless_cursor( │ │ │ │ │ + 169 transaction_base &trans, │ │ │ │ │ + 170 const std::string &query, │ │ │ │ │ + 171 const std::string &cname, │ │ │ │ │ + 172 bool hold) : │ │ │ │ │ + 173 m_cur{trans, query, cname, cursor_base::random_access, up, op, hold} │ │ │ │ │ + 174 { │ │ │ │ │ + 175 } │ │ │ │ │ + 176 │ │ │ │ │ +178 stateless_cursor( │ │ │ │ │ + 179 transaction_base &trans, │ │ │ │ │ + 180 const std::string adopted_cursor) : │ │ │ │ │ + 181 m_cur{trans, adopted_cursor, op} │ │ │ │ │ + 182 { │ │ │ │ │ + 183 // Put cursor in known position │ │ │ │ │ + 184 m_cur.move(cursor_base::backward_all()); │ │ │ │ │ + 185 } │ │ │ │ │ + 186 │ │ │ │ │ +187 void close() noexcept { m_cur.close(); } │ │ │ │ │ + 188 │ │ │ │ │ + 190 │ │ │ │ │ +193 size_type size() { return internal::obtain_stateless_cursor_size(m_cur); } │ │ │ │ │ + 194 │ │ │ │ │ + 196 │ │ │ │ │ +207 result retrieve(difference_type begin_pos, difference_type end_pos) │ │ │ │ │ + 208 { │ │ │ │ │ + 209 return internal::stateless_cursor_retrieve( │ │ │ │ │ + 210 m_cur, │ │ │ │ │ + 211 result::difference_type(size()), │ │ │ │ │ + 212 begin_pos, │ │ │ │ │ + 213 end_pos); │ │ │ │ │ + 214 } │ │ │ │ │ + 215 │ │ │ │ │ +216 const std::string &name() const noexcept { return m_cur.name(); } │ │ │ │ │ + 217 │ │ │ │ │ + 218private: │ │ │ │ │ + 219 internal::sql_cursor m_cur; │ │ │ │ │ + 220}; │ │ │ │ │ + 221 │ │ │ │ │ + 222 │ │ │ │ │ + 223class icursor_iterator; │ │ │ │ │ + 224 │ │ │ │ │ + 225 │ │ │ │ │ + 226namespace internal │ │ │ │ │ + 227{ │ │ │ │ │ + 228namespace gate │ │ │ │ │ + 229{ │ │ │ │ │ + 230class icursor_iterator_icursorstream; │ │ │ │ │ + 231class icursorstream_icursor_iterator; │ │ │ │ │ + 232} // namespace internal::gate │ │ │ │ │ + 233} // namespace internal │ │ │ │ │ + 234 │ │ │ │ │ + 235 │ │ │ │ │ + 237 │ │ │ │ │ +252class PQXX_LIBEXPORT icursorstream │ │ │ │ │ + 253{ │ │ │ │ │ + 254public: │ │ │ │ │ +255 using size_type = cursor_base::size_type; │ │ │ │ │ +256 using difference_type = cursor_base::difference_type; │ │ │ │ │ + 257 │ │ │ │ │ + 259 │ │ │ │ │ + 270 icursorstream( │ │ │ │ │ + 271 transaction_base &context, │ │ │ │ │ + 272 const std::string &query, │ │ │ │ │ + 273 const std::string &basename, │ │ │ │ │ + 274 difference_type sstride=1); //[t81] │ │ │ │ │ + 275 │ │ │ │ │ + 277 │ │ │ │ │ + 301 icursorstream( │ │ │ │ │ + 302 transaction_base &context, │ │ │ │ │ + 303 const field &cname, │ │ │ │ │ + 304 difference_type sstride=1, │ │ │ │ │ + 305 cursor_base::ownershippolicy op=cursor_base::owned); //[t84] │ │ │ │ │ + 306 │ │ │ │ │ +307 operator bool() const noexcept { return not m_done; } │ │ │ │ │ + 308 │ │ │ │ │ + 310 │ │ │ │ │ +316 icursorstream &get(result &res) { res = fetchblock(); return *this; } // │ │ │ │ │ +[t81] │ │ │ │ │ + 318 │ │ │ │ │ +324 icursorstream &operator>>(result &res) { return get(res); } //[t81] │ │ │ │ │ + 325 │ │ │ │ │ + 327 │ │ │ │ │ + 331 icursorstream &ignore(std::streamsize n=1); //[t81] │ │ │ │ │ + 332 │ │ │ │ │ + 334 │ │ │ │ │ + 337 void set_stride(difference_type stride); //[t81] │ │ │ │ │ +338 difference_type stride() const noexcept { return m_stride; } //[t81] │ │ │ │ │ + 339 │ │ │ │ │ + 340private: │ │ │ │ │ + 341 result fetchblock(); │ │ │ │ │ + 342 │ │ │ │ │ +343 friend class internal::gate::icursorstream_icursor_iterator; │ │ │ │ │ + 344 size_type forward(size_type n=1); │ │ │ │ │ + 345 void insert_iterator(icursor_iterator *) noexcept; │ │ │ │ │ + 346 void remove_iterator(icursor_iterator *) const noexcept; │ │ │ │ │ + 347 │ │ │ │ │ + 348 void service_iterators(difference_type); │ │ │ │ │ + 349 │ │ │ │ │ + 350 internal::sql_cursor m_cur; │ │ │ │ │ + 351 │ │ │ │ │ + 352 difference_type m_stride; │ │ │ │ │ + 353 difference_type m_realpos, m_reqpos; │ │ │ │ │ + 354 │ │ │ │ │ + 355 mutable icursor_iterator *m_iterators; │ │ │ │ │ + 356 │ │ │ │ │ + 357 bool m_done; │ │ │ │ │ + 358}; │ │ │ │ │ + 359 │ │ │ │ │ + 360 │ │ │ │ │ + 362 │ │ │ │ │ +388class PQXX_LIBEXPORT icursor_iterator │ │ │ │ │ + 389{ │ │ │ │ │ + 390public: │ │ │ │ │ +391 using iterator_category = std::input_iterator_tag; │ │ │ │ │ +392 using value_type = result; │ │ │ │ │ +393 using pointer = const result *; │ │ │ │ │ +394 using reference = const result &; │ │ │ │ │ +395 using istream_type = icursorstream; │ │ │ │ │ +396 using size_type = istream_type::size_type; │ │ │ │ │ +397 using difference_type = istream_type::difference_type; │ │ │ │ │ + 398 │ │ │ │ │ + 399 icursor_iterator() noexcept; //[t84] │ │ │ │ │ + 400 explicit icursor_iterator(istream_type &) noexcept; //[t84] │ │ │ │ │ + 401 icursor_iterator(const icursor_iterator &) noexcept; //[t84] │ │ │ │ │ + 402 ~icursor_iterator() noexcept; │ │ │ │ │ + 403 │ │ │ │ │ +404 const result &operator*() const { refresh(); return m_here; } //[t84] │ │ │ │ │ +405 const result *operator->() const { refresh(); return &m_here; } //[t84] │ │ │ │ │ + 406 icursor_iterator &operator++(); //[t84] │ │ │ │ │ + 407 icursor_iterator operator++(int); //[t84] │ │ │ │ │ + 408 icursor_iterator &operator+=(difference_type); //[t84] │ │ │ │ │ + 409 icursor_iterator &operator=(const icursor_iterator &) noexcept; //[t84] │ │ │ │ │ + 410 │ │ │ │ │ + 411 bool operator==(const icursor_iterator &rhs) const; //[t84] │ │ │ │ │ +412 bool operator!=(const icursor_iterator &rhs) const noexcept //[t84] │ │ │ │ │ + 413 { return not operator==(rhs); } │ │ │ │ │ + 414 bool operator<(const icursor_iterator &rhs) const; //[t84] │ │ │ │ │ +415 bool operator>(const icursor_iterator &rhs) const //[t84] │ │ │ │ │ + 416 { return rhs < *this; } │ │ │ │ │ +417 bool operator<=(const icursor_iterator &rhs) const //[t84] │ │ │ │ │ + 418 { return not (*this > rhs); } │ │ │ │ │ +419 bool operator>=(const icursor_iterator &rhs) const //[t84] │ │ │ │ │ + 420 { return not (*this < rhs); } │ │ │ │ │ + 421 │ │ │ │ │ + 422private: │ │ │ │ │ + 423 void refresh() const; │ │ │ │ │ + 424 │ │ │ │ │ +425 friend class internal::gate::icursor_iterator_icursorstream; │ │ │ │ │ + 426 difference_type pos() const noexcept { return m_pos; } │ │ │ │ │ + 427 void fill(const result &); │ │ │ │ │ + 428 │ │ │ │ │ + 429 icursorstream *m_stream = nullptr; │ │ │ │ │ + 430 result m_here; │ │ │ │ │ + 431 difference_type m_pos; │ │ │ │ │ + 432 icursor_iterator *m_prev = nullptr, *m_next = nullptr; │ │ │ │ │ + 433}; │ │ │ │ │ + 434} // namespace pqxx │ │ │ │ │ + 435 │ │ │ │ │ + 436#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 437#endif │ │ │ │ │ std │ │ │ │ │ STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::operator<< │ │ │ │ │ -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 │ │ │ │ │ -pqxx::to_string │ │ │ │ │ -std::string to_string(const field &Obj) │ │ │ │ │ -Convert a field to a string. │ │ │ │ │ -Definition: result.cxx:451 │ │ │ │ │ -pqxx::separated_list │ │ │ │ │ -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 │ │ │ │ │ -pqxx::internal::escape │ │ │ │ │ -std::string escape(const std::string &s, const std::string &null) │ │ │ │ │ -Definition: tablewriter.cxx:131 │ │ │ │ │ -pqxx::internal::escape_any │ │ │ │ │ -std::string escape_any(const std::string &s, const std::string &null) │ │ │ │ │ -Definition: tablewriter.hxx:141 │ │ │ │ │ -pqxx::tablereader │ │ │ │ │ -Definition: tablereader.hxx:30 │ │ │ │ │ -pqxx::tablestream │ │ │ │ │ -Base class for obsolete tablereader/tablewriter classes. │ │ │ │ │ -Definition: tablestream.hxx:28 │ │ │ │ │ -pqxx::tablestream::NullStr │ │ │ │ │ -const std::string & NullStr() const │ │ │ │ │ -Definition: tablestream.hxx:36 │ │ │ │ │ -pqxx::tablestream::columnlist │ │ │ │ │ -static std::string columnlist(ITER colbegin, ITER colend) │ │ │ │ │ -Definition: tablestream.hxx:52 │ │ │ │ │ -pqxx::tablewriter │ │ │ │ │ -Definition: tablewriter.hxx:32 │ │ │ │ │ -pqxx::tablewriter::tablewriter │ │ │ │ │ -tablewriter(transaction_base &, const std::string &WName, const std::string │ │ │ │ │ -&Null=std::string{}) │ │ │ │ │ -Definition: tablewriter.cxx:22 │ │ │ │ │ -pqxx::tablewriter::reserve │ │ │ │ │ -void reserve(SIZE) │ │ │ │ │ -Definition: tablewriter.hxx:56 │ │ │ │ │ -pqxx::tablewriter::insert │ │ │ │ │ -void insert(IT Begin, IT End) │ │ │ │ │ -Definition: tablewriter.hxx:178 │ │ │ │ │ -pqxx::tablewriter::generate │ │ │ │ │ -std::string generate(IT Begin, IT End) const │ │ │ │ │ -Definition: tablewriter.hxx:168 │ │ │ │ │ -pqxx::tablewriter::push_back │ │ │ │ │ -void push_back(IT Begin, IT End) │ │ │ │ │ -Definition: tablewriter.hxx:189 │ │ │ │ │ -pqxx::tablewriter::operator<< │ │ │ │ │ -tablewriter & operator<<(const TUPLE &) │ │ │ │ │ -Definition: tablewriter.hxx:201 │ │ │ │ │ -pqxx::tablewriter::write_raw_line │ │ │ │ │ -void write_raw_line(const std::string &) │ │ │ │ │ -Definition: tablewriter.cxx:65 │ │ │ │ │ -std::back_insert_iterator<_pqxx::tablewriter_>::operator* │ │ │ │ │ -back_insert_iterator & operator*() │ │ │ │ │ -Definition: tablewriter.hxx:100 │ │ │ │ │ -std::back_insert_iterator<_pqxx::tablewriter_>::back_insert_iterator │ │ │ │ │ -back_insert_iterator(pqxx::tablewriter &W) noexcept │ │ │ │ │ -Definition: tablewriter.hxx:81 │ │ │ │ │ -std::back_insert_iterator<_pqxx::tablewriter_>::operator= │ │ │ │ │ -back_insert_iterator & operator=(const back_insert_iterator &rhs) noexcept │ │ │ │ │ -Definition: tablewriter.hxx:85 │ │ │ │ │ -std::back_insert_iterator<_pqxx::tablewriter_>::operator= │ │ │ │ │ -back_insert_iterator & operator=(const TUPLE &T) │ │ │ │ │ -Definition: tablewriter.hxx:92 │ │ │ │ │ -std::back_insert_iterator<_pqxx::tablewriter_>::operator++ │ │ │ │ │ -back_insert_iterator & operator++() │ │ │ │ │ -Definition: tablewriter.hxx:98 │ │ │ │ │ -std::back_insert_iterator<_pqxx::tablewriter_>::operator++ │ │ │ │ │ -back_insert_iterator & operator++(int) │ │ │ │ │ -Definition: tablewriter.hxx:99 │ │ │ │ │ -std::back_insert_iterator<_pqxx::tablewriter_>::iterator_category │ │ │ │ │ -output_iterator_tag iterator_category │ │ │ │ │ -Definition: tablewriter.hxx:79 │ │ │ │ │ -pqxx::internal::Escaper │ │ │ │ │ -Definition: tablewriter.hxx:158 │ │ │ │ │ -pqxx::internal::Escaper::operator() │ │ │ │ │ -std::string operator()(IT i) const │ │ │ │ │ -Definition: tablewriter.hxx:162 │ │ │ │ │ -pqxx::internal::Escaper::Escaper │ │ │ │ │ -Escaper(const std::string &null) │ │ │ │ │ -Definition: tablewriter.hxx:161 │ │ │ │ │ +pqxx::result_difference_type │ │ │ │ │ +signed long result_difference_type │ │ │ │ │ +Difference between result sizes. │ │ │ │ │ +Definition: types.hxx:21 │ │ │ │ │ +pqxx::result_size_type │ │ │ │ │ +unsigned long result_size_type │ │ │ │ │ +Number of rows in a result set. │ │ │ │ │ +Definition: types.hxx:18 │ │ │ │ │ +pqxx::connection_base │ │ │ │ │ +connection_base abstract base class; represents a connection to a database. │ │ │ │ │ +Definition: connection_base.hxx:140 │ │ │ │ │ +pqxx::cursor_base │ │ │ │ │ +Common definitions for cursor types. │ │ │ │ │ +Definition: cursor.hxx:41 │ │ │ │ │ +pqxx::cursor_base::prior │ │ │ │ │ +static difference_type prior() noexcept │ │ │ │ │ +Special value: read backwards, one row only. │ │ │ │ │ +Definition: cursor.hxx:120 │ │ │ │ │ +pqxx::cursor_base::backward_all │ │ │ │ │ +static difference_type backward_all() noexcept │ │ │ │ │ +Special value: read backwards from current position back to origin. │ │ │ │ │ +Definition: cursor.cxx:35 │ │ │ │ │ +pqxx::cursor_base::cursor_base │ │ │ │ │ +cursor_base(const cursor_base &)=delete │ │ │ │ │ +pqxx::cursor_base::accesspolicy │ │ │ │ │ +accesspolicy │ │ │ │ │ +Cursor access-pattern policy. │ │ │ │ │ +Definition: cursor.hxx:51 │ │ │ │ │ +pqxx::cursor_base::forward_only │ │ │ │ │ +@ forward_only │ │ │ │ │ +Cursor can move forward only. │ │ │ │ │ +Definition: cursor.hxx:53 │ │ │ │ │ +pqxx::cursor_base::size_type │ │ │ │ │ +result_size_type size_type │ │ │ │ │ +Definition: cursor.hxx:43 │ │ │ │ │ +pqxx::cursor_base::ownershippolicy │ │ │ │ │ +ownershippolicy │ │ │ │ │ +Cursor destruction policy. │ │ │ │ │ +Definition: cursor.hxx:90 │ │ │ │ │ +pqxx::cursor_base::owned │ │ │ │ │ +@ owned │ │ │ │ │ +Destroy SQL cursor when cursor object is closed at end of transaction. │ │ │ │ │ +Definition: cursor.hxx:92 │ │ │ │ │ +pqxx::cursor_base::m_name │ │ │ │ │ +const std::string m_name │ │ │ │ │ +Definition: cursor.hxx:143 │ │ │ │ │ +pqxx::cursor_base::cursor_base │ │ │ │ │ +cursor_base()=delete │ │ │ │ │ +pqxx::cursor_base::updatepolicy │ │ │ │ │ +updatepolicy │ │ │ │ │ +Cursor update policy. │ │ │ │ │ +Definition: cursor.hxx:63 │ │ │ │ │ +pqxx::cursor_base::read_only │ │ │ │ │ +@ read_only │ │ │ │ │ +Cursor can be used to read data but not to write. │ │ │ │ │ +Definition: cursor.hxx:65 │ │ │ │ │ +pqxx::cursor_base::operator= │ │ │ │ │ +cursor_base & operator=(const cursor_base &)=delete │ │ │ │ │ +pqxx::cursor_base::difference_type │ │ │ │ │ +result_difference_type difference_type │ │ │ │ │ +Definition: cursor.hxx:44 │ │ │ │ │ +pqxx::stateless_cursor │ │ │ │ │ +"Stateless cursor" class: easy API for retrieving parts of result sets │ │ │ │ │ +Definition: cursor.hxx:162 │ │ │ │ │ +pqxx::stateless_cursor::name │ │ │ │ │ +const std::string & name() const noexcept │ │ │ │ │ +Definition: cursor.hxx:216 │ │ │ │ │ +pqxx::stateless_cursor::close │ │ │ │ │ +void close() noexcept │ │ │ │ │ +Definition: cursor.hxx:187 │ │ │ │ │ +pqxx::stateless_cursor::stateless_cursor │ │ │ │ │ +stateless_cursor(transaction_base &trans, const std::string adopted_cursor) │ │ │ │ │ +Adopt existing scrolling SQL cursor. │ │ │ │ │ +Definition: cursor.hxx:178 │ │ │ │ │ +pqxx::stateless_cursor::size_type │ │ │ │ │ +result_size_type size_type │ │ │ │ │ +Definition: cursor.hxx:164 │ │ │ │ │ +pqxx::stateless_cursor::difference_type │ │ │ │ │ +result_difference_type difference_type │ │ │ │ │ +Definition: cursor.hxx:165 │ │ │ │ │ +pqxx::stateless_cursor::retrieve │ │ │ │ │ +result retrieve(difference_type begin_pos, difference_type end_pos) │ │ │ │ │ +Retrieve rows from begin_pos (inclusive) to end_pos (exclusive) │ │ │ │ │ +Definition: cursor.hxx:207 │ │ │ │ │ +pqxx::stateless_cursor::stateless_cursor │ │ │ │ │ +stateless_cursor(transaction_base &trans, const std::string &query, const std:: │ │ │ │ │ +string &cname, bool hold) │ │ │ │ │ +Create cursor. │ │ │ │ │ +Definition: cursor.hxx:168 │ │ │ │ │ +pqxx::stateless_cursor::size │ │ │ │ │ +size_type size() │ │ │ │ │ +Number of rows in cursor's result set. │ │ │ │ │ +Definition: cursor.hxx:193 │ │ │ │ │ +pqxx::icursorstream │ │ │ │ │ +Simple read-only cursor represented as a stream of results. │ │ │ │ │ +Definition: cursor.hxx:253 │ │ │ │ │ +pqxx::icursorstream::size_type │ │ │ │ │ +cursor_base::size_type size_type │ │ │ │ │ +Definition: cursor.hxx:255 │ │ │ │ │ +pqxx::icursorstream::get │ │ │ │ │ +icursorstream & get(result &res) │ │ │ │ │ +Read new value into given result object; same as operator >> │ │ │ │ │ +Definition: cursor.hxx:316 │ │ │ │ │ +pqxx::icursorstream::stride │ │ │ │ │ +difference_type stride() const noexcept │ │ │ │ │ +Definition: cursor.hxx:338 │ │ │ │ │ +pqxx::icursorstream::difference_type │ │ │ │ │ +cursor_base::difference_type difference_type │ │ │ │ │ +Definition: cursor.hxx:256 │ │ │ │ │ +pqxx::icursorstream::operator>> │ │ │ │ │ +icursorstream & operator>>(result &res) │ │ │ │ │ +Read new value into given result object; same as get(result &) │ │ │ │ │ +Definition: cursor.hxx:324 │ │ │ │ │ +pqxx::icursor_iterator │ │ │ │ │ +Approximate istream_iterator for icursorstream. │ │ │ │ │ +Definition: cursor.hxx:389 │ │ │ │ │ +pqxx::icursor_iterator::operator<= │ │ │ │ │ +bool operator<=(const icursor_iterator &rhs) const │ │ │ │ │ +Definition: cursor.hxx:417 │ │ │ │ │ +pqxx::icursor_iterator::operator!= │ │ │ │ │ +bool operator!=(const icursor_iterator &rhs) const noexcept │ │ │ │ │ +Definition: cursor.hxx:412 │ │ │ │ │ +pqxx::icursor_iterator::operator> │ │ │ │ │ +bool operator>(const icursor_iterator &rhs) const │ │ │ │ │ +Definition: cursor.hxx:415 │ │ │ │ │ +pqxx::icursor_iterator::difference_type │ │ │ │ │ +istream_type::difference_type difference_type │ │ │ │ │ +Definition: cursor.hxx:397 │ │ │ │ │ +pqxx::icursor_iterator::operator-> │ │ │ │ │ +const result * operator->() const │ │ │ │ │ +Definition: cursor.hxx:405 │ │ │ │ │ +pqxx::icursor_iterator::iterator_category │ │ │ │ │ +std::input_iterator_tag iterator_category │ │ │ │ │ +Definition: cursor.hxx:391 │ │ │ │ │ +pqxx::icursor_iterator::operator>= │ │ │ │ │ +bool operator>=(const icursor_iterator &rhs) const │ │ │ │ │ +Definition: cursor.hxx:419 │ │ │ │ │ +pqxx::icursor_iterator::size_type │ │ │ │ │ +istream_type::size_type size_type │ │ │ │ │ +Definition: cursor.hxx:396 │ │ │ │ │ +pqxx::field │ │ │ │ │ +Reference to a field in a result set. │ │ │ │ │ +Definition: field.hxx:50 │ │ │ │ │ +pqxx::result │ │ │ │ │ +Result set containing data returned by a query or command. │ │ │ │ │ +Definition: result.hxx:70 │ │ │ │ │ +pqxx::result::difference_type │ │ │ │ │ +result_difference_type difference_type │ │ │ │ │ +Definition: result.hxx:73 │ │ │ │ │ pqxx::transaction_base │ │ │ │ │ Interface definition (and common code) for "transaction" classes. │ │ │ │ │ Definition: transaction_base.hxx:138 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * tablewriter.hxx │ │ │ │ │ + * cursor.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00050_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: tablestream.hxx Source File │ │ │ │ +libpqxx: stream_to.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,76 +55,162 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
tablestream.hxx
│ │ │ │ +
stream_to.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_TABLESTREAM
│ │ │ │ -
14#define PQXX_H_TABLESTREAM
│ │ │ │ +
13#ifndef PQXX_H_STREAM_TO
│ │ │ │ +
14#define PQXX_H_STREAM_TO
│ │ │ │
15
│ │ │ │
16#include "pqxx/compiler-public.hxx"
│ │ │ │
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │
18#include "pqxx/transaction_base.hxx"
│ │ │ │ -
19
│ │ │ │ -
20
│ │ │ │ -
21namespace pqxx
│ │ │ │ -
22{
│ │ │ │ +
19#include "pqxx/stream_base.hxx"
│ │ │ │ +
20#include "pqxx/stream_from.hxx"
│ │ │ │ +
21#include "pqxx/internal/type_utils.hxx"
│ │ │ │ +
22
│ │ │ │ +
23#include <string>
│ │ │ │
24
│ │ │ │ -
26class PQXX_LIBEXPORT PQXX_NOVTABLE tablestream :
│ │ │ │ - │ │ │ │ -
28{
│ │ │ │ -
29public:
│ │ │ │ -
30 explicit tablestream(
│ │ │ │ -
31 transaction_base &Trans,
│ │ │ │ -
32 const std::string &Null=std::string{});
│ │ │ │ -
33 virtual ~tablestream() noexcept =0;
│ │ │ │ -
34 virtual void complete() =0;
│ │ │ │ -
35protected:
│ │ │ │ -
36 const std::string &NullStr() const { return m_null; }
│ │ │ │ -
37 bool is_finished() const noexcept { return m_finished; }
│ │ │ │ -
38 void base_close();
│ │ │ │ -
39 template<typename ITER>
│ │ │ │ -
40 static std::string columnlist(ITER colbegin, ITER colend);
│ │ │ │ -
41private:
│ │ │ │ -
42 std::string m_null;
│ │ │ │ -
43 bool m_finished = false;
│ │ │ │ -
44
│ │ │ │ -
45 tablestream() =delete;
│ │ │ │ -
46 tablestream(const tablestream &) =delete;
│ │ │ │ -
47 tablestream &operator=(const tablestream &) =delete;
│ │ │ │ -
48};
│ │ │ │ -
49
│ │ │ │ -
50
│ │ │ │ -
51template<typename ITER> inline
│ │ │ │ -
52std::string tablestream::columnlist(ITER colbegin, ITER colend)
│ │ │ │ -
53{
│ │ │ │ -
54 return separated_list(",", colbegin, colend);
│ │ │ │ -
55}
│ │ │ │ -
56} // namespace pqxx
│ │ │ │ -
57
│ │ │ │ -
58#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
59#endif
│ │ │ │ +
25
│ │ │ │ +
26namespace pqxx
│ │ │ │ +
27{
│ │ │ │ +
28
│ │ │ │ +
30
│ │ │ │ +
59class PQXX_LIBEXPORT stream_to : public stream_base
│ │ │ │ +
60{
│ │ │ │ +
61public:
│ │ │ │ +
63
│ │ │ │ +
70 stream_to(transaction_base &, const std::string &table_name);
│ │ │ │ +
71
│ │ │ │ +
73 template<typename Columns> stream_to(
│ │ │ │ + │ │ │ │ +
75 const std::string &table_name,
│ │ │ │ +
76 const Columns& columns
│ │ │ │ +
77 );
│ │ │ │ +
78
│ │ │ │ +
80 template<typename Iter> stream_to(
│ │ │ │ + │ │ │ │ +
82 const std::string &table_name,
│ │ │ │ +
83 Iter columns_begin,
│ │ │ │ +
84 Iter columns_end
│ │ │ │ +
85 );
│ │ │ │ +
86
│ │ │ │ +
87 ~stream_to() noexcept;
│ │ │ │ +
88
│ │ │ │ +
90
│ │ │ │ +
96 void complete() override;
│ │ │ │ +
97
│ │ │ │ +
99
│ │ │ │ +
106 template<typename Tuple> stream_to & operator<<(const Tuple &);
│ │ │ │ +
107
│ │ │ │ +
109
│ │ │ │ + │ │ │ │ +
114
│ │ │ │ +
115private:
│ │ │ │ +
117 void write_raw_line(const std::string &);
│ │ │ │ +
118
│ │ │ │ +
119 void set_up(transaction_base &, const std::string &table_name);
│ │ │ │ +
120 void set_up(
│ │ │ │ + │ │ │ │ +
122 const std::string &table_name,
│ │ │ │ +
123 const std::string &columns
│ │ │ │ +
124 );
│ │ │ │ +
125
│ │ │ │ +
126 void close() override;
│ │ │ │ +
127};
│ │ │ │ +
128
│ │ │ │ +
129
│ │ │ │ +
130template<typename Columns> inline stream_to::stream_to(
│ │ │ │ + │ │ │ │ +
132 const std::string &table_name,
│ │ │ │ +
133 const Columns& columns
│ │ │ │ +
134) : stream_to{
│ │ │ │ +
135 tb,
│ │ │ │ +
136 table_name,
│ │ │ │ +
137 std::begin(columns),
│ │ │ │ +
138 std::end(columns)
│ │ │ │ +
139}
│ │ │ │ +
140{}
│ │ │ │ +
141
│ │ │ │ +
142
│ │ │ │ +
143template<typename Iter> inline stream_to::stream_to(
│ │ │ │ + │ │ │ │ +
145 const std::string &table_name,
│ │ │ │ +
146 Iter columns_begin,
│ │ │ │ +
147 Iter columns_end
│ │ │ │ +
148) :
│ │ │ │ +
149 namedclass{"stream_from", table_name},
│ │ │ │ +
150 stream_base{tb}
│ │ │ │ +
151{
│ │ │ │ +
152 set_up(
│ │ │ │ +
153 tb,
│ │ │ │ +
154 table_name,
│ │ │ │ +
155 columnlist(columns_begin, columns_end)
│ │ │ │ +
156 );
│ │ │ │ +
157}
│ │ │ │ +
158
│ │ │ │ +
159
│ │ │ │ +
160namespace internal
│ │ │ │ +
161{
│ │ │ │ +
162
│ │ │ │ +
163class PQXX_LIBEXPORT TypedCopyEscaper
│ │ │ │ +
164{
│ │ │ │ +
165 static std::string escape(const std::string &);
│ │ │ │ +
166public:
│ │ │ │ +
167 template<typename T> std::string operator()(const T* t) const
│ │ │ │ +
168 {
│ │ │ │ +
169 return string_traits<T>::is_null(*t) ? "\\N" : escape(to_string(*t));
│ │ │ │ +
170 }
│ │ │ │ +
171};
│ │ │ │ +
172
│ │ │ │ +
173// Explicit specialization so we don't need a string_traits<> for nullptr_t
│ │ │ │ +
174template<> inline std::string TypedCopyEscaper::operator()<std::nullptr_t>(
│ │ │ │ +
175 const std::nullptr_t*
│ │ │ │ +
176) const
│ │ │ │ +
177{ return "\\N"; }
│ │ │ │ +
178
│ │ │ │ +
179} // namespace pqxx::internal
│ │ │ │ +
180
│ │ │ │ +
181
│ │ │ │ +
182template<typename Tuple> stream_to & stream_to::operator<<(const Tuple &t)
│ │ │ │ +
183{
│ │ │ │ +
184 write_raw_line(separated_list("\t", t, internal::TypedCopyEscaper()));
│ │ │ │ +
185 return *this;
│ │ │ │ +
186}
│ │ │ │ +
187
│ │ │ │ +
188} // namespace pqxx
│ │ │ │ +
189
│ │ │ │ +
190
│ │ │ │ +
191#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
192#endif
│ │ │ │ +
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ +
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
│ │ │ │ +
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
│ │ │ │
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
│ │ │ │ -
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
│ │ │ │ -
virtual void complete()=0
│ │ │ │ -
const std::string & NullStr() const
Definition: tablestream.hxx:36
│ │ │ │ -
bool is_finished() const noexcept
Definition: tablestream.hxx:37
│ │ │ │ -
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
│ │ │ │ -
Definition: transaction_base.hxx:44
│ │ │ │ +
std::string escape(const std::string &s, const std::string &null)
Definition: tablewriter.cxx:131
│ │ │ │ +
Traits class for use in string conversions.
Definition: strconv.hxx:51
│ │ │ │ +
Definition: stream_base.hxx:29
│ │ │ │ +
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
│ │ │ │ +
Efficiently pull data directly out of a table.
Definition: stream_from.hxx:30
│ │ │ │ +
Efficiently write data directly to a database table.
Definition: stream_to.hxx:60
│ │ │ │ +
stream_to(transaction_base &, const std::string &table_name)
Create a stream, without specifying columns.
Definition: stream_to.cxx:18
│ │ │ │ +
stream_to & operator<<(const Tuple &)
Insert a row of data.
Definition: stream_to.hxx:182
│ │ │ │ +
Definition: stream_to.hxx:164
│ │ │ │ +
std::string operator()(const T *t) const
Definition: stream_to.hxx:167
│ │ │ │
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,85 +1,189 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -tablestream.hxx │ │ │ │ │ +stream_to.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_TABLESTREAM │ │ │ │ │ - 14#define PQXX_H_TABLESTREAM │ │ │ │ │ + 13#ifndef PQXX_H_STREAM_TO │ │ │ │ │ + 14#define PQXX_H_STREAM_TO │ │ │ │ │ 15 │ │ │ │ │ 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ 18#include "pqxx/transaction_base.hxx" │ │ │ │ │ - 19 │ │ │ │ │ - 20 │ │ │ │ │ - 21namespace pqxx │ │ │ │ │ - 22{ │ │ │ │ │ + 19#include "pqxx/stream_base.hxx" │ │ │ │ │ + 20#include "pqxx/stream_from.hxx" │ │ │ │ │ + 21#include "pqxx/internal/type_utils.hxx" │ │ │ │ │ + 22 │ │ │ │ │ + 23#include │ │ │ │ │ 24 │ │ │ │ │ -26class PQXX_LIBEXPORT PQXX_NOVTABLE tablestream : │ │ │ │ │ - 27 public internal::transactionfocus │ │ │ │ │ - 28{ │ │ │ │ │ - 29public: │ │ │ │ │ - 30 explicit tablestream( │ │ │ │ │ - 31 transaction_base &Trans, │ │ │ │ │ - 32 const std::string &Null=std::string{}); │ │ │ │ │ - 33 virtual ~tablestream() noexcept =0; │ │ │ │ │ -34 virtual void complete() =0; │ │ │ │ │ - 35protected: │ │ │ │ │ -36 const std::string &NullStr() const { return m_null; } │ │ │ │ │ -37 bool is_finished() const noexcept { return m_finished; } │ │ │ │ │ - 38 void base_close(); │ │ │ │ │ - 39 template │ │ │ │ │ - 40 static std::string columnlist(ITER colbegin, ITER colend); │ │ │ │ │ - 41private: │ │ │ │ │ - 42 std::string m_null; │ │ │ │ │ - 43 bool m_finished = false; │ │ │ │ │ - 44 │ │ │ │ │ - 45 tablestream() =delete; │ │ │ │ │ - 46 tablestream(const tablestream &) =delete; │ │ │ │ │ - 47 tablestream &operator=(const tablestream &) =delete; │ │ │ │ │ - 48}; │ │ │ │ │ - 49 │ │ │ │ │ - 50 │ │ │ │ │ - 51template inline │ │ │ │ │ -52std::string tablestream::columnlist(ITER colbegin, ITER colend) │ │ │ │ │ - 53{ │ │ │ │ │ - 54 return separated_list(",", colbegin, colend); │ │ │ │ │ - 55} │ │ │ │ │ - 56} // namespace pqxx │ │ │ │ │ - 57 │ │ │ │ │ - 58#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 59#endif │ │ │ │ │ + 25 │ │ │ │ │ + 26namespace pqxx │ │ │ │ │ + 27{ │ │ │ │ │ + 28 │ │ │ │ │ + 30 │ │ │ │ │ +59class PQXX_LIBEXPORT stream_to : public stream_base │ │ │ │ │ + 60{ │ │ │ │ │ + 61public: │ │ │ │ │ + 63 │ │ │ │ │ + 70 stream_to(transaction_base &, const std::string &table_name); │ │ │ │ │ + 71 │ │ │ │ │ + 73 template stream_to( │ │ │ │ │ + 74 transaction_base &, │ │ │ │ │ + 75 const std::string &table_name, │ │ │ │ │ + 76 const Columns& columns │ │ │ │ │ + 77 ); │ │ │ │ │ + 78 │ │ │ │ │ + 80 template stream_to( │ │ │ │ │ + 81 transaction_base &, │ │ │ │ │ + 82 const std::string &table_name, │ │ │ │ │ + 83 Iter columns_begin, │ │ │ │ │ + 84 Iter columns_end │ │ │ │ │ + 85 ); │ │ │ │ │ + 86 │ │ │ │ │ + 87 ~stream_to() noexcept; │ │ │ │ │ + 88 │ │ │ │ │ + 90 │ │ │ │ │ + 96 void complete() override; │ │ │ │ │ + 97 │ │ │ │ │ + 99 │ │ │ │ │ + 106 template stream_to & operator<<(const Tuple &); │ │ │ │ │ + 107 │ │ │ │ │ + 109 │ │ │ │ │ + 113 stream_to &operator<<(stream_from &); │ │ │ │ │ + 114 │ │ │ │ │ + 115private: │ │ │ │ │ + 117 void write_raw_line(const std::string &); │ │ │ │ │ + 118 │ │ │ │ │ + 119 void set_up(transaction_base &, const std::string &table_name); │ │ │ │ │ + 120 void set_up( │ │ │ │ │ + 121 transaction_base &, │ │ │ │ │ + 122 const std::string &table_name, │ │ │ │ │ + 123 const std::string &columns │ │ │ │ │ + 124 ); │ │ │ │ │ + 125 │ │ │ │ │ + 126 void close() override; │ │ │ │ │ + 127}; │ │ │ │ │ + 128 │ │ │ │ │ + 129 │ │ │ │ │ +130template inline stream_to::stream_to( │ │ │ │ │ + 131 transaction_base &tb, │ │ │ │ │ + 132 const std::string &table_name, │ │ │ │ │ + 133 const Columns& columns │ │ │ │ │ + 134) : stream_to{ │ │ │ │ │ + 135 tb, │ │ │ │ │ + 136 table_name, │ │ │ │ │ + 137 std::begin(columns), │ │ │ │ │ + 138 std::end(columns) │ │ │ │ │ + 139} │ │ │ │ │ + 140{} │ │ │ │ │ + 141 │ │ │ │ │ + 142 │ │ │ │ │ +143template inline stream_to::stream_to( │ │ │ │ │ + 144 transaction_base &tb, │ │ │ │ │ + 145 const std::string &table_name, │ │ │ │ │ + 146 Iter columns_begin, │ │ │ │ │ + 147 Iter columns_end │ │ │ │ │ + 148) : │ │ │ │ │ + 149 namedclass{"stream_from", table_name}, │ │ │ │ │ + 150 stream_base{tb} │ │ │ │ │ + 151{ │ │ │ │ │ + 152 set_up( │ │ │ │ │ + 153 tb, │ │ │ │ │ + 154 table_name, │ │ │ │ │ + 155 columnlist(columns_begin, columns_end) │ │ │ │ │ + 156 ); │ │ │ │ │ + 157} │ │ │ │ │ + 158 │ │ │ │ │ + 159 │ │ │ │ │ + 160namespace internal │ │ │ │ │ + 161{ │ │ │ │ │ + 162 │ │ │ │ │ +163class PQXX_LIBEXPORT TypedCopyEscaper │ │ │ │ │ + 164{ │ │ │ │ │ + 165 static std::string escape(const std::string &); │ │ │ │ │ + 166public: │ │ │ │ │ +167 template std::string operator()(const T* t) const │ │ │ │ │ + 168 { │ │ │ │ │ + 169 return string_traits::is_null(*t) ? "\\N" : escape(to_string(*t)); │ │ │ │ │ + 170 } │ │ │ │ │ + 171}; │ │ │ │ │ + 172 │ │ │ │ │ + 173// Explicit specialization so we don't need a string_traits<> for nullptr_t │ │ │ │ │ +174template<> inline std::string TypedCopyEscaper::operator()( │ │ │ │ │ + 175 const std::nullptr_t* │ │ │ │ │ + 176) const │ │ │ │ │ + 177{ return "\\N"; } │ │ │ │ │ + 178 │ │ │ │ │ + 179} // namespace pqxx::internal │ │ │ │ │ + 180 │ │ │ │ │ + 181 │ │ │ │ │ +182template stream_to & stream_to::operator<<(const Tuple &t) │ │ │ │ │ + 183{ │ │ │ │ │ + 184 write_raw_line(separated_list("\t", t, internal::TypedCopyEscaper())); │ │ │ │ │ + 185 return *this; │ │ │ │ │ + 186} │ │ │ │ │ + 187 │ │ │ │ │ + 188} // namespace pqxx │ │ │ │ │ + 189 │ │ │ │ │ + 190 │ │ │ │ │ + 191#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 192#endif │ │ │ │ │ +std │ │ │ │ │ +STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ +pqxx::operator<< │ │ │ │ │ +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 │ │ │ │ │ +pqxx::to_string │ │ │ │ │ +std::string to_string(const field &Obj) │ │ │ │ │ +Convert a field to a string. │ │ │ │ │ +Definition: result.cxx:451 │ │ │ │ │ pqxx::separated_list │ │ │ │ │ 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 │ │ │ │ │ -pqxx::tablestream │ │ │ │ │ -Base class for obsolete tablereader/tablewriter classes. │ │ │ │ │ -Definition: tablestream.hxx:28 │ │ │ │ │ -pqxx::tablestream::complete │ │ │ │ │ -virtual void complete()=0 │ │ │ │ │ -pqxx::tablestream::NullStr │ │ │ │ │ -const std::string & NullStr() const │ │ │ │ │ -Definition: tablestream.hxx:36 │ │ │ │ │ -pqxx::tablestream::is_finished │ │ │ │ │ -bool is_finished() const noexcept │ │ │ │ │ -Definition: tablestream.hxx:37 │ │ │ │ │ -pqxx::tablestream::columnlist │ │ │ │ │ -static std::string columnlist(ITER colbegin, ITER colend) │ │ │ │ │ -Definition: tablestream.hxx:52 │ │ │ │ │ -pqxx::internal::transactionfocus │ │ │ │ │ -Definition: transaction_base.hxx:44 │ │ │ │ │ +pqxx::internal::escape │ │ │ │ │ +std::string escape(const std::string &s, const std::string &null) │ │ │ │ │ +Definition: tablewriter.cxx:131 │ │ │ │ │ +pqxx::string_traits │ │ │ │ │ +Traits class for use in string conversions. │ │ │ │ │ +Definition: strconv.hxx:51 │ │ │ │ │ +pqxx::stream_base │ │ │ │ │ +Definition: stream_base.hxx:29 │ │ │ │ │ +pqxx::stream_base::columnlist │ │ │ │ │ +static std::string columnlist(const C &) │ │ │ │ │ +Definition: stream_base.hxx:48 │ │ │ │ │ +pqxx::stream_from │ │ │ │ │ +Efficiently pull data directly out of a table. │ │ │ │ │ +Definition: stream_from.hxx:30 │ │ │ │ │ +pqxx::stream_to │ │ │ │ │ +Efficiently write data directly to a database table. │ │ │ │ │ +Definition: stream_to.hxx:60 │ │ │ │ │ +pqxx::stream_to::stream_to │ │ │ │ │ +stream_to(transaction_base &, const std::string &table_name) │ │ │ │ │ +Create a stream, without specifying columns. │ │ │ │ │ +Definition: stream_to.cxx:18 │ │ │ │ │ +pqxx::stream_to::operator<< │ │ │ │ │ +stream_to & operator<<(const Tuple &) │ │ │ │ │ +Insert a row of data. │ │ │ │ │ +Definition: stream_to.hxx:182 │ │ │ │ │ +pqxx::internal::TypedCopyEscaper │ │ │ │ │ +Definition: stream_to.hxx:164 │ │ │ │ │ +pqxx::internal::TypedCopyEscaper::operator() │ │ │ │ │ +std::string operator()(const T *t) const │ │ │ │ │ +Definition: stream_to.hxx:167 │ │ │ │ │ pqxx::transaction_base │ │ │ │ │ Interface definition (and common code) for "transaction" classes. │ │ │ │ │ Definition: transaction_base.hxx:138 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * tablestream.hxx │ │ │ │ │ + * stream_to.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00053_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: pipeline.hxx Source File │ │ │ │ +libpqxx: util.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,162 +55,288 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
pipeline.hxx
│ │ │ │ +
util.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_PIPELINE
│ │ │ │ -
14#define PQXX_H_PIPELINE
│ │ │ │ +
11#ifndef PQXX_H_UTIL
│ │ │ │ +
12#define PQXX_H_UTIL
│ │ │ │ +
13
│ │ │ │ +
14#include "pqxx/compiler-public.hxx"
│ │ │ │
15
│ │ │ │ -
16#include "pqxx/compiler-public.hxx"
│ │ │ │ -
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include <limits>
│ │ │ │ -
20#include <map>
│ │ │ │ +
16#include <cstdio>
│ │ │ │ +
17#include <cctype>
│ │ │ │ +
18#include <iterator>
│ │ │ │ +
19#include <memory>
│ │ │ │ +
20#include <stdexcept>
│ │ │ │
21#include <string>
│ │ │ │ -
22
│ │ │ │ -
23#include "pqxx/transaction_base.hxx"
│ │ │ │ -
24
│ │ │ │ +
22#include <type_traits>
│ │ │ │ +
23#include <typeinfo>
│ │ │ │ +
24#include <vector>
│ │ │ │
25
│ │ │ │ -
26// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ +
26#include "pqxx/strconv.hxx"
│ │ │ │
27
│ │ │ │ -
28namespace pqxx
│ │ │ │ -
29{
│ │ │ │ -
30
│ │ │ │ -
32
│ │ │ │ -
48class PQXX_LIBEXPORT pipeline : public internal::transactionfocus
│ │ │ │ -
49{
│ │ │ │ -
50public:
│ │ │ │ -
51 using query_id = long;
│ │ │ │ -
52
│ │ │ │ -
53 pipeline(const pipeline &) =delete;
│ │ │ │ -
54 pipeline &operator=(const pipeline &) =delete;
│ │ │ │ -
55
│ │ │ │ -
56 explicit pipeline( //[t69]
│ │ │ │ - │ │ │ │ -
58 const std::string &Name=std::string{});
│ │ │ │ +
28
│ │ │ │ +
30namespace pqxx {}
│ │ │ │ +
31
│ │ │ │ +
32#include <pqxx/internal/libpq-forward.hxx>
│ │ │ │ +
33
│ │ │ │ +
34
│ │ │ │ +
35namespace pqxx
│ │ │ │ +
36{
│ │ │ │ +
38template<typename T> inline void ignore_unused(T) {}
│ │ │ │ +
39
│ │ │ │ +
40
│ │ │ │ +
42
│ │ │ │ +
44struct PQXX_LIBEXPORT thread_safety_model
│ │ │ │ +
45{
│ │ │ │ +
47 bool have_safe_strerror = true;
│ │ │ │ +
48
│ │ │ │ + │ │ │ │ +
51
│ │ │ │ +
53 bool safe_query_cancel = true;
│ │ │ │ +
54
│ │ │ │ +
56 bool safe_result_copy = true;
│ │ │ │ +
57
│ │ │ │
59
│ │ │ │ -
60 ~pipeline() noexcept;
│ │ │ │ -
61
│ │ │ │ -
63
│ │ │ │ -
69 query_id insert(const std::string &); //[t69]
│ │ │ │ + │ │ │ │ +
66
│ │ │ │ +
68 std::string description;
│ │ │ │ +
69};
│ │ │ │
70
│ │ │ │ -
72
│ │ │ │ -
73 void complete(); //[t71]
│ │ │ │ +
71
│ │ │ │ +
73PQXX_LIBEXPORT thread_safety_model describe_thread_safety() noexcept;
│ │ │ │
74
│ │ │ │ -
76
│ │ │ │ -
85 void flush(); //[t70]
│ │ │ │ +
75
│ │ │ │ +
77constexpr oid oid_none = 0;
│ │ │ │ +
78
│ │ │ │ +
79
│ │ │ │ +
84
│ │ │ │
86
│ │ │ │ -
88
│ │ │ │ -
96 void cancel();
│ │ │ │ -
97
│ │ │ │ -
99 bool is_finished(query_id) const; //[t71]
│ │ │ │ -
100
│ │ │ │ -
102
│ │ │ │ -
108 result retrieve(query_id qid) //[t71]
│ │ │ │ -
109 { return retrieve(m_queries.find(qid)).second; }
│ │ │ │ -
110
│ │ │ │ -
112
│ │ │ │ -
113 std::pair<query_id, result> retrieve(); //[t69]
│ │ │ │ +
94template<typename ITER, typename ACCESS> inline
│ │ │ │ +
95std::string separated_list( //[t00]
│ │ │ │ +
96 const std::string &sep,
│ │ │ │ +
97 ITER begin,
│ │ │ │ +
98 ITER end,
│ │ │ │ +
99 ACCESS access)
│ │ │ │ +
100{
│ │ │ │ +
101 std::string result;
│ │ │ │ +
102 if (begin != end)
│ │ │ │ +
103 {
│ │ │ │ +
104 result = to_string(access(begin));
│ │ │ │ +
105 for (++begin; begin != end; ++begin)
│ │ │ │ +
106 {
│ │ │ │ +
107 result += sep;
│ │ │ │ +
108 result += to_string(access(begin));
│ │ │ │ +
109 }
│ │ │ │ +
110 }
│ │ │ │ +
111 return result;
│ │ │ │ +
112}
│ │ │ │ +
113
│ │ │ │
114
│ │ │ │ -
115 bool empty() const noexcept { return m_queries.empty(); } //[t69]
│ │ │ │ -
116
│ │ │ │ -
118
│ │ │ │ -
129 int retain(int retain_max=2); //[t70]
│ │ │ │ -
130
│ │ │ │ -
131
│ │ │ │ -
133 void resume(); //[t70]
│ │ │ │ -
134
│ │ │ │ -
135private:
│ │ │ │ -
136 class PQXX_PRIVATE Query
│ │ │ │ -
137 {
│ │ │ │ -
138 public:
│ │ │ │ -
139 explicit Query(const std::string &q) : m_query{q}, m_res{} {}
│ │ │ │ +
116template<typename ITER> inline std::string
│ │ │ │ +
117separated_list(const std::string &sep, ITER begin, ITER end) //[t00]
│ │ │ │ +
118 { return separated_list(sep, begin, end, [](ITER i){ return *i; }); }
│ │ │ │ +
119
│ │ │ │ +
120
│ │ │ │ +
122template<typename CONTAINER> inline auto
│ │ │ │ +
123separated_list(const std::string &sep, const CONTAINER &c) //[t10]
│ │ │ │ +
124 /*
│ │ │ │ +
125 Always std::string; necessary because SFINAE doesn't work with the
│ │ │ │ +
126 contents of function bodies, so the check for iterability has to be in
│ │ │ │ +
127 the signature.
│ │ │ │ +
128 */
│ │ │ │ +
129 -> typename std::enable_if<
│ │ │ │ +
130 (
│ │ │ │ +
131 not std::is_void<decltype(std::begin(c))>::value
│ │ │ │ +
132 and not std::is_void<decltype(std::end(c))>::value
│ │ │ │ +
133 ),
│ │ │ │ +
134 std::string
│ │ │ │ +
135 >::type
│ │ │ │ +
136{
│ │ │ │ +
137 return separated_list(sep, std::begin(c), std::end(c));
│ │ │ │ +
138}
│ │ │ │ +
139
│ │ │ │
140
│ │ │ │ -
141 const result &get_result() const noexcept { return m_res; }
│ │ │ │ -
142 void set_result(const result &r) noexcept { m_res = r; }
│ │ │ │ -
143 const std::string &get_query() const noexcept { return m_query; }
│ │ │ │ -
144
│ │ │ │ -
145 private:
│ │ │ │ -
146 std::string m_query;
│ │ │ │ -
147 result m_res;
│ │ │ │ -
148 };
│ │ │ │ -
149
│ │ │ │ -
150 using QueryMap = std::map<query_id,Query>;
│ │ │ │ -
151
│ │ │ │ -
152 void attach();
│ │ │ │ -
153 void detach();
│ │ │ │ -
154
│ │ │ │ -
156 static constexpr query_id qid_limit() noexcept
│ │ │ │ -
157 {
│ │ │ │ -
158 // Parenthesise this to work around an eternal Visual C++ problem:
│ │ │ │ -
159 // Without the extra parentheses, unless NOMINMAX is defined, the
│ │ │ │ -
160 // preprocessor will mistake this "max" for its annoying built-in macro
│ │ │ │ -
161 // of the same name.
│ │ │ │ -
162 return (std::numeric_limits<query_id>::max)();
│ │ │ │ -
163 }
│ │ │ │ -
164
│ │ │ │ -
166 PQXX_PRIVATE query_id generate_id();
│ │ │ │ -
167
│ │ │ │ -
168 bool have_pending() const noexcept
│ │ │ │ -
169 { return m_issuedrange.second != m_issuedrange.first; }
│ │ │ │ -
170
│ │ │ │ -
171 PQXX_PRIVATE void issue();
│ │ │ │ -
172
│ │ │ │ -
174 void set_error_at(query_id qid) noexcept
│ │ │ │ -
175 { if (qid < m_error) m_error = qid; }
│ │ │ │ -
176
│ │ │ │ -
178 [[noreturn]] PQXX_PRIVATE void internal_error(const std::string &err);
│ │ │ │ -
179
│ │ │ │ -
180 PQXX_PRIVATE bool obtain_result(bool expect_none=false);
│ │ │ │ -
181
│ │ │ │ -
182 PQXX_PRIVATE void obtain_dummy();
│ │ │ │ -
183 PQXX_PRIVATE void get_further_available_results();
│ │ │ │ -
184 PQXX_PRIVATE void check_end_results();
│ │ │ │ -
185
│ │ │ │ -
187 PQXX_PRIVATE void receive_if_available();
│ │ │ │ -
188
│ │ │ │ -
190 PQXX_PRIVATE void receive(pipeline::QueryMap::const_iterator stop);
│ │ │ │ -
191 std::pair<pipeline::query_id, result>
│ │ │ │ -
192 retrieve(pipeline::QueryMap::iterator);
│ │ │ │ +
142template<
│ │ │ │ +
143 typename TUPLE,
│ │ │ │ +
144 std::size_t INDEX=0,
│ │ │ │ +
145 typename ACCESS,
│ │ │ │ +
146 typename std::enable_if<
│ │ │ │ +
147 (INDEX == std::tuple_size<TUPLE>::value-1),
│ │ │ │ +
148 int
│ │ │ │ +
149 >::type=0
│ │ │ │ +
150>
│ │ │ │ +
151inline std::string
│ │ │ │ + │ │ │ │ +
153 const std::string & /* sep */,
│ │ │ │ +
154 const TUPLE &t,
│ │ │ │ +
155 const ACCESS& access
│ │ │ │ +
156)
│ │ │ │ +
157{
│ │ │ │ +
158 return to_string(access(&std::get<INDEX>(t)));
│ │ │ │ +
159}
│ │ │ │ +
160
│ │ │ │ +
161template<
│ │ │ │ +
162 typename TUPLE,
│ │ │ │ +
163 std::size_t INDEX=0,
│ │ │ │ +
164 typename ACCESS,
│ │ │ │ +
165 typename std::enable_if<
│ │ │ │ +
166 (INDEX < std::tuple_size<TUPLE>::value-1),
│ │ │ │ +
167 int
│ │ │ │ +
168 >::type=0
│ │ │ │ +
169>
│ │ │ │ +
170inline std::string
│ │ │ │ +
171separated_list(const std::string &sep, const TUPLE &t, const ACCESS& access)
│ │ │ │ +
172{
│ │ │ │ +
173 return
│ │ │ │ +
174 to_string(access(&std::get<INDEX>(t))) +
│ │ │ │ +
175 sep +
│ │ │ │ +
176 separated_list<TUPLE, INDEX+1>(sep, t, access);
│ │ │ │ +
177}
│ │ │ │ +
178
│ │ │ │ +
179template<
│ │ │ │ +
180 typename TUPLE,
│ │ │ │ +
181 std::size_t INDEX=0,
│ │ │ │ +
182 typename std::enable_if<
│ │ │ │ +
183 (INDEX <= std::tuple_size<TUPLE>::value),
│ │ │ │ +
184 int
│ │ │ │ +
185 >::type=0
│ │ │ │ +
186>
│ │ │ │ +
187inline std::string
│ │ │ │ +
188separated_list(const std::string &sep, const TUPLE &t)
│ │ │ │ +
189{
│ │ │ │ +
190 return separated_list(sep, t, [](const TUPLE &tup){return *tup;});
│ │ │ │ +
191}
│ │ │ │
193
│ │ │ │ -
194 QueryMap m_queries;
│ │ │ │ -
195 std::pair<QueryMap::iterator,QueryMap::iterator> m_issuedrange;
│ │ │ │ -
196 int m_retain = 0;
│ │ │ │ -
197 int m_num_waiting = 0;
│ │ │ │ -
198 query_id m_q_id = 0;
│ │ │ │ -
199
│ │ │ │ -
201 bool m_dummy_pending = false;
│ │ │ │ -
202
│ │ │ │ -
204 query_id m_error = qid_limit();
│ │ │ │ -
205};
│ │ │ │ -
206
│ │ │ │ -
207} // namespace
│ │ │ │ -
208
│ │ │ │ -
209#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
210#endif
│ │ │ │ +
194
│ │ │ │ +
196
│ │ │ │ +
205namespace internal
│ │ │ │ +
206{
│ │ │ │ +
207PQXX_LIBEXPORT void freepqmem(const void *) noexcept;
│ │ │ │ +
208template<typename P> inline void freepqmem_templated(P *p) noexcept
│ │ │ │ +
209{
│ │ │ │ +
210 freepqmem(p);
│ │ │ │ +
211}
│ │ │ │ +
212
│ │ │ │ +
213PQXX_LIBEXPORT void freemallocmem(const void *) noexcept;
│ │ │ │ +
214template<typename P> inline void freemallocmem_templated(P *p) noexcept
│ │ │ │ +
215{
│ │ │ │ +
216 freemallocmem(p);
│ │ │ │ +
217}
│ │ │ │ +
218
│ │ │ │ +
219
│ │ │ │ +
221
│ │ │ │ +
233class PQXX_LIBEXPORT namedclass
│ │ │ │ +
234{
│ │ │ │ +
235public:
│ │ │ │ +
236 explicit namedclass(const std::string &Classname) :
│ │ │ │ +
237 m_classname{Classname},
│ │ │ │ +
238 m_name{}
│ │ │ │ +
239 {
│ │ │ │ +
240 }
│ │ │ │ +
241
│ │ │ │ +
242 namedclass(const std::string &Classname, const std::string &Name) :
│ │ │ │ +
243 m_classname{Classname},
│ │ │ │ +
244 m_name{Name}
│ │ │ │ +
245 {
│ │ │ │ +
246 }
│ │ │ │ +
247
│ │ │ │ +
249 const std::string &name() const noexcept { return m_name; } //[t01]
│ │ │ │ +
250
│ │ │ │ +
252 const std::string &classname() const noexcept //[t73]
│ │ │ │ +
253 { return m_classname; }
│ │ │ │ +
254
│ │ │ │ +
256 std::string description() const;
│ │ │ │ +
257
│ │ │ │ +
258private:
│ │ │ │ +
259 std::string m_classname, m_name;
│ │ │ │ +
260};
│ │ │ │ +
261
│ │ │ │ +
262
│ │ │ │ +
263PQXX_PRIVATE void CheckUniqueRegistration(
│ │ │ │ +
264 const namedclass *New, const namedclass *Old);
│ │ │ │ +
265PQXX_PRIVATE void CheckUniqueUnregistration(
│ │ │ │ +
266 const namedclass *New, const namedclass *Old);
│ │ │ │ +
267
│ │ │ │ +
268
│ │ │ │ +
270
│ │ │ │ +
273template<typename GUEST>
│ │ │ │ + │ │ │ │ +
275{
│ │ │ │ +
276public:
│ │ │ │ +
277 unique() =default;
│ │ │ │ +
278 unique(const unique &) =delete;
│ │ │ │ +
279 unique &operator=(const unique &) =delete;
│ │ │ │ +
280
│ │ │ │ +
281 GUEST *get() const noexcept { return m_guest; }
│ │ │ │ +
282
│ │ │ │ +
283 void register_guest(GUEST *G)
│ │ │ │ +
284 {
│ │ │ │ +
285 CheckUniqueRegistration(G, m_guest);
│ │ │ │ +
286 m_guest = G;
│ │ │ │ +
287 }
│ │ │ │ +
288
│ │ │ │ +
289 void unregister_guest(GUEST *G)
│ │ │ │ +
290 {
│ │ │ │ +
291 CheckUniqueUnregistration(G, m_guest);
│ │ │ │ +
292 m_guest = nullptr;
│ │ │ │ +
293 }
│ │ │ │ +
294
│ │ │ │ +
295private:
│ │ │ │ +
296 GUEST *m_guest = nullptr;
│ │ │ │ +
297};
│ │ │ │ +
298
│ │ │ │ +
299
│ │ │ │ +
301
│ │ │ │ +
304PQXX_LIBEXPORT void sleep_seconds(int);
│ │ │ │ +
305
│ │ │ │ +
306} // namespace internal
│ │ │ │ +
307} // namespace pqxx
│ │ │ │ +
308
│ │ │ │ +
309#endif
│ │ │ │
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
Processes several queries in FIFO manner, optimized for high throughput.
Definition: pipeline.hxx:49
│ │ │ │ -
pipeline & operator=(const pipeline &)=delete
│ │ │ │ -
bool empty() const noexcept
Definition: pipeline.hxx:115
│ │ │ │ -
pipeline(const pipeline &)=delete
│ │ │ │ -
long query_id
Definition: pipeline.hxx:51
│ │ │ │ +
thread_safety_model describe_thread_safety() noexcept
Describe thread safety available in this build.
Definition: util.cxx:31
│ │ │ │ +
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
│ │ │ │ +
void ignore_unused(T)
Suppress compiler warning about an unused item.
Definition: util.hxx:38
│ │ │ │ +
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
│ │ │ │ +
constexpr oid oid_none
The "null" oid.
Definition: util.hxx:77
│ │ │ │ +
void freepqmem_templated(P *p) noexcept
Definition: util.hxx:208
│ │ │ │ +
void CheckUniqueUnregistration(const namedclass *New, const namedclass *Old)
Definition: util.cxx:88
│ │ │ │ +
void CheckUniqueRegistration(const namedclass *New, const namedclass *Old)
Definition: util.cxx:72
│ │ │ │ +
void freemallocmem(const void *) noexcept
Definition: util.cxx:112
│ │ │ │ +
void freepqmem(const void *) noexcept
Definition: util.cxx:106
│ │ │ │ +
void freemallocmem_templated(P *p) noexcept
Definition: util.hxx:214
│ │ │ │
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ -
Definition: transaction_base.hxx:44
│ │ │ │ -
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │ +
Descriptor of library's thread-safety model.
Definition: util.hxx:45
│ │ │ │ +
bool safe_libpq
Is the underlying libpq build thread-safe?
Definition: util.hxx:50
│ │ │ │ +
bool safe_kerberos
Is Kerberos thread-safe?
Definition: util.hxx:65
│ │ │ │ +
std::string description
A human-readable description of any thread-safety issues.
Definition: util.hxx:68
│ │ │ │ +
Helper base class: object descriptions for error messages and such.
Definition: util.hxx:234
│ │ │ │ +
const std::string & classname() const noexcept
Class name.
Definition: util.hxx:252
│ │ │ │ +
namedclass(const std::string &Classname, const std::string &Name)
Definition: util.hxx:242
│ │ │ │ +
namedclass(const std::string &Classname)
Definition: util.hxx:236
│ │ │ │ +
const std::string & name() const noexcept
Object name, or the empty string if no name was given.
Definition: util.hxx:249
│ │ │ │ +
Ensure proper opening/closing of GUEST objects related to a "host" object.
Definition: util.hxx:275
│ │ │ │ + │ │ │ │ +
unique(const unique &)=delete
│ │ │ │ +
GUEST * get() const noexcept
Definition: util.hxx:281
│ │ │ │ +
void unregister_guest(GUEST *G)
Definition: util.hxx:289
│ │ │ │ +
void register_guest(GUEST *G)
Definition: util.hxx:283
│ │ │ │ +
unique & operator=(const unique &)=delete
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,169 +1,347 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -pipeline.hxx │ │ │ │ │ +util.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_PIPELINE │ │ │ │ │ - 14#define PQXX_H_PIPELINE │ │ │ │ │ + 11#ifndef PQXX_H_UTIL │ │ │ │ │ + 12#define PQXX_H_UTIL │ │ │ │ │ + 13 │ │ │ │ │ + 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ 15 │ │ │ │ │ - 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include │ │ │ │ │ - 20#include │ │ │ │ │ + 16#include │ │ │ │ │ + 17#include │ │ │ │ │ + 18#include │ │ │ │ │ + 19#include │ │ │ │ │ + 20#include │ │ │ │ │ 21#include │ │ │ │ │ - 22 │ │ │ │ │ - 23#include "pqxx/transaction_base.hxx" │ │ │ │ │ - 24 │ │ │ │ │ + 22#include │ │ │ │ │ + 23#include │ │ │ │ │ + 24#include │ │ │ │ │ 25 │ │ │ │ │ - 26// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ + 26#include "pqxx/strconv.hxx" │ │ │ │ │ 27 │ │ │ │ │ - 28namespace pqxx │ │ │ │ │ - 29{ │ │ │ │ │ - 30 │ │ │ │ │ - 32 │ │ │ │ │ -48class PQXX_LIBEXPORT pipeline : public internal::transactionfocus │ │ │ │ │ - 49{ │ │ │ │ │ - 50public: │ │ │ │ │ -51 using query_id = long; │ │ │ │ │ - 52 │ │ │ │ │ -53 pipeline(const pipeline &) =delete; │ │ │ │ │ -54 pipeline &operator=(const pipeline &) =delete; │ │ │ │ │ - 55 │ │ │ │ │ - 56 explicit pipeline( //[t69] │ │ │ │ │ - 57 transaction_base &, │ │ │ │ │ - 58 const std::string &Name=std::string{}); │ │ │ │ │ + 28 │ │ │ │ │ + 30namespace pqxx {} │ │ │ │ │ + 31 │ │ │ │ │ + 32#include │ │ │ │ │ + 33 │ │ │ │ │ + 34 │ │ │ │ │ + 35namespace pqxx │ │ │ │ │ + 36{ │ │ │ │ │ +38template inline void ignore_unused(T) {} │ │ │ │ │ + 39 │ │ │ │ │ + 40 │ │ │ │ │ + 42 │ │ │ │ │ +44struct PQXX_LIBEXPORT thread_safety_model │ │ │ │ │ + 45{ │ │ │ │ │ +47 bool have_safe_strerror = true; │ │ │ │ │ + 48 │ │ │ │ │ +50 bool safe_libpq; │ │ │ │ │ + 51 │ │ │ │ │ +53 bool safe_query_cancel = true; │ │ │ │ │ + 54 │ │ │ │ │ +56 bool safe_result_copy = true; │ │ │ │ │ + 57 │ │ │ │ │ 59 │ │ │ │ │ - 60 ~pipeline() noexcept; │ │ │ │ │ - 61 │ │ │ │ │ - 63 │ │ │ │ │ - 69 query_id insert(const std::string &); //[t69] │ │ │ │ │ +65 bool safe_kerberos; │ │ │ │ │ + 66 │ │ │ │ │ +68 std::string description; │ │ │ │ │ + 69}; │ │ │ │ │ 70 │ │ │ │ │ - 72 │ │ │ │ │ - 73 void complete(); //[t71] │ │ │ │ │ + 71 │ │ │ │ │ + 73PQXX_LIBEXPORT thread_safety_model describe_thread_safety() noexcept; │ │ │ │ │ 74 │ │ │ │ │ - 76 │ │ │ │ │ - 85 void flush(); //[t70] │ │ │ │ │ + 75 │ │ │ │ │ +77constexpr oid oid_none = 0; │ │ │ │ │ + 78 │ │ │ │ │ + 79 │ │ │ │ │ + 84 │ │ │ │ │ 86 │ │ │ │ │ - 88 │ │ │ │ │ - 96 void cancel(); │ │ │ │ │ - 97 │ │ │ │ │ - 99 bool is_finished(query_id) const; //[t71] │ │ │ │ │ - 100 │ │ │ │ │ - 102 │ │ │ │ │ -108 result retrieve(query_id qid) //[t71] │ │ │ │ │ - 109 { return retrieve(m_queries.find(qid)).second; } │ │ │ │ │ - 110 │ │ │ │ │ - 112 │ │ │ │ │ - 113 std::pair retrieve(); //[t69] │ │ │ │ │ + 94template inline │ │ │ │ │ +95std::string separated_list( //[t00] │ │ │ │ │ + 96 const std::string &sep, │ │ │ │ │ + 97 ITER begin, │ │ │ │ │ + 98 ITER end, │ │ │ │ │ + 99 ACCESS access) │ │ │ │ │ + 100{ │ │ │ │ │ + 101 std::string result; │ │ │ │ │ + 102 if (begin != end) │ │ │ │ │ + 103 { │ │ │ │ │ + 104 result = to_string(access(begin)); │ │ │ │ │ + 105 for (++begin; begin != end; ++begin) │ │ │ │ │ + 106 { │ │ │ │ │ + 107 result += sep; │ │ │ │ │ + 108 result += to_string(access(begin)); │ │ │ │ │ + 109 } │ │ │ │ │ + 110 } │ │ │ │ │ + 111 return result; │ │ │ │ │ + 112} │ │ │ │ │ + 113 │ │ │ │ │ 114 │ │ │ │ │ -115 bool empty() const noexcept { return m_queries.empty(); } //[t69] │ │ │ │ │ - 116 │ │ │ │ │ - 118 │ │ │ │ │ - 129 int retain(int retain_max=2); //[t70] │ │ │ │ │ - 130 │ │ │ │ │ - 131 │ │ │ │ │ - 133 void resume(); //[t70] │ │ │ │ │ - 134 │ │ │ │ │ - 135private: │ │ │ │ │ - 136 class PQXX_PRIVATE Query │ │ │ │ │ - 137 { │ │ │ │ │ - 138 public: │ │ │ │ │ - 139 explicit Query(const std::string &q) : m_query{q}, m_res{} {} │ │ │ │ │ + 116template inline std::string │ │ │ │ │ +117separated_list(const std::string &sep, ITER begin, ITER end) //[t00] │ │ │ │ │ + 118 { return separated_list(sep, begin, end, [](ITER i){ return *i; }); } │ │ │ │ │ + 119 │ │ │ │ │ + 120 │ │ │ │ │ + 122template inline auto │ │ │ │ │ +123separated_list(const std::string &sep, const CONTAINER &c) //[t10] │ │ │ │ │ + 124 /* │ │ │ │ │ + 125 Always std::string; necessary because SFINAE doesn't work with the │ │ │ │ │ + 126 contents of function bodies, so the check for iterability has to be in │ │ │ │ │ + 127 the signature. │ │ │ │ │ + 128 */ │ │ │ │ │ + 129 -> typename std::enable_if< │ │ │ │ │ + 130 ( │ │ │ │ │ + 131 not std::is_void::value │ │ │ │ │ + 132 and not std::is_void::value │ │ │ │ │ + 133 ), │ │ │ │ │ + 134 std::string │ │ │ │ │ + 135 >::type │ │ │ │ │ + 136{ │ │ │ │ │ + 137 return separated_list(sep, std::begin(c), std::end(c)); │ │ │ │ │ + 138} │ │ │ │ │ + 139 │ │ │ │ │ 140 │ │ │ │ │ - 141 const result &get_result() const noexcept { return m_res; } │ │ │ │ │ - 142 void set_result(const result &r) noexcept { m_res = r; } │ │ │ │ │ - 143 const std::string &get_query() const noexcept { return m_query; } │ │ │ │ │ - 144 │ │ │ │ │ - 145 private: │ │ │ │ │ - 146 std::string m_query; │ │ │ │ │ - 147 result m_res; │ │ │ │ │ - 148 }; │ │ │ │ │ - 149 │ │ │ │ │ - 150 using QueryMap = std::map; │ │ │ │ │ - 151 │ │ │ │ │ - 152 void attach(); │ │ │ │ │ - 153 void detach(); │ │ │ │ │ - 154 │ │ │ │ │ - 156 static constexpr query_id qid_limit() noexcept │ │ │ │ │ - 157 { │ │ │ │ │ - 158 // Parenthesise this to work around an eternal Visual C++ problem: │ │ │ │ │ - 159 // Without the extra parentheses, unless NOMINMAX is defined, the │ │ │ │ │ - 160 // preprocessor will mistake this "max" for its annoying built-in macro │ │ │ │ │ - 161 // of the same name. │ │ │ │ │ - 162 return (std::numeric_limits::max)(); │ │ │ │ │ - 163 } │ │ │ │ │ - 164 │ │ │ │ │ - 166 PQXX_PRIVATE query_id generate_id(); │ │ │ │ │ - 167 │ │ │ │ │ - 168 bool have_pending() const noexcept │ │ │ │ │ - 169 { return m_issuedrange.second != m_issuedrange.first; } │ │ │ │ │ - 170 │ │ │ │ │ - 171 PQXX_PRIVATE void issue(); │ │ │ │ │ - 172 │ │ │ │ │ - 174 void set_error_at(query_id qid) noexcept │ │ │ │ │ - 175 { if (qid < m_error) m_error = qid; } │ │ │ │ │ - 176 │ │ │ │ │ - 178 [[noreturn]] PQXX_PRIVATE void internal_error(const std::string &err); │ │ │ │ │ - 179 │ │ │ │ │ - 180 PQXX_PRIVATE bool obtain_result(bool expect_none=false); │ │ │ │ │ - 181 │ │ │ │ │ - 182 PQXX_PRIVATE void obtain_dummy(); │ │ │ │ │ - 183 PQXX_PRIVATE void get_further_available_results(); │ │ │ │ │ - 184 PQXX_PRIVATE void check_end_results(); │ │ │ │ │ - 185 │ │ │ │ │ - 187 PQXX_PRIVATE void receive_if_available(); │ │ │ │ │ - 188 │ │ │ │ │ - 190 PQXX_PRIVATE void receive(pipeline::QueryMap::const_iterator stop); │ │ │ │ │ - 191 std::pair │ │ │ │ │ - 192 retrieve(pipeline::QueryMap::iterator); │ │ │ │ │ + 142template< │ │ │ │ │ + 143 typename TUPLE, │ │ │ │ │ + 144 std::size_t INDEX=0, │ │ │ │ │ + 145 typename ACCESS, │ │ │ │ │ + 146 typename std::enable_if< │ │ │ │ │ + 147 (INDEX == std::tuple_size::value-1), │ │ │ │ │ + 148 int │ │ │ │ │ + 149 >::type=0 │ │ │ │ │ + 150> │ │ │ │ │ + 151inline std::string │ │ │ │ │ +152separated_list( │ │ │ │ │ + 153 const std::string & /* sep */, │ │ │ │ │ + 154 const TUPLE &t, │ │ │ │ │ + 155 const ACCESS& access │ │ │ │ │ + 156) │ │ │ │ │ + 157{ │ │ │ │ │ + 158 return to_string(access(&std::get(t))); │ │ │ │ │ + 159} │ │ │ │ │ + 160 │ │ │ │ │ + 161template< │ │ │ │ │ + 162 typename TUPLE, │ │ │ │ │ + 163 std::size_t INDEX=0, │ │ │ │ │ + 164 typename ACCESS, │ │ │ │ │ + 165 typename std::enable_if< │ │ │ │ │ + 166 (INDEX < std::tuple_size::value-1), │ │ │ │ │ + 167 int │ │ │ │ │ + 168 >::type=0 │ │ │ │ │ + 169> │ │ │ │ │ + 170inline std::string │ │ │ │ │ + 171separated_list(const std::string &sep, const TUPLE &t, const ACCESS& │ │ │ │ │ +access) │ │ │ │ │ + 172{ │ │ │ │ │ + 173 return │ │ │ │ │ + 174 to_string(access(&std::get(t))) + │ │ │ │ │ + 175 sep + │ │ │ │ │ + 176 separated_list(sep, t, access); │ │ │ │ │ + 177} │ │ │ │ │ + 178 │ │ │ │ │ + 179template< │ │ │ │ │ + 180 typename TUPLE, │ │ │ │ │ + 181 std::size_t INDEX=0, │ │ │ │ │ + 182 typename std::enable_if< │ │ │ │ │ + 183 (INDEX <= std::tuple_size::value), │ │ │ │ │ + 184 int │ │ │ │ │ + 185 >::type=0 │ │ │ │ │ + 186> │ │ │ │ │ + 187inline std::string │ │ │ │ │ +188separated_list(const std::string &sep, const TUPLE &t) │ │ │ │ │ + 189{ │ │ │ │ │ + 190 return separated_list(sep, t, [](const TUPLE &tup){return *tup;}); │ │ │ │ │ + 191} │ │ │ │ │ 193 │ │ │ │ │ - 194 QueryMap m_queries; │ │ │ │ │ - 195 std::pair m_issuedrange; │ │ │ │ │ - 196 int m_retain = 0; │ │ │ │ │ - 197 int m_num_waiting = 0; │ │ │ │ │ - 198 query_id m_q_id = 0; │ │ │ │ │ - 199 │ │ │ │ │ - 201 bool m_dummy_pending = false; │ │ │ │ │ - 202 │ │ │ │ │ - 204 query_id m_error = qid_limit(); │ │ │ │ │ - 205}; │ │ │ │ │ - 206 │ │ │ │ │ - 207} // namespace │ │ │ │ │ - 208 │ │ │ │ │ - 209#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 210#endif │ │ │ │ │ + 194 │ │ │ │ │ + 196 │ │ │ │ │ + 205namespace internal │ │ │ │ │ + 206{ │ │ │ │ │ + 207PQXX_LIBEXPORT void freepqmem(const void *) noexcept; │ │ │ │ │ +208template inline void freepqmem_templated(P *p) noexcept │ │ │ │ │ + 209{ │ │ │ │ │ + 210 freepqmem(p); │ │ │ │ │ + 211} │ │ │ │ │ + 212 │ │ │ │ │ + 213PQXX_LIBEXPORT void freemallocmem(const void *) noexcept; │ │ │ │ │ +214template inline void freemallocmem_templated(P *p) noexcept │ │ │ │ │ + 215{ │ │ │ │ │ + 216 freemallocmem(p); │ │ │ │ │ + 217} │ │ │ │ │ + 218 │ │ │ │ │ + 219 │ │ │ │ │ + 221 │ │ │ │ │ +233class PQXX_LIBEXPORT namedclass │ │ │ │ │ + 234{ │ │ │ │ │ + 235public: │ │ │ │ │ +236 explicit namedclass(const std::string &Classname) : │ │ │ │ │ + 237 m_classname{Classname}, │ │ │ │ │ + 238 m_name{} │ │ │ │ │ + 239 { │ │ │ │ │ + 240 } │ │ │ │ │ + 241 │ │ │ │ │ +242 namedclass(const std::string &Classname, const std::string &Name) : │ │ │ │ │ + 243 m_classname{Classname}, │ │ │ │ │ + 244 m_name{Name} │ │ │ │ │ + 245 { │ │ │ │ │ + 246 } │ │ │ │ │ + 247 │ │ │ │ │ +249 const std::string &name() const noexcept { return m_name; } //[t01] │ │ │ │ │ + 250 │ │ │ │ │ +252 const std::string &classname() const noexcept //[t73] │ │ │ │ │ + 253 { return m_classname; } │ │ │ │ │ + 254 │ │ │ │ │ + 256 std::string description() const; │ │ │ │ │ + 257 │ │ │ │ │ + 258private: │ │ │ │ │ + 259 std::string m_classname, m_name; │ │ │ │ │ + 260}; │ │ │ │ │ + 261 │ │ │ │ │ + 262 │ │ │ │ │ + 263PQXX_PRIVATE void CheckUniqueRegistration( │ │ │ │ │ + 264 const namedclass *New, const namedclass *Old); │ │ │ │ │ + 265PQXX_PRIVATE void CheckUniqueUnregistration( │ │ │ │ │ + 266 const namedclass *New, const namedclass *Old); │ │ │ │ │ + 267 │ │ │ │ │ + 268 │ │ │ │ │ + 270 │ │ │ │ │ + 273template │ │ │ │ │ +274class unique │ │ │ │ │ + 275{ │ │ │ │ │ + 276public: │ │ │ │ │ +277 unique() =default; │ │ │ │ │ +278 unique(const unique &) =delete; │ │ │ │ │ +279 unique &operator=(const unique &) =delete; │ │ │ │ │ + 280 │ │ │ │ │ +281 GUEST *get() const noexcept { return m_guest; } │ │ │ │ │ + 282 │ │ │ │ │ +283 void register_guest(GUEST *G) │ │ │ │ │ + 284 { │ │ │ │ │ + 285 CheckUniqueRegistration(G, m_guest); │ │ │ │ │ + 286 m_guest = G; │ │ │ │ │ + 287 } │ │ │ │ │ + 288 │ │ │ │ │ +289 void unregister_guest(GUEST *G) │ │ │ │ │ + 290 { │ │ │ │ │ + 291 CheckUniqueUnregistration(G, m_guest); │ │ │ │ │ + 292 m_guest = nullptr; │ │ │ │ │ + 293 } │ │ │ │ │ + 294 │ │ │ │ │ + 295private: │ │ │ │ │ + 296 GUEST *m_guest = nullptr; │ │ │ │ │ + 297}; │ │ │ │ │ + 298 │ │ │ │ │ + 299 │ │ │ │ │ + 301 │ │ │ │ │ + 304PQXX_LIBEXPORT void sleep_seconds(int); │ │ │ │ │ + 305 │ │ │ │ │ + 306} // namespace internal │ │ │ │ │ + 307} // namespace pqxx │ │ │ │ │ + 308 │ │ │ │ │ + 309#endif │ │ │ │ │ std │ │ │ │ │ STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::pipeline │ │ │ │ │ -Processes several queries in FIFO manner, optimized for high throughput. │ │ │ │ │ -Definition: pipeline.hxx:49 │ │ │ │ │ -pqxx::pipeline::operator= │ │ │ │ │ -pipeline & operator=(const pipeline &)=delete │ │ │ │ │ -pqxx::pipeline::empty │ │ │ │ │ -bool empty() const noexcept │ │ │ │ │ -Definition: pipeline.hxx:115 │ │ │ │ │ -pqxx::pipeline::pipeline │ │ │ │ │ -pipeline(const pipeline &)=delete │ │ │ │ │ -pqxx::pipeline::query_id │ │ │ │ │ -long query_id │ │ │ │ │ -Definition: pipeline.hxx:51 │ │ │ │ │ +pqxx::describe_thread_safety │ │ │ │ │ +thread_safety_model describe_thread_safety() noexcept │ │ │ │ │ +Describe thread safety available in this build. │ │ │ │ │ +Definition: util.cxx:31 │ │ │ │ │ +pqxx::to_string │ │ │ │ │ +std::string to_string(const field &Obj) │ │ │ │ │ +Convert a field to a string. │ │ │ │ │ +Definition: result.cxx:451 │ │ │ │ │ +pqxx::ignore_unused │ │ │ │ │ +void ignore_unused(T) │ │ │ │ │ +Suppress compiler warning about an unused item. │ │ │ │ │ +Definition: util.hxx:38 │ │ │ │ │ +pqxx::separated_list │ │ │ │ │ +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 │ │ │ │ │ +pqxx::oid_none │ │ │ │ │ +constexpr oid oid_none │ │ │ │ │ +The "null" oid. │ │ │ │ │ +Definition: util.hxx:77 │ │ │ │ │ +pqxx::internal::freepqmem_templated │ │ │ │ │ +void freepqmem_templated(P *p) noexcept │ │ │ │ │ +Definition: util.hxx:208 │ │ │ │ │ +pqxx::internal::CheckUniqueUnregistration │ │ │ │ │ +void CheckUniqueUnregistration(const namedclass *New, const namedclass *Old) │ │ │ │ │ +Definition: util.cxx:88 │ │ │ │ │ +pqxx::internal::CheckUniqueRegistration │ │ │ │ │ +void CheckUniqueRegistration(const namedclass *New, const namedclass *Old) │ │ │ │ │ +Definition: util.cxx:72 │ │ │ │ │ +pqxx::internal::freemallocmem │ │ │ │ │ +void freemallocmem(const void *) noexcept │ │ │ │ │ +Definition: util.cxx:112 │ │ │ │ │ +pqxx::internal::freepqmem │ │ │ │ │ +void freepqmem(const void *) noexcept │ │ │ │ │ +Definition: util.cxx:106 │ │ │ │ │ +pqxx::internal::freemallocmem_templated │ │ │ │ │ +void freemallocmem_templated(P *p) noexcept │ │ │ │ │ +Definition: util.hxx:214 │ │ │ │ │ pqxx::result │ │ │ │ │ Result set containing data returned by a query or command. │ │ │ │ │ Definition: result.hxx:70 │ │ │ │ │ -pqxx::internal::transactionfocus │ │ │ │ │ -Definition: transaction_base.hxx:44 │ │ │ │ │ -pqxx::transaction_base │ │ │ │ │ -Interface definition (and common code) for "transaction" classes. │ │ │ │ │ -Definition: transaction_base.hxx:138 │ │ │ │ │ +pqxx::thread_safety_model │ │ │ │ │ +Descriptor of library's thread-safety model. │ │ │ │ │ +Definition: util.hxx:45 │ │ │ │ │ +pqxx::thread_safety_model::safe_libpq │ │ │ │ │ +bool safe_libpq │ │ │ │ │ +Is the underlying libpq build thread-safe? │ │ │ │ │ +Definition: util.hxx:50 │ │ │ │ │ +pqxx::thread_safety_model::safe_kerberos │ │ │ │ │ +bool safe_kerberos │ │ │ │ │ +Is Kerberos thread-safe? │ │ │ │ │ +Definition: util.hxx:65 │ │ │ │ │ +pqxx::thread_safety_model::description │ │ │ │ │ +std::string description │ │ │ │ │ +A human-readable description of any thread-safety issues. │ │ │ │ │ +Definition: util.hxx:68 │ │ │ │ │ +pqxx::internal::namedclass │ │ │ │ │ +Helper base class: object descriptions for error messages and such. │ │ │ │ │ +Definition: util.hxx:234 │ │ │ │ │ +pqxx::internal::namedclass::classname │ │ │ │ │ +const std::string & classname() const noexcept │ │ │ │ │ +Class name. │ │ │ │ │ +Definition: util.hxx:252 │ │ │ │ │ +pqxx::internal::namedclass::namedclass │ │ │ │ │ +namedclass(const std::string &Classname, const std::string &Name) │ │ │ │ │ +Definition: util.hxx:242 │ │ │ │ │ +pqxx::internal::namedclass::namedclass │ │ │ │ │ +namedclass(const std::string &Classname) │ │ │ │ │ +Definition: util.hxx:236 │ │ │ │ │ +pqxx::internal::namedclass::name │ │ │ │ │ +const std::string & name() const noexcept │ │ │ │ │ +Object name, or the empty string if no name was given. │ │ │ │ │ +Definition: util.hxx:249 │ │ │ │ │ +pqxx::internal::unique │ │ │ │ │ +Ensure proper opening/closing of GUEST objects related to a "host" object. │ │ │ │ │ +Definition: util.hxx:275 │ │ │ │ │ +pqxx::internal::unique::unique │ │ │ │ │ +unique()=default │ │ │ │ │ +pqxx::internal::unique::unique │ │ │ │ │ +unique(const unique &)=delete │ │ │ │ │ +pqxx::internal::unique::get │ │ │ │ │ +GUEST * get() const noexcept │ │ │ │ │ +Definition: util.hxx:281 │ │ │ │ │ +pqxx::internal::unique::unregister_guest │ │ │ │ │ +void unregister_guest(GUEST *G) │ │ │ │ │ +Definition: util.hxx:289 │ │ │ │ │ +pqxx::internal::unique::register_guest │ │ │ │ │ +void register_guest(GUEST *G) │ │ │ │ │ +Definition: util.hxx:283 │ │ │ │ │ +pqxx::internal::unique::operator= │ │ │ │ │ +unique & operator=(const unique &)=delete │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * pipeline.hxx │ │ │ │ │ + * util.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00056_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: transactor.hxx Source File │ │ │ │ +libpqxx: dbtransaction.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,190 +55,88 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
transactor.hxx
│ │ │ │ +
dbtransaction.hxx
│ │ │ │
│ │ │ │
│ │ │ │ -
1/* Transactor framework, a wrapper for safely retryable transactions.
│ │ │ │ -
2 *
│ │ │ │ -
3 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transactor instead.
│ │ │ │ -
4 *
│ │ │ │ -
5 * Copyright (c) 2000-2019, Jeroen T. Vermeulen.
│ │ │ │ -
6 *
│ │ │ │ -
7 * See COPYING for copyright license. If you did not receive a file called
│ │ │ │ -
8 * COPYING with this source code, please notify the distributor of this mistake,
│ │ │ │ -
9 * or contact the author.
│ │ │ │ -
10 */
│ │ │ │ -
11#ifndef PQXX_H_TRANSACTOR
│ │ │ │ -
12#define PQXX_H_TRANSACTOR
│ │ │ │ -
13
│ │ │ │ -
14#include "pqxx/compiler-public.hxx"
│ │ │ │ -
15#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
16
│ │ │ │ -
17#include "pqxx/connection_base.hxx"
│ │ │ │ -
18#include "pqxx/transaction.hxx"
│ │ │ │ -
19
│ │ │ │ +
1
│ │ │ │ +
13#ifndef PQXX_H_DBTRANSACTION
│ │ │ │ +
14#define PQXX_H_DBTRANSACTION
│ │ │ │ +
15
│ │ │ │ +
16#include "pqxx/compiler-public.hxx"
│ │ │ │ +
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
18
│ │ │ │ +
19#include "pqxx/transaction_base.hxx"
│ │ │ │
20
│ │ │ │ -
21// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ -
22
│ │ │ │ -
23namespace pqxx
│ │ │ │ -
24{
│ │ │ │ -
67
│ │ │ │ -
69
│ │ │ │ -
98template<typename TRANSACTION_CALLBACK>
│ │ │ │ -
99inline auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3)
│ │ │ │ -
100 -> decltype(callback())
│ │ │ │ -
101{
│ │ │ │ -
102 if (attempts <= 0)
│ │ │ │ -
103 throw std::invalid_argument{
│ │ │ │ -
104 "Zero or negative number of attempts passed to pqxx::perform()."};
│ │ │ │ -
105
│ │ │ │ -
106 for (; attempts > 0; --attempts)
│ │ │ │ -
107 {
│ │ │ │ -
108 try
│ │ │ │ -
109 {
│ │ │ │ -
110 return callback();
│ │ │ │ -
111 }
│ │ │ │ -
112 catch (const in_doubt_error &)
│ │ │ │ -
113 {
│ │ │ │ -
114 // Not sure whether transaction went through or not. The last thing in
│ │ │ │ -
115 // the world that we should do now is try again!
│ │ │ │ -
116 throw;
│ │ │ │ -
117 }
│ │ │ │ -
118 catch (const statement_completion_unknown &)
│ │ │ │ -
119 {
│ │ │ │ -
120 // Not sure whether our last statement succeeded. Don't risk running it
│ │ │ │ -
121 // again.
│ │ │ │ -
122 throw;
│ │ │ │ -
123 }
│ │ │ │ -
124 catch (const broken_connection &)
│ │ │ │ -
125 {
│ │ │ │ -
126 // Connection failed. Definitely worth retrying.
│ │ │ │ -
127 if (attempts <= 1) throw;
│ │ │ │ -
128 continue;
│ │ │ │ -
129 }
│ │ │ │ -
130 catch (const transaction_rollback &)
│ │ │ │ -
131 {
│ │ │ │ -
132 // Some error that may well be transient, such as serialization failure
│ │ │ │ -
133 // or deadlock. Worth retrying.
│ │ │ │ -
134 if (attempts <= 1) throw;
│ │ │ │ -
135 continue;
│ │ │ │ -
136 }
│ │ │ │ -
137 }
│ │ │ │ -
138 throw pqxx::internal_error{"No outcome reached on perform()."};
│ │ │ │ -
139}
│ │ │ │ -
140
│ │ │ │ -
142
│ │ │ │ -
156template<typename TRANSACTION=transaction<read_committed>> class transactor
│ │ │ │ -
157{
│ │ │ │ -
158public:
│ │ │ │ -
159 using argument_type = TRANSACTION;
│ │ │ │ -
160 PQXX_DEPRECATED explicit transactor( //[t04]
│ │ │ │ -
161 const std::string &TName="transactor") :
│ │ │ │ -
162 m_name{TName} { }
│ │ │ │ -
163
│ │ │ │ -
165
│ │ │ │ -
176 void operator()(TRANSACTION &T); //[t04]
│ │ │ │ -
177
│ │ │ │ -
178 // Overridable member functions, called by connection_base::perform() if an
│ │ │ │ -
179 // attempt to run transaction fails/succeeds, respectively, or if the
│ │ │ │ -
180 // connection is lost at just the wrong moment, goes into an indeterminate
│ │ │ │ -
181 // state. Use these to patch up runtime state to match events, if needed, or
│ │ │ │ -
182 // to report failure conditions.
│ │ │ │ -
183
│ │ │ │ -
185
│ │ │ │ -
193 void on_abort(const char[]) noexcept {} //[t13]
│ │ │ │ -
194
│ │ │ │ -
196
│ │ │ │ -
200 void on_commit() {} //[t07]
│ │ │ │ -
201
│ │ │ │ -
203
│ │ │ │ -
214 void on_doubt() noexcept {} //[t13]
│ │ │ │ -
215
│ │ │ │ -
217 std::string name() const { return m_name; } //[t13]
│ │ │ │ -
218
│ │ │ │ -
219private:
│ │ │ │ -
220 std::string m_name;
│ │ │ │ -
221};
│ │ │ │ -
222
│ │ │ │ -
223
│ │ │ │ -
224template<typename TRANSACTOR>
│ │ │ │ - │ │ │ │ -
226 const TRANSACTOR &T,
│ │ │ │ -
227 int Attempts)
│ │ │ │ -
228{
│ │ │ │ -
229 if (Attempts <= 0) return;
│ │ │ │ -
230
│ │ │ │ -
231 bool Done = false;
│ │ │ │ -
232
│ │ │ │ -
233 // Make attempts to perform T
│ │ │ │ -
234 do
│ │ │ │ -
235 {
│ │ │ │ -
236 --Attempts;
│ │ │ │ -
237
│ │ │ │ -
238 // Work on a copy of T2 so we can restore the starting situation if need be
│ │ │ │ -
239 TRANSACTOR T2{T};
│ │ │ │ -
240 try
│ │ │ │ -
241 {
│ │ │ │ -
242 typename TRANSACTOR::argument_type X{*this, T2.name()};
│ │ │ │ -
243 T2(X);
│ │ │ │ -
244 X.commit();
│ │ │ │ -
245 Done = true;
│ │ │ │ -
246 }
│ │ │ │ -
247 catch (const in_doubt_error &)
│ │ │ │ -
248 {
│ │ │ │ -
249 // Not sure whether transaction went through or not. The last thing in
│ │ │ │ -
250 // the world that we should do now is retry.
│ │ │ │ -
251 T2.on_doubt();
│ │ │ │ -
252 throw;
│ │ │ │ -
253 }
│ │ │ │ -
254 catch (const std::exception &e)
│ │ │ │ -
255 {
│ │ │ │ -
256 // Could be any kind of error.
│ │ │ │ -
257 T2.on_abort(e.what());
│ │ │ │ -
258 if (Attempts <= 0) throw;
│ │ │ │ -
259 continue;
│ │ │ │ -
260 }
│ │ │ │ -
261 catch (...)
│ │ │ │ -
262 {
│ │ │ │ -
263 // Don't try to forge ahead if we don't even know what happened
│ │ │ │ -
264 T2.on_abort("Unknown exception");
│ │ │ │ -
265 throw;
│ │ │ │ -
266 }
│ │ │ │ -
267
│ │ │ │ -
268 T2.on_commit();
│ │ │ │ -
269 } while (not Done);
│ │ │ │ -
270}
│ │ │ │ -
271} // namespace pqxx
│ │ │ │ -
273#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
274#endif
│ │ │ │ +
21namespace pqxx
│ │ │ │ +
22{
│ │ │ │ +
23
│ │ │ │ + │ │ │ │ +
25{
│ │ │ │ + │ │ │ │ + │ │ │ │ +
28};
│ │ │ │ +
29
│ │ │ │ +
30
│ │ │ │ +
32
│ │ │ │ +
62class PQXX_LIBEXPORT PQXX_NOVTABLE dbtransaction : public transaction_base
│ │ │ │ +
63{
│ │ │ │ +
64public:
│ │ │ │ +
65 virtual ~dbtransaction();
│ │ │ │ +
66
│ │ │ │ +
67protected:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
70 const std::string &IsolationString,
│ │ │ │ + │ │ │ │ +
72
│ │ │ │ +
73 explicit dbtransaction(
│ │ │ │ + │ │ │ │ +
75 bool direct=true,
│ │ │ │ + │ │ │ │ +
77
│ │ │ │ +
78
│ │ │ │ + │ │ │ │ +
81
│ │ │ │ +
83 virtual void do_begin() override; //[t01]
│ │ │ │ +
85 virtual result do_exec(const char Query[]) override;
│ │ │ │ +
87 virtual void do_commit() override =0;
│ │ │ │ +
89
│ │ │ │ +
95 virtual void do_abort() override; //[t13]
│ │ │ │ +
96
│ │ │ │ +
97 static std::string fullname(const std::string &ttype,
│ │ │ │ +
98 const std::string &isolation);
│ │ │ │ +
99
│ │ │ │ +
100private:
│ │ │ │ +
102 std::string m_start_cmd;
│ │ │ │ +
103};
│ │ │ │ +
104
│ │ │ │ +
105} // namespace pqxx
│ │ │ │ +
106
│ │ │ │ +
107#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
108
│ │ │ │ +
109#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype(callback())
Simple way to execute a transaction with automatic retry.
Definition: transactor.hxx:99
│ │ │ │ -
void perform(const TRANSACTOR &T, int Attempts)
Definition: transactor.hxx:225
│ │ │ │ -
Exception class for lost or failed backend connection.
Definition: except.hxx:119
│ │ │ │ -
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:160
│ │ │ │ -
The backend saw itself forced to roll back the ongoing transaction.
Definition: except.hxx:168
│ │ │ │ -
We can't tell whether our last statement succeeded.
Definition: except.hxx:192
│ │ │ │ -
Internal error in libpqxx library.
Definition: except.hxx:209
│ │ │ │ -
Definition: transactor.hxx:157
│ │ │ │ -
void on_doubt() noexcept
Overridable function to be called when "in doubt" about outcome.
Definition: transactor.hxx:214
│ │ │ │ -
transactor(const std::string &TName="transactor")
Definition: transactor.hxx:160
│ │ │ │ -
void on_commit()
Optional overridable function to be called after successful commit.
Definition: transactor.hxx:200
│ │ │ │ -
void operator()(TRANSACTION &T)
Overridable transaction definition; insert your database code here.
│ │ │ │ -
void on_abort(const char[]) noexcept
Optional overridable function to be called if transaction is aborted.
Definition: transactor.hxx:193
│ │ │ │ -
TRANSACTION argument_type
Definition: transactor.hxx:159
│ │ │ │ -
std::string name() const
The transactor's name.
Definition: transactor.hxx:217
│ │ │ │ +
readwrite_policy
Definition: dbtransaction.hxx:25
│ │ │ │ +
@ read_only
Definition: dbtransaction.hxx:26
│ │ │ │ +
@ read_write
Definition: dbtransaction.hxx:27
│ │ │ │ +
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ +
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ +
void start_backend_transaction()
Start a transaction on the backend and set desired isolation level.
│ │ │ │ +
virtual void do_commit() override=0
To be implemented by derived class: commit backend transaction.
│ │ │ │ +
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ +
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,222 +1,99 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -transactor.hxx │ │ │ │ │ - 1/* Transactor framework, a wrapper for safely retryable transactions. │ │ │ │ │ - 2 * │ │ │ │ │ - 3 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transactor instead. │ │ │ │ │ - 4 * │ │ │ │ │ - 5 * Copyright (c) 2000-2019, Jeroen T. Vermeulen. │ │ │ │ │ - 6 * │ │ │ │ │ - 7 * See COPYING for copyright license. If you did not receive a file called │ │ │ │ │ - 8 * COPYING with this source code, please notify the distributor of this │ │ │ │ │ -mistake, │ │ │ │ │ - 9 * or contact the author. │ │ │ │ │ - 10 */ │ │ │ │ │ - 11#ifndef PQXX_H_TRANSACTOR │ │ │ │ │ - 12#define PQXX_H_TRANSACTOR │ │ │ │ │ - 13 │ │ │ │ │ - 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 15#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 16 │ │ │ │ │ - 17#include "pqxx/connection_base.hxx" │ │ │ │ │ - 18#include "pqxx/transaction.hxx" │ │ │ │ │ - 19 │ │ │ │ │ +dbtransaction.hxx │ │ │ │ │ + 1 │ │ │ │ │ + 13#ifndef PQXX_H_DBTRANSACTION │ │ │ │ │ + 14#define PQXX_H_DBTRANSACTION │ │ │ │ │ + 15 │ │ │ │ │ + 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 18 │ │ │ │ │ + 19#include "pqxx/transaction_base.hxx" │ │ │ │ │ 20 │ │ │ │ │ - 21// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ - 22 │ │ │ │ │ - 23namespace pqxx │ │ │ │ │ - 24{ │ │ │ │ │ - 67 │ │ │ │ │ - 69 │ │ │ │ │ - 98template │ │ │ │ │ -99inline auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) │ │ │ │ │ - 100 -> decltype(callback()) │ │ │ │ │ - 101{ │ │ │ │ │ - 102 if (attempts <= 0) │ │ │ │ │ - 103 throw std::invalid_argument{ │ │ │ │ │ - 104 "Zero or negative number of attempts passed to pqxx::perform()."}; │ │ │ │ │ - 105 │ │ │ │ │ - 106 for (; attempts > 0; --attempts) │ │ │ │ │ - 107 { │ │ │ │ │ - 108 try │ │ │ │ │ - 109 { │ │ │ │ │ - 110 return callback(); │ │ │ │ │ - 111 } │ │ │ │ │ - 112 catch (const in_doubt_error &) │ │ │ │ │ - 113 { │ │ │ │ │ - 114 // Not sure whether transaction went through or not. The last thing in │ │ │ │ │ - 115 // the world that we should do now is try again! │ │ │ │ │ - 116 throw; │ │ │ │ │ - 117 } │ │ │ │ │ - 118 catch (const statement_completion_unknown &) │ │ │ │ │ - 119 { │ │ │ │ │ - 120 // Not sure whether our last statement succeeded. Don't risk running it │ │ │ │ │ - 121 // again. │ │ │ │ │ - 122 throw; │ │ │ │ │ - 123 } │ │ │ │ │ - 124 catch (const broken_connection &) │ │ │ │ │ - 125 { │ │ │ │ │ - 126 // Connection failed. Definitely worth retrying. │ │ │ │ │ - 127 if (attempts <= 1) throw; │ │ │ │ │ - 128 continue; │ │ │ │ │ - 129 } │ │ │ │ │ - 130 catch (const transaction_rollback &) │ │ │ │ │ - 131 { │ │ │ │ │ - 132 // Some error that may well be transient, such as serialization failure │ │ │ │ │ - 133 // or deadlock. Worth retrying. │ │ │ │ │ - 134 if (attempts <= 1) throw; │ │ │ │ │ - 135 continue; │ │ │ │ │ - 136 } │ │ │ │ │ - 137 } │ │ │ │ │ - 138 throw pqxx::internal_error{"No outcome reached on perform()."}; │ │ │ │ │ - 139} │ │ │ │ │ - 140 │ │ │ │ │ - 142 │ │ │ │ │ -156template> class transactor │ │ │ │ │ - 157{ │ │ │ │ │ - 158public: │ │ │ │ │ -159 using argument_type = TRANSACTION; │ │ │ │ │ -160 PQXX_DEPRECATED explicit transactor( //[t04] │ │ │ │ │ - 161 const std::string &TName="transactor") : │ │ │ │ │ - 162 m_name{TName} { } │ │ │ │ │ - 163 │ │ │ │ │ - 165 │ │ │ │ │ -176 void operator()(TRANSACTION &T); //[t04] │ │ │ │ │ - 177 │ │ │ │ │ - 178 // Overridable member functions, called by connection_base::perform() if │ │ │ │ │ -an │ │ │ │ │ - 179 // attempt to run transaction fails/succeeds, respectively, or if the │ │ │ │ │ - 180 // connection is lost at just the wrong moment, goes into an indeterminate │ │ │ │ │ - 181 // state. Use these to patch up runtime state to match events, if needed, │ │ │ │ │ -or │ │ │ │ │ - 182 // to report failure conditions. │ │ │ │ │ - 183 │ │ │ │ │ - 185 │ │ │ │ │ -193 void on_abort(const char[]) noexcept {} //[t13] │ │ │ │ │ - 194 │ │ │ │ │ - 196 │ │ │ │ │ -200 void on_commit() {} //[t07] │ │ │ │ │ - 201 │ │ │ │ │ - 203 │ │ │ │ │ -214 void on_doubt() noexcept {} //[t13] │ │ │ │ │ - 215 │ │ │ │ │ -217 std::string name() const { return m_name; } //[t13] │ │ │ │ │ - 218 │ │ │ │ │ - 219private: │ │ │ │ │ - 220 std::string m_name; │ │ │ │ │ - 221}; │ │ │ │ │ - 222 │ │ │ │ │ - 223 │ │ │ │ │ - 224template │ │ │ │ │ -225inline void connection_base::perform( │ │ │ │ │ - 226 const TRANSACTOR &T, │ │ │ │ │ - 227 int Attempts) │ │ │ │ │ - 228{ │ │ │ │ │ - 229 if (Attempts <= 0) return; │ │ │ │ │ - 230 │ │ │ │ │ - 231 bool Done = false; │ │ │ │ │ - 232 │ │ │ │ │ - 233 // Make attempts to perform T │ │ │ │ │ - 234 do │ │ │ │ │ - 235 { │ │ │ │ │ - 236 --Attempts; │ │ │ │ │ - 237 │ │ │ │ │ - 238 // Work on a copy of T2 so we can restore the starting situation if need │ │ │ │ │ -be │ │ │ │ │ - 239 TRANSACTOR T2{T}; │ │ │ │ │ - 240 try │ │ │ │ │ - 241 { │ │ │ │ │ - 242 typename TRANSACTOR::argument_type X{*this, T2.name()}; │ │ │ │ │ - 243 T2(X); │ │ │ │ │ - 244 X.commit(); │ │ │ │ │ - 245 Done = true; │ │ │ │ │ - 246 } │ │ │ │ │ - 247 catch (const in_doubt_error &) │ │ │ │ │ - 248 { │ │ │ │ │ - 249 // Not sure whether transaction went through or not. The last thing in │ │ │ │ │ - 250 // the world that we should do now is retry. │ │ │ │ │ - 251 T2.on_doubt(); │ │ │ │ │ - 252 throw; │ │ │ │ │ - 253 } │ │ │ │ │ - 254 catch (const std::exception &e) │ │ │ │ │ - 255 { │ │ │ │ │ - 256 // Could be any kind of error. │ │ │ │ │ - 257 T2.on_abort(e.what()); │ │ │ │ │ - 258 if (Attempts <= 0) throw; │ │ │ │ │ - 259 continue; │ │ │ │ │ - 260 } │ │ │ │ │ - 261 catch (...) │ │ │ │ │ - 262 { │ │ │ │ │ - 263 // Don't try to forge ahead if we don't even know what happened │ │ │ │ │ - 264 T2.on_abort("Unknown exception"); │ │ │ │ │ - 265 throw; │ │ │ │ │ - 266 } │ │ │ │ │ - 267 │ │ │ │ │ - 268 T2.on_commit(); │ │ │ │ │ - 269 } while (not Done); │ │ │ │ │ - 270} │ │ │ │ │ - 271} // namespace pqxx │ │ │ │ │ - 273#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 274#endif │ │ │ │ │ + 21namespace pqxx │ │ │ │ │ + 22{ │ │ │ │ │ + 23 │ │ │ │ │ +24enum readwrite_policy │ │ │ │ │ + 25{ │ │ │ │ │ +26 read_only, │ │ │ │ │ + 27 read_write │ │ │ │ │ +28}; │ │ │ │ │ + 29 │ │ │ │ │ + 30 │ │ │ │ │ + 32 │ │ │ │ │ +62class PQXX_LIBEXPORT PQXX_NOVTABLE dbtransaction : public transaction_base │ │ │ │ │ + 63{ │ │ │ │ │ + 64public: │ │ │ │ │ + 65 virtual ~dbtransaction(); │ │ │ │ │ + 66 │ │ │ │ │ + 67protected: │ │ │ │ │ + 68 dbtransaction( │ │ │ │ │ + 69 connection_base &, │ │ │ │ │ + 70 const std::string &IsolationString, │ │ │ │ │ + 71 readwrite_policy rw=read_write); │ │ │ │ │ + 72 │ │ │ │ │ + 73 explicit dbtransaction( │ │ │ │ │ + 74 connection_base &, │ │ │ │ │ + 75 bool direct=true, │ │ │ │ │ + 76 readwrite_policy rw=read_write); │ │ │ │ │ + 77 │ │ │ │ │ + 78 │ │ │ │ │ +80 void start_backend_transaction(); │ │ │ │ │ + 81 │ │ │ │ │ + 83 virtual void do_begin() override; //[t01] │ │ │ │ │ + 85 virtual result do_exec(const char Query[]) override; │ │ │ │ │ +87 virtual void do_commit() override =0; │ │ │ │ │ + 89 │ │ │ │ │ + 95 virtual void do_abort() override; //[t13] │ │ │ │ │ + 96 │ │ │ │ │ + 97 static std::string fullname(const std::string &ttype, │ │ │ │ │ + 98 const std::string &isolation); │ │ │ │ │ + 99 │ │ │ │ │ + 100private: │ │ │ │ │ + 102 std::string m_start_cmd; │ │ │ │ │ + 103}; │ │ │ │ │ + 104 │ │ │ │ │ + 105} // namespace pqxx │ │ │ │ │ + 106 │ │ │ │ │ + 107#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 108 │ │ │ │ │ + 109#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::perform │ │ │ │ │ -auto perform(const TRANSACTION_CALLBACK &callback, int attempts=3) -> decltype │ │ │ │ │ -(callback()) │ │ │ │ │ -Simple way to execute a transaction with automatic retry. │ │ │ │ │ -Definition: transactor.hxx:99 │ │ │ │ │ -pqxx::connection_base::perform │ │ │ │ │ -void perform(const TRANSACTOR &T, int Attempts) │ │ │ │ │ -Definition: transactor.hxx:225 │ │ │ │ │ -pqxx::broken_connection │ │ │ │ │ -Exception class for lost or failed backend connection. │ │ │ │ │ -Definition: except.hxx:119 │ │ │ │ │ -pqxx::in_doubt_error │ │ │ │ │ -"Help, I don't know whether transaction was committed successfully!" │ │ │ │ │ -Definition: except.hxx:160 │ │ │ │ │ -pqxx::transaction_rollback │ │ │ │ │ -The backend saw itself forced to roll back the ongoing transaction. │ │ │ │ │ -Definition: except.hxx:168 │ │ │ │ │ -pqxx::statement_completion_unknown │ │ │ │ │ -We can't tell whether our last statement succeeded. │ │ │ │ │ -Definition: except.hxx:192 │ │ │ │ │ -pqxx::internal_error │ │ │ │ │ -Internal error in libpqxx library. │ │ │ │ │ -Definition: except.hxx:209 │ │ │ │ │ -pqxx::transactor │ │ │ │ │ -Definition: transactor.hxx:157 │ │ │ │ │ -pqxx::transactor::on_doubt │ │ │ │ │ -void on_doubt() noexcept │ │ │ │ │ -Overridable function to be called when "in doubt" about outcome. │ │ │ │ │ -Definition: transactor.hxx:214 │ │ │ │ │ -pqxx::transactor::transactor │ │ │ │ │ -transactor(const std::string &TName="transactor") │ │ │ │ │ -Definition: transactor.hxx:160 │ │ │ │ │ -pqxx::transactor::on_commit │ │ │ │ │ -void on_commit() │ │ │ │ │ -Optional overridable function to be called after successful commit. │ │ │ │ │ -Definition: transactor.hxx:200 │ │ │ │ │ -pqxx::transactor::operator() │ │ │ │ │ -void operator()(TRANSACTION &T) │ │ │ │ │ -Overridable transaction definition; insert your database code here. │ │ │ │ │ -pqxx::transactor::on_abort │ │ │ │ │ -void on_abort(const char[]) noexcept │ │ │ │ │ -Optional overridable function to be called if transaction is aborted. │ │ │ │ │ -Definition: transactor.hxx:193 │ │ │ │ │ -pqxx::transactor::argument_type │ │ │ │ │ -TRANSACTION argument_type │ │ │ │ │ -Definition: transactor.hxx:159 │ │ │ │ │ -pqxx::transactor::name │ │ │ │ │ -std::string name() const │ │ │ │ │ -The transactor's name. │ │ │ │ │ -Definition: transactor.hxx:217 │ │ │ │ │ +pqxx::readwrite_policy │ │ │ │ │ +readwrite_policy │ │ │ │ │ +Definition: dbtransaction.hxx:25 │ │ │ │ │ +pqxx::read_only │ │ │ │ │ +@ read_only │ │ │ │ │ +Definition: dbtransaction.hxx:26 │ │ │ │ │ +pqxx::read_write │ │ │ │ │ +@ read_write │ │ │ │ │ +Definition: dbtransaction.hxx:27 │ │ │ │ │ +pqxx::connection_base │ │ │ │ │ +connection_base abstract base class; represents a connection to a database. │ │ │ │ │ +Definition: connection_base.hxx:140 │ │ │ │ │ +pqxx::dbtransaction │ │ │ │ │ +Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ +Definition: dbtransaction.hxx:63 │ │ │ │ │ +pqxx::dbtransaction::start_backend_transaction │ │ │ │ │ +void start_backend_transaction() │ │ │ │ │ +Start a transaction on the backend and set desired isolation level. │ │ │ │ │ +pqxx::dbtransaction::do_commit │ │ │ │ │ +virtual void do_commit() override=0 │ │ │ │ │ +To be implemented by derived class: commit backend transaction. │ │ │ │ │ +pqxx::result │ │ │ │ │ +Result set containing data returned by a query or command. │ │ │ │ │ +Definition: result.hxx:70 │ │ │ │ │ +pqxx::transaction_base │ │ │ │ │ +Interface definition (and common code) for "transaction" classes. │ │ │ │ │ +Definition: transaction_base.hxx:138 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * transactor.hxx │ │ │ │ │ + * dbtransaction.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00059_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: basic_connection.hxx Source File │ │ │ │ +libpqxx: notification.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,110 +55,69 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
basic_connection.hxx
│ │ │ │ +
notification.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_BASIC_CONNECTION
│ │ │ │ -
14#define PQXX_H_BASIC_CONNECTION
│ │ │ │ +
13#ifndef PQXX_H_NOTIFICATION
│ │ │ │ +
14#define PQXX_H_NOTIFICATION
│ │ │ │
15
│ │ │ │
16#include "pqxx/compiler-public.hxx"
│ │ │ │
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │
18
│ │ │ │ -
19#include <cstddef>
│ │ │ │ -
20#include <memory>
│ │ │ │ -
21#include <string>
│ │ │ │ +
19#include <string>
│ │ │ │ +
20
│ │ │ │ +
21#include "pqxx/types.hxx"
│ │ │ │
22
│ │ │ │ -
23#include "pqxx/connection_base.hxx"
│ │ │ │ -
24
│ │ │ │ -
25
│ │ │ │ -
26namespace pqxx
│ │ │ │ -
27{
│ │ │ │ -
28
│ │ │ │ -
30
│ │ │ │ -
45template<typename CONNECTPOLICY> class basic_connection_base :
│ │ │ │ -
46 public connection_base
│ │ │ │ -
47{
│ │ │ │ -
48public:
│ │ │ │ - │ │ │ │ -
50 connection_base(m_policy),
│ │ │ │ -
51 m_options(std::string{}),
│ │ │ │ -
52 m_policy(m_options)
│ │ │ │ -
53 { init(); }
│ │ │ │ -
54
│ │ │ │ -
57 explicit basic_connection_base(const std::string &opt) :
│ │ │ │ -
58 connection_base(m_policy),
│ │ │ │ -
59 m_options(opt),
│ │ │ │ -
60 m_policy(m_options)
│ │ │ │ -
61 {init();}
│ │ │ │ -
62
│ │ │ │ -
64 explicit basic_connection_base(const char opt[]) :
│ │ │ │ -
65 basic_connection_base(opt ? std::string{opt} : std::string{}) {}
│ │ │ │ -
66
│ │ │ │ -
67 explicit basic_connection_base(std::nullptr_t) : basic_connection_base() {}
│ │ │ │ -
68
│ │ │ │ - │ │ │ │ -
70 { close(); }
│ │ │ │ -
71
│ │ │ │ -
72 const std::string &options() const noexcept //[t01]
│ │ │ │ -
73 {return m_policy.options();}
│ │ │ │ -
74
│ │ │ │ -
75private:
│ │ │ │ -
77 std::string m_options;
│ │ │ │ -
79 CONNECTPOLICY m_policy;
│ │ │ │ -
80};
│ │ │ │ -
81
│ │ │ │ -
82
│ │ │ │ -
84
│ │ │ │ -
88template<typename CONNECTPOLICY> struct basic_connection :
│ │ │ │ -
89 basic_connection_base<CONNECTPOLICY>
│ │ │ │ -
90{
│ │ │ │ -
91 PQXX_DEPRECATED basic_connection() =default;
│ │ │ │ -
92 PQXX_DEPRECATED explicit basic_connection(const std::string &opt) :
│ │ │ │ -
93 basic_connection(opt) {}
│ │ │ │ -
94 PQXX_DEPRECATED explicit basic_connection(const char opt[]) :
│ │ │ │ -
95 basic_connection(opt) {}
│ │ │ │ -
96
│ │ │ │ -
97 PQXX_DEPRECATED explicit basic_connection(std::nullptr_t) :
│ │ │ │ - │ │ │ │ -
99
│ │ │ │ -
100 using basic_connection_base<CONNECTPOLICY>::options;
│ │ │ │ -
101};
│ │ │ │ -
102
│ │ │ │ -
103} // namespace
│ │ │ │ -
104
│ │ │ │ -
105#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
106
│ │ │ │ -
107#endif
│ │ │ │ -
STL namespace.
│ │ │ │ +
23
│ │ │ │ +
24namespace pqxx
│ │ │ │ +
25{
│ │ │ │ +
27
│ │ │ │ +
55class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver
│ │ │ │ +
56{
│ │ │ │ +
57public:
│ │ │ │ +
59
│ │ │ │ +
63 notification_receiver(connection_base &c, const std::string &channel);
│ │ │ │ + │ │ │ │ + │ │ │ │ +
66 virtual ~notification_receiver();
│ │ │ │ +
67
│ │ │ │ +
69 const std::string &channel() const { return m_channel; }
│ │ │ │ +
70
│ │ │ │ +
72
│ │ │ │ +
79 virtual void operator()(const std::string &payload, int backend_pid) =0;
│ │ │ │ +
80
│ │ │ │ +
81protected:
│ │ │ │ +
82 connection_base &conn() const noexcept { return m_conn; }
│ │ │ │ +
83
│ │ │ │ +
84private:
│ │ │ │ +
85 connection_base &m_conn;
│ │ │ │ +
86 std::string m_channel;
│ │ │ │ +
87};
│ │ │ │ +
88}
│ │ │ │ +
89
│ │ │ │ +
90#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
91#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
Base-class template for all libpqxx connection types.
Definition: basic_connection.hxx:47
│ │ │ │ -
basic_connection_base(const std::string &opt)
Definition: basic_connection.hxx:57
│ │ │ │ -
const std::string & options() const noexcept
Definition: basic_connection.hxx:72
│ │ │ │ -
basic_connection_base(std::nullptr_t)
Definition: basic_connection.hxx:67
│ │ │ │ -
~basic_connection_base() noexcept
Definition: basic_connection.hxx:69
│ │ │ │ -
basic_connection_base(const char opt[])
See: basic_connection(const std::string &opt)
Definition: basic_connection.hxx:64
│ │ │ │ -
basic_connection_base()
Definition: basic_connection.hxx:49
│ │ │ │ -
Concrete connection type template.
Definition: basic_connection.hxx:90
│ │ │ │ -
basic_connection(const std::string &opt)
Definition: basic_connection.hxx:92
│ │ │ │ -
basic_connection(std::nullptr_t)
Definition: basic_connection.hxx:97
│ │ │ │ -
basic_connection(const char opt[])
Definition: basic_connection.hxx:94
│ │ │ │ - │ │ │ │
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ -
void init()
Definition: connection_base.cxx:99
│ │ │ │ -
void close() noexcept
Definition: connection_base.cxx:902
│ │ │ │ +
Definition: notification.hxx:56
│ │ │ │ +
notification_receiver(const notification_receiver &)=delete
│ │ │ │ +
connection_base & conn() const noexcept
Definition: notification.hxx:82
│ │ │ │ +
const std::string & channel() const
The channel that this receiver listens on.
Definition: notification.hxx:69
│ │ │ │ +
virtual void operator()(const std::string &payload, int backend_pid)=0
Overridable: action to invoke when notification arrives.
│ │ │ │ +
notification_receiver & operator=(const notification_receiver &)=delete
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,134 +1,74 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -basic_connection.hxx │ │ │ │ │ +notification.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_BASIC_CONNECTION │ │ │ │ │ - 14#define PQXX_H_BASIC_CONNECTION │ │ │ │ │ + 13#ifndef PQXX_H_NOTIFICATION │ │ │ │ │ + 14#define PQXX_H_NOTIFICATION │ │ │ │ │ 15 │ │ │ │ │ 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ 18 │ │ │ │ │ - 19#include │ │ │ │ │ - 20#include │ │ │ │ │ - 21#include │ │ │ │ │ + 19#include │ │ │ │ │ + 20 │ │ │ │ │ + 21#include "pqxx/types.hxx" │ │ │ │ │ 22 │ │ │ │ │ - 23#include "pqxx/connection_base.hxx" │ │ │ │ │ - 24 │ │ │ │ │ - 25 │ │ │ │ │ - 26namespace pqxx │ │ │ │ │ - 27{ │ │ │ │ │ - 28 │ │ │ │ │ - 30 │ │ │ │ │ -45template class basic_connection_base : │ │ │ │ │ - 46 public connection_base │ │ │ │ │ - 47{ │ │ │ │ │ - 48public: │ │ │ │ │ -49 basic_connection_base() : │ │ │ │ │ - 50 connection_base(m_policy), │ │ │ │ │ - 51 m_options(std::string{}), │ │ │ │ │ - 52 m_policy(m_options) │ │ │ │ │ - 53 { init(); } │ │ │ │ │ - 54 │ │ │ │ │ -57 explicit basic_connection_base(const std::string &opt) : │ │ │ │ │ - 58 connection_base(m_policy), │ │ │ │ │ - 59 m_options(opt), │ │ │ │ │ - 60 m_policy(m_options) │ │ │ │ │ - 61 {init();} │ │ │ │ │ - 62 │ │ │ │ │ -64 explicit basic_connection_base(const char opt[]) : │ │ │ │ │ - 65 basic_connection_base(opt ? std::string{opt} : std::string{}) {} │ │ │ │ │ - 66 │ │ │ │ │ -67 explicit basic_connection_base(std::nullptr_t) : basic_connection_base() {} │ │ │ │ │ - 68 │ │ │ │ │ -69 ~basic_connection_base() noexcept │ │ │ │ │ - 70 { close(); } │ │ │ │ │ - 71 │ │ │ │ │ -72 const std::string &options() const noexcept //[t01] │ │ │ │ │ - 73 {return m_policy.options();} │ │ │ │ │ - 74 │ │ │ │ │ - 75private: │ │ │ │ │ - 77 std::string m_options; │ │ │ │ │ - 79 CONNECTPOLICY m_policy; │ │ │ │ │ - 80}; │ │ │ │ │ - 81 │ │ │ │ │ - 82 │ │ │ │ │ - 84 │ │ │ │ │ -88template struct basic_connection : │ │ │ │ │ - 89 basic_connection_base │ │ │ │ │ - 90{ │ │ │ │ │ -91 PQXX_DEPRECATED basic_connection() =default; │ │ │ │ │ -92 PQXX_DEPRECATED explicit basic_connection(const std::string &opt) : │ │ │ │ │ - 93 basic_connection(opt) {} │ │ │ │ │ -94 PQXX_DEPRECATED explicit basic_connection(const char opt[]) : │ │ │ │ │ - 95 basic_connection(opt) {} │ │ │ │ │ - 96 │ │ │ │ │ -97 PQXX_DEPRECATED explicit basic_connection(std::nullptr_t) : │ │ │ │ │ - 98 basic_connection() {} │ │ │ │ │ - 99 │ │ │ │ │ - 100 using basic_connection_base::options; │ │ │ │ │ - 101}; │ │ │ │ │ - 102 │ │ │ │ │ - 103} // namespace │ │ │ │ │ - 104 │ │ │ │ │ - 105#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 106 │ │ │ │ │ - 107#endif │ │ │ │ │ -std │ │ │ │ │ -STL namespace. │ │ │ │ │ + 23 │ │ │ │ │ + 24namespace pqxx │ │ │ │ │ + 25{ │ │ │ │ │ + 27 │ │ │ │ │ +55class PQXX_LIBEXPORT PQXX_NOVTABLE notification_receiver │ │ │ │ │ + 56{ │ │ │ │ │ + 57public: │ │ │ │ │ + 59 │ │ │ │ │ + 63 notification_receiver(connection_base &c, const std::string &channel); │ │ │ │ │ +64 notification_receiver(const notification_receiver &) =delete; │ │ │ │ │ +65 notification_receiver &operator=(const notification_receiver &) =delete; │ │ │ │ │ + 66 virtual ~notification_receiver(); │ │ │ │ │ + 67 │ │ │ │ │ +69 const std::string &channel() const { return m_channel; } │ │ │ │ │ + 70 │ │ │ │ │ + 72 │ │ │ │ │ +79 virtual void operator()(const std::string &payload, int backend_pid) =0; │ │ │ │ │ + 80 │ │ │ │ │ + 81protected: │ │ │ │ │ +82 connection_base &conn() const noexcept { return m_conn; } │ │ │ │ │ + 83 │ │ │ │ │ + 84private: │ │ │ │ │ + 85 connection_base &m_conn; │ │ │ │ │ + 86 std::string m_channel; │ │ │ │ │ + 87}; │ │ │ │ │ + 88} │ │ │ │ │ + 89 │ │ │ │ │ + 90#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 91#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::basic_connection_base │ │ │ │ │ -Base-class template for all libpqxx connection types. │ │ │ │ │ -Definition: basic_connection.hxx:47 │ │ │ │ │ -pqxx::basic_connection_base::basic_connection_base │ │ │ │ │ -basic_connection_base(const std::string &opt) │ │ │ │ │ -Definition: basic_connection.hxx:57 │ │ │ │ │ -pqxx::basic_connection_base::options │ │ │ │ │ -const std::string & options() const noexcept │ │ │ │ │ -Definition: basic_connection.hxx:72 │ │ │ │ │ -pqxx::basic_connection_base::basic_connection_base │ │ │ │ │ -basic_connection_base(std::nullptr_t) │ │ │ │ │ -Definition: basic_connection.hxx:67 │ │ │ │ │ -pqxx::basic_connection_base::~basic_connection_base │ │ │ │ │ -~basic_connection_base() noexcept │ │ │ │ │ -Definition: basic_connection.hxx:69 │ │ │ │ │ -pqxx::basic_connection_base::basic_connection_base │ │ │ │ │ -basic_connection_base(const char opt[]) │ │ │ │ │ -See: basic_connection(const std::string &opt) │ │ │ │ │ -Definition: basic_connection.hxx:64 │ │ │ │ │ -pqxx::basic_connection_base::basic_connection_base │ │ │ │ │ -basic_connection_base() │ │ │ │ │ -Definition: basic_connection.hxx:49 │ │ │ │ │ -pqxx::basic_connection │ │ │ │ │ -Concrete connection type template. │ │ │ │ │ -Definition: basic_connection.hxx:90 │ │ │ │ │ -pqxx::basic_connection::basic_connection │ │ │ │ │ -basic_connection(const std::string &opt) │ │ │ │ │ -Definition: basic_connection.hxx:92 │ │ │ │ │ -pqxx::basic_connection::basic_connection │ │ │ │ │ -basic_connection(std::nullptr_t) │ │ │ │ │ -Definition: basic_connection.hxx:97 │ │ │ │ │ -pqxx::basic_connection::basic_connection │ │ │ │ │ -basic_connection(const char opt[]) │ │ │ │ │ -Definition: basic_connection.hxx:94 │ │ │ │ │ -pqxx::basic_connection::basic_connection │ │ │ │ │ -basic_connection()=default │ │ │ │ │ pqxx::connection_base │ │ │ │ │ connection_base abstract base class; represents a connection to a database. │ │ │ │ │ Definition: connection_base.hxx:140 │ │ │ │ │ -pqxx::connection_base::init │ │ │ │ │ -void init() │ │ │ │ │ -Definition: connection_base.cxx:99 │ │ │ │ │ -pqxx::connection_base::close │ │ │ │ │ -void close() noexcept │ │ │ │ │ -Definition: connection_base.cxx:902 │ │ │ │ │ +pqxx::notification_receiver │ │ │ │ │ +Definition: notification.hxx:56 │ │ │ │ │ +pqxx::notification_receiver::notification_receiver │ │ │ │ │ +notification_receiver(const notification_receiver &)=delete │ │ │ │ │ +pqxx::notification_receiver::conn │ │ │ │ │ +connection_base & conn() const noexcept │ │ │ │ │ +Definition: notification.hxx:82 │ │ │ │ │ +pqxx::notification_receiver::channel │ │ │ │ │ +const std::string & channel() const │ │ │ │ │ +The channel that this receiver listens on. │ │ │ │ │ +Definition: notification.hxx:69 │ │ │ │ │ +pqxx::notification_receiver::operator() │ │ │ │ │ +virtual void operator()(const std::string &payload, int backend_pid)=0 │ │ │ │ │ +Overridable: action to invoke when notification arrives. │ │ │ │ │ +pqxx::notification_receiver::operator= │ │ │ │ │ +notification_receiver & operator=(const notification_receiver &)=delete │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * basic_connection.hxx │ │ │ │ │ + * notification.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00062_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: nontransaction.hxx Source File │ │ │ │ +libpqxx: compiler-internal-post.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,65 +55,32 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
nontransaction.hxx
│ │ │ │ +
compiler-internal-post.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_NONTRANSACTION
│ │ │ │ -
14#define PQXX_H_NONTRANSACTION
│ │ │ │ +
12// NO GUARDS HERE! This code should be executed every time!
│ │ │ │ +
13
│ │ │ │ +
14#ifdef _WIN32
│ │ │ │
15
│ │ │ │ -
16#include "pqxx/compiler-public.hxx"
│ │ │ │ -
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include "pqxx/connection_base.hxx"
│ │ │ │ -
20#include "pqxx/result.hxx"
│ │ │ │ -
21#include "pqxx/transaction_base.hxx"
│ │ │ │ -
22
│ │ │ │ -
23// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ -
24
│ │ │ │ -
25namespace pqxx
│ │ │ │ -
26{
│ │ │ │ -
27
│ │ │ │ -
29
│ │ │ │ -
54class PQXX_LIBEXPORT nontransaction : public transaction_base
│ │ │ │ -
55{
│ │ │ │ -
56public:
│ │ │ │ -
58
│ │ │ │ -
63 explicit nontransaction( //[t14]
│ │ │ │ - │ │ │ │ -
65 const std::string &Name=std::string{}) :
│ │ │ │ -
66 namedclass{"nontransaction", Name}, transaction_base{C} { Begin(); }
│ │ │ │ -
67
│ │ │ │ -
68 virtual ~nontransaction(); //[t14]
│ │ │ │ -
69
│ │ │ │ -
70private:
│ │ │ │ -
71 virtual void do_begin() override {} //[t14]
│ │ │ │ -
72 virtual result do_exec(const char C[]) override; //[t14]
│ │ │ │ -
73 virtual void do_commit() override {} //[t14]
│ │ │ │ -
74 virtual void do_abort() override {} //[t14]
│ │ │ │ -
75};
│ │ │ │ -
76
│ │ │ │ -
77} // namespace pqxx
│ │ │ │ -
78
│ │ │ │ -
79#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
80#endif
│ │ │ │ -
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ -
Simple "transaction" class offering no transactional integrity.
Definition: nontransaction.hxx:55
│ │ │ │ -
nontransaction(connection_base &C, const std::string &Name=std::string{})
Constructor.
Definition: nontransaction.hxx:63
│ │ │ │ -
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │ +
16#ifdef _MSC_VER
│ │ │ │ +
17#pragma warning (pop) // Restore client program's warning state
│ │ │ │ +
18#endif
│ │ │ │ +
19
│ │ │ │ +
20#endif
│ │ │ │ +
21
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,67 +1,23 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -nontransaction.hxx │ │ │ │ │ +compiler-internal-post.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_NONTRANSACTION │ │ │ │ │ - 14#define PQXX_H_NONTRANSACTION │ │ │ │ │ + 12// NO GUARDS HERE! This code should be executed every time! │ │ │ │ │ + 13 │ │ │ │ │ + 14#ifdef _WIN32 │ │ │ │ │ 15 │ │ │ │ │ - 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include "pqxx/connection_base.hxx" │ │ │ │ │ - 20#include "pqxx/result.hxx" │ │ │ │ │ - 21#include "pqxx/transaction_base.hxx" │ │ │ │ │ - 22 │ │ │ │ │ - 23// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ - 24 │ │ │ │ │ - 25namespace pqxx │ │ │ │ │ - 26{ │ │ │ │ │ - 27 │ │ │ │ │ - 29 │ │ │ │ │ -54class PQXX_LIBEXPORT nontransaction : public transaction_base │ │ │ │ │ - 55{ │ │ │ │ │ - 56public: │ │ │ │ │ - 58 │ │ │ │ │ -63 explicit nontransaction( //[t14] │ │ │ │ │ - 64 connection_base &C, │ │ │ │ │ - 65 const std::string &Name=std::string{}) : │ │ │ │ │ - 66 namedclass{"nontransaction", Name}, transaction_base{C} { Begin(); } │ │ │ │ │ - 67 │ │ │ │ │ - 68 virtual ~nontransaction(); //[t14] │ │ │ │ │ - 69 │ │ │ │ │ - 70private: │ │ │ │ │ - 71 virtual void do_begin() override {} //[t14] │ │ │ │ │ - 72 virtual result do_exec(const char C[]) override; //[t14] │ │ │ │ │ - 73 virtual void do_commit() override {} //[t14] │ │ │ │ │ - 74 virtual void do_abort() override {} //[t14] │ │ │ │ │ - 75}; │ │ │ │ │ - 76 │ │ │ │ │ - 77} // namespace pqxx │ │ │ │ │ - 78 │ │ │ │ │ - 79#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 80#endif │ │ │ │ │ -pqxx │ │ │ │ │ -The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ -Definition: array.hxx:26 │ │ │ │ │ -pqxx::connection_base │ │ │ │ │ -connection_base abstract base class; represents a connection to a database. │ │ │ │ │ -Definition: connection_base.hxx:140 │ │ │ │ │ -pqxx::nontransaction │ │ │ │ │ -Simple "transaction" class offering no transactional integrity. │ │ │ │ │ -Definition: nontransaction.hxx:55 │ │ │ │ │ -pqxx::nontransaction::nontransaction │ │ │ │ │ -nontransaction(connection_base &C, const std::string &Name=std::string{}) │ │ │ │ │ -Constructor. │ │ │ │ │ -Definition: nontransaction.hxx:63 │ │ │ │ │ -pqxx::transaction_base │ │ │ │ │ -Interface definition (and common code) for "transaction" classes. │ │ │ │ │ -Definition: transaction_base.hxx:138 │ │ │ │ │ + 16#ifdef _MSC_VER │ │ │ │ │ + 17#pragma warning (pop) // Restore client program's warning state │ │ │ │ │ + 18#endif │ │ │ │ │ + 19 │ │ │ │ │ + 20#endif │ │ │ │ │ + 21 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * nontransaction.hxx │ │ │ │ │ + * compiler-internal-post.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00065_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: strconv.hxx Source File │ │ │ │ +libpqxx: row.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,322 +55,353 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
strconv.hxx
│ │ │ │ +
row.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
11#ifndef PQXX_H_STRINGCONV
│ │ │ │ -
12#define PQXX_H_STRINGCONV
│ │ │ │ -
13
│ │ │ │ -
14#include "pqxx/compiler-public.hxx"
│ │ │ │ +
13#ifndef PQXX_H_ROW
│ │ │ │ +
14#define PQXX_H_ROW
│ │ │ │
15
│ │ │ │ -
16#include <limits>
│ │ │ │ -
17#include <sstream>
│ │ │ │ -
18#include <stdexcept>
│ │ │ │ -
19
│ │ │ │ -
20
│ │ │ │ -
21namespace pqxx
│ │ │ │ -
22{
│ │ │ │ +
16#include "pqxx/compiler-public.hxx"
│ │ │ │ +
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
18
│ │ │ │ +
19#include "pqxx/except.hxx"
│ │ │ │ +
20#include "pqxx/field.hxx"
│ │ │ │ +
21#include "pqxx/result.hxx"
│ │ │ │ +
22
│ │ │ │
23
│ │ │ │ -
46
│ │ │ │ -
48
│ │ │ │ -
51template<typename T, typename = void> struct string_traits;
│ │ │ │ -
52
│ │ │ │ -
53namespace internal
│ │ │ │ -
54{
│ │ │ │ -
56[[noreturn]] PQXX_LIBEXPORT void throw_null_conversion(
│ │ │ │ -
57 const std::string &type);
│ │ │ │ +
24// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ +
25
│ │ │ │ +
26namespace pqxx
│ │ │ │ +
27{
│ │ │ │ +
29
│ │ │ │ +
40class PQXX_LIBEXPORT row
│ │ │ │ +
41{
│ │ │ │ +
42public:
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
51
│ │ │ │ +
52 row() =default;
│ │ │ │ +
53
│ │ │ │ +
55 row(result r, size_t i) noexcept;
│ │ │ │ +
56
│ │ │ │ +
57 ~row() noexcept =default; // Yes Scott Meyers, you're absolutely right[1]
│ │ │ │
58
│ │ │ │ -
60
│ │ │ │ -
67template<typename TYPE> struct type_name;
│ │ │ │ -
68#define PQXX_DECLARE_TYPE_NAME(TYPE) \
│ │ │ │ -
69 template<> struct type_name<TYPE> \
│ │ │ │ -
70 { static constexpr const char *value = #TYPE; }
│ │ │ │ -
71
│ │ │ │ - │ │ │ │ - │ │ │ │ -
74PQXX_DECLARE_TYPE_NAME(unsigned short);
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
80PQXX_DECLARE_TYPE_NAME(unsigned long long);
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
87PQXX_DECLARE_TYPE_NAME(const std::string);
│ │ │ │ -
88PQXX_DECLARE_TYPE_NAME(std::stringstream);
│ │ │ │ -
89#undef PQXX_DECLARE_TYPE_NAME
│ │ │ │ -
90
│ │ │ │ -
91template<size_t N> struct type_name<char[N]>
│ │ │ │ -
92{ static constexpr const char *value = "char[]"; };
│ │ │ │ -
93
│ │ │ │ -
94
│ │ │ │ -
96
│ │ │ │ -
102template<typename TYPE> struct PQXX_LIBEXPORT builtin_traits
│ │ │ │ -
103{
│ │ │ │ -
104 static constexpr const char *name() noexcept
│ │ │ │ - │ │ │ │ -
106 static constexpr bool has_null() noexcept { return false; }
│ │ │ │ -
107 static bool is_null(TYPE) { return false; }
│ │ │ │ -
108 [[noreturn]] static TYPE null() { throw_null_conversion(name()); }
│ │ │ │ -
109 static void from_string(const char Str[], TYPE &Obj);
│ │ │ │ -
110 static std::string to_string(TYPE Obj);
│ │ │ │ -
111};
│ │ │ │ -
112} // namespace pqxx::internal
│ │ │ │ -
113
│ │ │ │ +
63 PQXX_PURE bool operator==(const row &) const noexcept; //[t75]
│ │ │ │ +
64 bool operator!=(const row &rhs) const noexcept //[t75]
│ │ │ │ +
65 { return not operator==(rhs); }
│ │ │ │ +
67
│ │ │ │ +
68 const_iterator begin() const noexcept; //[t82]
│ │ │ │ +
69 const_iterator cbegin() const noexcept;
│ │ │ │ +
70 const_iterator end() const noexcept; //[t82]
│ │ │ │ +
71 const_iterator cend() const noexcept;
│ │ │ │ +
72
│ │ │ │ +
77 reference front() const noexcept; //[t74]
│ │ │ │ +
78 reference back() const noexcept; //[t75]
│ │ │ │ +
79
│ │ │ │ +
80 const_reverse_row_iterator rbegin() const; //[t82]
│ │ │ │ +
81 const_reverse_row_iterator crbegin() const;
│ │ │ │ +
82 const_reverse_row_iterator rend() const; //[t82]
│ │ │ │ +
83 const_reverse_row_iterator crend() const;
│ │ │ │ +
84
│ │ │ │ +
85 reference operator[](size_type) const noexcept; //[t11]
│ │ │ │ +
86 reference operator[](int) const noexcept; //[t02]
│ │ │ │ +
90 reference operator[](const char[]) const; //[t11]
│ │ │ │ +
94 reference operator[](const std::string &) const; //[t11]
│ │ │ │ +
95 reference at(size_type) const; //[t11]
│ │ │ │ +
96 reference at(int) const; //[t11]
│ │ │ │ +
100 reference at(const char[]) const; //[t11]
│ │ │ │ +
104 reference at(const std::string &) const; //[t11]
│ │ │ │ +
106
│ │ │ │ +
107 size_type size() const noexcept //[t11]
│ │ │ │ +
108 { return m_end-m_begin; }
│ │ │ │ +
109
│ │ │ │ +
110 void swap(row &) noexcept; //[t11]
│ │ │ │ +
111
│ │ │ │ +
113 size_t rownumber() const noexcept { return size_t(m_index); } //[t11]
│ │ │ │
114
│ │ │ │ -
116#define PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(TYPE) \
│ │ │ │ -
117 template<> struct PQXX_LIBEXPORT string_traits<TYPE> : \
│ │ │ │ -
118 internal::builtin_traits<TYPE> {};
│ │ │ │ -
119
│ │ │ │ -
120PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(bool)
│ │ │ │ -
121
│ │ │ │ -
122PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(short)
│ │ │ │ -
123PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned short)
│ │ │ │ -
124PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(int)
│ │ │ │ -
125PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned int)
│ │ │ │ -
126PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long)
│ │ │ │ -
127PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long)
│ │ │ │ -
128PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long long)
│ │ │ │ -
129PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long long)
│ │ │ │ -
130
│ │ │ │ -
131PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(float)
│ │ │ │ -
132PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(double)
│ │ │ │ -
133PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long double)
│ │ │ │ -
134
│ │ │ │ -
135#undef PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION
│ │ │ │ +
120 size_type column_number(const std::string &ColName) const //[t30]
│ │ │ │ +
121 { return column_number(ColName.c_str()); }
│ │ │ │ +
122
│ │ │ │ +
124 size_type column_number(const char[]) const; //[t30]
│ │ │ │ +
125
│ │ │ │ +
127 oid column_type(size_type) const; //[t07]
│ │ │ │ +
128
│ │ │ │ +
130 oid column_type(int ColNum) const //[t07]
│ │ │ │ +
131 { return column_type(size_type(ColNum)); }
│ │ │ │ +
132
│ │ │ │ +
134 oid column_type(const std::string &ColName) const //[t07]
│ │ │ │ +
135 { return column_type(column_number(ColName)); }
│ │ │ │
136
│ │ │ │ -
137
│ │ │ │ -
139
│ │ │ │ -
148template<typename ENUM>
│ │ │ │ - │ │ │ │ -
150{
│ │ │ │ -
151 using underlying_type = typename std::underlying_type<ENUM>::type;
│ │ │ │ - │ │ │ │ -
153
│ │ │ │ -
154 static constexpr bool has_null() noexcept { return false; }
│ │ │ │ -
155 [[noreturn]] static ENUM null()
│ │ │ │ -
156 { internal::throw_null_conversion("enum type"); }
│ │ │ │ -
157
│ │ │ │ -
158 static void from_string(const char Str[], ENUM &Obj)
│ │ │ │ -
159 {
│ │ │ │ -
160 underlying_type tmp;
│ │ │ │ -
161 underlying_traits::from_string(Str, tmp);
│ │ │ │ -
162 Obj = ENUM(tmp);
│ │ │ │ -
163 }
│ │ │ │ +
138 oid column_type(const char ColName[]) const //[t07]
│ │ │ │ +
139 { return column_type(column_number(ColName)); }
│ │ │ │ +
140
│ │ │ │ +
142 oid column_table(size_type ColNum) const; //[t02]
│ │ │ │ +
143
│ │ │ │ +
145 oid column_table(int ColNum) const //[t02]
│ │ │ │ +
146 { return column_table(size_type(ColNum)); }
│ │ │ │ +
148 oid column_table(const std::string &ColName) const //[t02]
│ │ │ │ +
149 { return column_table(column_number(ColName)); }
│ │ │ │ +
150
│ │ │ │ +
152
│ │ │ │ +
159 size_type table_column(size_type) const; //[t93]
│ │ │ │ +
160
│ │ │ │ +
162 size_type table_column(int ColNum) const //[t93]
│ │ │ │ +
163 { return table_column(size_type(ColNum)); }
│ │ │ │
164
│ │ │ │ -
165 static std::string to_string(ENUM Obj)
│ │ │ │ -
166 { return underlying_traits::to_string(underlying_type(Obj)); }
│ │ │ │ -
167};
│ │ │ │ -
168
│ │ │ │ +
166 size_type table_column(const std::string &ColName) const //[t93]
│ │ │ │ +
167 { return table_column(column_number(ColName)); }
│ │ │ │
169
│ │ │ │ +
170 size_t num() const { return rownumber(); } //[t01]
│ │ │ │
171
│ │ │ │ -
182#define PQXX_DECLARE_ENUM_CONVERSION(ENUM) \
│ │ │ │ -
183template<> \
│ │ │ │ -
184struct string_traits<ENUM> : pqxx::enum_traits<ENUM> \
│ │ │ │ -
185{ \
│ │ │ │ -
186 static constexpr const char *name() noexcept { return #ENUM; } \
│ │ │ │ -
187 [[noreturn]] static ENUM null() \
│ │ │ │ -
188 { internal::throw_null_conversion(name()); } \
│ │ │ │ -
189}
│ │ │ │ -
190
│ │ │ │ -
191
│ │ │ │ -
193template<> struct PQXX_LIBEXPORT string_traits<const char *>
│ │ │ │ -
194{
│ │ │ │ -
195 static constexpr const char *name() noexcept { return "const char *"; }
│ │ │ │ -
196 static constexpr bool has_null() noexcept { return true; }
│ │ │ │ -
197 static bool is_null(const char *t) { return t == nullptr; }
│ │ │ │ -
198 static const char *null() { return nullptr; }
│ │ │ │ -
199 static void from_string(const char Str[], const char *&Obj) { Obj = Str; }
│ │ │ │ -
200 static std::string to_string(const char *Obj) { return Obj; }
│ │ │ │ -
201};
│ │ │ │ -
202
│ │ │ │ -
204template<> struct PQXX_LIBEXPORT string_traits<char *>
│ │ │ │ -
205{
│ │ │ │ -
206 static constexpr const char *name() noexcept { return "char *"; }
│ │ │ │ -
207 static constexpr bool has_null() noexcept { return true; }
│ │ │ │ -
208 static bool is_null(const char *t) { return t == nullptr; }
│ │ │ │ -
209 static const char *null() { return nullptr; }
│ │ │ │ -
210
│ │ │ │ -
211 // Don't allow this conversion since it breaks const-safety.
│ │ │ │ -
212 // static void from_string(const char Str[], char *&Obj);
│ │ │ │ -
213
│ │ │ │ -
214 static std::string to_string(char *Obj) { return Obj; }
│ │ │ │ -
215};
│ │ │ │ +
184 row slice(size_type Begin, size_type End) const;
│ │ │ │ +
185
│ │ │ │ +
186 // Is this an empty slice?
│ │ │ │ +
187 PQXX_PURE bool empty() const noexcept;
│ │ │ │ +
188
│ │ │ │ +
189protected:
│ │ │ │ +
190 friend class field;
│ │ │ │ +
192 result m_result;
│ │ │ │ +
194
│ │ │ │ +
198 long m_index = 0;
│ │ │ │ +
200 size_type m_begin = 0;
│ │ │ │ +
202 size_type m_end = 0;
│ │ │ │ +
203};
│ │ │ │ +
204
│ │ │ │ +
205
│ │ │ │ +
207class PQXX_LIBEXPORT const_row_iterator : public field
│ │ │ │ +
208{
│ │ │ │ +
209public:
│ │ │ │ +
210 using iterator_category = std::random_access_iterator_tag;
│ │ │ │ +
211 using value_type = const field;
│ │ │ │ +
212 using pointer = const field *;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │
216
│ │ │ │ -
218template<size_t N> struct PQXX_LIBEXPORT string_traits<char[N]>
│ │ │ │ -
219{
│ │ │ │ -
220 static constexpr const char *name() noexcept { return "char[]"; }
│ │ │ │ -
221 static constexpr bool has_null() noexcept { return true; }
│ │ │ │ -
222 static bool is_null(const char t[]) { return t == nullptr; }
│ │ │ │ -
223 static const char *null() { return nullptr; }
│ │ │ │ -
224 static std::string to_string(const char Obj[]) { return Obj; }
│ │ │ │ -
225};
│ │ │ │ -
226
│ │ │ │ -
227template<> struct PQXX_LIBEXPORT string_traits<std::string>
│ │ │ │ -
228{
│ │ │ │ -
229 static constexpr const char *name() noexcept { return "string"; }
│ │ │ │ -
230 static constexpr bool has_null() noexcept { return false; }
│ │ │ │ -
231 static bool is_null(const std::string &) { return false; }
│ │ │ │ -
232 [[noreturn]] static std::string null()
│ │ │ │ - │ │ │ │ -
234 static void from_string(const char Str[], std::string &Obj) { Obj=Str; }
│ │ │ │ -
235 static std::string to_string(const std::string &Obj) { return Obj; }
│ │ │ │ -
236};
│ │ │ │ +
217 const_row_iterator(const row &T, row_size_type C) noexcept : //[t82]
│ │ │ │ +
218 field{T, C} {}
│ │ │ │ +
219 const_row_iterator(const field &F) noexcept : field{F} {} //[t82]
│ │ │ │ +
220
│ │ │ │ +
225 pointer operator->() const { return this; } //[t82]
│ │ │ │ +
226 reference operator*() const { return field{*this}; } //[t82]
│ │ │ │ +
228
│ │ │ │ +
233 const_row_iterator operator++(int); //[t82]
│ │ │ │ +
234 const_row_iterator &operator++() { ++m_col; return *this; } //[t82]
│ │ │ │ +
235 const_row_iterator operator--(int); //[t82]
│ │ │ │ +
236 const_row_iterator &operator--() { --m_col; return *this; } //[t82]
│ │ │ │
237
│ │ │ │ -
238template<> struct PQXX_LIBEXPORT string_traits<const std::string>
│ │ │ │ -
239{
│ │ │ │ -
240 static constexpr const char *name() noexcept { return "const string"; }
│ │ │ │ -
241 static constexpr bool has_null() noexcept { return false; }
│ │ │ │ -
242 static bool is_null(const std::string &) { return false; }
│ │ │ │ -
243 [[noreturn]] static const std::string null()
│ │ │ │ - │ │ │ │ -
245 static const std::string to_string(const std::string &Obj) { return Obj; }
│ │ │ │ -
246};
│ │ │ │ -
247
│ │ │ │ -
248template<> struct PQXX_LIBEXPORT string_traits<std::stringstream>
│ │ │ │ -
249{
│ │ │ │ -
250 static constexpr const char *name() noexcept { return "stringstream"; }
│ │ │ │ -
251 static constexpr bool has_null() noexcept { return false; }
│ │ │ │ -
252 static bool is_null(const std::stringstream &) { return false; }
│ │ │ │ -
253 [[noreturn]] static std::stringstream null()
│ │ │ │ - │ │ │ │ -
255 static void from_string(const char Str[], std::stringstream &Obj)
│ │ │ │ -
256 { Obj.clear(); Obj << Str; }
│ │ │ │ -
257 static std::string to_string(const std::stringstream &Obj)
│ │ │ │ -
258 { return Obj.str(); }
│ │ │ │ -
259};
│ │ │ │ -
260
│ │ │ │ + │ │ │ │ +
239 { m_col = size_type(difference_type(m_col) + i); return *this; }
│ │ │ │ + │ │ │ │ +
241 { m_col = size_type(difference_type(m_col) - i); return *this; }
│ │ │ │ +
243
│ │ │ │ +
248 bool operator==(const const_row_iterator &i) const //[t82]
│ │ │ │ +
249 {return col()==i.col();}
│ │ │ │ +
250 bool operator!=(const const_row_iterator &i) const //[t82]
│ │ │ │ +
251 {return col()!=i.col();}
│ │ │ │ +
252 bool operator<(const const_row_iterator &i) const //[t82]
│ │ │ │ +
253 {return col()<i.col();}
│ │ │ │ +
254 bool operator<=(const const_row_iterator &i) const //[t82]
│ │ │ │ +
255 {return col()<=i.col();}
│ │ │ │ +
256 bool operator>(const const_row_iterator &i) const //[t82]
│ │ │ │ +
257 {return col()>i.col();}
│ │ │ │ +
258 bool operator>=(const const_row_iterator &i) const //[t82]
│ │ │ │ +
259 {return col()>=i.col();}
│ │ │ │
261
│ │ │ │ -
262// TODO: Implement date conversions.
│ │ │ │ -
263
│ │ │ │ -
265
│ │ │ │ -
277template<typename T>
│ │ │ │ -
278 inline void from_string(const char Str[], T &Obj)
│ │ │ │ -
279{
│ │ │ │ -
280 if (Str == nullptr) throw std::runtime_error{"Attempt to read null string."};
│ │ │ │ - │ │ │ │ -
282}
│ │ │ │ -
283
│ │ │ │ -
284
│ │ │ │ -
286
│ │ │ │ -
292template<typename T> inline void from_string(const char Str[], T &Obj, size_t)
│ │ │ │ -
293{
│ │ │ │ -
294 return from_string(Str, Obj);
│ │ │ │ -
295}
│ │ │ │ -
296
│ │ │ │ -
297template<>
│ │ │ │ -
298 inline void from_string<std::string>( //[t00]
│ │ │ │ -
299 const char Str[],
│ │ │ │ -
300 std::string &Obj,
│ │ │ │ -
301 size_t len)
│ │ │ │ -
302{
│ │ │ │ -
303 if (Str == nullptr) throw std::runtime_error{"Attempt to read null string."};
│ │ │ │ -
304 Obj.assign(Str, len);
│ │ │ │ -
305}
│ │ │ │ -
306
│ │ │ │ -
307template<typename T>
│ │ │ │ -
308 inline void from_string(const std::string &Str, T &Obj) //[t45]
│ │ │ │ -
309 { from_string(Str.c_str(), Obj); }
│ │ │ │ -
310
│ │ │ │ -
311template<typename T>
│ │ │ │ -
312 inline void from_string(const std::stringstream &Str, T &Obj) //[t00]
│ │ │ │ -
313 { from_string(Str.str(), Obj); }
│ │ │ │ -
314
│ │ │ │ -
315template<> inline void
│ │ │ │ -
316from_string(const std::string &Str, std::string &Obj) //[t46]
│ │ │ │ -
317 { Obj = Str; }
│ │ │ │ -
318
│ │ │ │ -
319
│ │ │ │ -
320namespace internal
│ │ │ │ -
321{
│ │ │ │ -
323constexpr int digit_to_number(char c) noexcept { return c-'0'; }
│ │ │ │ -
324constexpr char number_to_digit(int i) noexcept
│ │ │ │ -
325 { return static_cast<char>(i+'0'); }
│ │ │ │ -
326} // namespace pqxx::internal
│ │ │ │ -
327
│ │ │ │ -
328
│ │ │ │ -
330
│ │ │ │ -
334template<typename T> inline std::string to_string(const T &Obj)
│ │ │ │ -
335 { return string_traits<T>::to_string(Obj); }
│ │ │ │ -
336
│ │ │ │ -
338
│ │ │ │ -
339} // namespace pqxx
│ │ │ │ -
340
│ │ │ │ -
341#endif
│ │ │ │ +
266 inline const_row_iterator operator+(difference_type) const; //[t82]
│ │ │ │ +
267
│ │ │ │ +
268 friend const_row_iterator operator+( //[t82]
│ │ │ │ +
269 difference_type,
│ │ │ │ + │ │ │ │ +
271
│ │ │ │ +
272 inline const_row_iterator operator-(difference_type) const; //[t82]
│ │ │ │ +
273 inline difference_type operator-(const_row_iterator) const; //[t82]
│ │ │ │ +
275};
│ │ │ │ +
276
│ │ │ │ +
277
│ │ │ │ +
279class PQXX_LIBEXPORT const_reverse_row_iterator : private const_row_iterator
│ │ │ │ +
280{
│ │ │ │ +
281public:
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
289
│ │ │ │ + │ │ │ │ + │ │ │ │ +
292 explicit
│ │ │ │ +
293 const_reverse_row_iterator(const super &rhs) noexcept : //[t82]
│ │ │ │ +
294 const_row_iterator{rhs} { super::operator--(); }
│ │ │ │ +
295
│ │ │ │ +
296 PQXX_PURE iterator_type base() const noexcept; //[t82]
│ │ │ │ +
297
│ │ │ │ +
302 using iterator_type::operator->; //[t82]
│ │ │ │ +
303 using iterator_type::operator*; //[t82]
│ │ │ │ +
305
│ │ │ │ +
310 const_reverse_row_iterator &
│ │ │ │ +
311 operator=(const const_reverse_row_iterator &r) //[t82]
│ │ │ │ +
312 { iterator_type::operator=(r); return *this; }
│ │ │ │ + │ │ │ │ +
314 { iterator_type::operator--(); return *this; }
│ │ │ │ +
315 const_reverse_row_iterator operator++(int); //[t82]
│ │ │ │ + │ │ │ │ +
317 { iterator_type::operator++(); return *this; }
│ │ │ │ +
318 const_reverse_row_iterator operator--(int); //[t82]
│ │ │ │ + │ │ │ │ +
320 { iterator_type::operator-=(i); return *this; }
│ │ │ │ + │ │ │ │ +
322 { iterator_type::operator+=(i); return *this; }
│ │ │ │ +
324
│ │ │ │ + │ │ │ │ +
330 { return const_reverse_row_iterator{base()-i}; }
│ │ │ │ + │ │ │ │ +
332 { return const_reverse_row_iterator{base()+i}; }
│ │ │ │ +
333 difference_type
│ │ │ │ +
334 operator-(const const_reverse_row_iterator &rhs) const //[t82]
│ │ │ │ +
335 { return rhs.const_row_iterator::operator-(*this); }
│ │ │ │ +
337
│ │ │ │ +
342 bool operator==(const const_reverse_row_iterator &rhs) const noexcept //[t82]
│ │ │ │ +
343 { return iterator_type::operator==(rhs); }
│ │ │ │ +
344 bool operator!=(const const_reverse_row_iterator &rhs) const noexcept //[t82]
│ │ │ │ +
345 { return !operator==(rhs); }
│ │ │ │ +
346
│ │ │ │ +
347 bool operator<(const const_reverse_row_iterator &rhs) const //[t82]
│ │ │ │ +
348 { return iterator_type::operator>(rhs); }
│ │ │ │ +
349 bool operator<=(const const_reverse_row_iterator &rhs) const //[t82]
│ │ │ │ +
350 { return iterator_type::operator>=(rhs); }
│ │ │ │ +
351 bool operator>(const const_reverse_row_iterator &rhs) const //[t82]
│ │ │ │ +
352 { return iterator_type::operator<(rhs); }
│ │ │ │ +
353 bool operator>=(const const_reverse_row_iterator &rhs) const //[t82]
│ │ │ │ +
354 { return iterator_type::operator<=(rhs); }
│ │ │ │ +
356};
│ │ │ │ +
357
│ │ │ │ +
358
│ │ │ │ +
359inline const_row_iterator
│ │ │ │ + │ │ │ │ +
361{
│ │ │ │ +
362 return const_row_iterator{
│ │ │ │ +
363 row(home(), idx()),
│ │ │ │ +
364 size_type(difference_type(col()) + o)};
│ │ │ │ +
365}
│ │ │ │ +
366
│ │ │ │ + │ │ │ │ + │ │ │ │ +
369 { return i + o; }
│ │ │ │ +
370
│ │ │ │ + │ │ │ │ + │ │ │ │ +
373{
│ │ │ │ +
374 return const_row_iterator{
│ │ │ │ +
375 row(home(), idx()),
│ │ │ │ +
376 size_type(difference_type(col()) - o)};
│ │ │ │ +
377}
│ │ │ │ +
378
│ │ │ │ + │ │ │ │ + │ │ │ │ +
381 { return difference_type(num() - i.num()); }
│ │ │ │ +
382
│ │ │ │ +
383
│ │ │ │ +
384} // namespace pqxx
│ │ │ │ +
385
│ │ │ │ +
386
│ │ │ │ +
387/*
│ │ │ │ +
388[1] Scott Meyers, in one of his essential books, "Effective C++" and "More
│ │ │ │ +
389Effective C++", points out that it is good style to have any class containing
│ │ │ │ +
390a member of pointer type define a destructor--just to show that it knows what
│ │ │ │ +
391it is doing with the pointer. This helps prevent nasty memory leak / double
│ │ │ │ +
392deletion bugs typically resulting from programmers' omission to deal with such
│ │ │ │ +
393issues in their destructors.
│ │ │ │ +
394
│ │ │ │ +
395The @c -Weffc++ option in gcc generates warnings for noncompliance with Scott's
│ │ │ │ +
396style guidelines, and hence necessitates the definition of this destructor,
│ │ │ │ +
397trivial as it may be.
│ │ │ │ +
398*/
│ │ │ │ +
399
│ │ │ │ +
400
│ │ │ │ +
401#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
402
│ │ │ │ +
403#endif
│ │ │ │
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
void from_string(const field &F, T &Obj)
Convert a field's string contents to another type.
Definition: field.hxx:365
│ │ │ │ -
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
│ │ │ │ -
PQXX_DECLARE_TYPE_NAME(bool)
│ │ │ │ -
constexpr char number_to_digit(int i) noexcept
Definition: strconv.hxx:324
│ │ │ │ -
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
│ │ │ │ -
void throw_null_conversion(const std::string &type)
Throw exception for attempt to convert null to given type.
Definition: strconv.cxx:58
│ │ │ │ -
Traits class for use in string conversions.
Definition: strconv.hxx:51
│ │ │ │ -
Give a human-readable name for a type, at compile time.
Definition: strconv.hxx:67
│ │ │ │ -
Helper: string traits implementation for built-in types.
Definition: strconv.hxx:103
│ │ │ │ -
static void from_string(const char Str[], TYPE &Obj)
│ │ │ │ -
static bool is_null(TYPE)
Definition: strconv.hxx:107
│ │ │ │ -
static std::string to_string(TYPE Obj)
│ │ │ │ -
static TYPE null()
Definition: strconv.hxx:108
│ │ │ │ -
static constexpr const char * name() noexcept
Definition: strconv.hxx:104
│ │ │ │ -
static constexpr bool has_null() noexcept
Definition: strconv.hxx:106
│ │ │ │ -
Helper class for defining enum conversions.
Definition: strconv.hxx:150
│ │ │ │ -
static std::string to_string(ENUM Obj)
Definition: strconv.hxx:165
│ │ │ │ -
static ENUM null()
Definition: strconv.hxx:155
│ │ │ │ -
static constexpr bool has_null() noexcept
Definition: strconv.hxx:154
│ │ │ │ -
static void from_string(const char Str[], ENUM &Obj)
Definition: strconv.hxx:158
│ │ │ │ -
typename std::underlying_type< ENUM >::type underlying_type
Definition: strconv.hxx:151
│ │ │ │ -
static const char * null()
Definition: strconv.hxx:198
│ │ │ │ -
static std::string to_string(const char *Obj)
Definition: strconv.hxx:200
│ │ │ │ -
static bool is_null(const char *t)
Definition: strconv.hxx:197
│ │ │ │ -
static constexpr const char * name() noexcept
Definition: strconv.hxx:195
│ │ │ │ -
static void from_string(const char Str[], const char *&Obj)
Definition: strconv.hxx:199
│ │ │ │ -
static constexpr bool has_null() noexcept
Definition: strconv.hxx:196
│ │ │ │ -
static constexpr const char * name() noexcept
Definition: strconv.hxx:206
│ │ │ │ -
static bool is_null(const char *t)
Definition: strconv.hxx:208
│ │ │ │ -
static std::string to_string(char *Obj)
Definition: strconv.hxx:214
│ │ │ │ -
static constexpr bool has_null() noexcept
Definition: strconv.hxx:207
│ │ │ │ -
static const char * null()
Definition: strconv.hxx:209
│ │ │ │ -
static constexpr bool has_null() noexcept
Definition: strconv.hxx:221
│ │ │ │ -
static constexpr const char * name() noexcept
Definition: strconv.hxx:220
│ │ │ │ -
static const char * null()
Definition: strconv.hxx:223
│ │ │ │ -
static bool is_null(const char t[])
Definition: strconv.hxx:222
│ │ │ │ -
static std::string to_string(const char Obj[])
Definition: strconv.hxx:224
│ │ │ │ -
static bool is_null(const std::string &)
Definition: strconv.hxx:231
│ │ │ │ -
static void from_string(const char Str[], std::string &Obj)
Definition: strconv.hxx:234
│ │ │ │ -
static std::string to_string(const std::string &Obj)
Definition: strconv.hxx:235
│ │ │ │ -
static constexpr bool has_null() noexcept
Definition: strconv.hxx:230
│ │ │ │ -
static constexpr const char * name() noexcept
Definition: strconv.hxx:229
│ │ │ │ -
static std::string null()
Definition: strconv.hxx:232
│ │ │ │ -
static const std::string null()
Definition: strconv.hxx:243
│ │ │ │ -
static constexpr const char * name() noexcept
Definition: strconv.hxx:240
│ │ │ │ -
static const std::string to_string(const std::string &Obj)
Definition: strconv.hxx:245
│ │ │ │ -
static bool is_null(const std::string &)
Definition: strconv.hxx:242
│ │ │ │ -
static constexpr bool has_null() noexcept
Definition: strconv.hxx:241
│ │ │ │ -
static constexpr bool has_null() noexcept
Definition: strconv.hxx:251
│ │ │ │ -
static bool is_null(const std::stringstream &)
Definition: strconv.hxx:252
│ │ │ │ -
static std::string to_string(const std::stringstream &Obj)
Definition: strconv.hxx:257
│ │ │ │ -
static void from_string(const char Str[], std::stringstream &Obj)
Definition: strconv.hxx:255
│ │ │ │ -
static constexpr const char * name() noexcept
Definition: strconv.hxx:250
│ │ │ │ -
static std::stringstream null()
Definition: strconv.hxx:253
│ │ │ │ +
const_result_iterator operator+(result::difference_type o, const_result_iterator i)
Definition: result_iterator.hxx:212
│ │ │ │ +
signed int row_difference_type
Difference between row sizes.
Definition: types.hxx:27
│ │ │ │ +
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
│ │ │ │ +
Reference to a field in a result set.
Definition: field.hxx:50
│ │ │ │ +
row_size_type num() const
Definition: field.hxx:104
│ │ │ │ +
field_size_type size_type
Definition: field.hxx:52
│ │ │ │ +
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ +
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │ +
size_t rownumber() const noexcept
Row number, assuming this is a real row and not end()/rend().
Definition: row.hxx:113
│ │ │ │ +
oid column_type(const std::string &ColName) const
Type of given column.
Definition: row.hxx:134
│ │ │ │ +
oid column_table(const std::string &ColName) const
What table did this column come from?
Definition: row.hxx:148
│ │ │ │ +
row_size_type size_type
Definition: row.hxx:43
│ │ │ │ +
row_difference_type difference_type
Definition: row.hxx:44
│ │ │ │ +
row()=default
│ │ │ │ +
size_t num() const
Definition: row.hxx:170
│ │ │ │ +
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
│ │ │ │ +
size_type column_number(const std::string &ColName) const
Number of given column (throws exception if it doesn't exist)
Definition: row.hxx:120
│ │ │ │ +
~row() noexcept=default
│ │ │ │ +
oid column_table(int ColNum) const
What table did this column come from?
Definition: row.hxx:145
│ │ │ │ +
oid column_type(const char ColName[]) const
Type of given column.
Definition: row.hxx:138
│ │ │ │ +
size_type table_column(int ColNum) const
What column number in its table did this result column come from?
Definition: row.hxx:162
│ │ │ │ +
oid column_type(int ColNum) const
Type of given column.
Definition: row.hxx:130
│ │ │ │ +
Iterator for fields in a row. Use as row::const_iterator.
Definition: row.hxx:208
│ │ │ │ +
bool operator!=(const const_row_iterator &i) const
Definition: row.hxx:250
│ │ │ │ +
const_row_iterator & operator++()
Definition: row.hxx:234
│ │ │ │ +
const_row_iterator & operator--()
Definition: row.hxx:236
│ │ │ │ +
bool operator<=(const const_row_iterator &i) const
Definition: row.hxx:254
│ │ │ │ +
std::random_access_iterator_tag iterator_category
Definition: row.hxx:210
│ │ │ │ +
const_row_iterator & operator-=(difference_type i)
Definition: row.hxx:240
│ │ │ │ +
const_row_iterator operator-(difference_type) const
Definition: row.hxx:372
│ │ │ │ +
const_row_iterator operator+(difference_type) const
Definition: row.hxx:360
│ │ │ │ +
bool operator==(const const_row_iterator &i) const
Definition: row.hxx:248
│ │ │ │ +
bool operator>=(const const_row_iterator &i) const
Definition: row.hxx:258
│ │ │ │ +
reference operator*() const
Definition: row.hxx:226
│ │ │ │ +
const_row_iterator(const row &T, row_size_type C) noexcept
Definition: row.hxx:217
│ │ │ │ +
row_difference_type difference_type
Definition: row.hxx:214
│ │ │ │ +
pointer operator->() const
Definition: row.hxx:225
│ │ │ │ +
bool operator<(const const_row_iterator &i) const
Definition: row.hxx:252
│ │ │ │ +
const_row_iterator & operator+=(difference_type i)
Definition: row.hxx:238
│ │ │ │ +
bool operator>(const const_row_iterator &i) const
Definition: row.hxx:256
│ │ │ │ +
const_row_iterator(const field &F) noexcept
Definition: row.hxx:219
│ │ │ │ +
Reverse iterator for a row. Use as row::const_reverse_iterator.
Definition: row.hxx:280
│ │ │ │ +
const_reverse_row_iterator & operator+=(difference_type i)
Definition: row.hxx:319
│ │ │ │ +
const_reverse_row_iterator(const const_reverse_row_iterator &r)
Definition: row.hxx:290
│ │ │ │ +
const_reverse_row_iterator & operator-=(difference_type i)
Definition: row.hxx:321
│ │ │ │ +
bool operator!=(const const_reverse_row_iterator &rhs) const noexcept
Definition: row.hxx:344
│ │ │ │ +
const_reverse_row_iterator operator+(difference_type i) const
Definition: row.hxx:329
│ │ │ │ +
bool operator<(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:347
│ │ │ │ +
const_reverse_row_iterator operator-(difference_type i)
Definition: row.hxx:331
│ │ │ │ +
bool operator<=(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:349
│ │ │ │ +
bool operator>=(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:353
│ │ │ │ +
bool operator>(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:351
│ │ │ │ +
bool operator==(const const_reverse_row_iterator &rhs) const noexcept
Definition: row.hxx:342
│ │ │ │ +
const_reverse_row_iterator & operator--()
Definition: row.hxx:316
│ │ │ │ +
difference_type operator-(const const_reverse_row_iterator &rhs) const
Definition: row.hxx:334
│ │ │ │ +
const_reverse_row_iterator operator++()
Definition: row.hxx:313
│ │ │ │ +
const_reverse_row_iterator(const super &rhs) noexcept
Definition: row.hxx:293
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,428 +1,477 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -strconv.hxx │ │ │ │ │ +row.hxx │ │ │ │ │ 1 │ │ │ │ │ - 11#ifndef PQXX_H_STRINGCONV │ │ │ │ │ - 12#define PQXX_H_STRINGCONV │ │ │ │ │ - 13 │ │ │ │ │ - 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 13#ifndef PQXX_H_ROW │ │ │ │ │ + 14#define PQXX_H_ROW │ │ │ │ │ 15 │ │ │ │ │ - 16#include │ │ │ │ │ - 17#include │ │ │ │ │ - 18#include │ │ │ │ │ - 19 │ │ │ │ │ - 20 │ │ │ │ │ - 21namespace pqxx │ │ │ │ │ - 22{ │ │ │ │ │ + 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 18 │ │ │ │ │ + 19#include "pqxx/except.hxx" │ │ │ │ │ + 20#include "pqxx/field.hxx" │ │ │ │ │ + 21#include "pqxx/result.hxx" │ │ │ │ │ + 22 │ │ │ │ │ 23 │ │ │ │ │ - 46 │ │ │ │ │ - 48 │ │ │ │ │ -51template struct string_traits; │ │ │ │ │ - 52 │ │ │ │ │ - 53namespace internal │ │ │ │ │ - 54{ │ │ │ │ │ - 56[[noreturn]] PQXX_LIBEXPORT void throw_null_conversion( │ │ │ │ │ - 57 const std::string &type); │ │ │ │ │ + 24// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ + 25 │ │ │ │ │ + 26namespace pqxx │ │ │ │ │ + 27{ │ │ │ │ │ + 29 │ │ │ │ │ +40class PQXX_LIBEXPORT row │ │ │ │ │ + 41{ │ │ │ │ │ + 42public: │ │ │ │ │ +43 using size_type = row_size_type; │ │ │ │ │ +44 using difference_type = row_difference_type; │ │ │ │ │ +45 using const_iterator = const_row_iterator; │ │ │ │ │ +46 using iterator = const_iterator; │ │ │ │ │ +47 using reference = field; │ │ │ │ │ +48 using pointer = const_row_iterator; │ │ │ │ │ +49 using const_reverse_iterator = const_reverse_row_iterator; │ │ │ │ │ +50 using reverse_iterator = const_reverse_iterator; │ │ │ │ │ + 51 │ │ │ │ │ +52 row() =default; │ │ │ │ │ + 53 │ │ │ │ │ + 55 row(result r, size_t i) noexcept; │ │ │ │ │ + 56 │ │ │ │ │ +57 ~row() noexcept =default; // Yes Scott Meyers, you're absolutely right[1] │ │ │ │ │ 58 │ │ │ │ │ - 60 │ │ │ │ │ -67template struct type_name; │ │ │ │ │ - 68#define PQXX_DECLARE_TYPE_NAME(TYPE) \ │ │ │ │ │ - 69 template<> struct type_name \ │ │ │ │ │ - 70 { static constexpr const char *value = #TYPE; } │ │ │ │ │ - 71 │ │ │ │ │ -72PQXX_DECLARE_TYPE_NAME(bool); │ │ │ │ │ -73PQXX_DECLARE_TYPE_NAME(short); │ │ │ │ │ -74PQXX_DECLARE_TYPE_NAME(unsigned short); │ │ │ │ │ -75PQXX_DECLARE_TYPE_NAME(int); │ │ │ │ │ -76PQXX_DECLARE_TYPE_NAME(unsigned int); │ │ │ │ │ -77PQXX_DECLARE_TYPE_NAME(long); │ │ │ │ │ -78PQXX_DECLARE_TYPE_NAME(unsigned long); │ │ │ │ │ -79PQXX_DECLARE_TYPE_NAME(long long); │ │ │ │ │ -80PQXX_DECLARE_TYPE_NAME(unsigned long long); │ │ │ │ │ -81PQXX_DECLARE_TYPE_NAME(float); │ │ │ │ │ -82PQXX_DECLARE_TYPE_NAME(double); │ │ │ │ │ -83PQXX_DECLARE_TYPE_NAME(long double); │ │ │ │ │ -84PQXX_DECLARE_TYPE_NAME(char *); │ │ │ │ │ -85PQXX_DECLARE_TYPE_NAME(const char *); │ │ │ │ │ -86PQXX_DECLARE_TYPE_NAME(std::string); │ │ │ │ │ - 87PQXX_DECLARE_TYPE_NAME(const std::string); │ │ │ │ │ -88PQXX_DECLARE_TYPE_NAME(std::stringstream); │ │ │ │ │ - 89#undef PQXX_DECLARE_TYPE_NAME │ │ │ │ │ - 90 │ │ │ │ │ -91template struct type_name │ │ │ │ │ -92{ static constexpr const char *value = "char[]"; }; │ │ │ │ │ - 93 │ │ │ │ │ - 94 │ │ │ │ │ - 96 │ │ │ │ │ -102template struct PQXX_LIBEXPORT builtin_traits │ │ │ │ │ - 103{ │ │ │ │ │ -104 static constexpr const char *name() noexcept │ │ │ │ │ - 105 { return internal::type_name::value; } │ │ │ │ │ -106 static constexpr bool has_null() noexcept { return false; } │ │ │ │ │ -107 static bool is_null(TYPE) { return false; } │ │ │ │ │ -108 [[noreturn]] static TYPE null() { throw_null_conversion(name()); } │ │ │ │ │ -109 static void from_string(const char Str[], TYPE &Obj); │ │ │ │ │ -110 static std::string to_string(TYPE Obj); │ │ │ │ │ - 111}; │ │ │ │ │ - 112} // namespace pqxx::internal │ │ │ │ │ - 113 │ │ │ │ │ + 63 PQXX_PURE bool operator==(const row &) const noexcept; //[t75] │ │ │ │ │ +64 bool operator!=(const row &rhs) const noexcept //[t75] │ │ │ │ │ + 65 { return not operator==(rhs); } │ │ │ │ │ + 67 │ │ │ │ │ + 68 const_iterator begin() const noexcept; //[t82] │ │ │ │ │ + 69 const_iterator cbegin() const noexcept; │ │ │ │ │ + 70 const_iterator end() const noexcept; //[t82] │ │ │ │ │ + 71 const_iterator cend() const noexcept; │ │ │ │ │ + 72 │ │ │ │ │ + 77 reference front() const noexcept; //[t74] │ │ │ │ │ + 78 reference back() const noexcept; //[t75] │ │ │ │ │ + 79 │ │ │ │ │ + 80 const_reverse_row_iterator rbegin() const; //[t82] │ │ │ │ │ + 81 const_reverse_row_iterator crbegin() const; │ │ │ │ │ + 82 const_reverse_row_iterator rend() const; //[t82] │ │ │ │ │ + 83 const_reverse_row_iterator crend() const; │ │ │ │ │ + 84 │ │ │ │ │ + 85 reference operator[](size_type) const noexcept; //[t11] │ │ │ │ │ + 86 reference operator[](int) const noexcept; //[t02] │ │ │ │ │ + 90 reference operator[](const char[]) const; //[t11] │ │ │ │ │ + 94 reference operator[](const std::string &) const; //[t11] │ │ │ │ │ + 95 reference at(size_type) const; //[t11] │ │ │ │ │ + 96 reference at(int) const; //[t11] │ │ │ │ │ + 100 reference at(const char[]) const; //[t11] │ │ │ │ │ + 104 reference at(const std::string &) const; //[t11] │ │ │ │ │ + 106 │ │ │ │ │ +107 size_type size() const noexcept //[t11] │ │ │ │ │ + 108 { return m_end-m_begin; } │ │ │ │ │ + 109 │ │ │ │ │ + 110 void swap(row &) noexcept; //[t11] │ │ │ │ │ + 111 │ │ │ │ │ +113 size_t rownumber() const noexcept { return size_t(m_index); } //[t11] │ │ │ │ │ 114 │ │ │ │ │ - 116#define PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(TYPE) \ │ │ │ │ │ - 117 template<> struct PQXX_LIBEXPORT string_traits : \ │ │ │ │ │ - 118 internal::builtin_traits {}; │ │ │ │ │ - 119 │ │ │ │ │ - 120PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(bool) │ │ │ │ │ - 121 │ │ │ │ │ - 122PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(short) │ │ │ │ │ - 123PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned short) │ │ │ │ │ - 124PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(int) │ │ │ │ │ - 125PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned int) │ │ │ │ │ - 126PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long) │ │ │ │ │ - 127PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long) │ │ │ │ │ - 128PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long long) │ │ │ │ │ - 129PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long long) │ │ │ │ │ - 130 │ │ │ │ │ - 131PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(float) │ │ │ │ │ - 132PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(double) │ │ │ │ │ - 133PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long double) │ │ │ │ │ - 134 │ │ │ │ │ - 135#undef PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION │ │ │ │ │ +120 size_type column_number(const std::string &ColName) const //[t30] │ │ │ │ │ + 121 { return column_number(ColName.c_str()); } │ │ │ │ │ + 122 │ │ │ │ │ + 124 size_type column_number(const char[]) const; //[t30] │ │ │ │ │ + 125 │ │ │ │ │ + 127 oid column_type(size_type) const; //[t07] │ │ │ │ │ + 128 │ │ │ │ │ +130 oid column_type(int ColNum) const //[t07] │ │ │ │ │ + 131 { return column_type(size_type(ColNum)); } │ │ │ │ │ + 132 │ │ │ │ │ +134 oid column_type(const std::string &ColName) const //[t07] │ │ │ │ │ + 135 { return column_type(column_number(ColName)); } │ │ │ │ │ 136 │ │ │ │ │ - 137 │ │ │ │ │ - 139 │ │ │ │ │ - 148template │ │ │ │ │ -149struct enum_traits │ │ │ │ │ - 150{ │ │ │ │ │ -151 using underlying_type = typename std::underlying_type::type; │ │ │ │ │ -152 using underlying_traits = string_traits; │ │ │ │ │ - 153 │ │ │ │ │ -154 static constexpr bool has_null() noexcept { return false; } │ │ │ │ │ -155 [[noreturn]] static ENUM null() │ │ │ │ │ - 156 { internal::throw_null_conversion("enum type"); } │ │ │ │ │ - 157 │ │ │ │ │ -158 static void from_string(const char Str[], ENUM &Obj) │ │ │ │ │ - 159 { │ │ │ │ │ - 160 underlying_type tmp; │ │ │ │ │ - 161 underlying_traits::from_string(Str, tmp); │ │ │ │ │ - 162 Obj = ENUM(tmp); │ │ │ │ │ - 163 } │ │ │ │ │ +138 oid column_type(const char ColName[]) const //[t07] │ │ │ │ │ + 139 { return column_type(column_number(ColName)); } │ │ │ │ │ + 140 │ │ │ │ │ + 142 oid column_table(size_type ColNum) const; //[t02] │ │ │ │ │ + 143 │ │ │ │ │ +145 oid column_table(int ColNum) const //[t02] │ │ │ │ │ + 146 { return column_table(size_type(ColNum)); } │ │ │ │ │ +148 oid column_table(const std::string &ColName) const //[t02] │ │ │ │ │ + 149 { return column_table(column_number(ColName)); } │ │ │ │ │ + 150 │ │ │ │ │ + 152 │ │ │ │ │ + 159 size_type table_column(size_type) const; //[t93] │ │ │ │ │ + 160 │ │ │ │ │ +162 size_type table_column(int ColNum) const //[t93] │ │ │ │ │ + 163 { return table_column(size_type(ColNum)); } │ │ │ │ │ 164 │ │ │ │ │ -165 static std::string to_string(ENUM Obj) │ │ │ │ │ - 166 { return underlying_traits::to_string(underlying_type(Obj)); } │ │ │ │ │ - 167}; │ │ │ │ │ - 168 │ │ │ │ │ +166 size_type table_column(const std::string &ColName) const //[t93] │ │ │ │ │ + 167 { return table_column(column_number(ColName)); } │ │ │ │ │ 169 │ │ │ │ │ +170 size_t num() const { return rownumber(); } //[t01] │ │ │ │ │ 171 │ │ │ │ │ - 182#define PQXX_DECLARE_ENUM_CONVERSION(ENUM) \ │ │ │ │ │ - 183template<> \ │ │ │ │ │ - 184struct string_traits : pqxx::enum_traits \ │ │ │ │ │ - 185{ \ │ │ │ │ │ - 186 static constexpr const char *name() noexcept { return #ENUM; } \ │ │ │ │ │ - 187 [[noreturn]] static ENUM null() \ │ │ │ │ │ - 188 { internal::throw_null_conversion(name()); } \ │ │ │ │ │ - 189} │ │ │ │ │ - 190 │ │ │ │ │ - 191 │ │ │ │ │ -193template<> struct PQXX_LIBEXPORT string_traits │ │ │ │ │ - 194{ │ │ │ │ │ -195 static constexpr const char *name() noexcept { return "const char *"; } │ │ │ │ │ -196 static constexpr bool has_null() noexcept { return true; } │ │ │ │ │ -197 static bool is_null(const char *t) { return t == nullptr; } │ │ │ │ │ -198 static const char *null() { return nullptr; } │ │ │ │ │ -199 static void from_string(const char Str[], const char *&Obj) { Obj = Str; } │ │ │ │ │ -200 static std::string to_string(const char *Obj) { return Obj; } │ │ │ │ │ - 201}; │ │ │ │ │ - 202 │ │ │ │ │ -204template<> struct PQXX_LIBEXPORT string_traits │ │ │ │ │ - 205{ │ │ │ │ │ -206 static constexpr const char *name() noexcept { return "char *"; } │ │ │ │ │ -207 static constexpr bool has_null() noexcept { return true; } │ │ │ │ │ -208 static bool is_null(const char *t) { return t == nullptr; } │ │ │ │ │ -209 static const char *null() { return nullptr; } │ │ │ │ │ - 210 │ │ │ │ │ - 211 // Don't allow this conversion since it breaks const-safety. │ │ │ │ │ - 212 // static void from_string(const char Str[], char *&Obj); │ │ │ │ │ - 213 │ │ │ │ │ -214 static std::string to_string(char *Obj) { return Obj; } │ │ │ │ │ - 215}; │ │ │ │ │ + 184 row slice(size_type Begin, size_type End) const; │ │ │ │ │ + 185 │ │ │ │ │ + 186 // Is this an empty slice? │ │ │ │ │ + 187 PQXX_PURE bool empty() const noexcept; │ │ │ │ │ + 188 │ │ │ │ │ + 189protected: │ │ │ │ │ +190 friend class field; │ │ │ │ │ +192 result m_result; │ │ │ │ │ + 194 │ │ │ │ │ +198 long m_index = 0; │ │ │ │ │ +200 size_type m_begin = 0; │ │ │ │ │ +202 size_type m_end = 0; │ │ │ │ │ + 203}; │ │ │ │ │ + 204 │ │ │ │ │ + 205 │ │ │ │ │ +207class PQXX_LIBEXPORT const_row_iterator : public field │ │ │ │ │ + 208{ │ │ │ │ │ + 209public: │ │ │ │ │ +210 using iterator_category = std::random_access_iterator_tag; │ │ │ │ │ +211 using value_type = const field; │ │ │ │ │ +212 using pointer = const field *; │ │ │ │ │ +213 using size_type = row_size_type; │ │ │ │ │ +214 using difference_type = row_difference_type; │ │ │ │ │ +215 using reference = field; │ │ │ │ │ 216 │ │ │ │ │ -218template struct PQXX_LIBEXPORT string_traits │ │ │ │ │ - 219{ │ │ │ │ │ -220 static constexpr const char *name() noexcept { return "char[]"; } │ │ │ │ │ -221 static constexpr bool has_null() noexcept { return true; } │ │ │ │ │ -222 static bool is_null(const char t[]) { return t == nullptr; } │ │ │ │ │ -223 static const char *null() { return nullptr; } │ │ │ │ │ -224 static std::string to_string(const char Obj[]) { return Obj; } │ │ │ │ │ - 225}; │ │ │ │ │ - 226 │ │ │ │ │ -227template<> struct PQXX_LIBEXPORT string_traits │ │ │ │ │ - 228{ │ │ │ │ │ -229 static constexpr const char *name() noexcept { return "string"; } │ │ │ │ │ -230 static constexpr bool has_null() noexcept { return false; } │ │ │ │ │ -231 static bool is_null(const std::string &) { return false; } │ │ │ │ │ -232 [[noreturn]] static std::string null() │ │ │ │ │ - 233 { internal::throw_null_conversion(name()); } │ │ │ │ │ -234 static void from_string(const char Str[], std::string &Obj) { Obj=Str; } │ │ │ │ │ -235 static std::string to_string(const std::string &Obj) { return Obj; } │ │ │ │ │ - 236}; │ │ │ │ │ +217 const_row_iterator(const row &T, row_size_type C) noexcept : //[t82] │ │ │ │ │ + 218 field{T, C} {} │ │ │ │ │ +219 const_row_iterator(const field &F) noexcept : field{F} {} //[t82] │ │ │ │ │ + 220 │ │ │ │ │ +225 pointer operator->() const { return this; } //[t82] │ │ │ │ │ +226 reference operator*() const { return field{*this}; } //[t82] │ │ │ │ │ + 228 │ │ │ │ │ + 233 const_row_iterator operator++(int); //[t82] │ │ │ │ │ +234 const_row_iterator &operator++() { ++m_col; return *this; } //[t82] │ │ │ │ │ + 235 const_row_iterator operator--(int); //[t82] │ │ │ │ │ +236 const_row_iterator &operator--() { --m_col; return *this; } //[t82] │ │ │ │ │ 237 │ │ │ │ │ -238template<> struct PQXX_LIBEXPORT string_traits │ │ │ │ │ - 239{ │ │ │ │ │ -240 static constexpr const char *name() noexcept { return "const string"; } │ │ │ │ │ -241 static constexpr bool has_null() noexcept { return false; } │ │ │ │ │ -242 static bool is_null(const std::string &) { return false; } │ │ │ │ │ -243 [[noreturn]] static const std::string null() │ │ │ │ │ - 244 { internal::throw_null_conversion(name()); } │ │ │ │ │ -245 static const std::string to_string(const std::string &Obj) { return Obj; } │ │ │ │ │ - 246}; │ │ │ │ │ - 247 │ │ │ │ │ -248template<> struct PQXX_LIBEXPORT string_traits │ │ │ │ │ - 249{ │ │ │ │ │ -250 static constexpr const char *name() noexcept { return "stringstream"; } │ │ │ │ │ -251 static constexpr bool has_null() noexcept { return false; } │ │ │ │ │ -252 static bool is_null(const std::stringstream &) { return false; } │ │ │ │ │ -253 [[noreturn]] static std::stringstream null() │ │ │ │ │ - 254 { internal::throw_null_conversion(name()); } │ │ │ │ │ -255 static void from_string(const char Str[], std::stringstream &Obj) │ │ │ │ │ - 256 { Obj.clear(); Obj << Str; } │ │ │ │ │ -257 static std::string to_string(const std::stringstream &Obj) │ │ │ │ │ - 258 { return Obj.str(); } │ │ │ │ │ - 259}; │ │ │ │ │ - 260 │ │ │ │ │ +238 const_row_iterator &operator+=(difference_type i) //[t82] │ │ │ │ │ + 239 { m_col = size_type(difference_type(m_col) + i); return *this; } │ │ │ │ │ +240 const_row_iterator &operator-=(difference_type i) //[t82] │ │ │ │ │ + 241 { m_col = size_type(difference_type(m_col) - i); return *this; } │ │ │ │ │ + 243 │ │ │ │ │ +248 bool operator==(const const_row_iterator &i) const //[t82] │ │ │ │ │ + 249 {return col()==i.col();} │ │ │ │ │ +250 bool operator!=(const const_row_iterator &i) const //[t82] │ │ │ │ │ + 251 {return col()!=i.col();} │ │ │ │ │ +252 bool operator<(const const_row_iterator &i) const //[t82] │ │ │ │ │ + 253 {return col()(const const_row_iterator &i) const //[t82] │ │ │ │ │ + 257 {return col()>i.col();} │ │ │ │ │ +258 bool operator>=(const const_row_iterator &i) const //[t82] │ │ │ │ │ + 259 {return col()>=i.col();} │ │ │ │ │ 261 │ │ │ │ │ - 262// TODO: Implement date conversions. │ │ │ │ │ - 263 │ │ │ │ │ - 265 │ │ │ │ │ - 277template │ │ │ │ │ -278 inline void from_string(const char Str[], T &Obj) │ │ │ │ │ - 279{ │ │ │ │ │ - 280 if (Str == nullptr) throw std::runtime_error{"Attempt to read null │ │ │ │ │ -string."}; │ │ │ │ │ - 281 string_traits::from_string(Str, Obj); │ │ │ │ │ - 282} │ │ │ │ │ - 283 │ │ │ │ │ - 284 │ │ │ │ │ - 286 │ │ │ │ │ -292template inline void from_string(const char Str[], T &Obj, │ │ │ │ │ -size_t) │ │ │ │ │ - 293{ │ │ │ │ │ - 294 return from_string(Str, Obj); │ │ │ │ │ - 295} │ │ │ │ │ - 296 │ │ │ │ │ - 297template<> │ │ │ │ │ -298 inline void from_string( //[t00] │ │ │ │ │ - 299 const char Str[], │ │ │ │ │ - 300 std::string &Obj, │ │ │ │ │ - 301 size_t len) │ │ │ │ │ - 302{ │ │ │ │ │ - 303 if (Str == nullptr) throw std::runtime_error{"Attempt to read null │ │ │ │ │ -string."}; │ │ │ │ │ - 304 Obj.assign(Str, len); │ │ │ │ │ - 305} │ │ │ │ │ - 306 │ │ │ │ │ - 307template │ │ │ │ │ -308 inline void from_string(const std::string &Str, T &Obj) //[t45] │ │ │ │ │ - 309 { from_string(Str.c_str(), Obj); } │ │ │ │ │ - 310 │ │ │ │ │ - 311template │ │ │ │ │ -312 inline void from_string(const std::stringstream &Str, T &Obj) //[t00] │ │ │ │ │ - 313 { from_string(Str.str(), Obj); } │ │ │ │ │ - 314 │ │ │ │ │ - 315template<> inline void │ │ │ │ │ -316from_string(const std::string &Str, std::string &Obj) //[t46] │ │ │ │ │ - 317 { Obj = Str; } │ │ │ │ │ - 318 │ │ │ │ │ - 319 │ │ │ │ │ - 320namespace internal │ │ │ │ │ - 321{ │ │ │ │ │ -323constexpr int digit_to_number(char c) noexcept { return c-'0'; } │ │ │ │ │ -324constexpr char number_to_digit(int i) noexcept │ │ │ │ │ - 325 { return static_cast(i+'0'); } │ │ │ │ │ - 326} // namespace pqxx::internal │ │ │ │ │ - 327 │ │ │ │ │ - 328 │ │ │ │ │ - 330 │ │ │ │ │ -334template inline std::string to_string(const T &Obj) │ │ │ │ │ - 335 { return string_traits::to_string(Obj); } │ │ │ │ │ - 336 │ │ │ │ │ - 338 │ │ │ │ │ - 339} // namespace pqxx │ │ │ │ │ - 340 │ │ │ │ │ - 341#endif │ │ │ │ │ + 266 inline const_row_iterator operator+(difference_type) const; //[t82] │ │ │ │ │ + 267 │ │ │ │ │ + 268 friend const_row_iterator operator+( //[t82] │ │ │ │ │ + 269 difference_type, │ │ │ │ │ + 270 const_row_iterator); │ │ │ │ │ + 271 │ │ │ │ │ +272 inline const_row_iterator operator-(difference_type) const; //[t82] │ │ │ │ │ +273 inline difference_type operator-(const_row_iterator) const; //[t82] │ │ │ │ │ + 275}; │ │ │ │ │ + 276 │ │ │ │ │ + 277 │ │ │ │ │ +279class PQXX_LIBEXPORT const_reverse_row_iterator : private const_row_iterator │ │ │ │ │ + 280{ │ │ │ │ │ + 281public: │ │ │ │ │ +282 using super = const_row_iterator; │ │ │ │ │ +283 using iterator_type = const_row_iterator; │ │ │ │ │ + 284 using iterator_type::iterator_category; │ │ │ │ │ + 285 using iterator_type::difference_type; │ │ │ │ │ + 286 using iterator_type::pointer; │ │ │ │ │ +287 using value_type = iterator_type::value_type; │ │ │ │ │ +288 using reference = iterator_type::reference; │ │ │ │ │ + 289 │ │ │ │ │ +290 const_reverse_row_iterator(const const_reverse_row_iterator &r) : //[t82] │ │ │ │ │ + 291 const_row_iterator{r} {} │ │ │ │ │ + 292 explicit │ │ │ │ │ +293 const_reverse_row_iterator(const super &rhs) noexcept : //[t82] │ │ │ │ │ + 294 const_row_iterator{rhs} { super::operator--(); } │ │ │ │ │ + 295 │ │ │ │ │ + 296 PQXX_PURE iterator_type base() const noexcept; //[t82] │ │ │ │ │ + 297 │ │ │ │ │ + 302 using iterator_type::operator->; //[t82] │ │ │ │ │ + 303 using iterator_type::operator*; //[t82] │ │ │ │ │ + 305 │ │ │ │ │ + 310 const_reverse_row_iterator & │ │ │ │ │ +311 operator=(const const_reverse_row_iterator &r) //[t82] │ │ │ │ │ + 312 { iterator_type::operator=(r); return *this; } │ │ │ │ │ +313 const_reverse_row_iterator operator++() //[t82] │ │ │ │ │ + 314 { iterator_type::operator--(); return *this; } │ │ │ │ │ + 315 const_reverse_row_iterator operator++(int); //[t82] │ │ │ │ │ +316 const_reverse_row_iterator &operator--() //[t82] │ │ │ │ │ + 317 { iterator_type::operator++(); return *this; } │ │ │ │ │ + 318 const_reverse_row_iterator operator--(int); //[t82] │ │ │ │ │ +319 const_reverse_row_iterator &operator+=(difference_type i) //[t82] │ │ │ │ │ + 320 { iterator_type::operator-=(i); return *this; } │ │ │ │ │ +321 const_reverse_row_iterator &operator-=(difference_type i) //[t82] │ │ │ │ │ + 322 { iterator_type::operator+=(i); return *this; } │ │ │ │ │ + 324 │ │ │ │ │ +329 const_reverse_row_iterator operator+(difference_type i) const //[t82] │ │ │ │ │ + 330 { return const_reverse_row_iterator{base()-i}; } │ │ │ │ │ +331 const_reverse_row_iterator operator-(difference_type i) //[t82] │ │ │ │ │ + 332 { return const_reverse_row_iterator{base()+i}; } │ │ │ │ │ + 333 difference_type │ │ │ │ │ +334 operator-(const const_reverse_row_iterator &rhs) const //[t82] │ │ │ │ │ + 335 { return rhs.const_row_iterator::operator-(*this); } │ │ │ │ │ + 337 │ │ │ │ │ +342 bool operator==(const const_reverse_row_iterator &rhs) const noexcept // │ │ │ │ │ +[t82] │ │ │ │ │ + 343 { return iterator_type::operator==(rhs); } │ │ │ │ │ +344 bool operator!=(const const_reverse_row_iterator &rhs) const noexcept // │ │ │ │ │ +[t82] │ │ │ │ │ + 345 { return !operator==(rhs); } │ │ │ │ │ + 346 │ │ │ │ │ +347 bool operator<(const const_reverse_row_iterator &rhs) const //[t82] │ │ │ │ │ + 348 { return iterator_type::operator>(rhs); } │ │ │ │ │ +349 bool operator<=(const const_reverse_row_iterator &rhs) const //[t82] │ │ │ │ │ + 350 { return iterator_type::operator>=(rhs); } │ │ │ │ │ +351 bool operator>(const const_reverse_row_iterator &rhs) const //[t82] │ │ │ │ │ + 352 { return iterator_type::operator<(rhs); } │ │ │ │ │ +353 bool operator>=(const const_reverse_row_iterator &rhs) const //[t82] │ │ │ │ │ + 354 { return iterator_type::operator<=(rhs); } │ │ │ │ │ + 356}; │ │ │ │ │ + 357 │ │ │ │ │ + 358 │ │ │ │ │ + 359inline const_row_iterator │ │ │ │ │ +360const_row_iterator::operator+(difference_type o) const │ │ │ │ │ + 361{ │ │ │ │ │ + 362 return const_row_iterator{ │ │ │ │ │ + 363 row(home(), idx()), │ │ │ │ │ + 364 size_type(difference_type(col()) + o)}; │ │ │ │ │ + 365} │ │ │ │ │ + 366 │ │ │ │ │ + 367inline const_row_iterator │ │ │ │ │ +368operator+(const_row_iterator::difference_type o, const_row_iterator i) │ │ │ │ │ + 369 { return i + o; } │ │ │ │ │ + 370 │ │ │ │ │ + 371inline const_row_iterator │ │ │ │ │ +372const_row_iterator::operator-(difference_type o) const │ │ │ │ │ + 373{ │ │ │ │ │ + 374 return const_row_iterator{ │ │ │ │ │ + 375 row(home(), idx()), │ │ │ │ │ + 376 size_type(difference_type(col()) - o)}; │ │ │ │ │ + 377} │ │ │ │ │ + 378 │ │ │ │ │ + 379inline const_row_iterator::difference_type │ │ │ │ │ +380const_row_iterator::operator-(const_row_iterator i) const │ │ │ │ │ + 381 { return difference_type(num() - i.num()); } │ │ │ │ │ + 382 │ │ │ │ │ + 383 │ │ │ │ │ + 384} // namespace pqxx │ │ │ │ │ + 385 │ │ │ │ │ + 386 │ │ │ │ │ + 387/* │ │ │ │ │ + 388[1] Scott Meyers, in one of his essential books, "Effective C++" and "More │ │ │ │ │ + 389Effective C++", points out that it is good style to have any class │ │ │ │ │ +containing │ │ │ │ │ + 390a member of pointer type define a destructor--just to show that it knows │ │ │ │ │ +what │ │ │ │ │ + 391it is doing with the pointer. This helps prevent nasty memory leak / double │ │ │ │ │ + 392deletion bugs typically resulting from programmers' omission to deal with │ │ │ │ │ +such │ │ │ │ │ + 393issues in their destructors. │ │ │ │ │ + 394 │ │ │ │ │ + 395The @c -Weffc++ option in gcc generates warnings for noncompliance with │ │ │ │ │ +Scott's │ │ │ │ │ + 396style guidelines, and hence necessitates the definition of this destructor, │ │ │ │ │ + 397trivial as it may be. │ │ │ │ │ + 398*/ │ │ │ │ │ + 399 │ │ │ │ │ + 400 │ │ │ │ │ + 401#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 402 │ │ │ │ │ + 403#endif │ │ │ │ │ std │ │ │ │ │ STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::from_string │ │ │ │ │ -void from_string(const field &F, T &Obj) │ │ │ │ │ -Convert a field's string contents to another type. │ │ │ │ │ -Definition: field.hxx:365 │ │ │ │ │ -pqxx::to_string │ │ │ │ │ -std::string to_string(const field &Obj) │ │ │ │ │ -Convert a field to a string. │ │ │ │ │ -Definition: result.cxx:451 │ │ │ │ │ -pqxx::internal::PQXX_DECLARE_TYPE_NAME │ │ │ │ │ -PQXX_DECLARE_TYPE_NAME(bool) │ │ │ │ │ -pqxx::internal::number_to_digit │ │ │ │ │ -constexpr char number_to_digit(int i) noexcept │ │ │ │ │ -Definition: strconv.hxx:324 │ │ │ │ │ -pqxx::internal::digit_to_number │ │ │ │ │ -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 │ │ │ │ │ -pqxx::internal::throw_null_conversion │ │ │ │ │ -void throw_null_conversion(const std::string &type) │ │ │ │ │ -Throw exception for attempt to convert null to given type. │ │ │ │ │ -Definition: strconv.cxx:58 │ │ │ │ │ -pqxx::string_traits │ │ │ │ │ -Traits class for use in string conversions. │ │ │ │ │ -Definition: strconv.hxx:51 │ │ │ │ │ -pqxx::internal::type_name │ │ │ │ │ -Give a human-readable name for a type, at compile time. │ │ │ │ │ -Definition: strconv.hxx:67 │ │ │ │ │ -pqxx::internal::builtin_traits │ │ │ │ │ -Helper: string traits implementation for built-in types. │ │ │ │ │ -Definition: strconv.hxx:103 │ │ │ │ │ -pqxx::internal::builtin_traits::from_string │ │ │ │ │ -static void from_string(const char Str[], TYPE &Obj) │ │ │ │ │ -pqxx::internal::builtin_traits::is_null │ │ │ │ │ -static bool is_null(TYPE) │ │ │ │ │ -Definition: strconv.hxx:107 │ │ │ │ │ -pqxx::internal::builtin_traits::to_string │ │ │ │ │ -static std::string to_string(TYPE Obj) │ │ │ │ │ -pqxx::internal::builtin_traits::null │ │ │ │ │ -static TYPE null() │ │ │ │ │ -Definition: strconv.hxx:108 │ │ │ │ │ -pqxx::internal::builtin_traits::name │ │ │ │ │ -static constexpr const char * name() noexcept │ │ │ │ │ -Definition: strconv.hxx:104 │ │ │ │ │ -pqxx::internal::builtin_traits::has_null │ │ │ │ │ -static constexpr bool has_null() noexcept │ │ │ │ │ -Definition: strconv.hxx:106 │ │ │ │ │ -pqxx::enum_traits │ │ │ │ │ -Helper class for defining enum conversions. │ │ │ │ │ -Definition: strconv.hxx:150 │ │ │ │ │ -pqxx::enum_traits::to_string │ │ │ │ │ -static std::string to_string(ENUM Obj) │ │ │ │ │ -Definition: strconv.hxx:165 │ │ │ │ │ -pqxx::enum_traits::null │ │ │ │ │ -static ENUM null() │ │ │ │ │ -Definition: strconv.hxx:155 │ │ │ │ │ -pqxx::enum_traits::has_null │ │ │ │ │ -static constexpr bool has_null() noexcept │ │ │ │ │ -Definition: strconv.hxx:154 │ │ │ │ │ -pqxx::enum_traits::from_string │ │ │ │ │ -static void from_string(const char Str[], ENUM &Obj) │ │ │ │ │ -Definition: strconv.hxx:158 │ │ │ │ │ -pqxx::enum_traits::underlying_type │ │ │ │ │ -typename std::underlying_type< ENUM >::type underlying_type │ │ │ │ │ -Definition: strconv.hxx:151 │ │ │ │ │ -pqxx::string_traits<_const_char_*_>::null │ │ │ │ │ -static const char * null() │ │ │ │ │ -Definition: strconv.hxx:198 │ │ │ │ │ -pqxx::string_traits<_const_char_*_>::to_string │ │ │ │ │ -static std::string to_string(const char *Obj) │ │ │ │ │ -Definition: strconv.hxx:200 │ │ │ │ │ -pqxx::string_traits<_const_char_*_>::is_null │ │ │ │ │ -static bool is_null(const char *t) │ │ │ │ │ -Definition: strconv.hxx:197 │ │ │ │ │ -pqxx::string_traits<_const_char_*_>::name │ │ │ │ │ -static constexpr const char * name() noexcept │ │ │ │ │ -Definition: strconv.hxx:195 │ │ │ │ │ -pqxx::string_traits<_const_char_*_>::from_string │ │ │ │ │ -static void from_string(const char Str[], const char *&Obj) │ │ │ │ │ -Definition: strconv.hxx:199 │ │ │ │ │ -pqxx::string_traits<_const_char_*_>::has_null │ │ │ │ │ -static constexpr bool has_null() noexcept │ │ │ │ │ -Definition: strconv.hxx:196 │ │ │ │ │ -pqxx::string_traits<_char_*_>::name │ │ │ │ │ -static constexpr const char * name() noexcept │ │ │ │ │ -Definition: strconv.hxx:206 │ │ │ │ │ -pqxx::string_traits<_char_*_>::is_null │ │ │ │ │ -static bool is_null(const char *t) │ │ │ │ │ -Definition: strconv.hxx:208 │ │ │ │ │ -pqxx::string_traits<_char_*_>::to_string │ │ │ │ │ -static std::string to_string(char *Obj) │ │ │ │ │ -Definition: strconv.hxx:214 │ │ │ │ │ -pqxx::string_traits<_char_*_>::has_null │ │ │ │ │ -static constexpr bool has_null() noexcept │ │ │ │ │ -Definition: strconv.hxx:207 │ │ │ │ │ -pqxx::string_traits<_char_*_>::null │ │ │ │ │ -static const char * null() │ │ │ │ │ -Definition: strconv.hxx:209 │ │ │ │ │ -pqxx::string_traits<_char[N]>::has_null │ │ │ │ │ -static constexpr bool has_null() noexcept │ │ │ │ │ -Definition: strconv.hxx:221 │ │ │ │ │ -pqxx::string_traits<_char[N]>::name │ │ │ │ │ -static constexpr const char * name() noexcept │ │ │ │ │ -Definition: strconv.hxx:220 │ │ │ │ │ -pqxx::string_traits<_char[N]>::null │ │ │ │ │ -static const char * null() │ │ │ │ │ -Definition: strconv.hxx:223 │ │ │ │ │ -pqxx::string_traits<_char[N]>::is_null │ │ │ │ │ -static bool is_null(const char t[]) │ │ │ │ │ -Definition: strconv.hxx:222 │ │ │ │ │ -pqxx::string_traits<_char[N]>::to_string │ │ │ │ │ -static std::string to_string(const char Obj[]) │ │ │ │ │ -Definition: strconv.hxx:224 │ │ │ │ │ -pqxx::string_traits<_std::string_>::is_null │ │ │ │ │ -static bool is_null(const std::string &) │ │ │ │ │ -Definition: strconv.hxx:231 │ │ │ │ │ -pqxx::string_traits<_std::string_>::from_string │ │ │ │ │ -static void from_string(const char Str[], std::string &Obj) │ │ │ │ │ -Definition: strconv.hxx:234 │ │ │ │ │ -pqxx::string_traits<_std::string_>::to_string │ │ │ │ │ -static std::string to_string(const std::string &Obj) │ │ │ │ │ -Definition: strconv.hxx:235 │ │ │ │ │ -pqxx::string_traits<_std::string_>::has_null │ │ │ │ │ -static constexpr bool has_null() noexcept │ │ │ │ │ -Definition: strconv.hxx:230 │ │ │ │ │ -pqxx::string_traits<_std::string_>::name │ │ │ │ │ -static constexpr const char * name() noexcept │ │ │ │ │ -Definition: strconv.hxx:229 │ │ │ │ │ -pqxx::string_traits<_std::string_>::null │ │ │ │ │ -static std::string null() │ │ │ │ │ -Definition: strconv.hxx:232 │ │ │ │ │ -pqxx::string_traits<_const_std::string_>::null │ │ │ │ │ -static const std::string null() │ │ │ │ │ -Definition: strconv.hxx:243 │ │ │ │ │ -pqxx::string_traits<_const_std::string_>::name │ │ │ │ │ -static constexpr const char * name() noexcept │ │ │ │ │ -Definition: strconv.hxx:240 │ │ │ │ │ -pqxx::string_traits<_const_std::string_>::to_string │ │ │ │ │ -static const std::string to_string(const std::string &Obj) │ │ │ │ │ -Definition: strconv.hxx:245 │ │ │ │ │ -pqxx::string_traits<_const_std::string_>::is_null │ │ │ │ │ -static bool is_null(const std::string &) │ │ │ │ │ -Definition: strconv.hxx:242 │ │ │ │ │ -pqxx::string_traits<_const_std::string_>::has_null │ │ │ │ │ -static constexpr bool has_null() noexcept │ │ │ │ │ -Definition: strconv.hxx:241 │ │ │ │ │ -pqxx::string_traits<_std::stringstream_>::has_null │ │ │ │ │ -static constexpr bool has_null() noexcept │ │ │ │ │ -Definition: strconv.hxx:251 │ │ │ │ │ -pqxx::string_traits<_std::stringstream_>::is_null │ │ │ │ │ -static bool is_null(const std::stringstream &) │ │ │ │ │ -Definition: strconv.hxx:252 │ │ │ │ │ -pqxx::string_traits<_std::stringstream_>::to_string │ │ │ │ │ -static std::string to_string(const std::stringstream &Obj) │ │ │ │ │ -Definition: strconv.hxx:257 │ │ │ │ │ -pqxx::string_traits<_std::stringstream_>::from_string │ │ │ │ │ -static void from_string(const char Str[], std::stringstream &Obj) │ │ │ │ │ -Definition: strconv.hxx:255 │ │ │ │ │ -pqxx::string_traits<_std::stringstream_>::name │ │ │ │ │ -static constexpr const char * name() noexcept │ │ │ │ │ -Definition: strconv.hxx:250 │ │ │ │ │ -pqxx::string_traits<_std::stringstream_>::null │ │ │ │ │ -static std::stringstream null() │ │ │ │ │ -Definition: strconv.hxx:253 │ │ │ │ │ +pqxx::operator+ │ │ │ │ │ +const_result_iterator operator+(result::difference_type o, │ │ │ │ │ +const_result_iterator i) │ │ │ │ │ +Definition: result_iterator.hxx:212 │ │ │ │ │ +pqxx::row_difference_type │ │ │ │ │ +signed int row_difference_type │ │ │ │ │ +Difference between row sizes. │ │ │ │ │ +Definition: types.hxx:27 │ │ │ │ │ +pqxx::row_size_type │ │ │ │ │ +unsigned int row_size_type │ │ │ │ │ +Number of fields in a row of database data. │ │ │ │ │ +Definition: types.hxx:24 │ │ │ │ │ +pqxx::field │ │ │ │ │ +Reference to a field in a result set. │ │ │ │ │ +Definition: field.hxx:50 │ │ │ │ │ +pqxx::field::num │ │ │ │ │ +row_size_type num() const │ │ │ │ │ +Definition: field.hxx:104 │ │ │ │ │ +pqxx::field::size_type │ │ │ │ │ +field_size_type size_type │ │ │ │ │ +Definition: field.hxx:52 │ │ │ │ │ +pqxx::result │ │ │ │ │ +Result set containing data returned by a query or command. │ │ │ │ │ +Definition: result.hxx:70 │ │ │ │ │ +pqxx::row │ │ │ │ │ +Reference to one row in a result. │ │ │ │ │ +Definition: row.hxx:41 │ │ │ │ │ +pqxx::row::rownumber │ │ │ │ │ +size_t rownumber() const noexcept │ │ │ │ │ +Row number, assuming this is a real row and not end()/rend(). │ │ │ │ │ +Definition: row.hxx:113 │ │ │ │ │ +pqxx::row::column_type │ │ │ │ │ +oid column_type(const std::string &ColName) const │ │ │ │ │ +Type of given column. │ │ │ │ │ +Definition: row.hxx:134 │ │ │ │ │ +pqxx::row::column_table │ │ │ │ │ +oid column_table(const std::string &ColName) const │ │ │ │ │ +What table did this column come from? │ │ │ │ │ +Definition: row.hxx:148 │ │ │ │ │ +pqxx::row::size_type │ │ │ │ │ +row_size_type size_type │ │ │ │ │ +Definition: row.hxx:43 │ │ │ │ │ +pqxx::row::difference_type │ │ │ │ │ +row_difference_type difference_type │ │ │ │ │ +Definition: row.hxx:44 │ │ │ │ │ +pqxx::row::row │ │ │ │ │ +row()=default │ │ │ │ │ +pqxx::row::num │ │ │ │ │ +size_t num() const │ │ │ │ │ +Definition: row.hxx:170 │ │ │ │ │ +pqxx::row::table_column │ │ │ │ │ +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 │ │ │ │ │ +pqxx::row::column_number │ │ │ │ │ +size_type column_number(const std::string &ColName) const │ │ │ │ │ +Number of given column (throws exception if it doesn't exist) │ │ │ │ │ +Definition: row.hxx:120 │ │ │ │ │ +pqxx::row::~row │ │ │ │ │ +~row() noexcept=default │ │ │ │ │ +pqxx::row::column_table │ │ │ │ │ +oid column_table(int ColNum) const │ │ │ │ │ +What table did this column come from? │ │ │ │ │ +Definition: row.hxx:145 │ │ │ │ │ +pqxx::row::column_type │ │ │ │ │ +oid column_type(const char ColName[]) const │ │ │ │ │ +Type of given column. │ │ │ │ │ +Definition: row.hxx:138 │ │ │ │ │ +pqxx::row::table_column │ │ │ │ │ +size_type table_column(int ColNum) const │ │ │ │ │ +What column number in its table did this result column come from? │ │ │ │ │ +Definition: row.hxx:162 │ │ │ │ │ +pqxx::row::column_type │ │ │ │ │ +oid column_type(int ColNum) const │ │ │ │ │ +Type of given column. │ │ │ │ │ +Definition: row.hxx:130 │ │ │ │ │ +pqxx::const_row_iterator │ │ │ │ │ +Iterator for fields in a row. Use as row::const_iterator. │ │ │ │ │ +Definition: row.hxx:208 │ │ │ │ │ +pqxx::const_row_iterator::operator!= │ │ │ │ │ +bool operator!=(const const_row_iterator &i) const │ │ │ │ │ +Definition: row.hxx:250 │ │ │ │ │ +pqxx::const_row_iterator::operator++ │ │ │ │ │ +const_row_iterator & operator++() │ │ │ │ │ +Definition: row.hxx:234 │ │ │ │ │ +pqxx::const_row_iterator::operator-- │ │ │ │ │ +const_row_iterator & operator--() │ │ │ │ │ +Definition: row.hxx:236 │ │ │ │ │ +pqxx::const_row_iterator::operator<= │ │ │ │ │ +bool operator<=(const const_row_iterator &i) const │ │ │ │ │ +Definition: row.hxx:254 │ │ │ │ │ +pqxx::const_row_iterator::iterator_category │ │ │ │ │ +std::random_access_iterator_tag iterator_category │ │ │ │ │ +Definition: row.hxx:210 │ │ │ │ │ +pqxx::const_row_iterator::operator-= │ │ │ │ │ +const_row_iterator & operator-=(difference_type i) │ │ │ │ │ +Definition: row.hxx:240 │ │ │ │ │ +pqxx::const_row_iterator::operator- │ │ │ │ │ +const_row_iterator operator-(difference_type) const │ │ │ │ │ +Definition: row.hxx:372 │ │ │ │ │ +pqxx::const_row_iterator::operator+ │ │ │ │ │ +const_row_iterator operator+(difference_type) const │ │ │ │ │ +Definition: row.hxx:360 │ │ │ │ │ +pqxx::const_row_iterator::operator== │ │ │ │ │ +bool operator==(const const_row_iterator &i) const │ │ │ │ │ +Definition: row.hxx:248 │ │ │ │ │ +pqxx::const_row_iterator::operator>= │ │ │ │ │ +bool operator>=(const const_row_iterator &i) const │ │ │ │ │ +Definition: row.hxx:258 │ │ │ │ │ +pqxx::const_row_iterator::operator* │ │ │ │ │ +reference operator*() const │ │ │ │ │ +Definition: row.hxx:226 │ │ │ │ │ +pqxx::const_row_iterator::const_row_iterator │ │ │ │ │ +const_row_iterator(const row &T, row_size_type C) noexcept │ │ │ │ │ +Definition: row.hxx:217 │ │ │ │ │ +pqxx::const_row_iterator::difference_type │ │ │ │ │ +row_difference_type difference_type │ │ │ │ │ +Definition: row.hxx:214 │ │ │ │ │ +pqxx::const_row_iterator::operator-> │ │ │ │ │ +pointer operator->() const │ │ │ │ │ +Definition: row.hxx:225 │ │ │ │ │ +pqxx::const_row_iterator::operator< │ │ │ │ │ +bool operator<(const const_row_iterator &i) const │ │ │ │ │ +Definition: row.hxx:252 │ │ │ │ │ +pqxx::const_row_iterator::operator+= │ │ │ │ │ +const_row_iterator & operator+=(difference_type i) │ │ │ │ │ +Definition: row.hxx:238 │ │ │ │ │ +pqxx::const_row_iterator::operator> │ │ │ │ │ +bool operator>(const const_row_iterator &i) const │ │ │ │ │ +Definition: row.hxx:256 │ │ │ │ │ +pqxx::const_row_iterator::const_row_iterator │ │ │ │ │ +const_row_iterator(const field &F) noexcept │ │ │ │ │ +Definition: row.hxx:219 │ │ │ │ │ +pqxx::const_reverse_row_iterator │ │ │ │ │ +Reverse iterator for a row. Use as row::const_reverse_iterator. │ │ │ │ │ +Definition: row.hxx:280 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator+= │ │ │ │ │ +const_reverse_row_iterator & operator+=(difference_type i) │ │ │ │ │ +Definition: row.hxx:319 │ │ │ │ │ +pqxx::const_reverse_row_iterator::const_reverse_row_iterator │ │ │ │ │ +const_reverse_row_iterator(const const_reverse_row_iterator &r) │ │ │ │ │ +Definition: row.hxx:290 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator-= │ │ │ │ │ +const_reverse_row_iterator & operator-=(difference_type i) │ │ │ │ │ +Definition: row.hxx:321 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator!= │ │ │ │ │ +bool operator!=(const const_reverse_row_iterator &rhs) const noexcept │ │ │ │ │ +Definition: row.hxx:344 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator+ │ │ │ │ │ +const_reverse_row_iterator operator+(difference_type i) const │ │ │ │ │ +Definition: row.hxx:329 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator< │ │ │ │ │ +bool operator<(const const_reverse_row_iterator &rhs) const │ │ │ │ │ +Definition: row.hxx:347 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator- │ │ │ │ │ +const_reverse_row_iterator operator-(difference_type i) │ │ │ │ │ +Definition: row.hxx:331 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator<= │ │ │ │ │ +bool operator<=(const const_reverse_row_iterator &rhs) const │ │ │ │ │ +Definition: row.hxx:349 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator>= │ │ │ │ │ +bool operator>=(const const_reverse_row_iterator &rhs) const │ │ │ │ │ +Definition: row.hxx:353 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator> │ │ │ │ │ +bool operator>(const const_reverse_row_iterator &rhs) const │ │ │ │ │ +Definition: row.hxx:351 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator== │ │ │ │ │ +bool operator==(const const_reverse_row_iterator &rhs) const noexcept │ │ │ │ │ +Definition: row.hxx:342 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator-- │ │ │ │ │ +const_reverse_row_iterator & operator--() │ │ │ │ │ +Definition: row.hxx:316 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator- │ │ │ │ │ +difference_type operator-(const const_reverse_row_iterator &rhs) const │ │ │ │ │ +Definition: row.hxx:334 │ │ │ │ │ +pqxx::const_reverse_row_iterator::operator++ │ │ │ │ │ +const_reverse_row_iterator operator++() │ │ │ │ │ +Definition: row.hxx:313 │ │ │ │ │ +pqxx::const_reverse_row_iterator::const_reverse_row_iterator │ │ │ │ │ +const_reverse_row_iterator(const super &rhs) noexcept │ │ │ │ │ +Definition: row.hxx:293 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * strconv.hxx │ │ │ │ │ + * row.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00068_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: field.hxx Source File │ │ │ │ +libpqxx: robusttransaction.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,314 +55,106 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
field.hxx
│ │ │ │ +
robusttransaction.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_FIELD
│ │ │ │ -
14#define PQXX_H_FIELD
│ │ │ │ +
13#ifndef PQXX_H_ROBUSTTRANSACTION
│ │ │ │ +
14#define PQXX_H_ROBUSTTRANSACTION
│ │ │ │
15
│ │ │ │
16#include "pqxx/compiler-public.hxx"
│ │ │ │
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18#include "pqxx/internal/type_utils.hxx"
│ │ │ │ -
19
│ │ │ │ -
20#if defined(PQXX_HAVE_OPTIONAL)
│ │ │ │ -
21#include <optional>
│ │ │ │ -
22
│ │ │ │ -
23/* Use std::experimental::optional as a fallback for std::optional, if
│ │ │ │ -
24 * present.
│ │ │ │ -
25 *
│ │ │ │ -
26 * This may break compilation for some software, if using a libpqxx that was
│ │ │ │ -
27 * configured for a different language version. To stop libpqxx headers from
│ │ │ │ -
28 * using or supporting std::experimental::optional, define a macro
│ │ │ │ -
29 * PQXX_HIDE_EXP_OPTIONAL when building your software.
│ │ │ │ -
30 */
│ │ │ │ -
31#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)
│ │ │ │ -
32#include <experimental/optional>
│ │ │ │ -
33#endif
│ │ │ │ -
34
│ │ │ │ -
35#include "pqxx/array.hxx"
│ │ │ │ -
36#include "pqxx/result.hxx"
│ │ │ │ -
37#include "pqxx/strconv.hxx"
│ │ │ │ -
38#include "pqxx/types.hxx"
│ │ │ │ -
39
│ │ │ │ -
40
│ │ │ │ -
41// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ -
42
│ │ │ │ -
43namespace pqxx
│ │ │ │ -
44{
│ │ │ │ -
46
│ │ │ │ -
49class PQXX_LIBEXPORT field
│ │ │ │ -
50{
│ │ │ │ -
51public:
│ │ │ │ - │ │ │ │ -
53
│ │ │ │ -
55
│ │ │ │ -
59 field(const row &R, row_size_type C) noexcept; //[t01]
│ │ │ │ -
60
│ │ │ │ -
66
│ │ │ │ -
82 bool operator==(const field &) const; //[t75]
│ │ │ │ -
83
│ │ │ │ -
85
│ │ │ │ -
87 bool operator!=(const field &rhs) const //[t82]
│ │ │ │ -
88 {return not operator==(rhs);}
│ │ │ │ -
90
│ │ │ │ -
96 const char *name() const; //[t11]
│ │ │ │ -
97
│ │ │ │ -
99 oid type() const; //[t07]
│ │ │ │ -
100
│ │ │ │ -
102 oid table() const; //[t02]
│ │ │ │ -
103
│ │ │ │ -
104 row_size_type num() const { return col(); } //[t82]
│ │ │ │ -
105
│ │ │ │ -
107 row_size_type table_column() const; //[t93]
│ │ │ │ -
109
│ │ │ │ -
115
│ │ │ │ -
120 const char *c_str() const; //[t02]
│ │ │ │ -
121
│ │ │ │ -
123 bool is_null() const noexcept; //[t12]
│ │ │ │ -
124
│ │ │ │ -
126
│ │ │ │ -
129 size_type size() const noexcept; //[t11]
│ │ │ │ -
130
│ │ │ │ -
132
│ │ │ │ -
135 template<typename T> auto to(T &Obj) const //[t03]
│ │ │ │ -
136 -> typename std::enable_if<(
│ │ │ │ -
137 not std::is_pointer<T>::value
│ │ │ │ -
138 or std::is_same<T, const char*>::value
│ │ │ │ -
139 ), bool>::type
│ │ │ │ -
140 {
│ │ │ │ -
141 const char *const bytes = c_str();
│ │ │ │ -
142 if (bytes[0] == '\0' and is_null()) return false;
│ │ │ │ -
143 from_string(bytes, Obj);
│ │ │ │ -
144 return true;
│ │ │ │ -
145 }
│ │ │ │ +
18
│ │ │ │ +
19#include "pqxx/dbtransaction.hxx"
│ │ │ │ +
20
│ │ │ │ +
21
│ │ │ │ +
22// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ +
23
│ │ │ │ +
24namespace pqxx
│ │ │ │ +
25{
│ │ │ │ +
26
│ │ │ │ +
27namespace internal
│ │ │ │ +
28{
│ │ │ │ +
30class PQXX_LIBEXPORT PQXX_NOVTABLE basic_robusttransaction :
│ │ │ │ +
31 public dbtransaction
│ │ │ │ +
32{
│ │ │ │ +
33public:
│ │ │ │ + │ │ │ │ +
36
│ │ │ │ +
37 virtual ~basic_robusttransaction() =0; //[t16]
│ │ │ │ +
38
│ │ │ │ +
39protected:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
42 const std::string &IsolationLevel,
│ │ │ │ +
43 const std::string &table_name=std::string{}); //[t16]
│ │ │ │ +
44
│ │ │ │ +
45private:
│ │ │ │ +
46 using IDType = unsigned long;
│ │ │ │ +
47 IDType m_record_id = 0;
│ │ │ │ +
48 std::string m_xid;
│ │ │ │ +
49 std::string m_log_table;
│ │ │ │ +
50 std::string m_sequence;
│ │ │ │ +
51 int m_backendpid = -1;
│ │ │ │ +
52
│ │ │ │ +
53 virtual void do_begin() override; //[t18]
│ │ │ │ +
54 virtual void do_commit() override; //[t16]
│ │ │ │ +
55 virtual void do_abort() override; //[t18]
│ │ │ │ +
56
│ │ │ │ +
57 PQXX_PRIVATE void CreateLogTable();
│ │ │ │ +
58 PQXX_PRIVATE void CreateTransactionRecord();
│ │ │ │ +
59 PQXX_PRIVATE std::string sql_delete() const;
│ │ │ │ +
60 PQXX_PRIVATE void DeleteTransactionRecord() noexcept;
│ │ │ │ +
61 PQXX_PRIVATE bool CheckTransactionRecord();
│ │ │ │ +
62};
│ │ │ │ +
63} // namespace internal
│ │ │ │ +
64
│ │ │ │ +
65
│ │ │ │ +
73
│ │ │ │ +
139template<isolation_level ISOLATIONLEVEL=read_committed>
│ │ │ │ +
140class robusttransaction : public internal::basic_robusttransaction
│ │ │ │ +
141{
│ │ │ │ +
142public:
│ │ │ │ + │ │ │ │ +
144
│ │ │ │
146
│ │ │ │ -
148 template<typename T> bool operator>>(T &Obj) const //[t07]
│ │ │ │ -
149 { return to(Obj); }
│ │ │ │ -
150
│ │ │ │ -
152
│ │ │ │ -
155 template<typename T> auto to(T &Obj, const T &Default) const //[t12]
│ │ │ │ -
156 -> typename std::enable_if<(
│ │ │ │ -
157 not std::is_pointer<T>::value
│ │ │ │ -
158 or std::is_same<T, const char*>::value
│ │ │ │ -
159 ), bool>::type
│ │ │ │ -
160 {
│ │ │ │ -
161 const bool NotNull = to(Obj);
│ │ │ │ -
162 if (not NotNull) Obj = Default;
│ │ │ │ -
163 return NotNull;
│ │ │ │ -
164 }
│ │ │ │ -
165
│ │ │ │ -
167
│ │ │ │ -
170 template<typename T> T as(const T &Default) const //[t01]
│ │ │ │ -
171 {
│ │ │ │ -
172 T Obj;
│ │ │ │ -
173 to(Obj, Default);
│ │ │ │ -
174 return Obj;
│ │ │ │ -
175 }
│ │ │ │ -
176
│ │ │ │ -
178
│ │ │ │ -
183 template<typename T> T as() const //[t45]
│ │ │ │ -
184 {
│ │ │ │ -
185 T Obj;
│ │ │ │ -
186 if (not to(Obj)) Obj = string_traits<T>::null();
│ │ │ │ -
187 return Obj;
│ │ │ │ -
188 }
│ │ │ │ -
189
│ │ │ │ -
191
│ │ │ │ -
195 template<typename T, template<typename> class O
│ │ │ │ -
196#if defined(PQXX_HAVE_OPTIONAL)
│ │ │ │ -
197 = std::optional
│ │ │ │ -
198#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL)
│ │ │ │ -
199 = std::experimental::optional
│ │ │ │ -
200#endif
│ │ │ │ -
201 > constexpr O<T> get() const { return as<O<T>>(); }
│ │ │ │ -
202
│ │ │ │ -
204
│ │ │ │ - │ │ │ │ -
211 { return array_parser{c_str(), m_home.m_encoding}; }
│ │ │ │ -
213
│ │ │ │ -
214
│ │ │ │ -
215protected:
│ │ │ │ -
216 const result &home() const noexcept { return m_home; }
│ │ │ │ -
217 size_t idx() const noexcept { return m_row; }
│ │ │ │ -
218 row_size_type col() const noexcept { return row_size_type(m_col); }
│ │ │ │ -
219
│ │ │ │ -
224 long m_col;
│ │ │ │ -
225
│ │ │ │ -
226private:
│ │ │ │ -
227 result m_home;
│ │ │ │ -
228 size_t m_row;
│ │ │ │ -
229};
│ │ │ │ -
230
│ │ │ │ -
231
│ │ │ │ -
233template<>
│ │ │ │ -
234inline bool field::to<std::string>(std::string &Obj) const
│ │ │ │ -
235{
│ │ │ │ -
236 const char *const bytes = c_str();
│ │ │ │ -
237 if (bytes[0] == '\0' and is_null()) return false;
│ │ │ │ -
238 Obj = std::string{bytes, size()};
│ │ │ │ -
239 return true;
│ │ │ │ -
240}
│ │ │ │ -
241
│ │ │ │ -
243
│ │ │ │ -
248template<>
│ │ │ │ -
249inline bool field::to<const char *>(const char *&Obj) const
│ │ │ │ -
250{
│ │ │ │ -
251 if (is_null()) return false;
│ │ │ │ -
252 Obj = c_str();
│ │ │ │ -
253 return true;
│ │ │ │ -
254}
│ │ │ │ -
255
│ │ │ │ -
256
│ │ │ │ -
257template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ - │ │ │ │ -
259 public std::basic_streambuf<CHAR, TRAITS>
│ │ │ │ -
260{
│ │ │ │ -
261public:
│ │ │ │ -
262 using char_type = CHAR;
│ │ │ │ -
263 using traits_type = TRAITS;
│ │ │ │ -
264 using int_type = typename traits_type::int_type;
│ │ │ │ -
265 using pos_type = typename traits_type::pos_type;
│ │ │ │ -
266 using off_type = typename traits_type::off_type;
│ │ │ │ -
267 using openmode = std::ios::openmode;
│ │ │ │ -
268 using seekdir = std::ios::seekdir;
│ │ │ │ -
269
│ │ │ │ -
270 explicit field_streambuf(const field &F) : //[t74]
│ │ │ │ -
271 m_field{F}
│ │ │ │ -
272 {
│ │ │ │ -
273 initialize();
│ │ │ │ -
274 }
│ │ │ │ -
275
│ │ │ │ -
276protected:
│ │ │ │ -
277 virtual int sync() override { return traits_type::eof(); }
│ │ │ │ -
278
│ │ │ │ -
279protected:
│ │ │ │ - │ │ │ │ -
281 { return traits_type::eof(); }
│ │ │ │ - │ │ │ │ -
283 {return traits_type::eof();}
│ │ │ │ -
284 virtual int_type overflow(int_type) override
│ │ │ │ -
285 { return traits_type::eof(); }
│ │ │ │ -
286 virtual int_type underflow() override
│ │ │ │ -
287 { return traits_type::eof(); }
│ │ │ │ -
288
│ │ │ │ -
289private:
│ │ │ │ -
290 const field &m_field;
│ │ │ │ -
291
│ │ │ │ -
292 int_type initialize()
│ │ │ │ -
293 {
│ │ │ │ -
294 char_type *G =
│ │ │ │ -
295 reinterpret_cast<char_type *>(const_cast<char *>(m_field.c_str()));
│ │ │ │ -
296 this->setg(G, G, G + m_field.size());
│ │ │ │ -
297 return int_type(m_field.size());
│ │ │ │ -
298 }
│ │ │ │ -
299};
│ │ │ │ -
300
│ │ │ │ -
301
│ │ │ │ -
303
│ │ │ │ -
311template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ - │ │ │ │ -
313 public std::basic_istream<CHAR, TRAITS>
│ │ │ │ -
314{
│ │ │ │ -
315 using super = std::basic_istream<CHAR, TRAITS>;
│ │ │ │ -
316
│ │ │ │ -
317public:
│ │ │ │ -
318 using char_type = CHAR;
│ │ │ │ -
319 using traits_type = TRAITS;
│ │ │ │ -
320 using int_type = typename traits_type::int_type;
│ │ │ │ -
321 using pos_type = typename traits_type::pos_type;
│ │ │ │ -
322 using off_type = typename traits_type::off_type;
│ │ │ │ -
323
│ │ │ │ -
324 basic_fieldstream(const field &F) : super{nullptr}, m_buf{F}
│ │ │ │ -
325 { super::init(&m_buf); }
│ │ │ │ -
326
│ │ │ │ -
327private:
│ │ │ │ - │ │ │ │ -
329};
│ │ │ │ -
330
│ │ │ │ - │ │ │ │ -
332
│ │ │ │ -
334
│ │ │ │ -
354template<typename CHAR>
│ │ │ │ -
355inline std::basic_ostream<CHAR> &operator<<(
│ │ │ │ -
356 std::basic_ostream<CHAR> &S, const field &F) //[t46]
│ │ │ │ -
357{
│ │ │ │ -
358 S.write(F.c_str(), std::streamsize(F.size()));
│ │ │ │ -
359 return S;
│ │ │ │ -
360}
│ │ │ │ -
361
│ │ │ │ -
362
│ │ │ │ -
364template<typename T>
│ │ │ │ -
365inline void from_string(const field &F, T &Obj) //[t46]
│ │ │ │ -
366 { from_string(F.c_str(), Obj, F.size()); }
│ │ │ │ -
367
│ │ │ │ -
369template<> PQXX_LIBEXPORT std::string to_string(const field &Obj); //[t74]
│ │ │ │ -
370
│ │ │ │ -
371} // namespace pqxx
│ │ │ │ -
372#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
373#endif
│ │ │ │ -
STL namespace.
│ │ │ │ + │ │ │ │ + │ │ │ │ +
152 const std::string &Name=std::string{}) :
│ │ │ │ +
153 namedclass{fullname("robusttransaction",isolation_tag::name()), Name},
│ │ │ │ +
154 internal::basic_robusttransaction(C, isolation_tag::name())
│ │ │ │ +
155 { Begin(); }
│ │ │ │ +
156
│ │ │ │ +
157 virtual ~robusttransaction() noexcept
│ │ │ │ +
158 { End(); }
│ │ │ │ +
159};
│ │ │ │ +
160
│ │ │ │ +
165} // namespace pqxx
│ │ │ │ +
166
│ │ │ │ +
167#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
168#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
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
│ │ │ │ -
void from_string(const field &F, T &Obj)
Convert a field's string contents to another type.
Definition: field.hxx:365
│ │ │ │ -
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
│ │ │ │ -
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
│ │ │ │ -
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
│ │ │ │ -
Low-level array parser.
Definition: array.hxx:47
│ │ │ │ -
Reference to a field in a result set.
Definition: field.hxx:50
│ │ │ │ -
row_size_type num() const
Definition: field.hxx:104
│ │ │ │ -
row_size_type col() const noexcept
Definition: field.hxx:218
│ │ │ │ -
size_type size() const noexcept
Return number of bytes taken up by the field's value.
Definition: field.cxx:74
│ │ │ │ -
long m_col
Definition: field.hxx:224
│ │ │ │ -
T as(const T &Default) const
Return value as object of given type, or Default if null.
Definition: field.hxx:170
│ │ │ │ -
field_size_type size_type
Definition: field.hxx:52
│ │ │ │ -
bool operator>>(T &Obj) const
Read value into Obj; or leave Obj untouched and return false if null.
Definition: field.hxx:148
│ │ │ │ -
array_parser as_array() const
Parse the field as an SQL array.
Definition: field.hxx:210
│ │ │ │ -
const result & home() const noexcept
Definition: field.hxx:216
│ │ │ │ -
T as() const
Return value as object of given type, or throw exception if null.
Definition: field.hxx:183
│ │ │ │ -
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
│ │ │ │ -
const char * c_str() const
Read as plain C string.
Definition: field.cxx:62
│ │ │ │ -
bool is_null() const noexcept
Is this field's value null?
Definition: field.cxx:68
│ │ │ │ -
constexpr O< T > get() const
Return value wrapped in some optional type (empty for nulls)
Definition: field.hxx:201
│ │ │ │ -
size_t idx() const noexcept
Definition: field.hxx:217
│ │ │ │ -
bool operator!=(const field &rhs) const
Byte-by-byte comparison (all nulls are considered equal)
Definition: field.hxx:87
│ │ │ │ -
Definition: field.hxx:260
│ │ │ │ -
TRAITS traits_type
Definition: field.hxx:263
│ │ │ │ -
typename traits_type::off_type off_type
Definition: field.hxx:266
│ │ │ │ -
virtual pos_type seekoff(off_type, seekdir, openmode) override
Definition: field.hxx:280
│ │ │ │ -
virtual pos_type seekpos(pos_type, openmode) override
Definition: field.hxx:282
│ │ │ │ -
std::ios::openmode openmode
Definition: field.hxx:267
│ │ │ │ -
virtual int_type overflow(int_type) override
Definition: field.hxx:284
│ │ │ │ -
field_streambuf(const field &F)
Definition: field.hxx:270
│ │ │ │ -
typename traits_type::pos_type pos_type
Definition: field.hxx:265
│ │ │ │ -
virtual int sync() override
Definition: field.hxx:277
│ │ │ │ -
typename traits_type::int_type int_type
Definition: field.hxx:264
│ │ │ │ -
virtual int_type underflow() override
Definition: field.hxx:286
│ │ │ │ -
CHAR char_type
Definition: field.hxx:262
│ │ │ │ -
std::ios::seekdir seekdir
Definition: field.hxx:268
│ │ │ │ -
Input stream that gets its data from a result field.
Definition: field.hxx:314
│ │ │ │ -
TRAITS traits_type
Definition: field.hxx:319
│ │ │ │ -
basic_fieldstream(const field &F)
Definition: field.hxx:324
│ │ │ │ -
typename traits_type::pos_type pos_type
Definition: field.hxx:321
│ │ │ │ -
typename traits_type::off_type off_type
Definition: field.hxx:322
│ │ │ │ -
typename traits_type::int_type int_type
Definition: field.hxx:320
│ │ │ │ -
CHAR char_type
Definition: field.hxx:318
│ │ │ │ -
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ -
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │ -
Traits class for use in string conversions.
Definition: strconv.hxx:51
│ │ │ │ +
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:57
│ │ │ │ +
@ read_committed
Definition: isolation.hxx:59
│ │ │ │ +
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ +
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ +
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
│ │ │ │ +
Helper base class for the robusttransaction class template.
Definition: robusttransaction.hxx:32
│ │ │ │ +
Slightly slower, better-fortified version of transaction.
Definition: robusttransaction.hxx:141
│ │ │ │ +
virtual ~robusttransaction() noexcept
Definition: robusttransaction.hxx:157
│ │ │ │ +
robusttransaction(connection_base &C, const std::string &Name=std::string{})
Constructor.
Definition: robusttransaction.hxx:150
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,418 +1,119 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -field.hxx │ │ │ │ │ +robusttransaction.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_FIELD │ │ │ │ │ - 14#define PQXX_H_FIELD │ │ │ │ │ + 13#ifndef PQXX_H_ROBUSTTRANSACTION │ │ │ │ │ + 14#define PQXX_H_ROBUSTTRANSACTION │ │ │ │ │ 15 │ │ │ │ │ 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18#include "pqxx/internal/type_utils.hxx" │ │ │ │ │ - 19 │ │ │ │ │ - 20#if defined(PQXX_HAVE_OPTIONAL) │ │ │ │ │ - 21#include │ │ │ │ │ - 22 │ │ │ │ │ - 23/* Use std::experimental::optional as a fallback for std::optional, if │ │ │ │ │ - 24 * present. │ │ │ │ │ - 25 * │ │ │ │ │ - 26 * This may break compilation for some software, if using a libpqxx that was │ │ │ │ │ - 27 * configured for a different language version. To stop libpqxx headers from │ │ │ │ │ - 28 * using or supporting std::experimental::optional, define a macro │ │ │ │ │ - 29 * PQXX_HIDE_EXP_OPTIONAL when building your software. │ │ │ │ │ - 30 */ │ │ │ │ │ - 31#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL) │ │ │ │ │ - 32#include │ │ │ │ │ - 33#endif │ │ │ │ │ - 34 │ │ │ │ │ - 35#include "pqxx/array.hxx" │ │ │ │ │ - 36#include "pqxx/result.hxx" │ │ │ │ │ - 37#include "pqxx/strconv.hxx" │ │ │ │ │ - 38#include "pqxx/types.hxx" │ │ │ │ │ - 39 │ │ │ │ │ - 40 │ │ │ │ │ - 41// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ - 42 │ │ │ │ │ - 43namespace pqxx │ │ │ │ │ - 44{ │ │ │ │ │ - 46 │ │ │ │ │ -49class PQXX_LIBEXPORT field │ │ │ │ │ - 50{ │ │ │ │ │ - 51public: │ │ │ │ │ -52 using size_type = field_size_type; │ │ │ │ │ - 53 │ │ │ │ │ - 55 │ │ │ │ │ - 59 field(const row &R, row_size_type C) noexcept; //[t01] │ │ │ │ │ - 60 │ │ │ │ │ - 66 │ │ │ │ │ - 82 bool operator==(const field &) const; //[t75] │ │ │ │ │ - 83 │ │ │ │ │ - 85 │ │ │ │ │ -87 bool operator!=(const field &rhs) const //[t82] │ │ │ │ │ - 88 {return not operator==(rhs);} │ │ │ │ │ - 90 │ │ │ │ │ - 96 const char *name() const; //[t11] │ │ │ │ │ - 97 │ │ │ │ │ - 99 oid type() const; //[t07] │ │ │ │ │ - 100 │ │ │ │ │ - 102 oid table() const; //[t02] │ │ │ │ │ - 103 │ │ │ │ │ -104 row_size_type num() const { return col(); } //[t82] │ │ │ │ │ - 105 │ │ │ │ │ - 107 row_size_type table_column() const; //[t93] │ │ │ │ │ - 109 │ │ │ │ │ - 115 │ │ │ │ │ - 120 const char *c_str() const; //[t02] │ │ │ │ │ - 121 │ │ │ │ │ - 123 bool is_null() const noexcept; //[t12] │ │ │ │ │ - 124 │ │ │ │ │ - 126 │ │ │ │ │ - 129 size_type size() const noexcept; //[t11] │ │ │ │ │ - 130 │ │ │ │ │ - 132 │ │ │ │ │ -135 template auto to(T &Obj) const //[t03] │ │ │ │ │ - 136 -> typename std::enable_if<( │ │ │ │ │ - 137 not std::is_pointer::value │ │ │ │ │ - 138 or std::is_same::value │ │ │ │ │ - 139 ), bool>::type │ │ │ │ │ - 140 { │ │ │ │ │ - 141 const char *const bytes = c_str(); │ │ │ │ │ - 142 if (bytes[0] == '\0' and is_null()) return false; │ │ │ │ │ - 143 from_string(bytes, Obj); │ │ │ │ │ - 144 return true; │ │ │ │ │ - 145 } │ │ │ │ │ + 18 │ │ │ │ │ + 19#include "pqxx/dbtransaction.hxx" │ │ │ │ │ + 20 │ │ │ │ │ + 21 │ │ │ │ │ + 22// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ + 23 │ │ │ │ │ + 24namespace pqxx │ │ │ │ │ + 25{ │ │ │ │ │ + 26 │ │ │ │ │ + 27namespace internal │ │ │ │ │ + 28{ │ │ │ │ │ +30class PQXX_LIBEXPORT PQXX_NOVTABLE basic_robusttransaction : │ │ │ │ │ + 31 public dbtransaction │ │ │ │ │ + 32{ │ │ │ │ │ + 33public: │ │ │ │ │ +35 using isolation_tag = isolation_traits; │ │ │ │ │ + 36 │ │ │ │ │ + 37 virtual ~basic_robusttransaction() =0; //[t16] │ │ │ │ │ + 38 │ │ │ │ │ + 39protected: │ │ │ │ │ + 40 basic_robusttransaction( │ │ │ │ │ + 41 connection_base &C, │ │ │ │ │ + 42 const std::string &IsolationLevel, │ │ │ │ │ + 43 const std::string &table_name=std::string{}); //[t16] │ │ │ │ │ + 44 │ │ │ │ │ + 45private: │ │ │ │ │ + 46 using IDType = unsigned long; │ │ │ │ │ + 47 IDType m_record_id = 0; │ │ │ │ │ + 48 std::string m_xid; │ │ │ │ │ + 49 std::string m_log_table; │ │ │ │ │ + 50 std::string m_sequence; │ │ │ │ │ + 51 int m_backendpid = -1; │ │ │ │ │ + 52 │ │ │ │ │ + 53 virtual void do_begin() override; //[t18] │ │ │ │ │ + 54 virtual void do_commit() override; //[t16] │ │ │ │ │ + 55 virtual void do_abort() override; //[t18] │ │ │ │ │ + 56 │ │ │ │ │ + 57 PQXX_PRIVATE void CreateLogTable(); │ │ │ │ │ + 58 PQXX_PRIVATE void CreateTransactionRecord(); │ │ │ │ │ + 59 PQXX_PRIVATE std::string sql_delete() const; │ │ │ │ │ + 60 PQXX_PRIVATE void DeleteTransactionRecord() noexcept; │ │ │ │ │ + 61 PQXX_PRIVATE bool CheckTransactionRecord(); │ │ │ │ │ + 62}; │ │ │ │ │ + 63} // namespace internal │ │ │ │ │ + 64 │ │ │ │ │ + 65 │ │ │ │ │ + 73 │ │ │ │ │ + 139template │ │ │ │ │ +140class robusttransaction : public internal::basic_robusttransaction │ │ │ │ │ + 141{ │ │ │ │ │ + 142public: │ │ │ │ │ +143 using isolation_tag = isolation_traits; │ │ │ │ │ + 144 │ │ │ │ │ 146 │ │ │ │ │ -148 template bool operator>>(T &Obj) const //[t07] │ │ │ │ │ - 149 { return to(Obj); } │ │ │ │ │ - 150 │ │ │ │ │ - 152 │ │ │ │ │ -155 template auto to(T &Obj, const T &Default) const //[t12] │ │ │ │ │ - 156 -> typename std::enable_if<( │ │ │ │ │ - 157 not std::is_pointer::value │ │ │ │ │ - 158 or std::is_same::value │ │ │ │ │ - 159 ), bool>::type │ │ │ │ │ - 160 { │ │ │ │ │ - 161 const bool NotNull = to(Obj); │ │ │ │ │ - 162 if (not NotNull) Obj = Default; │ │ │ │ │ - 163 return NotNull; │ │ │ │ │ - 164 } │ │ │ │ │ - 165 │ │ │ │ │ - 167 │ │ │ │ │ -170 template T as(const T &Default) const //[t01] │ │ │ │ │ - 171 { │ │ │ │ │ - 172 T Obj; │ │ │ │ │ - 173 to(Obj, Default); │ │ │ │ │ - 174 return Obj; │ │ │ │ │ - 175 } │ │ │ │ │ - 176 │ │ │ │ │ - 178 │ │ │ │ │ -183 template T as() const //[t45] │ │ │ │ │ - 184 { │ │ │ │ │ - 185 T Obj; │ │ │ │ │ - 186 if (not to(Obj)) Obj = string_traits::null(); │ │ │ │ │ - 187 return Obj; │ │ │ │ │ - 188 } │ │ │ │ │ - 189 │ │ │ │ │ - 191 │ │ │ │ │ - 195 template class O │ │ │ │ │ - 196#if defined(PQXX_HAVE_OPTIONAL) │ │ │ │ │ - 197 = std::optional │ │ │ │ │ - 198#elif defined(PQXX_HAVE_EXP_OPTIONAL) && !defined(PQXX_HIDE_EXP_OPTIONAL) │ │ │ │ │ - 199 = std::experimental::optional │ │ │ │ │ - 200#endif │ │ │ │ │ -201 > constexpr O get() const { return as>(); } │ │ │ │ │ - 202 │ │ │ │ │ - 204 │ │ │ │ │ -210 array_parser as_array() const │ │ │ │ │ - 211 { return array_parser{c_str(), m_home.m_encoding}; } │ │ │ │ │ - 213 │ │ │ │ │ - 214 │ │ │ │ │ - 215protected: │ │ │ │ │ -216 const result &home() const noexcept { return m_home; } │ │ │ │ │ -217 size_t idx() const noexcept { return m_row; } │ │ │ │ │ -218 row_size_type col() const noexcept { return row_size_type(m_col); } │ │ │ │ │ - 219 │ │ │ │ │ -224 long m_col; │ │ │ │ │ - 225 │ │ │ │ │ - 226private: │ │ │ │ │ - 227 result m_home; │ │ │ │ │ - 228 size_t m_row; │ │ │ │ │ - 229}; │ │ │ │ │ - 230 │ │ │ │ │ - 231 │ │ │ │ │ - 233template<> │ │ │ │ │ -234inline bool field::to(std::string &Obj) const │ │ │ │ │ - 235{ │ │ │ │ │ - 236 const char *const bytes = c_str(); │ │ │ │ │ - 237 if (bytes[0] == '\0' and is_null()) return false; │ │ │ │ │ - 238 Obj = std::string{bytes, size()}; │ │ │ │ │ - 239 return true; │ │ │ │ │ - 240} │ │ │ │ │ - 241 │ │ │ │ │ - 243 │ │ │ │ │ - 248template<> │ │ │ │ │ -249inline bool field::to(const char *&Obj) const │ │ │ │ │ - 250{ │ │ │ │ │ - 251 if (is_null()) return false; │ │ │ │ │ - 252 Obj = c_str(); │ │ │ │ │ - 253 return true; │ │ │ │ │ - 254} │ │ │ │ │ - 255 │ │ │ │ │ - 256 │ │ │ │ │ - 257template> │ │ │ │ │ -258 class field_streambuf : │ │ │ │ │ - 259 public std::basic_streambuf │ │ │ │ │ - 260{ │ │ │ │ │ - 261public: │ │ │ │ │ -262 using char_type = CHAR; │ │ │ │ │ -263 using traits_type = TRAITS; │ │ │ │ │ -264 using int_type = typename traits_type::int_type; │ │ │ │ │ -265 using pos_type = typename traits_type::pos_type; │ │ │ │ │ -266 using off_type = typename traits_type::off_type; │ │ │ │ │ -267 using openmode = std::ios::openmode; │ │ │ │ │ -268 using seekdir = std::ios::seekdir; │ │ │ │ │ - 269 │ │ │ │ │ -270 explicit field_streambuf(const field &F) : //[t74] │ │ │ │ │ - 271 m_field{F} │ │ │ │ │ - 272 { │ │ │ │ │ - 273 initialize(); │ │ │ │ │ - 274 } │ │ │ │ │ - 275 │ │ │ │ │ - 276protected: │ │ │ │ │ -277 virtual int sync() override { return traits_type::eof(); } │ │ │ │ │ - 278 │ │ │ │ │ - 279protected: │ │ │ │ │ -280 virtual pos_type seekoff(off_type, seekdir, openmode) override │ │ │ │ │ - 281 { return traits_type::eof(); } │ │ │ │ │ -282 virtual pos_type seekpos(pos_type, openmode) override │ │ │ │ │ - 283 {return traits_type::eof();} │ │ │ │ │ -284 virtual int_type overflow(int_type) override │ │ │ │ │ - 285 { return traits_type::eof(); } │ │ │ │ │ -286 virtual int_type underflow() override │ │ │ │ │ - 287 { return traits_type::eof(); } │ │ │ │ │ - 288 │ │ │ │ │ - 289private: │ │ │ │ │ - 290 const field &m_field; │ │ │ │ │ - 291 │ │ │ │ │ - 292 int_type initialize() │ │ │ │ │ - 293 { │ │ │ │ │ - 294 char_type *G = │ │ │ │ │ - 295 reinterpret_cast(const_cast(m_field.c_str())); │ │ │ │ │ - 296 this->setg(G, G, G + m_field.size()); │ │ │ │ │ - 297 return int_type(m_field.size()); │ │ │ │ │ - 298 } │ │ │ │ │ - 299}; │ │ │ │ │ - 300 │ │ │ │ │ - 301 │ │ │ │ │ - 303 │ │ │ │ │ - 311template> │ │ │ │ │ -312 class basic_fieldstream : │ │ │ │ │ - 313 public std::basic_istream │ │ │ │ │ - 314{ │ │ │ │ │ - 315 using super = std::basic_istream; │ │ │ │ │ - 316 │ │ │ │ │ - 317public: │ │ │ │ │ -318 using char_type = CHAR; │ │ │ │ │ -319 using traits_type = TRAITS; │ │ │ │ │ -320 using int_type = typename traits_type::int_type; │ │ │ │ │ -321 using pos_type = typename traits_type::pos_type; │ │ │ │ │ -322 using off_type = typename traits_type::off_type; │ │ │ │ │ - 323 │ │ │ │ │ -324 basic_fieldstream(const field &F) : super{nullptr}, m_buf{F} │ │ │ │ │ - 325 { super::init(&m_buf); } │ │ │ │ │ - 326 │ │ │ │ │ - 327private: │ │ │ │ │ - 328 field_streambuf m_buf; │ │ │ │ │ - 329}; │ │ │ │ │ - 330 │ │ │ │ │ -331using fieldstream = basic_fieldstream; │ │ │ │ │ - 332 │ │ │ │ │ - 334 │ │ │ │ │ - 354template │ │ │ │ │ - 355inline std::basic_ostream &operator<<( │ │ │ │ │ - 356 std::basic_ostream &S, const field &F) //[t46] │ │ │ │ │ - 357{ │ │ │ │ │ - 358 S.write(F.c_str(), std::streamsize(F.size())); │ │ │ │ │ - 359 return S; │ │ │ │ │ - 360} │ │ │ │ │ - 361 │ │ │ │ │ - 362 │ │ │ │ │ - 364template │ │ │ │ │ -365inline void from_string(const field &F, T &Obj) //[t46] │ │ │ │ │ - 366 { from_string(F.c_str(), Obj, F.size()); } │ │ │ │ │ - 367 │ │ │ │ │ - 369template<> PQXX_LIBEXPORT std::string to_string(const field &Obj); //[t74] │ │ │ │ │ - 370 │ │ │ │ │ - 371} // namespace pqxx │ │ │ │ │ - 372#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 373#endif │ │ │ │ │ -std │ │ │ │ │ -STL namespace. │ │ │ │ │ +150 explicit robusttransaction( │ │ │ │ │ + 151 connection_base &C, │ │ │ │ │ + 152 const std::string &Name=std::string{}) : │ │ │ │ │ + 153 namedclass{fullname("robusttransaction",isolation_tag::name()), Name}, │ │ │ │ │ + 154 internal::basic_robusttransaction(C, isolation_tag::name()) │ │ │ │ │ + 155 { Begin(); } │ │ │ │ │ + 156 │ │ │ │ │ +157 virtual ~robusttransaction() noexcept │ │ │ │ │ + 158 { End(); } │ │ │ │ │ + 159}; │ │ │ │ │ + 160 │ │ │ │ │ + 165} // namespace pqxx │ │ │ │ │ + 166 │ │ │ │ │ + 167#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 168#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::operator<< │ │ │ │ │ -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 │ │ │ │ │ -pqxx::from_string │ │ │ │ │ -void from_string(const field &F, T &Obj) │ │ │ │ │ -Convert a field's string contents to another type. │ │ │ │ │ -Definition: field.hxx:365 │ │ │ │ │ -pqxx::to_string │ │ │ │ │ -std::string to_string(const field &Obj) │ │ │ │ │ -Convert a field to a string. │ │ │ │ │ -Definition: result.cxx:451 │ │ │ │ │ -pqxx::field_size_type │ │ │ │ │ -std::size_t field_size_type │ │ │ │ │ -Number of bytes in a field of database data. │ │ │ │ │ -Definition: types.hxx:30 │ │ │ │ │ -pqxx::row_size_type │ │ │ │ │ -unsigned int row_size_type │ │ │ │ │ -Number of fields in a row of database data. │ │ │ │ │ -Definition: types.hxx:24 │ │ │ │ │ -pqxx::array_parser │ │ │ │ │ -Low-level array parser. │ │ │ │ │ -Definition: array.hxx:47 │ │ │ │ │ -pqxx::field │ │ │ │ │ -Reference to a field in a result set. │ │ │ │ │ -Definition: field.hxx:50 │ │ │ │ │ -pqxx::field::num │ │ │ │ │ -row_size_type num() const │ │ │ │ │ -Definition: field.hxx:104 │ │ │ │ │ -pqxx::field::col │ │ │ │ │ -row_size_type col() const noexcept │ │ │ │ │ -Definition: field.hxx:218 │ │ │ │ │ -pqxx::field::size │ │ │ │ │ -size_type size() const noexcept │ │ │ │ │ -Return number of bytes taken up by the field's value. │ │ │ │ │ -Definition: field.cxx:74 │ │ │ │ │ -pqxx::field::m_col │ │ │ │ │ -long m_col │ │ │ │ │ -Definition: field.hxx:224 │ │ │ │ │ -pqxx::field::as │ │ │ │ │ -T as(const T &Default) const │ │ │ │ │ -Return value as object of given type, or Default if null. │ │ │ │ │ -Definition: field.hxx:170 │ │ │ │ │ -pqxx::field::size_type │ │ │ │ │ -field_size_type size_type │ │ │ │ │ -Definition: field.hxx:52 │ │ │ │ │ -pqxx::field::operator>> │ │ │ │ │ -bool operator>>(T &Obj) const │ │ │ │ │ -Read value into Obj; or leave Obj untouched and return false if null. │ │ │ │ │ -Definition: field.hxx:148 │ │ │ │ │ -pqxx::field::as_array │ │ │ │ │ -array_parser as_array() const │ │ │ │ │ -Parse the field as an SQL array. │ │ │ │ │ -Definition: field.hxx:210 │ │ │ │ │ -pqxx::field::home │ │ │ │ │ -const result & home() const noexcept │ │ │ │ │ -Definition: field.hxx:216 │ │ │ │ │ -pqxx::field::as │ │ │ │ │ -T as() const │ │ │ │ │ -Return value as object of given type, or throw exception if null. │ │ │ │ │ -Definition: field.hxx:183 │ │ │ │ │ -pqxx::field::to │ │ │ │ │ -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 │ │ │ │ │ -pqxx::field::c_str │ │ │ │ │ -const char * c_str() const │ │ │ │ │ -Read as plain C string. │ │ │ │ │ -Definition: field.cxx:62 │ │ │ │ │ -pqxx::field::is_null │ │ │ │ │ -bool is_null() const noexcept │ │ │ │ │ -Is this field's value null? │ │ │ │ │ -Definition: field.cxx:68 │ │ │ │ │ -pqxx::field::get │ │ │ │ │ -constexpr O< T > get() const │ │ │ │ │ -Return value wrapped in some optional type (empty for nulls) │ │ │ │ │ -Definition: field.hxx:201 │ │ │ │ │ -pqxx::field::idx │ │ │ │ │ -size_t idx() const noexcept │ │ │ │ │ -Definition: field.hxx:217 │ │ │ │ │ -pqxx::field::operator!= │ │ │ │ │ -bool operator!=(const field &rhs) const │ │ │ │ │ -Byte-by-byte comparison (all nulls are considered equal) │ │ │ │ │ -Definition: field.hxx:87 │ │ │ │ │ -pqxx::field_streambuf │ │ │ │ │ -Definition: field.hxx:260 │ │ │ │ │ -pqxx::field_streambuf::traits_type │ │ │ │ │ -TRAITS traits_type │ │ │ │ │ -Definition: field.hxx:263 │ │ │ │ │ -pqxx::field_streambuf::off_type │ │ │ │ │ -typename traits_type::off_type off_type │ │ │ │ │ -Definition: field.hxx:266 │ │ │ │ │ -pqxx::field_streambuf::seekoff │ │ │ │ │ -virtual pos_type seekoff(off_type, seekdir, openmode) override │ │ │ │ │ -Definition: field.hxx:280 │ │ │ │ │ -pqxx::field_streambuf::seekpos │ │ │ │ │ -virtual pos_type seekpos(pos_type, openmode) override │ │ │ │ │ -Definition: field.hxx:282 │ │ │ │ │ -pqxx::field_streambuf::openmode │ │ │ │ │ -std::ios::openmode openmode │ │ │ │ │ -Definition: field.hxx:267 │ │ │ │ │ -pqxx::field_streambuf::overflow │ │ │ │ │ -virtual int_type overflow(int_type) override │ │ │ │ │ -Definition: field.hxx:284 │ │ │ │ │ -pqxx::field_streambuf::field_streambuf │ │ │ │ │ -field_streambuf(const field &F) │ │ │ │ │ -Definition: field.hxx:270 │ │ │ │ │ -pqxx::field_streambuf::pos_type │ │ │ │ │ -typename traits_type::pos_type pos_type │ │ │ │ │ -Definition: field.hxx:265 │ │ │ │ │ -pqxx::field_streambuf::sync │ │ │ │ │ -virtual int sync() override │ │ │ │ │ -Definition: field.hxx:277 │ │ │ │ │ -pqxx::field_streambuf::int_type │ │ │ │ │ -typename traits_type::int_type int_type │ │ │ │ │ -Definition: field.hxx:264 │ │ │ │ │ -pqxx::field_streambuf::underflow │ │ │ │ │ -virtual int_type underflow() override │ │ │ │ │ -Definition: field.hxx:286 │ │ │ │ │ -pqxx::field_streambuf::char_type │ │ │ │ │ -CHAR char_type │ │ │ │ │ -Definition: field.hxx:262 │ │ │ │ │ -pqxx::field_streambuf::seekdir │ │ │ │ │ -std::ios::seekdir seekdir │ │ │ │ │ -Definition: field.hxx:268 │ │ │ │ │ -pqxx::basic_fieldstream │ │ │ │ │ -Input stream that gets its data from a result field. │ │ │ │ │ -Definition: field.hxx:314 │ │ │ │ │ -pqxx::basic_fieldstream::traits_type │ │ │ │ │ -TRAITS traits_type │ │ │ │ │ -Definition: field.hxx:319 │ │ │ │ │ -pqxx::basic_fieldstream::basic_fieldstream │ │ │ │ │ -basic_fieldstream(const field &F) │ │ │ │ │ -Definition: field.hxx:324 │ │ │ │ │ -pqxx::basic_fieldstream::pos_type │ │ │ │ │ -typename traits_type::pos_type pos_type │ │ │ │ │ -Definition: field.hxx:321 │ │ │ │ │ -pqxx::basic_fieldstream::off_type │ │ │ │ │ -typename traits_type::off_type off_type │ │ │ │ │ -Definition: field.hxx:322 │ │ │ │ │ -pqxx::basic_fieldstream::int_type │ │ │ │ │ -typename traits_type::int_type int_type │ │ │ │ │ -Definition: field.hxx:320 │ │ │ │ │ -pqxx::basic_fieldstream::char_type │ │ │ │ │ -CHAR char_type │ │ │ │ │ -Definition: field.hxx:318 │ │ │ │ │ -pqxx::result │ │ │ │ │ -Result set containing data returned by a query or command. │ │ │ │ │ -Definition: result.hxx:70 │ │ │ │ │ -pqxx::row │ │ │ │ │ -Reference to one row in a result. │ │ │ │ │ -Definition: row.hxx:41 │ │ │ │ │ -pqxx::string_traits │ │ │ │ │ -Traits class for use in string conversions. │ │ │ │ │ -Definition: strconv.hxx:51 │ │ │ │ │ +pqxx::isolation_level │ │ │ │ │ +isolation_level │ │ │ │ │ +Transaction isolation levels. │ │ │ │ │ +Definition: isolation.hxx:57 │ │ │ │ │ +pqxx::read_committed │ │ │ │ │ +@ read_committed │ │ │ │ │ +Definition: isolation.hxx:59 │ │ │ │ │ +pqxx::connection_base │ │ │ │ │ +connection_base abstract base class; represents a connection to a database. │ │ │ │ │ +Definition: connection_base.hxx:140 │ │ │ │ │ +pqxx::dbtransaction │ │ │ │ │ +Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ +Definition: dbtransaction.hxx:63 │ │ │ │ │ +pqxx::isolation_traits │ │ │ │ │ +Traits class to describe an isolation level; primarly for libpqxx's own use. │ │ │ │ │ +Definition: isolation.hxx:66 │ │ │ │ │ +pqxx::internal::basic_robusttransaction │ │ │ │ │ +Helper base class for the robusttransaction class template. │ │ │ │ │ +Definition: robusttransaction.hxx:32 │ │ │ │ │ +pqxx::robusttransaction │ │ │ │ │ +Slightly slower, better-fortified version of transaction. │ │ │ │ │ +Definition: robusttransaction.hxx:141 │ │ │ │ │ +pqxx::robusttransaction::~robusttransaction │ │ │ │ │ +virtual ~robusttransaction() noexcept │ │ │ │ │ +Definition: robusttransaction.hxx:157 │ │ │ │ │ +pqxx::robusttransaction::robusttransaction │ │ │ │ │ +robusttransaction(connection_base &C, const std::string &Name=std::string{}) │ │ │ │ │ +Constructor. │ │ │ │ │ +Definition: robusttransaction.hxx:150 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * field.hxx │ │ │ │ │ + * robusttransaction.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00071_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: connection.hxx Source File │ │ │ │ +libpqxx: array.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,101 +55,90 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
connection.hxx
│ │ │ │ +
array.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_CONNECTION
│ │ │ │ -
14#define PQXX_H_CONNECTION
│ │ │ │ -
15
│ │ │ │ -
16#include "pqxx/compiler-public.hxx"
│ │ │ │ -
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include "pqxx/connectionpolicy.hxx"
│ │ │ │ -
20#include "pqxx/basic_connection.hxx"
│ │ │ │ -
21
│ │ │ │ -
22namespace pqxx
│ │ │ │ -
23{
│ │ │ │ +
11#ifndef PQXX_H_ARRAY
│ │ │ │ +
12#define PQXX_H_ARRAY
│ │ │ │ +
13
│ │ │ │ +
14#include "pqxx/compiler-public.hxx"
│ │ │ │ +
15#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
16
│ │ │ │ +
17#include "pqxx/internal/encoding_group.hxx"
│ │ │ │ +
18#include "pqxx/internal/encodings.hxx"
│ │ │ │ +
19
│ │ │ │ +
20#include <stdexcept>
│ │ │ │ +
21#include <string>
│ │ │ │ +
22#include <utility>
│ │ │ │ +
23
│ │ │ │
24
│ │ │ │ +
25namespace pqxx
│ │ │ │ +
26{
│ │ │ │ +
28
│ │ │ │ +
46class PQXX_LIBEXPORT array_parser
│ │ │ │ +
47{
│ │ │ │ +
48public:
│ │ │ │ + │ │ │ │ +
51 {
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
62 };
│ │ │ │ +
63
│ │ │ │ +
64// XXX: Actually _pass_ encoding group!
│ │ │ │ +
66 explicit array_parser(
│ │ │ │ +
67 const char input[],
│ │ │ │ +
68 internal::encoding_group=internal::encoding_group::MONOBYTE);
│ │ │ │ +
69
│ │ │ │ +
71
│ │ │ │ +
76 std::pair<juncture, std::string> get_next();
│ │ │ │
77
│ │ │ │ -
87class PQXX_LIBEXPORT connect_direct : public connectionpolicy
│ │ │ │ -
88{
│ │ │ │ -
89public:
│ │ │ │ -
92 explicit connect_direct(const std::string &opts) : connectionpolicy{opts} {}
│ │ │ │ -
93 virtual handle do_startconnect(handle) override;
│ │ │ │ -
94};
│ │ │ │ -
95
│ │ │ │ - │ │ │ │ -
98
│ │ │ │ +
78private:
│ │ │ │ +
79 const char *const m_input;
│ │ │ │ +
80 const std::string::size_type m_end;
│ │ │ │ +
81 internal::glyph_scanner_func *const m_scan;
│ │ │ │ +
82
│ │ │ │ +
84 std::string::size_type m_pos;
│ │ │ │ +
85
│ │ │ │ +
86 std::string::size_type scan_single_quoted_string() const;
│ │ │ │ +
87 std::string parse_single_quoted_string(std::string::size_type end) const;
│ │ │ │ +
88 std::string::size_type scan_double_quoted_string() const;
│ │ │ │ +
89 std::string parse_double_quoted_string(std::string::size_type end) const;
│ │ │ │ +
90 std::string::size_type scan_unquoted_string() const;
│ │ │ │ +
91 std::string parse_unquoted_string(std::string::size_type end) const;
│ │ │ │ +
92
│ │ │ │ +
93 std::string::size_type scan_glyph(std::string::size_type pos) const;
│ │ │ │ +
94 std::string::size_type scan_glyph(
│ │ │ │ +
95 std::string::size_type pos,
│ │ │ │ +
96 std::string::size_type end) const;
│ │ │ │ +
97};
│ │ │ │ +
98} // namespace pqxx
│ │ │ │
99
│ │ │ │ -
101
│ │ │ │ -
105class PQXX_LIBEXPORT connect_lazy : public connectionpolicy
│ │ │ │ -
106{
│ │ │ │ -
107public:
│ │ │ │ -
110 explicit connect_lazy(const std::string &opts) : connectionpolicy{opts} {}
│ │ │ │ -
111 virtual handle do_completeconnect(handle) override;
│ │ │ │ -
112};
│ │ │ │ -
113
│ │ │ │ -
114
│ │ │ │ - │ │ │ │ -
117
│ │ │ │ -
118
│ │ │ │ -
120
│ │ │ │ -
126class PQXX_LIBEXPORT connect_async : public connectionpolicy
│ │ │ │ -
127{
│ │ │ │ -
128public:
│ │ │ │ -
131 explicit connect_async(const std::string &opts);
│ │ │ │ -
132 virtual handle do_startconnect(handle) override;
│ │ │ │ -
133 virtual handle do_completeconnect(handle) override;
│ │ │ │ -
134 virtual handle do_dropconnect(handle) noexcept override;
│ │ │ │ -
135 virtual bool is_ready(handle) const noexcept override;
│ │ │ │ -
136
│ │ │ │ -
137private:
│ │ │ │ -
139 bool m_connecting;
│ │ │ │ -
140};
│ │ │ │ -
141
│ │ │ │ -
142
│ │ │ │ - │ │ │ │ -
145
│ │ │ │ -
146
│ │ │ │ -
148
│ │ │ │ -
152class PQXX_LIBEXPORT connect_null : public connectionpolicy
│ │ │ │ -
153{
│ │ │ │ -
154public:
│ │ │ │ -
155 explicit connect_null(const std::string &opts) : connectionpolicy{opts} {}
│ │ │ │ -
156};
│ │ │ │ -
157
│ │ │ │ -
158
│ │ │ │ - │ │ │ │ -
161
│ │ │ │ -
166}
│ │ │ │ -
167
│ │ │ │ -
168#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
169
│ │ │ │ -
170#endif
│ │ │ │ +
100#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
101#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
Base-class template for all libpqxx connection types.
Definition: basic_connection.hxx:47
│ │ │ │ -
Connection policy; creates an immediate connection to a database.
Definition: connection.hxx:88
│ │ │ │ -
connect_direct(const std::string &opts)
Definition: connection.hxx:92
│ │ │ │ -
Lazy connection policy; causes connection to be deferred until first use.
Definition: connection.hxx:106
│ │ │ │ -
connect_lazy(const std::string &opts)
Definition: connection.hxx:110
│ │ │ │ -
Asynchronous connection policy; connects "in the background".
Definition: connection.hxx:127
│ │ │ │ -
Nonfunctional, always-down connection policy for testing/debugging purposes.
Definition: connection.hxx:153
│ │ │ │ -
connect_null(const std::string &opts)
Definition: connection.hxx:155
│ │ │ │ -
Definition: connectionpolicy.hxx:32
│ │ │ │ -
internal::pq::PGconn * handle
Definition: connectionpolicy.hxx:34
│ │ │ │ +
Low-level array parser.
Definition: array.hxx:47
│ │ │ │ +
juncture
What's the latest thing found in the array?
Definition: array.hxx:51
│ │ │ │ +
@ string_value
Found a string value.
Definition: array.hxx:59
│ │ │ │ +
@ row_end
Ending the current row.
Definition: array.hxx:55
│ │ │ │ +
@ done
Parsing has completed.
Definition: array.hxx:61
│ │ │ │ +
@ row_start
Starting a new row.
Definition: array.hxx:53
│ │ │ │ +
@ null_value
Found a NULL value.
Definition: array.hxx:57
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,113 +1,103 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -connection.hxx │ │ │ │ │ +array.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_CONNECTION │ │ │ │ │ - 14#define PQXX_H_CONNECTION │ │ │ │ │ - 15 │ │ │ │ │ - 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include "pqxx/connectionpolicy.hxx" │ │ │ │ │ - 20#include "pqxx/basic_connection.hxx" │ │ │ │ │ - 21 │ │ │ │ │ - 22namespace pqxx │ │ │ │ │ - 23{ │ │ │ │ │ + 11#ifndef PQXX_H_ARRAY │ │ │ │ │ + 12#define PQXX_H_ARRAY │ │ │ │ │ + 13 │ │ │ │ │ + 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 15#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 16 │ │ │ │ │ + 17#include "pqxx/internal/encoding_group.hxx" │ │ │ │ │ + 18#include "pqxx/internal/encodings.hxx" │ │ │ │ │ + 19 │ │ │ │ │ + 20#include │ │ │ │ │ + 21#include │ │ │ │ │ + 22#include │ │ │ │ │ + 23 │ │ │ │ │ 24 │ │ │ │ │ +25namespace pqxx │ │ │ │ │ + 26{ │ │ │ │ │ + 28 │ │ │ │ │ +46class PQXX_LIBEXPORT array_parser │ │ │ │ │ + 47{ │ │ │ │ │ + 48public: │ │ │ │ │ +50 enum juncture │ │ │ │ │ + 51 { │ │ │ │ │ +53 row_start, │ │ │ │ │ +55 row_end, │ │ │ │ │ +57 null_value, │ │ │ │ │ +59 string_value, │ │ │ │ │ +61 done, │ │ │ │ │ + 62 }; │ │ │ │ │ + 63 │ │ │ │ │ + 64// XXX: Actually _pass_ encoding group! │ │ │ │ │ + 66 explicit array_parser( │ │ │ │ │ + 67 const char input[], │ │ │ │ │ + 68 internal::encoding_group=internal::encoding_group::MONOBYTE); │ │ │ │ │ + 69 │ │ │ │ │ + 71 │ │ │ │ │ + 76 std::pair get_next(); │ │ │ │ │ 77 │ │ │ │ │ -87class PQXX_LIBEXPORT connect_direct : public connectionpolicy │ │ │ │ │ - 88{ │ │ │ │ │ - 89public: │ │ │ │ │ -92 explicit connect_direct(const std::string &opts) : connectionpolicy{opts} {} │ │ │ │ │ - 93 virtual handle do_startconnect(handle) override; │ │ │ │ │ - 94}; │ │ │ │ │ - 95 │ │ │ │ │ -97using connection = basic_connection_base; │ │ │ │ │ - 98 │ │ │ │ │ + 78private: │ │ │ │ │ + 79 const char *const m_input; │ │ │ │ │ + 80 const std::string::size_type m_end; │ │ │ │ │ + 81 internal::glyph_scanner_func *const m_scan; │ │ │ │ │ + 82 │ │ │ │ │ + 84 std::string::size_type m_pos; │ │ │ │ │ + 85 │ │ │ │ │ + 86 std::string::size_type scan_single_quoted_string() const; │ │ │ │ │ + 87 std::string parse_single_quoted_string(std::string::size_type end) const; │ │ │ │ │ + 88 std::string::size_type scan_double_quoted_string() const; │ │ │ │ │ + 89 std::string parse_double_quoted_string(std::string::size_type end) const; │ │ │ │ │ + 90 std::string::size_type scan_unquoted_string() const; │ │ │ │ │ + 91 std::string parse_unquoted_string(std::string::size_type end) const; │ │ │ │ │ + 92 │ │ │ │ │ + 93 std::string::size_type scan_glyph(std::string::size_type pos) const; │ │ │ │ │ + 94 std::string::size_type scan_glyph( │ │ │ │ │ + 95 std::string::size_type pos, │ │ │ │ │ + 96 std::string::size_type end) const; │ │ │ │ │ + 97}; │ │ │ │ │ + 98} // namespace pqxx │ │ │ │ │ 99 │ │ │ │ │ - 101 │ │ │ │ │ -105class PQXX_LIBEXPORT connect_lazy : public connectionpolicy │ │ │ │ │ - 106{ │ │ │ │ │ - 107public: │ │ │ │ │ -110 explicit connect_lazy(const std::string &opts) : connectionpolicy{opts} {} │ │ │ │ │ - 111 virtual handle do_completeconnect(handle) override; │ │ │ │ │ - 112}; │ │ │ │ │ - 113 │ │ │ │ │ - 114 │ │ │ │ │ -116using lazyconnection = basic_connection_base; │ │ │ │ │ - 117 │ │ │ │ │ - 118 │ │ │ │ │ - 120 │ │ │ │ │ -126class PQXX_LIBEXPORT connect_async : public connectionpolicy │ │ │ │ │ - 127{ │ │ │ │ │ - 128public: │ │ │ │ │ - 131 explicit connect_async(const std::string &opts); │ │ │ │ │ - 132 virtual handle do_startconnect(handle) override; │ │ │ │ │ - 133 virtual handle do_completeconnect(handle) override; │ │ │ │ │ - 134 virtual handle do_dropconnect(handle) noexcept override; │ │ │ │ │ - 135 virtual bool is_ready(handle) const noexcept override; │ │ │ │ │ - 136 │ │ │ │ │ - 137private: │ │ │ │ │ - 139 bool m_connecting; │ │ │ │ │ - 140}; │ │ │ │ │ - 141 │ │ │ │ │ - 142 │ │ │ │ │ -144using asyncconnection = basic_connection_base; │ │ │ │ │ - 145 │ │ │ │ │ - 146 │ │ │ │ │ - 148 │ │ │ │ │ -152class PQXX_LIBEXPORT connect_null : public connectionpolicy │ │ │ │ │ - 153{ │ │ │ │ │ - 154public: │ │ │ │ │ -155 explicit connect_null(const std::string &opts) : connectionpolicy{opts} {} │ │ │ │ │ - 156}; │ │ │ │ │ - 157 │ │ │ │ │ - 158 │ │ │ │ │ -160using nullconnection = basic_connection_base; │ │ │ │ │ - 161 │ │ │ │ │ - 166} │ │ │ │ │ - 167 │ │ │ │ │ - 168#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 169 │ │ │ │ │ - 170#endif │ │ │ │ │ + 100#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 101#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::basic_connection_base │ │ │ │ │ -Base-class template for all libpqxx connection types. │ │ │ │ │ -Definition: basic_connection.hxx:47 │ │ │ │ │ -pqxx::connect_direct │ │ │ │ │ -Connection policy; creates an immediate connection to a database. │ │ │ │ │ -Definition: connection.hxx:88 │ │ │ │ │ -pqxx::connect_direct::connect_direct │ │ │ │ │ -connect_direct(const std::string &opts) │ │ │ │ │ -Definition: connection.hxx:92 │ │ │ │ │ -pqxx::connect_lazy │ │ │ │ │ -Lazy connection policy; causes connection to be deferred until first use. │ │ │ │ │ -Definition: connection.hxx:106 │ │ │ │ │ -pqxx::connect_lazy::connect_lazy │ │ │ │ │ -connect_lazy(const std::string &opts) │ │ │ │ │ -Definition: connection.hxx:110 │ │ │ │ │ -pqxx::connect_async │ │ │ │ │ -Asynchronous connection policy; connects "in the background". │ │ │ │ │ -Definition: connection.hxx:127 │ │ │ │ │ -pqxx::connect_null │ │ │ │ │ -Nonfunctional, always-down connection policy for testing/debugging purposes. │ │ │ │ │ -Definition: connection.hxx:153 │ │ │ │ │ -pqxx::connect_null::connect_null │ │ │ │ │ -connect_null(const std::string &opts) │ │ │ │ │ -Definition: connection.hxx:155 │ │ │ │ │ -pqxx::connectionpolicy │ │ │ │ │ -Definition: connectionpolicy.hxx:32 │ │ │ │ │ -pqxx::connectionpolicy::handle │ │ │ │ │ -internal::pq::PGconn * handle │ │ │ │ │ -Definition: connectionpolicy.hxx:34 │ │ │ │ │ +pqxx::array_parser │ │ │ │ │ +Low-level array parser. │ │ │ │ │ +Definition: array.hxx:47 │ │ │ │ │ +pqxx::array_parser::juncture │ │ │ │ │ +juncture │ │ │ │ │ +What's the latest thing found in the array? │ │ │ │ │ +Definition: array.hxx:51 │ │ │ │ │ +pqxx::array_parser::string_value │ │ │ │ │ +@ string_value │ │ │ │ │ +Found a string value. │ │ │ │ │ +Definition: array.hxx:59 │ │ │ │ │ +pqxx::array_parser::row_end │ │ │ │ │ +@ row_end │ │ │ │ │ +Ending the current row. │ │ │ │ │ +Definition: array.hxx:55 │ │ │ │ │ +pqxx::array_parser::done │ │ │ │ │ +@ done │ │ │ │ │ +Parsing has completed. │ │ │ │ │ +Definition: array.hxx:61 │ │ │ │ │ +pqxx::array_parser::row_start │ │ │ │ │ +@ row_start │ │ │ │ │ +Starting a new row. │ │ │ │ │ +Definition: array.hxx:53 │ │ │ │ │ +pqxx::array_parser::null_value │ │ │ │ │ +@ null_value │ │ │ │ │ +Found a NULL value. │ │ │ │ │ +Definition: array.hxx:57 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * connection.hxx │ │ │ │ │ + * array.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00074_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: array.hxx Source File │ │ │ │ +libpqxx: pipeline.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,90 +55,162 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
array.hxx
│ │ │ │ +
pipeline.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
11#ifndef PQXX_H_ARRAY
│ │ │ │ -
12#define PQXX_H_ARRAY
│ │ │ │ -
13
│ │ │ │ -
14#include "pqxx/compiler-public.hxx"
│ │ │ │ -
15#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
16
│ │ │ │ -
17#include "pqxx/internal/encoding_group.hxx"
│ │ │ │ -
18#include "pqxx/internal/encodings.hxx"
│ │ │ │ -
19
│ │ │ │ -
20#include <stdexcept>
│ │ │ │ +
13#ifndef PQXX_H_PIPELINE
│ │ │ │ +
14#define PQXX_H_PIPELINE
│ │ │ │ +
15
│ │ │ │ +
16#include "pqxx/compiler-public.hxx"
│ │ │ │ +
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
18
│ │ │ │ +
19#include <limits>
│ │ │ │ +
20#include <map>
│ │ │ │
21#include <string>
│ │ │ │ -
22#include <utility>
│ │ │ │ -
23
│ │ │ │ +
22
│ │ │ │ +
23#include "pqxx/transaction_base.hxx"
│ │ │ │
24
│ │ │ │ -
25namespace pqxx
│ │ │ │ -
26{
│ │ │ │ -
28
│ │ │ │ -
46class PQXX_LIBEXPORT array_parser
│ │ │ │ -
47{
│ │ │ │ -
48public:
│ │ │ │ - │ │ │ │ -
51 {
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
62 };
│ │ │ │ +
25
│ │ │ │ +
26// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ +
27
│ │ │ │ +
28namespace pqxx
│ │ │ │ +
29{
│ │ │ │ +
30
│ │ │ │ +
32
│ │ │ │ +
48class PQXX_LIBEXPORT pipeline : public internal::transactionfocus
│ │ │ │ +
49{
│ │ │ │ +
50public:
│ │ │ │ +
51 using query_id = long;
│ │ │ │ +
52
│ │ │ │ +
53 pipeline(const pipeline &) =delete;
│ │ │ │ +
54 pipeline &operator=(const pipeline &) =delete;
│ │ │ │ +
55
│ │ │ │ +
56 explicit pipeline( //[t69]
│ │ │ │ + │ │ │ │ +
58 const std::string &Name=std::string{});
│ │ │ │ +
59
│ │ │ │ +
60 ~pipeline() noexcept;
│ │ │ │ +
61
│ │ │ │
63
│ │ │ │ -
64// XXX: Actually _pass_ encoding group!
│ │ │ │ -
66 explicit array_parser(
│ │ │ │ -
67 const char input[],
│ │ │ │ -
68 internal::encoding_group=internal::encoding_group::MONOBYTE);
│ │ │ │ -
69
│ │ │ │ -
71
│ │ │ │ -
76 std::pair<juncture, std::string> get_next();
│ │ │ │ -
77
│ │ │ │ -
78private:
│ │ │ │ -
79 const char *const m_input;
│ │ │ │ -
80 const std::string::size_type m_end;
│ │ │ │ -
81 internal::glyph_scanner_func *const m_scan;
│ │ │ │ -
82
│ │ │ │ -
84 std::string::size_type m_pos;
│ │ │ │ -
85
│ │ │ │ -
86 std::string::size_type scan_single_quoted_string() const;
│ │ │ │ -
87 std::string parse_single_quoted_string(std::string::size_type end) const;
│ │ │ │ -
88 std::string::size_type scan_double_quoted_string() const;
│ │ │ │ -
89 std::string parse_double_quoted_string(std::string::size_type end) const;
│ │ │ │ -
90 std::string::size_type scan_unquoted_string() const;
│ │ │ │ -
91 std::string parse_unquoted_string(std::string::size_type end) const;
│ │ │ │ -
92
│ │ │ │ -
93 std::string::size_type scan_glyph(std::string::size_type pos) const;
│ │ │ │ -
94 std::string::size_type scan_glyph(
│ │ │ │ -
95 std::string::size_type pos,
│ │ │ │ -
96 std::string::size_type end) const;
│ │ │ │ -
97};
│ │ │ │ -
98} // namespace pqxx
│ │ │ │ -
99
│ │ │ │ -
100#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
101#endif
│ │ │ │ +
69 query_id insert(const std::string &); //[t69]
│ │ │ │ +
70
│ │ │ │ +
72
│ │ │ │ +
73 void complete(); //[t71]
│ │ │ │ +
74
│ │ │ │ +
76
│ │ │ │ +
85 void flush(); //[t70]
│ │ │ │ +
86
│ │ │ │ +
88
│ │ │ │ +
96 void cancel();
│ │ │ │ +
97
│ │ │ │ +
99 bool is_finished(query_id) const; //[t71]
│ │ │ │ +
100
│ │ │ │ +
102
│ │ │ │ +
108 result retrieve(query_id qid) //[t71]
│ │ │ │ +
109 { return retrieve(m_queries.find(qid)).second; }
│ │ │ │ +
110
│ │ │ │ +
112
│ │ │ │ +
113 std::pair<query_id, result> retrieve(); //[t69]
│ │ │ │ +
114
│ │ │ │ +
115 bool empty() const noexcept { return m_queries.empty(); } //[t69]
│ │ │ │ +
116
│ │ │ │ +
118
│ │ │ │ +
129 int retain(int retain_max=2); //[t70]
│ │ │ │ +
130
│ │ │ │ +
131
│ │ │ │ +
133 void resume(); //[t70]
│ │ │ │ +
134
│ │ │ │ +
135private:
│ │ │ │ +
136 class PQXX_PRIVATE Query
│ │ │ │ +
137 {
│ │ │ │ +
138 public:
│ │ │ │ +
139 explicit Query(const std::string &q) : m_query{q}, m_res{} {}
│ │ │ │ +
140
│ │ │ │ +
141 const result &get_result() const noexcept { return m_res; }
│ │ │ │ +
142 void set_result(const result &r) noexcept { m_res = r; }
│ │ │ │ +
143 const std::string &get_query() const noexcept { return m_query; }
│ │ │ │ +
144
│ │ │ │ +
145 private:
│ │ │ │ +
146 std::string m_query;
│ │ │ │ +
147 result m_res;
│ │ │ │ +
148 };
│ │ │ │ +
149
│ │ │ │ +
150 using QueryMap = std::map<query_id,Query>;
│ │ │ │ +
151
│ │ │ │ +
152 void attach();
│ │ │ │ +
153 void detach();
│ │ │ │ +
154
│ │ │ │ +
156 static constexpr query_id qid_limit() noexcept
│ │ │ │ +
157 {
│ │ │ │ +
158 // Parenthesise this to work around an eternal Visual C++ problem:
│ │ │ │ +
159 // Without the extra parentheses, unless NOMINMAX is defined, the
│ │ │ │ +
160 // preprocessor will mistake this "max" for its annoying built-in macro
│ │ │ │ +
161 // of the same name.
│ │ │ │ +
162 return (std::numeric_limits<query_id>::max)();
│ │ │ │ +
163 }
│ │ │ │ +
164
│ │ │ │ +
166 PQXX_PRIVATE query_id generate_id();
│ │ │ │ +
167
│ │ │ │ +
168 bool have_pending() const noexcept
│ │ │ │ +
169 { return m_issuedrange.second != m_issuedrange.first; }
│ │ │ │ +
170
│ │ │ │ +
171 PQXX_PRIVATE void issue();
│ │ │ │ +
172
│ │ │ │ +
174 void set_error_at(query_id qid) noexcept
│ │ │ │ +
175 { if (qid < m_error) m_error = qid; }
│ │ │ │ +
176
│ │ │ │ +
178 [[noreturn]] PQXX_PRIVATE void internal_error(const std::string &err);
│ │ │ │ +
179
│ │ │ │ +
180 PQXX_PRIVATE bool obtain_result(bool expect_none=false);
│ │ │ │ +
181
│ │ │ │ +
182 PQXX_PRIVATE void obtain_dummy();
│ │ │ │ +
183 PQXX_PRIVATE void get_further_available_results();
│ │ │ │ +
184 PQXX_PRIVATE void check_end_results();
│ │ │ │ +
185
│ │ │ │ +
187 PQXX_PRIVATE void receive_if_available();
│ │ │ │ +
188
│ │ │ │ +
190 PQXX_PRIVATE void receive(pipeline::QueryMap::const_iterator stop);
│ │ │ │ +
191 std::pair<pipeline::query_id, result>
│ │ │ │ +
192 retrieve(pipeline::QueryMap::iterator);
│ │ │ │ +
193
│ │ │ │ +
194 QueryMap m_queries;
│ │ │ │ +
195 std::pair<QueryMap::iterator,QueryMap::iterator> m_issuedrange;
│ │ │ │ +
196 int m_retain = 0;
│ │ │ │ +
197 int m_num_waiting = 0;
│ │ │ │ +
198 query_id m_q_id = 0;
│ │ │ │ +
199
│ │ │ │ +
201 bool m_dummy_pending = false;
│ │ │ │ +
202
│ │ │ │ +
204 query_id m_error = qid_limit();
│ │ │ │ +
205};
│ │ │ │ +
206
│ │ │ │ +
207} // namespace
│ │ │ │ +
208
│ │ │ │ +
209#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
210#endif
│ │ │ │ +
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
Low-level array parser.
Definition: array.hxx:47
│ │ │ │ -
juncture
What's the latest thing found in the array?
Definition: array.hxx:51
│ │ │ │ -
@ string_value
Found a string value.
Definition: array.hxx:59
│ │ │ │ -
@ row_end
Ending the current row.
Definition: array.hxx:55
│ │ │ │ -
@ done
Parsing has completed.
Definition: array.hxx:61
│ │ │ │ -
@ row_start
Starting a new row.
Definition: array.hxx:53
│ │ │ │ -
@ null_value
Found a NULL value.
Definition: array.hxx:57
│ │ │ │ +
Processes several queries in FIFO manner, optimized for high throughput.
Definition: pipeline.hxx:49
│ │ │ │ +
pipeline & operator=(const pipeline &)=delete
│ │ │ │ +
bool empty() const noexcept
Definition: pipeline.hxx:115
│ │ │ │ +
pipeline(const pipeline &)=delete
│ │ │ │ +
long query_id
Definition: pipeline.hxx:51
│ │ │ │ +
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ +
Definition: transaction_base.hxx:44
│ │ │ │ +
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,103 +1,169 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -array.hxx │ │ │ │ │ +pipeline.hxx │ │ │ │ │ 1 │ │ │ │ │ - 11#ifndef PQXX_H_ARRAY │ │ │ │ │ - 12#define PQXX_H_ARRAY │ │ │ │ │ - 13 │ │ │ │ │ - 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 15#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 16 │ │ │ │ │ - 17#include "pqxx/internal/encoding_group.hxx" │ │ │ │ │ - 18#include "pqxx/internal/encodings.hxx" │ │ │ │ │ - 19 │ │ │ │ │ - 20#include │ │ │ │ │ + 13#ifndef PQXX_H_PIPELINE │ │ │ │ │ + 14#define PQXX_H_PIPELINE │ │ │ │ │ + 15 │ │ │ │ │ + 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 18 │ │ │ │ │ + 19#include │ │ │ │ │ + 20#include │ │ │ │ │ 21#include │ │ │ │ │ - 22#include │ │ │ │ │ - 23 │ │ │ │ │ + 22 │ │ │ │ │ + 23#include "pqxx/transaction_base.hxx" │ │ │ │ │ 24 │ │ │ │ │ -25namespace pqxx │ │ │ │ │ - 26{ │ │ │ │ │ - 28 │ │ │ │ │ -46class PQXX_LIBEXPORT array_parser │ │ │ │ │ - 47{ │ │ │ │ │ - 48public: │ │ │ │ │ -50 enum juncture │ │ │ │ │ - 51 { │ │ │ │ │ -53 row_start, │ │ │ │ │ -55 row_end, │ │ │ │ │ -57 null_value, │ │ │ │ │ -59 string_value, │ │ │ │ │ -61 done, │ │ │ │ │ - 62 }; │ │ │ │ │ + 25 │ │ │ │ │ + 26// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ + 27 │ │ │ │ │ + 28namespace pqxx │ │ │ │ │ + 29{ │ │ │ │ │ + 30 │ │ │ │ │ + 32 │ │ │ │ │ +48class PQXX_LIBEXPORT pipeline : public internal::transactionfocus │ │ │ │ │ + 49{ │ │ │ │ │ + 50public: │ │ │ │ │ +51 using query_id = long; │ │ │ │ │ + 52 │ │ │ │ │ +53 pipeline(const pipeline &) =delete; │ │ │ │ │ +54 pipeline &operator=(const pipeline &) =delete; │ │ │ │ │ + 55 │ │ │ │ │ + 56 explicit pipeline( //[t69] │ │ │ │ │ + 57 transaction_base &, │ │ │ │ │ + 58 const std::string &Name=std::string{}); │ │ │ │ │ + 59 │ │ │ │ │ + 60 ~pipeline() noexcept; │ │ │ │ │ + 61 │ │ │ │ │ 63 │ │ │ │ │ - 64// XXX: Actually _pass_ encoding group! │ │ │ │ │ - 66 explicit array_parser( │ │ │ │ │ - 67 const char input[], │ │ │ │ │ - 68 internal::encoding_group=internal::encoding_group::MONOBYTE); │ │ │ │ │ - 69 │ │ │ │ │ - 71 │ │ │ │ │ - 76 std::pair get_next(); │ │ │ │ │ - 77 │ │ │ │ │ - 78private: │ │ │ │ │ - 79 const char *const m_input; │ │ │ │ │ - 80 const std::string::size_type m_end; │ │ │ │ │ - 81 internal::glyph_scanner_func *const m_scan; │ │ │ │ │ - 82 │ │ │ │ │ - 84 std::string::size_type m_pos; │ │ │ │ │ - 85 │ │ │ │ │ - 86 std::string::size_type scan_single_quoted_string() const; │ │ │ │ │ - 87 std::string parse_single_quoted_string(std::string::size_type end) const; │ │ │ │ │ - 88 std::string::size_type scan_double_quoted_string() const; │ │ │ │ │ - 89 std::string parse_double_quoted_string(std::string::size_type end) const; │ │ │ │ │ - 90 std::string::size_type scan_unquoted_string() const; │ │ │ │ │ - 91 std::string parse_unquoted_string(std::string::size_type end) const; │ │ │ │ │ - 92 │ │ │ │ │ - 93 std::string::size_type scan_glyph(std::string::size_type pos) const; │ │ │ │ │ - 94 std::string::size_type scan_glyph( │ │ │ │ │ - 95 std::string::size_type pos, │ │ │ │ │ - 96 std::string::size_type end) const; │ │ │ │ │ - 97}; │ │ │ │ │ - 98} // namespace pqxx │ │ │ │ │ - 99 │ │ │ │ │ - 100#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 101#endif │ │ │ │ │ + 69 query_id insert(const std::string &); //[t69] │ │ │ │ │ + 70 │ │ │ │ │ + 72 │ │ │ │ │ + 73 void complete(); //[t71] │ │ │ │ │ + 74 │ │ │ │ │ + 76 │ │ │ │ │ + 85 void flush(); //[t70] │ │ │ │ │ + 86 │ │ │ │ │ + 88 │ │ │ │ │ + 96 void cancel(); │ │ │ │ │ + 97 │ │ │ │ │ + 99 bool is_finished(query_id) const; //[t71] │ │ │ │ │ + 100 │ │ │ │ │ + 102 │ │ │ │ │ +108 result retrieve(query_id qid) //[t71] │ │ │ │ │ + 109 { return retrieve(m_queries.find(qid)).second; } │ │ │ │ │ + 110 │ │ │ │ │ + 112 │ │ │ │ │ + 113 std::pair retrieve(); //[t69] │ │ │ │ │ + 114 │ │ │ │ │ +115 bool empty() const noexcept { return m_queries.empty(); } //[t69] │ │ │ │ │ + 116 │ │ │ │ │ + 118 │ │ │ │ │ + 129 int retain(int retain_max=2); //[t70] │ │ │ │ │ + 130 │ │ │ │ │ + 131 │ │ │ │ │ + 133 void resume(); //[t70] │ │ │ │ │ + 134 │ │ │ │ │ + 135private: │ │ │ │ │ + 136 class PQXX_PRIVATE Query │ │ │ │ │ + 137 { │ │ │ │ │ + 138 public: │ │ │ │ │ + 139 explicit Query(const std::string &q) : m_query{q}, m_res{} {} │ │ │ │ │ + 140 │ │ │ │ │ + 141 const result &get_result() const noexcept { return m_res; } │ │ │ │ │ + 142 void set_result(const result &r) noexcept { m_res = r; } │ │ │ │ │ + 143 const std::string &get_query() const noexcept { return m_query; } │ │ │ │ │ + 144 │ │ │ │ │ + 145 private: │ │ │ │ │ + 146 std::string m_query; │ │ │ │ │ + 147 result m_res; │ │ │ │ │ + 148 }; │ │ │ │ │ + 149 │ │ │ │ │ + 150 using QueryMap = std::map; │ │ │ │ │ + 151 │ │ │ │ │ + 152 void attach(); │ │ │ │ │ + 153 void detach(); │ │ │ │ │ + 154 │ │ │ │ │ + 156 static constexpr query_id qid_limit() noexcept │ │ │ │ │ + 157 { │ │ │ │ │ + 158 // Parenthesise this to work around an eternal Visual C++ problem: │ │ │ │ │ + 159 // Without the extra parentheses, unless NOMINMAX is defined, the │ │ │ │ │ + 160 // preprocessor will mistake this "max" for its annoying built-in macro │ │ │ │ │ + 161 // of the same name. │ │ │ │ │ + 162 return (std::numeric_limits::max)(); │ │ │ │ │ + 163 } │ │ │ │ │ + 164 │ │ │ │ │ + 166 PQXX_PRIVATE query_id generate_id(); │ │ │ │ │ + 167 │ │ │ │ │ + 168 bool have_pending() const noexcept │ │ │ │ │ + 169 { return m_issuedrange.second != m_issuedrange.first; } │ │ │ │ │ + 170 │ │ │ │ │ + 171 PQXX_PRIVATE void issue(); │ │ │ │ │ + 172 │ │ │ │ │ + 174 void set_error_at(query_id qid) noexcept │ │ │ │ │ + 175 { if (qid < m_error) m_error = qid; } │ │ │ │ │ + 176 │ │ │ │ │ + 178 [[noreturn]] PQXX_PRIVATE void internal_error(const std::string &err); │ │ │ │ │ + 179 │ │ │ │ │ + 180 PQXX_PRIVATE bool obtain_result(bool expect_none=false); │ │ │ │ │ + 181 │ │ │ │ │ + 182 PQXX_PRIVATE void obtain_dummy(); │ │ │ │ │ + 183 PQXX_PRIVATE void get_further_available_results(); │ │ │ │ │ + 184 PQXX_PRIVATE void check_end_results(); │ │ │ │ │ + 185 │ │ │ │ │ + 187 PQXX_PRIVATE void receive_if_available(); │ │ │ │ │ + 188 │ │ │ │ │ + 190 PQXX_PRIVATE void receive(pipeline::QueryMap::const_iterator stop); │ │ │ │ │ + 191 std::pair │ │ │ │ │ + 192 retrieve(pipeline::QueryMap::iterator); │ │ │ │ │ + 193 │ │ │ │ │ + 194 QueryMap m_queries; │ │ │ │ │ + 195 std::pair m_issuedrange; │ │ │ │ │ + 196 int m_retain = 0; │ │ │ │ │ + 197 int m_num_waiting = 0; │ │ │ │ │ + 198 query_id m_q_id = 0; │ │ │ │ │ + 199 │ │ │ │ │ + 201 bool m_dummy_pending = false; │ │ │ │ │ + 202 │ │ │ │ │ + 204 query_id m_error = qid_limit(); │ │ │ │ │ + 205}; │ │ │ │ │ + 206 │ │ │ │ │ + 207} // namespace │ │ │ │ │ + 208 │ │ │ │ │ + 209#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 210#endif │ │ │ │ │ +std │ │ │ │ │ +STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::array_parser │ │ │ │ │ -Low-level array parser. │ │ │ │ │ -Definition: array.hxx:47 │ │ │ │ │ -pqxx::array_parser::juncture │ │ │ │ │ -juncture │ │ │ │ │ -What's the latest thing found in the array? │ │ │ │ │ -Definition: array.hxx:51 │ │ │ │ │ -pqxx::array_parser::string_value │ │ │ │ │ -@ string_value │ │ │ │ │ -Found a string value. │ │ │ │ │ -Definition: array.hxx:59 │ │ │ │ │ -pqxx::array_parser::row_end │ │ │ │ │ -@ row_end │ │ │ │ │ -Ending the current row. │ │ │ │ │ -Definition: array.hxx:55 │ │ │ │ │ -pqxx::array_parser::done │ │ │ │ │ -@ done │ │ │ │ │ -Parsing has completed. │ │ │ │ │ -Definition: array.hxx:61 │ │ │ │ │ -pqxx::array_parser::row_start │ │ │ │ │ -@ row_start │ │ │ │ │ -Starting a new row. │ │ │ │ │ -Definition: array.hxx:53 │ │ │ │ │ -pqxx::array_parser::null_value │ │ │ │ │ -@ null_value │ │ │ │ │ -Found a NULL value. │ │ │ │ │ -Definition: array.hxx:57 │ │ │ │ │ +pqxx::pipeline │ │ │ │ │ +Processes several queries in FIFO manner, optimized for high throughput. │ │ │ │ │ +Definition: pipeline.hxx:49 │ │ │ │ │ +pqxx::pipeline::operator= │ │ │ │ │ +pipeline & operator=(const pipeline &)=delete │ │ │ │ │ +pqxx::pipeline::empty │ │ │ │ │ +bool empty() const noexcept │ │ │ │ │ +Definition: pipeline.hxx:115 │ │ │ │ │ +pqxx::pipeline::pipeline │ │ │ │ │ +pipeline(const pipeline &)=delete │ │ │ │ │ +pqxx::pipeline::query_id │ │ │ │ │ +long query_id │ │ │ │ │ +Definition: pipeline.hxx:51 │ │ │ │ │ +pqxx::result │ │ │ │ │ +Result set containing data returned by a query or command. │ │ │ │ │ +Definition: result.hxx:70 │ │ │ │ │ +pqxx::internal::transactionfocus │ │ │ │ │ +Definition: transaction_base.hxx:44 │ │ │ │ │ +pqxx::transaction_base │ │ │ │ │ +Interface definition (and common code) for "transaction" classes. │ │ │ │ │ +Definition: transaction_base.hxx:138 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * array.hxx │ │ │ │ │ + * pipeline.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00080_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: config-internal-autotools.h Source File │ │ │ │ +libpqxx: nontransaction.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,30 +55,65 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
config-internal-autotools.h
│ │ │ │ +
nontransaction.hxx
│ │ │ │
│ │ │ │
│ │ │ │ -
1/* Automatically generated from config.h: internal/autotools config. */
│ │ │ │ -
2
│ │ │ │ -
3#define PACKAGE "libpqxx"
│ │ │ │ -
4#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen"
│ │ │ │ -
5#define PACKAGE_NAME "libpqxx"
│ │ │ │ -
6#define PACKAGE_STRING "libpqxx 6.4.5"
│ │ │ │ -
7#define PACKAGE_TARNAME "libpqxx"
│ │ │ │ -
8#define PACKAGE_VERSION "6.4.5"
│ │ │ │ -
9#define VERSION "6.4.5"
│ │ │ │ +
1
│ │ │ │ +
13#ifndef PQXX_H_NONTRANSACTION
│ │ │ │ +
14#define PQXX_H_NONTRANSACTION
│ │ │ │ +
15
│ │ │ │ +
16#include "pqxx/compiler-public.hxx"
│ │ │ │ +
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
18
│ │ │ │ +
19#include "pqxx/connection_base.hxx"
│ │ │ │ +
20#include "pqxx/result.hxx"
│ │ │ │ +
21#include "pqxx/transaction_base.hxx"
│ │ │ │ +
22
│ │ │ │ +
23// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ +
24
│ │ │ │ +
25namespace pqxx
│ │ │ │ +
26{
│ │ │ │ +
27
│ │ │ │ +
29
│ │ │ │ +
54class PQXX_LIBEXPORT nontransaction : public transaction_base
│ │ │ │ +
55{
│ │ │ │ +
56public:
│ │ │ │ +
58
│ │ │ │ +
63 explicit nontransaction( //[t14]
│ │ │ │ + │ │ │ │ +
65 const std::string &Name=std::string{}) :
│ │ │ │ +
66 namedclass{"nontransaction", Name}, transaction_base{C} { Begin(); }
│ │ │ │ +
67
│ │ │ │ +
68 virtual ~nontransaction(); //[t14]
│ │ │ │ +
69
│ │ │ │ +
70private:
│ │ │ │ +
71 virtual void do_begin() override {} //[t14]
│ │ │ │ +
72 virtual result do_exec(const char C[]) override; //[t14]
│ │ │ │ +
73 virtual void do_commit() override {} //[t14]
│ │ │ │ +
74 virtual void do_abort() override {} //[t14]
│ │ │ │ +
75};
│ │ │ │ +
76
│ │ │ │ +
77} // namespace pqxx
│ │ │ │ +
78
│ │ │ │ +
79#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
80#endif
│ │ │ │ +
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ +
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ +
Simple "transaction" class offering no transactional integrity.
Definition: nontransaction.hxx:55
│ │ │ │ +
nontransaction(connection_base &C, const std::string &Name=std::string{})
Constructor.
Definition: nontransaction.hxx:63
│ │ │ │ +
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,21 +1,67 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -config-internal-autotools.h │ │ │ │ │ - 1/* Automatically generated from config.h: internal/autotools config. */ │ │ │ │ │ - 2 │ │ │ │ │ - 3#define PACKAGE "libpqxx" │ │ │ │ │ - 4#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen" │ │ │ │ │ - 5#define PACKAGE_NAME "libpqxx" │ │ │ │ │ - 6#define PACKAGE_STRING "libpqxx 6.4.5" │ │ │ │ │ - 7#define PACKAGE_TARNAME "libpqxx" │ │ │ │ │ - 8#define PACKAGE_VERSION "6.4.5" │ │ │ │ │ - 9#define VERSION "6.4.5" │ │ │ │ │ +nontransaction.hxx │ │ │ │ │ + 1 │ │ │ │ │ + 13#ifndef PQXX_H_NONTRANSACTION │ │ │ │ │ + 14#define PQXX_H_NONTRANSACTION │ │ │ │ │ + 15 │ │ │ │ │ + 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 18 │ │ │ │ │ + 19#include "pqxx/connection_base.hxx" │ │ │ │ │ + 20#include "pqxx/result.hxx" │ │ │ │ │ + 21#include "pqxx/transaction_base.hxx" │ │ │ │ │ + 22 │ │ │ │ │ + 23// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ + 24 │ │ │ │ │ + 25namespace pqxx │ │ │ │ │ + 26{ │ │ │ │ │ + 27 │ │ │ │ │ + 29 │ │ │ │ │ +54class PQXX_LIBEXPORT nontransaction : public transaction_base │ │ │ │ │ + 55{ │ │ │ │ │ + 56public: │ │ │ │ │ + 58 │ │ │ │ │ +63 explicit nontransaction( //[t14] │ │ │ │ │ + 64 connection_base &C, │ │ │ │ │ + 65 const std::string &Name=std::string{}) : │ │ │ │ │ + 66 namedclass{"nontransaction", Name}, transaction_base{C} { Begin(); } │ │ │ │ │ + 67 │ │ │ │ │ + 68 virtual ~nontransaction(); //[t14] │ │ │ │ │ + 69 │ │ │ │ │ + 70private: │ │ │ │ │ + 71 virtual void do_begin() override {} //[t14] │ │ │ │ │ + 72 virtual result do_exec(const char C[]) override; //[t14] │ │ │ │ │ + 73 virtual void do_commit() override {} //[t14] │ │ │ │ │ + 74 virtual void do_abort() override {} //[t14] │ │ │ │ │ + 75}; │ │ │ │ │ + 76 │ │ │ │ │ + 77} // namespace pqxx │ │ │ │ │ + 78 │ │ │ │ │ + 79#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 80#endif │ │ │ │ │ +pqxx │ │ │ │ │ +The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ +Definition: array.hxx:26 │ │ │ │ │ +pqxx::connection_base │ │ │ │ │ +connection_base abstract base class; represents a connection to a database. │ │ │ │ │ +Definition: connection_base.hxx:140 │ │ │ │ │ +pqxx::nontransaction │ │ │ │ │ +Simple "transaction" class offering no transactional integrity. │ │ │ │ │ +Definition: nontransaction.hxx:55 │ │ │ │ │ +pqxx::nontransaction::nontransaction │ │ │ │ │ +nontransaction(connection_base &C, const std::string &Name=std::string{}) │ │ │ │ │ +Constructor. │ │ │ │ │ +Definition: nontransaction.hxx:63 │ │ │ │ │ +pqxx::transaction_base │ │ │ │ │ +Interface definition (and common code) for "transaction" classes. │ │ │ │ │ +Definition: transaction_base.hxx:138 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * config-internal-autotools.h │ │ │ │ │ + * nontransaction.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00083_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: transaction_base.hxx Source File │ │ │ │ +libpqxx: tablestream.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,461 +55,76 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
transaction_base.hxx
│ │ │ │ +
tablestream.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
14#ifndef PQXX_H_TRANSACTION_BASE
│ │ │ │ -
15#define PQXX_H_TRANSACTION_BASE
│ │ │ │ -
16
│ │ │ │ -
17#include "pqxx/compiler-public.hxx"
│ │ │ │ -
18#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
13#ifndef PQXX_H_TABLESTREAM
│ │ │ │ +
14#define PQXX_H_TABLESTREAM
│ │ │ │ +
15
│ │ │ │ +
16#include "pqxx/compiler-public.hxx"
│ │ │ │ +
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
18#include "pqxx/transaction_base.hxx"
│ │ │ │
19
│ │ │ │ -
20/* End-user programs need not include this file, unless they define their own
│ │ │ │ -
21 * transaction classes. This is not something the typical program should want
│ │ │ │ -
22 * to do.
│ │ │ │ -
23 *
│ │ │ │ -
24 * However, reading this file is worthwhile because it defines the public
│ │ │ │ -
25 * interface for the available transaction classes such as transaction and
│ │ │ │ -
26 * nontransaction.
│ │ │ │ -
27 */
│ │ │ │ -
28
│ │ │ │ -
29#include "pqxx/connection_base.hxx"
│ │ │ │ -
30#include "pqxx/internal/encoding_group.hxx"
│ │ │ │ -
31#include "pqxx/isolation.hxx"
│ │ │ │ -
32#include "pqxx/result.hxx"
│ │ │ │ -
33#include "pqxx/row.hxx"
│ │ │ │ -
34
│ │ │ │ -
35// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ -
36
│ │ │ │ -
37namespace pqxx
│ │ │ │ -
38{
│ │ │ │ -
39namespace internal
│ │ │ │ -
40{
│ │ │ │ -
41class sql_cursor;
│ │ │ │ -
42
│ │ │ │ -
43class PQXX_LIBEXPORT transactionfocus : public virtual namedclass
│ │ │ │ -
44{
│ │ │ │ -
45public:
│ │ │ │ - │ │ │ │ -
47 namedclass{"transactionfocus"},
│ │ │ │ -
48 m_trans{t},
│ │ │ │ -
49 m_registered{false}
│ │ │ │ -
50 {
│ │ │ │ -
51 }
│ │ │ │ -
52
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
56
│ │ │ │ -
57protected:
│ │ │ │ -
58 void register_me();
│ │ │ │ -
59 void unregister_me() noexcept;
│ │ │ │ -
60 void reg_pending_error(const std::string &) noexcept;
│ │ │ │ -
61 bool registered() const noexcept { return m_registered; }
│ │ │ │ -
62
│ │ │ │ - │ │ │ │ -
64
│ │ │ │ -
65private:
│ │ │ │ -
66 bool m_registered;
│ │ │ │ -
67};
│ │ │ │ -
68
│ │ │ │ -
69
│ │ │ │ -
71
│ │ │ │ -
73class PQXX_LIBEXPORT parameterized_invocation : statement_parameters
│ │ │ │ -
74{
│ │ │ │ -
75public:
│ │ │ │ -
76 PQXX_DEPRECATED parameterized_invocation(
│ │ │ │ -
77 connection_base &, const std::string &query);
│ │ │ │ -
78
│ │ │ │ -
79 parameterized_invocation &operator()() { add_param(); return *this; }
│ │ │ │ - │ │ │ │ -
81 { add_binary_param(v, true); return *this; }
│ │ │ │ -
82 template<typename T> parameterized_invocation &operator()(const T &v)
│ │ │ │ -
83 { add_param(v, true); return *this; }
│ │ │ │ - │ │ │ │ -
85 { add_binary_param(v, nonnull); return *this; }
│ │ │ │ -
86 template<typename T>
│ │ │ │ -
87 parameterized_invocation &operator()(const T &v, bool nonnull)
│ │ │ │ -
88 { add_param(v, nonnull); return *this; }
│ │ │ │ -
89
│ │ │ │ -
90 result exec();
│ │ │ │ -
91
│ │ │ │ -
92private:
│ │ │ │ - │ │ │ │ -
95 =delete;
│ │ │ │ -
96
│ │ │ │ -
97 connection_base &m_home;
│ │ │ │ -
98 const std::string m_query;
│ │ │ │ -
99};
│ │ │ │ -
100} // namespace internal
│ │ │ │ -
101
│ │ │ │ -
102
│ │ │ │ -
103namespace internal
│ │ │ │ -
104{
│ │ │ │ -
105namespace gate
│ │ │ │ -
106{
│ │ │ │ -
107class transaction_subtransaction;
│ │ │ │ -
108class transaction_tablereader;
│ │ │ │ -
109class transaction_sql_cursor;
│ │ │ │ -
110class transaction_stream_from;
│ │ │ │ -
111class transaction_tablewriter;
│ │ │ │ -
112class transaction_stream_to;
│ │ │ │ -
113class transaction_transactionfocus;
│ │ │ │ -
114} // namespace internal::gate
│ │ │ │ -
115} // namespace internal
│ │ │ │ -
116
│ │ │ │ -
117
│ │ │ │ -
131
│ │ │ │ -
136class PQXX_LIBEXPORT PQXX_NOVTABLE transaction_base :
│ │ │ │ -
137 public virtual internal::namedclass
│ │ │ │ -
138{
│ │ │ │ -
139public:
│ │ │ │ - │ │ │ │ -
142
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
146
│ │ │ │ -
147 virtual ~transaction_base() =0; //[t01]
│ │ │ │ -
148
│ │ │ │ -
150
│ │ │ │ -
162 void commit(); //[t01]
│ │ │ │ -
163
│ │ │ │ -
165
│ │ │ │ -
168 void abort(); //[t10]
│ │ │ │ -
169
│ │ │ │ -
175 std::string esc(const char str[]) const { return conn().esc(str); }
│ │ │ │ -
177 std::string esc(const char str[], size_t maxlen) const
│ │ │ │ -
178 { return conn().esc(str, maxlen); }
│ │ │ │ -
180 std::string esc(const std::string &str) const { return conn().esc(str); }
│ │ │ │ -
181
│ │ │ │ -
183
│ │ │ │ -
194 std::string esc_raw(const unsigned char data[], size_t len) const //[t62]
│ │ │ │ -
195 { return conn().esc_raw(data, len); }
│ │ │ │ -
197 std::string esc_raw(const std::string &) const; //[t62]
│ │ │ │ -
198
│ │ │ │ -
200
│ │ │ │ -
203 std::string unesc_raw(const std::string &text) const
│ │ │ │ -
204 { return conn().unesc_raw(text); }
│ │ │ │ -
205
│ │ │ │ -
207
│ │ │ │ -
210 std::string unesc_raw(const char *text) const
│ │ │ │ -
211 { return conn().unesc_raw(text); }
│ │ │ │ -
212
│ │ │ │ -
214
│ │ │ │ -
215 template<typename T> std::string quote(const T &t) const
│ │ │ │ -
216 { return conn().quote(t); }
│ │ │ │ -
217
│ │ │ │ -
219 std::string quote_raw(const unsigned char str[], size_t len) const
│ │ │ │ -
220 { return conn().quote_raw(str, len); }
│ │ │ │ -
221
│ │ │ │ -
222 std::string quote_raw(const std::string &str) const;
│ │ │ │ -
223
│ │ │ │ -
225 std::string quote_name(const std::string &identifier) const
│ │ │ │ -
226 { return conn().quote_name(identifier); }
│ │ │ │ -
227
│ │ │ │ -
229 std::string esc_like(const std::string &str, char escape_char='\\') const
│ │ │ │ -
230 { return conn().esc_like(str, escape_char); }
│ │ │ │ -
232
│ │ │ │ -
234
│ │ │ │ -
249 result exec(
│ │ │ │ -
250 const std::string &Query,
│ │ │ │ -
251 const std::string &Desc=std::string{}); //[t01]
│ │ │ │ -
252
│ │ │ │ - │ │ │ │ -
254 const std::stringstream &Query,
│ │ │ │ -
255 const std::string &Desc=std::string{})
│ │ │ │ -
256 { return exec(Query.str(), Desc); }
│ │ │ │ -
257
│ │ │ │ -
259
│ │ │ │ - │ │ │ │ -
265 const std::string &Query,
│ │ │ │ -
266 const std::string &Desc=std::string{})
│ │ │ │ -
267 { return exec_n(0, Query, Desc); }
│ │ │ │ -
268
│ │ │ │ -
270
│ │ │ │ -
276 row exec1(const std::string &Query, const std::string &Desc=std::string{})
│ │ │ │ -
277 { return exec_n(1, Query, Desc).front(); }
│ │ │ │ -
278
│ │ │ │ -
280
│ │ │ │ -
285 result exec_n(
│ │ │ │ -
286 size_t rows,
│ │ │ │ -
287 const std::string &Query,
│ │ │ │ -
288 const std::string &Desc=std::string{});
│ │ │ │ -
289
│ │ │ │ -
320 template<typename ...Args>
│ │ │ │ -
321 result exec_params(const std::string &query, Args &&...args)
│ │ │ │ -
322 {
│ │ │ │ -
323 return internal_exec_params(
│ │ │ │ -
324 query, internal::params(std::forward<Args>(args)...));
│ │ │ │ -
325 }
│ │ │ │ -
326
│ │ │ │ -
327 // Execute parameterised statement, expect a single-row result.
│ │ │ │ -
330 template<typename ...Args>
│ │ │ │ -
331 row exec_params1(const std::string &query, Args&&... args)
│ │ │ │ -
332 {
│ │ │ │ -
333 return exec_params_n(1, query, std::forward<Args>(args)...).front();
│ │ │ │ -
334 }
│ │ │ │ -
335
│ │ │ │ -
336 // Execute parameterised statement, expect a result with zero rows.
│ │ │ │ -
339 template<typename ...Args>
│ │ │ │ -
340 result exec_params0(const std::string &query, Args &&...args)
│ │ │ │ -
341 {
│ │ │ │ -
342 return exec_params_n(0, query, std::forward<Args>(args)...);
│ │ │ │ -
343 }
│ │ │ │ -
344
│ │ │ │ -
345 // Execute parameterised statement, expect exactly a given number of rows.
│ │ │ │ -
348 template<typename ...Args>
│ │ │ │ -
349 result exec_params_n(size_t rows, const std::string &query, Args &&...args)
│ │ │ │ -
350 {
│ │ │ │ -
351 const auto r = exec_params(query, std::forward<Args>(args)...);
│ │ │ │ -
352 check_rowcount_params(rows, r.size());
│ │ │ │ -
353 return r;
│ │ │ │ -
354 }
│ │ │ │ -
355
│ │ │ │ -
357 /* Use this to build up a parameterized statement invocation, then invoke it
│ │ │ │ -
358 * using @c exec()
│ │ │ │ -
359 *
│ │ │ │ -
360 * Example: @c trans.parameterized("SELECT $1 + 1")(1).exec();
│ │ │ │ -
361 *
│ │ │ │ -
362 * This is the old, pre-C++11 way of handling parameterised statements. As
│ │ │ │ -
363 * of libpqxx 6.0, it's made much easier using variadic templates.
│ │ │ │ -
364 */
│ │ │ │ - │ │ │ │ -
366 parameterized(const std::string &query);
│ │ │ │ -
368
│ │ │ │ -
393
│ │ │ │ -
395 template<typename ...Args>
│ │ │ │ -
396 result exec_prepared(const std::string &statement, Args&&... args)
│ │ │ │ -
397 {
│ │ │ │ -
398 return internal_exec_prepared(
│ │ │ │ -
399 statement, internal::params(std::forward<Args>(args)...));
│ │ │ │ -
400 }
│ │ │ │ -
401
│ │ │ │ -
403
│ │ │ │ -
405 template<typename ...Args>
│ │ │ │ -
406 row exec_prepared1(const std::string &statement, Args&&... args)
│ │ │ │ -
407 {
│ │ │ │ -
408 return exec_prepared_n(1, statement, std::forward<Args>(args)...).front();
│ │ │ │ -
409 }
│ │ │ │ -
410
│ │ │ │ -
412
│ │ │ │ -
414 template<typename ...Args>
│ │ │ │ -
415 result exec_prepared0(const std::string &statement, Args&&... args)
│ │ │ │ -
416 {
│ │ │ │ -
417 return exec_prepared_n(0, statement, std::forward<Args>(args)...);
│ │ │ │ -
418 }
│ │ │ │ -
419
│ │ │ │ -
421
│ │ │ │ -
424 template<typename ...Args>
│ │ │ │ - │ │ │ │ -
426 size_t rows,
│ │ │ │ -
427 const std::string &statement,
│ │ │ │ -
428 Args&&... args)
│ │ │ │ -
429 {
│ │ │ │ -
430 const auto r = exec_prepared(statement, std::forward<Args>(args)...);
│ │ │ │ -
431 check_rowcount_prepared(statement, rows, r.size());
│ │ │ │ -
432 return r;
│ │ │ │ -
433 }
│ │ │ │ -
434
│ │ │ │ -
436
│ │ │ │ -
474 PQXX_DEPRECATED prepare::invocation
│ │ │ │ -
475 prepared(const std::string &statement=std::string{});
│ │ │ │ -
476
│ │ │ │ -
478
│ │ │ │ -
484 void process_notice(const char Msg[]) const //[t14]
│ │ │ │ -
485 { m_conn.process_notice(Msg); }
│ │ │ │ -
487 void process_notice(const std::string &Msg) const //[t14]
│ │ │ │ -
488 { m_conn.process_notice(Msg); }
│ │ │ │ -
490
│ │ │ │ -
492 connection_base &conn() const { return m_conn; } //[t04]
│ │ │ │ -
493
│ │ │ │ -
495
│ │ │ │ -
502 void set_variable(const std::string &Var, const std::string &Val); //[t61]
│ │ │ │ -
503
│ │ │ │ -
505
│ │ │ │ -
514 std::string get_variable(const std::string &); //[t61]
│ │ │ │ -
515
│ │ │ │ -
516protected:
│ │ │ │ -
518
│ │ │ │ -
524 explicit transaction_base(connection_base &c, bool direct=true);
│ │ │ │ -
525
│ │ │ │ -
527
│ │ │ │ -
529 void Begin();
│ │ │ │ -
530
│ │ │ │ -
532 void End() noexcept;
│ │ │ │ -
533
│ │ │ │ -
535 virtual void do_begin() =0;
│ │ │ │ -
537 virtual result do_exec(const char Query[]) =0;
│ │ │ │ -
539 virtual void do_commit() =0;
│ │ │ │ -
541 virtual void do_abort() =0;
│ │ │ │ -
542
│ │ │ │ -
543 // For use by implementing class:
│ │ │ │ -
544
│ │ │ │ -
546
│ │ │ │ -
554 result direct_exec(const char C[], int Retries=0);
│ │ │ │ -
555
│ │ │ │ -
557 void reactivation_avoidance_clear() noexcept
│ │ │ │ -
558 {m_reactivation_avoidance.clear();}
│ │ │ │ -
559
│ │ │ │ -
560protected:
│ │ │ │ -
562
│ │ │ │ - │ │ │ │ -
565
│ │ │ │ -
566private:
│ │ │ │ -
567 /* A transaction goes through the following stages in its lifecycle:
│ │ │ │ -
568 * <ul>
│ │ │ │ -
569 * <li> nascent: the transaction hasn't actually begun yet. If our connection
│ │ │ │ -
570 * fails at this stage, it may recover and the transaction can attempt to
│ │ │ │ -
571 * establish itself again.
│ │ │ │ -
572 * <li> active: the transaction has begun. Since no commit command has been
│ │ │ │ -
573 * issued, abortion is implicit if the connection fails now.
│ │ │ │ -
574 * <li> aborted: an abort has been issued; the transaction is terminated and
│ │ │ │ -
575 * its changes to the database rolled back. It will accept no further
│ │ │ │ -
576 * commands.
│ │ │ │ -
577 * <li> committed: the transaction has completed successfully, meaning that a
│ │ │ │ -
578 * commit has been issued. No further commands are accepted.
│ │ │ │ -
579 * <li> in_doubt: the connection was lost at the exact wrong time, and there
│ │ │ │ -
580 * is no way of telling whether the transaction was committed or aborted.
│ │ │ │ -
581 * </ul>
│ │ │ │ -
582 *
│ │ │ │ -
583 * Checking and maintaining state machine logic is the responsibility of the
│ │ │ │ -
584 * base class (ie., this one).
│ │ │ │ -
585 */
│ │ │ │ -
586 enum Status
│ │ │ │ -
587 {
│ │ │ │ -
588 st_nascent,
│ │ │ │ -
589 st_active,
│ │ │ │ -
590 st_aborted,
│ │ │ │ -
591 st_committed,
│ │ │ │ -
592 st_in_doubt
│ │ │ │ -
593 };
│ │ │ │ -
594
│ │ │ │ -
596 PQXX_PRIVATE void activate();
│ │ │ │ -
597
│ │ │ │ -
598 PQXX_PRIVATE void CheckPendingError();
│ │ │ │ -
599
│ │ │ │ -
600 template<typename T> bool parm_is_null(T *p) const noexcept
│ │ │ │ -
601 { return p == nullptr; }
│ │ │ │ -
602 template<typename T> bool parm_is_null(T) const noexcept
│ │ │ │ -
603 { return false; }
│ │ │ │ -
604
│ │ │ │ -
605 result internal_exec_prepared(
│ │ │ │ -
606 const std::string &statement,
│ │ │ │ -
607 const internal::params &args);
│ │ │ │ -
608
│ │ │ │ -
609 result internal_exec_params(
│ │ │ │ -
610 const std::string &query,
│ │ │ │ -
611 const internal::params &args);
│ │ │ │ -
612
│ │ │ │ -
614 void check_rowcount_prepared(
│ │ │ │ -
615 const std::string &statement,
│ │ │ │ -
616 size_t expected_rows,
│ │ │ │ -
617 size_t actual_rows);
│ │ │ │ -
618
│ │ │ │ -
620 void check_rowcount_params(
│ │ │ │ -
621 size_t expected_rows, size_t actual_rows);
│ │ │ │ -
622
│ │ │ │ -
623 friend class pqxx::internal::gate::transaction_transactionfocus;
│ │ │ │ -
624 PQXX_PRIVATE void register_focus(internal::transactionfocus *);
│ │ │ │ -
625 PQXX_PRIVATE void unregister_focus(internal::transactionfocus *) noexcept;
│ │ │ │ -
626 PQXX_PRIVATE void register_pending_error(const std::string &) noexcept;
│ │ │ │ -
627
│ │ │ │ -
628 friend class pqxx::internal::gate::transaction_tablereader;
│ │ │ │ -
629 friend class pqxx::internal::gate::transaction_stream_from;
│ │ │ │ -
630 PQXX_PRIVATE void BeginCopyRead(const std::string &, const std::string &);
│ │ │ │ -
631 bool read_copy_line(std::string &);
│ │ │ │ -
632
│ │ │ │ -
633 friend class pqxx::internal::gate::transaction_tablewriter;
│ │ │ │ -
634 friend class pqxx::internal::gate::transaction_stream_to;
│ │ │ │ -
635 PQXX_PRIVATE void BeginCopyWrite(
│ │ │ │ -
636 const std::string &Table,
│ │ │ │ -
637 const std::string &Columns);
│ │ │ │ -
638 void write_copy_line(const std::string &);
│ │ │ │ -
639 void end_copy_write();
│ │ │ │ -
640
│ │ │ │ -
641 friend class pqxx::internal::gate::transaction_subtransaction;
│ │ │ │ -
642
│ │ │ │ -
643 connection_base &m_conn;
│ │ │ │ -
644
│ │ │ │ - │ │ │ │ -
646 Status m_status = st_nascent;
│ │ │ │ -
647 bool m_registered = false;
│ │ │ │ -
648 std::map<std::string, std::string> m_vars;
│ │ │ │ -
649 std::string m_pending_error;
│ │ │ │ -
650};
│ │ │ │ -
651
│ │ │ │ -
652} // namespace pqxx
│ │ │ │ -
653
│ │ │ │ -
654#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
655#endif
│ │ │ │ -
std::string esc(const char str[]) const
Escape string for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:175
│ │ │ │ -
STL namespace.
│ │ │ │ +
20
│ │ │ │ +
21namespace pqxx
│ │ │ │ +
22{
│ │ │ │ +
24
│ │ │ │ +
26class PQXX_LIBEXPORT PQXX_NOVTABLE tablestream :
│ │ │ │ + │ │ │ │ +
28{
│ │ │ │ +
29public:
│ │ │ │ +
30 explicit tablestream(
│ │ │ │ +
31 transaction_base &Trans,
│ │ │ │ +
32 const std::string &Null=std::string{});
│ │ │ │ +
33 virtual ~tablestream() noexcept =0;
│ │ │ │ +
34 virtual void complete() =0;
│ │ │ │ +
35protected:
│ │ │ │ +
36 const std::string &NullStr() const { return m_null; }
│ │ │ │ +
37 bool is_finished() const noexcept { return m_finished; }
│ │ │ │ +
38 void base_close();
│ │ │ │ +
39 template<typename ITER>
│ │ │ │ +
40 static std::string columnlist(ITER colbegin, ITER colend);
│ │ │ │ +
41private:
│ │ │ │ +
42 std::string m_null;
│ │ │ │ +
43 bool m_finished = false;
│ │ │ │ +
44
│ │ │ │ +
45 tablestream() =delete;
│ │ │ │ +
46 tablestream(const tablestream &) =delete;
│ │ │ │ +
47 tablestream &operator=(const tablestream &) =delete;
│ │ │ │ +
48};
│ │ │ │ +
49
│ │ │ │ +
50
│ │ │ │ +
51template<typename ITER> inline
│ │ │ │ +
52std::string tablestream::columnlist(ITER colbegin, ITER colend)
│ │ │ │ +
53{
│ │ │ │ +
54 return separated_list(",", colbegin, colend);
│ │ │ │ +
55}
│ │ │ │ +
56} // namespace pqxx
│ │ │ │ +
57
│ │ │ │ +
58#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
59#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
│ │ │ │ -
Definition: connection_base.hxx:49
│ │ │ │ -
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ -
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
│ │ │ │ -
Helper class for passing parameters to, and executing, prepared statements.
Definition: prepared_statement.hxx:82
│ │ │ │ -
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ -
void clear() noexcept
Definition: result.hxx:121
│ │ │ │ -
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │ -
reference front() const noexcept
Definition: row.cxx:59
│ │ │ │ +
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
│ │ │ │ +
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
│ │ │ │ +
virtual void complete()=0
│ │ │ │ +
const std::string & NullStr() const
Definition: tablestream.hxx:36
│ │ │ │ +
bool is_finished() const noexcept
Definition: tablestream.hxx:37
│ │ │ │ +
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
│ │ │ │
Definition: transaction_base.hxx:44
│ │ │ │ - │ │ │ │ -
transactionfocus(const transactionfocus &)=delete
│ │ │ │ -
transactionfocus & operator=(const transactionfocus &)=delete
│ │ │ │ -
transactionfocus(transaction_base &t)
Definition: transaction_base.hxx:46
│ │ │ │ -
transaction_base & m_trans
Definition: transaction_base.hxx:63
│ │ │ │ -
Helper class to construct an invocation of a parameterised statement.
Definition: transaction_base.hxx:74
│ │ │ │ -
parameterized_invocation & operator()(const binarystring &v, bool nonnull)
Definition: transaction_base.hxx:84
│ │ │ │ -
parameterized_invocation & operator()(const binarystring &v)
Definition: transaction_base.hxx:80
│ │ │ │ -
parameterized_invocation & operator()(const T &v)
Definition: transaction_base.hxx:82
│ │ │ │ -
parameterized_invocation & operator()()
Definition: transaction_base.hxx:79
│ │ │ │ -
parameterized_invocation & operator()(const T &v, bool nonnull)
Definition: transaction_base.hxx:87
│ │ │ │
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │ -
result exec_params(const std::string &query, Args &&...args)
Execute an SQL statement with parameters.
Definition: transaction_base.hxx:321
│ │ │ │ -
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
│ │ │ │ -
result exec_params_n(size_t rows, const std::string &query, Args &&...args)
Definition: transaction_base.hxx:349
│ │ │ │ -
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
│ │ │ │ -
result exec(const std::stringstream &Query, const std::string &Desc=std::string{})
Definition: transaction_base.hxx:253
│ │ │ │ -
std::string quote(const T &t) const
Represent object as SQL string, including quoting & escaping.
Definition: transaction_base.hxx:215
│ │ │ │ -
transaction_base(const transaction_base &)=delete
│ │ │ │ -
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
│ │ │ │ -
result exec_prepared(const std::string &statement, Args &&... args)
Execute a prepared statement, with optional arguments.
Definition: transaction_base.hxx:396
│ │ │ │ -
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
│ │ │ │ -
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
│ │ │ │ -
transaction_base & operator=(const transaction_base &)=delete
│ │ │ │ -
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
│ │ │ │ -
connection_base & conn() const
Connection this transaction is running in.
Definition: transaction_base.hxx:492
│ │ │ │ -
void process_notice(const std::string &Msg) const
Have connection process warning message.
Definition: transaction_base.hxx:487
│ │ │ │ -
void process_notice(const char Msg[]) const
Have connection process warning message.
Definition: transaction_base.hxx:484
│ │ │ │ -
row exec_params1(const std::string &query, Args &&... args)
Definition: transaction_base.hxx:331
│ │ │ │ - │ │ │ │ -
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
│ │ │ │ -
result exec_params0(const std::string &query, Args &&...args)
Definition: transaction_base.hxx:340
│ │ │ │ -
std::string esc(const std::string &str) const
Escape string for use as SQL string literal in this transaction.
Definition: transaction_base.hxx:180
│ │ │ │ -
std::string quote_name(const std::string &identifier) const
Escape an SQL identifier for use in a query.
Definition: transaction_base.hxx:225
│ │ │ │ -
row exec_prepared1(const std::string &statement, Args &&... args)
Execute a prepared statement, and expect a single-row result.
Definition: transaction_base.hxx:406
│ │ │ │ -
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
│ │ │ │ -
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
│ │ │ │ -
internal::reactivation_avoidance_counter m_reactivation_avoidance
Resources allocated in this transaction that make reactivation impossible.
Definition: transaction_base.hxx:564
│ │ │ │ -
std::string esc_like(const std::string &str, char escape_char='\\') const
Escape string for literal LIKE match.
Definition: transaction_base.hxx:229
│ │ │ │ -
Helper base class: object descriptions for error messages and such.
Definition: util.hxx:234
│ │ │ │ -
Ensure proper opening/closing of GUEST objects related to a "host" object.
Definition: util.hxx:275
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,582 +1,85 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -transaction_base.hxx │ │ │ │ │ +tablestream.hxx │ │ │ │ │ 1 │ │ │ │ │ - 14#ifndef PQXX_H_TRANSACTION_BASE │ │ │ │ │ - 15#define PQXX_H_TRANSACTION_BASE │ │ │ │ │ - 16 │ │ │ │ │ - 17#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 18#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 13#ifndef PQXX_H_TABLESTREAM │ │ │ │ │ + 14#define PQXX_H_TABLESTREAM │ │ │ │ │ + 15 │ │ │ │ │ + 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 18#include "pqxx/transaction_base.hxx" │ │ │ │ │ 19 │ │ │ │ │ - 20/* End-user programs need not include this file, unless they define their │ │ │ │ │ -own │ │ │ │ │ - 21 * transaction classes. This is not something the typical program should │ │ │ │ │ -want │ │ │ │ │ - 22 * to do. │ │ │ │ │ - 23 * │ │ │ │ │ - 24 * However, reading this file is worthwhile because it defines the public │ │ │ │ │ - 25 * interface for the available transaction classes such as transaction and │ │ │ │ │ - 26 * nontransaction. │ │ │ │ │ - 27 */ │ │ │ │ │ - 28 │ │ │ │ │ - 29#include "pqxx/connection_base.hxx" │ │ │ │ │ - 30#include "pqxx/internal/encoding_group.hxx" │ │ │ │ │ - 31#include "pqxx/isolation.hxx" │ │ │ │ │ - 32#include "pqxx/result.hxx" │ │ │ │ │ - 33#include "pqxx/row.hxx" │ │ │ │ │ - 34 │ │ │ │ │ - 35// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ - 36 │ │ │ │ │ - 37namespace pqxx │ │ │ │ │ - 38{ │ │ │ │ │ - 39namespace internal │ │ │ │ │ - 40{ │ │ │ │ │ - 41class sql_cursor; │ │ │ │ │ - 42 │ │ │ │ │ -43class PQXX_LIBEXPORT transactionfocus : public virtual namedclass │ │ │ │ │ - 44{ │ │ │ │ │ - 45public: │ │ │ │ │ -46 explicit transactionfocus(transaction_base &t) : │ │ │ │ │ - 47 namedclass{"transactionfocus"}, │ │ │ │ │ - 48 m_trans{t}, │ │ │ │ │ - 49 m_registered{false} │ │ │ │ │ - 50 { │ │ │ │ │ - 51 } │ │ │ │ │ - 52 │ │ │ │ │ -53 transactionfocus() =delete; │ │ │ │ │ -54 transactionfocus(const transactionfocus &) =delete; │ │ │ │ │ -55 transactionfocus &operator=(const transactionfocus &) =delete; │ │ │ │ │ - 56 │ │ │ │ │ - 57protected: │ │ │ │ │ - 58 void register_me(); │ │ │ │ │ - 59 void unregister_me() noexcept; │ │ │ │ │ - 60 void reg_pending_error(const std::string &) noexcept; │ │ │ │ │ -61 bool registered() const noexcept { return m_registered; } │ │ │ │ │ - 62 │ │ │ │ │ -63 transaction_base &m_trans; │ │ │ │ │ - 64 │ │ │ │ │ - 65private: │ │ │ │ │ - 66 bool m_registered; │ │ │ │ │ - 67}; │ │ │ │ │ - 68 │ │ │ │ │ - 69 │ │ │ │ │ - 71 │ │ │ │ │ -73class PQXX_LIBEXPORT parameterized_invocation : statement_parameters │ │ │ │ │ - 74{ │ │ │ │ │ - 75public: │ │ │ │ │ - 76 PQXX_DEPRECATED parameterized_invocation( │ │ │ │ │ - 77 connection_base &, const std::string &query); │ │ │ │ │ - 78 │ │ │ │ │ -79 parameterized_invocation &operator()() { add_param(); return *this; } │ │ │ │ │ -80 parameterized_invocation &operator()(const binarystring &v) │ │ │ │ │ - 81 { add_binary_param(v, true); return *this; } │ │ │ │ │ -82 template parameterized_invocation &operator()(const T &v) │ │ │ │ │ - 83 { add_param(v, true); return *this; } │ │ │ │ │ -84 parameterized_invocation &operator()(const binarystring &v, bool nonnull) │ │ │ │ │ - 85 { add_binary_param(v, nonnull); return *this; } │ │ │ │ │ - 86 template │ │ │ │ │ -87 parameterized_invocation &operator()(const T &v, bool nonnull) │ │ │ │ │ - 88 { add_param(v, nonnull); return *this; } │ │ │ │ │ - 89 │ │ │ │ │ - 90 result exec(); │ │ │ │ │ - 91 │ │ │ │ │ - 92private: │ │ │ │ │ - 94 parameterized_invocation &operator=(const parameterized_invocation &) │ │ │ │ │ - 95 =delete; │ │ │ │ │ - 96 │ │ │ │ │ - 97 connection_base &m_home; │ │ │ │ │ - 98 const std::string m_query; │ │ │ │ │ - 99}; │ │ │ │ │ - 100} // namespace internal │ │ │ │ │ - 101 │ │ │ │ │ - 102 │ │ │ │ │ - 103namespace internal │ │ │ │ │ - 104{ │ │ │ │ │ - 105namespace gate │ │ │ │ │ - 106{ │ │ │ │ │ - 107class transaction_subtransaction; │ │ │ │ │ - 108class transaction_tablereader; │ │ │ │ │ - 109class transaction_sql_cursor; │ │ │ │ │ - 110class transaction_stream_from; │ │ │ │ │ - 111class transaction_tablewriter; │ │ │ │ │ - 112class transaction_stream_to; │ │ │ │ │ - 113class transaction_transactionfocus; │ │ │ │ │ - 114} // namespace internal::gate │ │ │ │ │ - 115} // namespace internal │ │ │ │ │ - 116 │ │ │ │ │ - 117 │ │ │ │ │ - 131 │ │ │ │ │ -136class PQXX_LIBEXPORT PQXX_NOVTABLE transaction_base : │ │ │ │ │ - 137 public virtual internal::namedclass │ │ │ │ │ - 138{ │ │ │ │ │ - 139public: │ │ │ │ │ -141 using isolation_tag = isolation_traits; │ │ │ │ │ - 142 │ │ │ │ │ -143 transaction_base() =delete; │ │ │ │ │ -144 transaction_base(const transaction_base &) =delete; │ │ │ │ │ -145 transaction_base &operator=(const transaction_base &) =delete; │ │ │ │ │ - 146 │ │ │ │ │ - 147 virtual ~transaction_base() =0; //[t01] │ │ │ │ │ - 148 │ │ │ │ │ - 150 │ │ │ │ │ - 162 void commit(); //[t01] │ │ │ │ │ - 163 │ │ │ │ │ - 165 │ │ │ │ │ - 168 void abort(); //[t10] │ │ │ │ │ - 169 │ │ │ │ │ -175 std::string esc(const char str[]) const { return conn().esc(str); } │ │ │ │ │ -177 std::string esc(const char str[], size_t maxlen) const │ │ │ │ │ - 178 { return conn().esc(str, maxlen); } │ │ │ │ │ -180 std::string esc(const std::string &str) const { return conn().esc(str); } │ │ │ │ │ - 181 │ │ │ │ │ - 183 │ │ │ │ │ -194 std::string esc_raw(const unsigned char data[], size_t len) const //[t62] │ │ │ │ │ - 195 { return conn().esc_raw(data, len); } │ │ │ │ │ - 197 std::string esc_raw(const std::string &) const; //[t62] │ │ │ │ │ - 198 │ │ │ │ │ - 200 │ │ │ │ │ -203 std::string unesc_raw(const std::string &text) const │ │ │ │ │ - 204 { return conn().unesc_raw(text); } │ │ │ │ │ - 205 │ │ │ │ │ - 207 │ │ │ │ │ -210 std::string unesc_raw(const char *text) const │ │ │ │ │ - 211 { return conn().unesc_raw(text); } │ │ │ │ │ - 212 │ │ │ │ │ - 214 │ │ │ │ │ -215 template std::string quote(const T &t) const │ │ │ │ │ - 216 { return conn().quote(t); } │ │ │ │ │ - 217 │ │ │ │ │ -219 std::string quote_raw(const unsigned char str[], size_t len) const │ │ │ │ │ - 220 { return conn().quote_raw(str, len); } │ │ │ │ │ - 221 │ │ │ │ │ - 222 std::string quote_raw(const std::string &str) const; │ │ │ │ │ - 223 │ │ │ │ │ -225 std::string quote_name(const std::string &identifier) const │ │ │ │ │ - 226 { return conn().quote_name(identifier); } │ │ │ │ │ - 227 │ │ │ │ │ -229 std::string esc_like(const std::string &str, char escape_char='\\') const │ │ │ │ │ - 230 { return conn().esc_like(str, escape_char); } │ │ │ │ │ - 232 │ │ │ │ │ - 234 │ │ │ │ │ - 249 result exec( │ │ │ │ │ - 250 const std::string &Query, │ │ │ │ │ - 251 const std::string &Desc=std::string{}); //[t01] │ │ │ │ │ - 252 │ │ │ │ │ -253 result exec( │ │ │ │ │ - 254 const std::stringstream &Query, │ │ │ │ │ - 255 const std::string &Desc=std::string{}) │ │ │ │ │ - 256 { return exec(Query.str(), Desc); } │ │ │ │ │ - 257 │ │ │ │ │ - 259 │ │ │ │ │ -264 result exec0( │ │ │ │ │ - 265 const std::string &Query, │ │ │ │ │ - 266 const std::string &Desc=std::string{}) │ │ │ │ │ - 267 { return exec_n(0, Query, Desc); } │ │ │ │ │ - 268 │ │ │ │ │ - 270 │ │ │ │ │ -276 row exec1(const std::string &Query, const std::string &Desc=std::string{}) │ │ │ │ │ - 277 { return exec_n(1, Query, Desc).front(); } │ │ │ │ │ - 278 │ │ │ │ │ - 280 │ │ │ │ │ - 285 result exec_n( │ │ │ │ │ - 286 size_t rows, │ │ │ │ │ - 287 const std::string &Query, │ │ │ │ │ - 288 const std::string &Desc=std::string{}); │ │ │ │ │ - 289 │ │ │ │ │ - 320 template │ │ │ │ │ -321 result exec_params(const std::string &query, Args &&...args) │ │ │ │ │ - 322 { │ │ │ │ │ - 323 return internal_exec_params( │ │ │ │ │ - 324 query, internal::params(std::forward(args)...)); │ │ │ │ │ - 325 } │ │ │ │ │ - 326 │ │ │ │ │ - 327 // Execute parameterised statement, expect a single-row result. │ │ │ │ │ - 330 template │ │ │ │ │ -331 row exec_params1(const std::string &query, Args&&... args) │ │ │ │ │ - 332 { │ │ │ │ │ - 333 return exec_params_n(1, query, std::forward(args)...).front(); │ │ │ │ │ - 334 } │ │ │ │ │ - 335 │ │ │ │ │ - 336 // Execute parameterised statement, expect a result with zero rows. │ │ │ │ │ - 339 template │ │ │ │ │ -340 result exec_params0(const std::string &query, Args &&...args) │ │ │ │ │ - 341 { │ │ │ │ │ - 342 return exec_params_n(0, query, std::forward(args)...); │ │ │ │ │ - 343 } │ │ │ │ │ - 344 │ │ │ │ │ - 345 // Execute parameterised statement, expect exactly a given number of rows. │ │ │ │ │ - 348 template │ │ │ │ │ -349 result exec_params_n(size_t rows, const std::string &query, Args &&...args) │ │ │ │ │ - 350 { │ │ │ │ │ - 351 const auto r = exec_params(query, std::forward(args)...); │ │ │ │ │ - 352 check_rowcount_params(rows, r.size()); │ │ │ │ │ - 353 return r; │ │ │ │ │ - 354 } │ │ │ │ │ - 355 │ │ │ │ │ - 357 /* Use this to build up a parameterized statement invocation, then invoke │ │ │ │ │ -it │ │ │ │ │ - 358 * using @c exec() │ │ │ │ │ - 359 * │ │ │ │ │ - 360 * Example: @c trans.parameterized("SELECT $1 + 1")(1).exec(); │ │ │ │ │ - 361 * │ │ │ │ │ - 362 * This is the old, pre-C++11 way of handling parameterised statements. As │ │ │ │ │ - 363 * of libpqxx 6.0, it's made much easier using variadic templates. │ │ │ │ │ - 364 */ │ │ │ │ │ - 365 PQXX_DEPRECATED internal::parameterized_invocation │ │ │ │ │ - 366 parameterized(const std::string &query); │ │ │ │ │ - 368 │ │ │ │ │ - 393 │ │ │ │ │ - 395 template │ │ │ │ │ -396 result exec_prepared(const std::string &statement, Args&&... args) │ │ │ │ │ - 397 { │ │ │ │ │ - 398 return internal_exec_prepared( │ │ │ │ │ - 399 statement, internal::params(std::forward(args)...)); │ │ │ │ │ - 400 } │ │ │ │ │ - 401 │ │ │ │ │ - 403 │ │ │ │ │ - 405 template │ │ │ │ │ -406 row exec_prepared1(const std::string &statement, Args&&... args) │ │ │ │ │ - 407 { │ │ │ │ │ - 408 return exec_prepared_n(1, statement, std::forward(args)...).front(); │ │ │ │ │ - 409 } │ │ │ │ │ - 410 │ │ │ │ │ - 412 │ │ │ │ │ - 414 template │ │ │ │ │ -415 result exec_prepared0(const std::string &statement, Args&&... args) │ │ │ │ │ - 416 { │ │ │ │ │ - 417 return exec_prepared_n(0, statement, std::forward(args)...); │ │ │ │ │ - 418 } │ │ │ │ │ - 419 │ │ │ │ │ - 421 │ │ │ │ │ - 424 template │ │ │ │ │ -425 result exec_prepared_n( │ │ │ │ │ - 426 size_t rows, │ │ │ │ │ - 427 const std::string &statement, │ │ │ │ │ - 428 Args&&... args) │ │ │ │ │ - 429 { │ │ │ │ │ - 430 const auto r = exec_prepared(statement, std::forward(args)...); │ │ │ │ │ - 431 check_rowcount_prepared(statement, rows, r.size()); │ │ │ │ │ - 432 return r; │ │ │ │ │ - 433 } │ │ │ │ │ - 434 │ │ │ │ │ - 436 │ │ │ │ │ - 474 PQXX_DEPRECATED prepare::invocation │ │ │ │ │ - 475 prepared(const std::string &statement=std::string{}); │ │ │ │ │ - 476 │ │ │ │ │ - 478 │ │ │ │ │ -484 void process_notice(const char Msg[]) const //[t14] │ │ │ │ │ - 485 { m_conn.process_notice(Msg); } │ │ │ │ │ -487 void process_notice(const std::string &Msg) const //[t14] │ │ │ │ │ - 488 { m_conn.process_notice(Msg); } │ │ │ │ │ - 490 │ │ │ │ │ -492 connection_base &conn() const { return m_conn; } //[t04] │ │ │ │ │ - 493 │ │ │ │ │ - 495 │ │ │ │ │ - 502 void set_variable(const std::string &Var, const std::string &Val); //[t61] │ │ │ │ │ - 503 │ │ │ │ │ - 505 │ │ │ │ │ - 514 std::string get_variable(const std::string &); //[t61] │ │ │ │ │ - 515 │ │ │ │ │ - 516protected: │ │ │ │ │ - 518 │ │ │ │ │ - 524 explicit transaction_base(connection_base &c, bool direct=true); │ │ │ │ │ - 525 │ │ │ │ │ - 527 │ │ │ │ │ - 529 void Begin(); │ │ │ │ │ - 530 │ │ │ │ │ - 532 void End() noexcept; │ │ │ │ │ - 533 │ │ │ │ │ -535 virtual void do_begin() =0; │ │ │ │ │ -537 virtual result do_exec(const char Query[]) =0; │ │ │ │ │ -539 virtual void do_commit() =0; │ │ │ │ │ -541 virtual void do_abort() =0; │ │ │ │ │ - 542 │ │ │ │ │ - 543 // For use by implementing class: │ │ │ │ │ - 544 │ │ │ │ │ - 546 │ │ │ │ │ - 554 result direct_exec(const char C[], int Retries=0); │ │ │ │ │ - 555 │ │ │ │ │ -557 void reactivation_avoidance_clear() noexcept │ │ │ │ │ - 558 {m_reactivation_avoidance.clear();} │ │ │ │ │ - 559 │ │ │ │ │ - 560protected: │ │ │ │ │ - 562 │ │ │ │ │ -564 internal::reactivation_avoidance_counter m_reactivation_avoidance; │ │ │ │ │ - 565 │ │ │ │ │ - 566private: │ │ │ │ │ - 567 /* A transaction goes through the following stages in its lifecycle: │ │ │ │ │ - 568 *
    │ │ │ │ │ - 569 *
  • nascent: the transaction hasn't actually begun yet. If our │ │ │ │ │ -connection │ │ │ │ │ - 570 * fails at this stage, it may recover and the transaction can attempt to │ │ │ │ │ - 571 * establish itself again. │ │ │ │ │ - 572 *
  • active: the transaction has begun. Since no commit command has been │ │ │ │ │ - 573 * issued, abortion is implicit if the connection fails now. │ │ │ │ │ - 574 *
  • aborted: an abort has been issued; the transaction is terminated │ │ │ │ │ -and │ │ │ │ │ - 575 * its changes to the database rolled back. It will accept no further │ │ │ │ │ - 576 * commands. │ │ │ │ │ - 577 *
  • committed: the transaction has completed successfully, meaning that │ │ │ │ │ -a │ │ │ │ │ - 578 * commit has been issued. No further commands are accepted. │ │ │ │ │ - 579 *
  • in_doubt: the connection was lost at the exact wrong time, and │ │ │ │ │ -there │ │ │ │ │ - 580 * is no way of telling whether the transaction was committed or aborted. │ │ │ │ │ - 581 *
│ │ │ │ │ - 582 * │ │ │ │ │ - 583 * Checking and maintaining state machine logic is the responsibility of │ │ │ │ │ -the │ │ │ │ │ - 584 * base class (ie., this one). │ │ │ │ │ - 585 */ │ │ │ │ │ - 586 enum Status │ │ │ │ │ - 587 { │ │ │ │ │ - 588 st_nascent, │ │ │ │ │ - 589 st_active, │ │ │ │ │ - 590 st_aborted, │ │ │ │ │ - 591 st_committed, │ │ │ │ │ - 592 st_in_doubt │ │ │ │ │ - 593 }; │ │ │ │ │ - 594 │ │ │ │ │ - 596 PQXX_PRIVATE void activate(); │ │ │ │ │ - 597 │ │ │ │ │ - 598 PQXX_PRIVATE void CheckPendingError(); │ │ │ │ │ - 599 │ │ │ │ │ - 600 template bool parm_is_null(T *p) const noexcept │ │ │ │ │ - 601 { return p == nullptr; } │ │ │ │ │ - 602 template bool parm_is_null(T) const noexcept │ │ │ │ │ - 603 { return false; } │ │ │ │ │ - 604 │ │ │ │ │ - 605 result internal_exec_prepared( │ │ │ │ │ - 606 const std::string &statement, │ │ │ │ │ - 607 const internal::params &args); │ │ │ │ │ - 608 │ │ │ │ │ - 609 result internal_exec_params( │ │ │ │ │ - 610 const std::string &query, │ │ │ │ │ - 611 const internal::params &args); │ │ │ │ │ - 612 │ │ │ │ │ - 614 void check_rowcount_prepared( │ │ │ │ │ - 615 const std::string &statement, │ │ │ │ │ - 616 size_t expected_rows, │ │ │ │ │ - 617 size_t actual_rows); │ │ │ │ │ - 618 │ │ │ │ │ - 620 void check_rowcount_params( │ │ │ │ │ - 621 size_t expected_rows, size_t actual_rows); │ │ │ │ │ - 622 │ │ │ │ │ -623 friend class pqxx::internal::gate::transaction_transactionfocus; │ │ │ │ │ - 624 PQXX_PRIVATE void register_focus(internal::transactionfocus *); │ │ │ │ │ - 625 PQXX_PRIVATE void unregister_focus(internal::transactionfocus *) noexcept; │ │ │ │ │ - 626 PQXX_PRIVATE void register_pending_error(const std::string &) noexcept; │ │ │ │ │ - 627 │ │ │ │ │ -628 friend class pqxx::internal::gate::transaction_tablereader; │ │ │ │ │ -629 friend class pqxx::internal::gate::transaction_stream_from; │ │ │ │ │ - 630 PQXX_PRIVATE void BeginCopyRead(const std::string &, const std::string &); │ │ │ │ │ - 631 bool read_copy_line(std::string &); │ │ │ │ │ - 632 │ │ │ │ │ -633 friend class pqxx::internal::gate::transaction_tablewriter; │ │ │ │ │ -634 friend class pqxx::internal::gate::transaction_stream_to; │ │ │ │ │ - 635 PQXX_PRIVATE void BeginCopyWrite( │ │ │ │ │ - 636 const std::string &Table, │ │ │ │ │ - 637 const std::string &Columns); │ │ │ │ │ - 638 void write_copy_line(const std::string &); │ │ │ │ │ - 639 void end_copy_write(); │ │ │ │ │ - 640 │ │ │ │ │ -641 friend class pqxx::internal::gate::transaction_subtransaction; │ │ │ │ │ - 642 │ │ │ │ │ - 643 connection_base &m_conn; │ │ │ │ │ - 644 │ │ │ │ │ - 645 internal::unique m_focus; │ │ │ │ │ - 646 Status m_status = st_nascent; │ │ │ │ │ - 647 bool m_registered = false; │ │ │ │ │ - 648 std::map m_vars; │ │ │ │ │ - 649 std::string m_pending_error; │ │ │ │ │ - 650}; │ │ │ │ │ - 651 │ │ │ │ │ - 652} // namespace pqxx │ │ │ │ │ - 653 │ │ │ │ │ - 654#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 655#endif │ │ │ │ │ -pqxx::transaction_base::esc │ │ │ │ │ -std::string esc(const char str[]) const │ │ │ │ │ -Escape string for use as SQL string literal in this transaction. │ │ │ │ │ -Definition: transaction_base.hxx:175 │ │ │ │ │ -std │ │ │ │ │ -STL namespace. │ │ │ │ │ + 20 │ │ │ │ │ + 21namespace pqxx │ │ │ │ │ + 22{ │ │ │ │ │ + 24 │ │ │ │ │ +26class PQXX_LIBEXPORT PQXX_NOVTABLE tablestream : │ │ │ │ │ + 27 public internal::transactionfocus │ │ │ │ │ + 28{ │ │ │ │ │ + 29public: │ │ │ │ │ + 30 explicit tablestream( │ │ │ │ │ + 31 transaction_base &Trans, │ │ │ │ │ + 32 const std::string &Null=std::string{}); │ │ │ │ │ + 33 virtual ~tablestream() noexcept =0; │ │ │ │ │ +34 virtual void complete() =0; │ │ │ │ │ + 35protected: │ │ │ │ │ +36 const std::string &NullStr() const { return m_null; } │ │ │ │ │ +37 bool is_finished() const noexcept { return m_finished; } │ │ │ │ │ + 38 void base_close(); │ │ │ │ │ + 39 template │ │ │ │ │ + 40 static std::string columnlist(ITER colbegin, ITER colend); │ │ │ │ │ + 41private: │ │ │ │ │ + 42 std::string m_null; │ │ │ │ │ + 43 bool m_finished = false; │ │ │ │ │ + 44 │ │ │ │ │ + 45 tablestream() =delete; │ │ │ │ │ + 46 tablestream(const tablestream &) =delete; │ │ │ │ │ + 47 tablestream &operator=(const tablestream &) =delete; │ │ │ │ │ + 48}; │ │ │ │ │ + 49 │ │ │ │ │ + 50 │ │ │ │ │ + 51template inline │ │ │ │ │ +52std::string tablestream::columnlist(ITER colbegin, ITER colend) │ │ │ │ │ + 53{ │ │ │ │ │ + 54 return separated_list(",", colbegin, colend); │ │ │ │ │ + 55} │ │ │ │ │ + 56} // namespace pqxx │ │ │ │ │ + 57 │ │ │ │ │ + 58#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 59#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::binarystring │ │ │ │ │ -Binary data corresponding to PostgreSQL's "BYTEA" binary-string type. │ │ │ │ │ -Definition: binarystring.hxx:54 │ │ │ │ │ -pqxx::internal::reactivation_avoidance_counter │ │ │ │ │ -Definition: connection_base.hxx:49 │ │ │ │ │ -pqxx::connection_base │ │ │ │ │ -connection_base abstract base class; represents a connection to a database. │ │ │ │ │ -Definition: connection_base.hxx:140 │ │ │ │ │ -pqxx::isolation_traits │ │ │ │ │ -Traits class to describe an isolation level; primarly for libpqxx's own use. │ │ │ │ │ -Definition: isolation.hxx:66 │ │ │ │ │ -pqxx::prepare::invocation │ │ │ │ │ -Helper class for passing parameters to, and executing, prepared statements. │ │ │ │ │ -Definition: prepared_statement.hxx:82 │ │ │ │ │ -pqxx::result │ │ │ │ │ -Result set containing data returned by a query or command. │ │ │ │ │ -Definition: result.hxx:70 │ │ │ │ │ -pqxx::result::clear │ │ │ │ │ -void clear() noexcept │ │ │ │ │ -Definition: result.hxx:121 │ │ │ │ │ -pqxx::row │ │ │ │ │ -Reference to one row in a result. │ │ │ │ │ -Definition: row.hxx:41 │ │ │ │ │ -pqxx::row::front │ │ │ │ │ -reference front() const noexcept │ │ │ │ │ -Definition: row.cxx:59 │ │ │ │ │ +pqxx::separated_list │ │ │ │ │ +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 │ │ │ │ │ +pqxx::tablestream │ │ │ │ │ +Base class for obsolete tablereader/tablewriter classes. │ │ │ │ │ +Definition: tablestream.hxx:28 │ │ │ │ │ +pqxx::tablestream::complete │ │ │ │ │ +virtual void complete()=0 │ │ │ │ │ +pqxx::tablestream::NullStr │ │ │ │ │ +const std::string & NullStr() const │ │ │ │ │ +Definition: tablestream.hxx:36 │ │ │ │ │ +pqxx::tablestream::is_finished │ │ │ │ │ +bool is_finished() const noexcept │ │ │ │ │ +Definition: tablestream.hxx:37 │ │ │ │ │ +pqxx::tablestream::columnlist │ │ │ │ │ +static std::string columnlist(ITER colbegin, ITER colend) │ │ │ │ │ +Definition: tablestream.hxx:52 │ │ │ │ │ pqxx::internal::transactionfocus │ │ │ │ │ Definition: transaction_base.hxx:44 │ │ │ │ │ -pqxx::internal::transactionfocus::transactionfocus │ │ │ │ │ -transactionfocus()=delete │ │ │ │ │ -pqxx::internal::transactionfocus::transactionfocus │ │ │ │ │ -transactionfocus(const transactionfocus &)=delete │ │ │ │ │ -pqxx::internal::transactionfocus::operator= │ │ │ │ │ -transactionfocus & operator=(const transactionfocus &)=delete │ │ │ │ │ -pqxx::internal::transactionfocus::transactionfocus │ │ │ │ │ -transactionfocus(transaction_base &t) │ │ │ │ │ -Definition: transaction_base.hxx:46 │ │ │ │ │ -pqxx::internal::transactionfocus::m_trans │ │ │ │ │ -transaction_base & m_trans │ │ │ │ │ -Definition: transaction_base.hxx:63 │ │ │ │ │ -pqxx::internal::parameterized_invocation │ │ │ │ │ -Helper class to construct an invocation of a parameterised statement. │ │ │ │ │ -Definition: transaction_base.hxx:74 │ │ │ │ │ -pqxx::internal::parameterized_invocation::operator() │ │ │ │ │ -parameterized_invocation & operator()(const binarystring &v, bool nonnull) │ │ │ │ │ -Definition: transaction_base.hxx:84 │ │ │ │ │ -pqxx::internal::parameterized_invocation::operator() │ │ │ │ │ -parameterized_invocation & operator()(const binarystring &v) │ │ │ │ │ -Definition: transaction_base.hxx:80 │ │ │ │ │ -pqxx::internal::parameterized_invocation::operator() │ │ │ │ │ -parameterized_invocation & operator()(const T &v) │ │ │ │ │ -Definition: transaction_base.hxx:82 │ │ │ │ │ -pqxx::internal::parameterized_invocation::operator() │ │ │ │ │ -parameterized_invocation & operator()() │ │ │ │ │ -Definition: transaction_base.hxx:79 │ │ │ │ │ -pqxx::internal::parameterized_invocation::operator() │ │ │ │ │ -parameterized_invocation & operator()(const T &v, bool nonnull) │ │ │ │ │ -Definition: transaction_base.hxx:87 │ │ │ │ │ pqxx::transaction_base │ │ │ │ │ Interface definition (and common code) for "transaction" classes. │ │ │ │ │ Definition: transaction_base.hxx:138 │ │ │ │ │ -pqxx::transaction_base::exec_params │ │ │ │ │ -result exec_params(const std::string &query, Args &&...args) │ │ │ │ │ -Execute an SQL statement with parameters. │ │ │ │ │ -Definition: transaction_base.hxx:321 │ │ │ │ │ -pqxx::transaction_base::quote_raw │ │ │ │ │ -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 │ │ │ │ │ -pqxx::transaction_base::exec_params_n │ │ │ │ │ -result exec_params_n(size_t rows, const std::string &query, Args &&...args) │ │ │ │ │ -Definition: transaction_base.hxx:349 │ │ │ │ │ -pqxx::transaction_base::esc │ │ │ │ │ -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 │ │ │ │ │ -pqxx::transaction_base::exec │ │ │ │ │ -result exec(const std::stringstream &Query, const std::string &Desc=std::string │ │ │ │ │ -{}) │ │ │ │ │ -Definition: transaction_base.hxx:253 │ │ │ │ │ -pqxx::transaction_base::quote │ │ │ │ │ -std::string quote(const T &t) const │ │ │ │ │ -Represent object as SQL string, including quoting & escaping. │ │ │ │ │ -Definition: transaction_base.hxx:215 │ │ │ │ │ -pqxx::transaction_base::transaction_base │ │ │ │ │ -transaction_base(const transaction_base &)=delete │ │ │ │ │ -pqxx::transaction_base::exec_prepared0 │ │ │ │ │ -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 │ │ │ │ │ -pqxx::transaction_base::exec_prepared │ │ │ │ │ -result exec_prepared(const std::string &statement, Args &&... args) │ │ │ │ │ -Execute a prepared statement, with optional arguments. │ │ │ │ │ -Definition: transaction_base.hxx:396 │ │ │ │ │ -pqxx::transaction_base::esc_raw │ │ │ │ │ -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 │ │ │ │ │ -pqxx::transaction_base::exec0 │ │ │ │ │ -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 │ │ │ │ │ -pqxx::transaction_base::operator= │ │ │ │ │ -transaction_base & operator=(const transaction_base &)=delete │ │ │ │ │ -pqxx::transaction_base::exec_prepared_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 │ │ │ │ │ -pqxx::transaction_base::conn │ │ │ │ │ -connection_base & conn() const │ │ │ │ │ -Connection this transaction is running in. │ │ │ │ │ -Definition: transaction_base.hxx:492 │ │ │ │ │ -pqxx::transaction_base::process_notice │ │ │ │ │ -void process_notice(const std::string &Msg) const │ │ │ │ │ -Have connection process warning message. │ │ │ │ │ -Definition: transaction_base.hxx:487 │ │ │ │ │ -pqxx::transaction_base::process_notice │ │ │ │ │ -void process_notice(const char Msg[]) const │ │ │ │ │ -Have connection process warning message. │ │ │ │ │ -Definition: transaction_base.hxx:484 │ │ │ │ │ -pqxx::transaction_base::exec_params1 │ │ │ │ │ -row exec_params1(const std::string &query, Args &&... args) │ │ │ │ │ -Definition: transaction_base.hxx:331 │ │ │ │ │ -pqxx::transaction_base::transaction_base │ │ │ │ │ -transaction_base()=delete │ │ │ │ │ -pqxx::transaction_base::unesc_raw │ │ │ │ │ -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 │ │ │ │ │ -pqxx::transaction_base::exec_params0 │ │ │ │ │ -result exec_params0(const std::string &query, Args &&...args) │ │ │ │ │ -Definition: transaction_base.hxx:340 │ │ │ │ │ -pqxx::transaction_base::esc │ │ │ │ │ -std::string esc(const std::string &str) const │ │ │ │ │ -Escape string for use as SQL string literal in this transaction. │ │ │ │ │ -Definition: transaction_base.hxx:180 │ │ │ │ │ -pqxx::transaction_base::quote_name │ │ │ │ │ -std::string quote_name(const std::string &identifier) const │ │ │ │ │ -Escape an SQL identifier for use in a query. │ │ │ │ │ -Definition: transaction_base.hxx:225 │ │ │ │ │ -pqxx::transaction_base::exec_prepared1 │ │ │ │ │ -row exec_prepared1(const std::string &statement, Args &&... args) │ │ │ │ │ -Execute a prepared statement, and expect a single-row result. │ │ │ │ │ -Definition: transaction_base.hxx:406 │ │ │ │ │ -pqxx::transaction_base::unesc_raw │ │ │ │ │ -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 │ │ │ │ │ -pqxx::transaction_base::exec1 │ │ │ │ │ -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 │ │ │ │ │ -pqxx::transaction_base::m_reactivation_avoidance │ │ │ │ │ -internal::reactivation_avoidance_counter m_reactivation_avoidance │ │ │ │ │ -Resources allocated in this transaction that make reactivation impossible. │ │ │ │ │ -Definition: transaction_base.hxx:564 │ │ │ │ │ -pqxx::transaction_base::esc_like │ │ │ │ │ -std::string esc_like(const std::string &str, char escape_char='\\') const │ │ │ │ │ -Escape string for literal LIKE match. │ │ │ │ │ -Definition: transaction_base.hxx:229 │ │ │ │ │ -pqxx::internal::namedclass │ │ │ │ │ -Helper base class: object descriptions for error messages and such. │ │ │ │ │ -Definition: util.hxx:234 │ │ │ │ │ -pqxx::internal::unique │ │ │ │ │ -Ensure proper opening/closing of GUEST objects related to a "host" object. │ │ │ │ │ -Definition: util.hxx:275 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * transaction_base.hxx │ │ │ │ │ + * tablestream.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00086_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: compiler-internal.hxx Source File │ │ │ │ +libpqxx: binarystring.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,54 +55,148 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
compiler-internal.hxx
│ │ │ │ +
binarystring.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
11#ifndef PQXX_H_COMPILER_INTERNAL
│ │ │ │ -
12#define PQXX_H_COMPILER_INTERNAL
│ │ │ │ +
11#ifndef PQXX_H_BINARYSTRING
│ │ │ │ +
12#define PQXX_H_BINARYSTRING
│ │ │ │
13
│ │ │ │ -
14
│ │ │ │ -
15// Workarounds & definitions needed to compile libpqxx into a library
│ │ │ │ -
16#include "pqxx/config-internal-compiler.h"
│ │ │ │ -
17
│ │ │ │ -
18#ifdef _WIN32
│ │ │ │ +
14#include "pqxx/compiler-public.hxx"
│ │ │ │ +
15#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
16
│ │ │ │ +
17#include <memory>
│ │ │ │ +
18#include <string>
│ │ │ │
19
│ │ │ │ -
20#ifdef PQXX_SHARED
│ │ │ │ -
21#undef PQXX_LIBEXPORT
│ │ │ │ -
22#define PQXX_LIBEXPORT __declspec(dllexport)
│ │ │ │ -
23#define PQXX_PRIVATE __declspec()
│ │ │ │ -
24#endif // PQXX_SHARED
│ │ │ │ +
20#include "pqxx/result.hxx"
│ │ │ │ +
21
│ │ │ │ +
22
│ │ │ │ +
23namespace pqxx
│ │ │ │ +
24{
│ │ │ │
25
│ │ │ │ -
26#ifdef _MSC_VER
│ │ │ │ -
27#pragma warning (disable: 4251 4275 4273)
│ │ │ │ -
28#pragma warning (disable: 4355)
│ │ │ │ -
29#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy().
│ │ │ │ -
30#endif
│ │ │ │ -
31
│ │ │ │ -
32#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_VISIBILITY) // !_WIN32
│ │ │ │ -
33
│ │ │ │ -
34#define PQXX_LIBEXPORT __attribute__ ((visibility("default")))
│ │ │ │ -
35#define PQXX_PRIVATE __attribute__ ((visibility("hidden")))
│ │ │ │ -
36
│ │ │ │ -
37#endif // __GNUC__ && PQXX_HAVE_GCC_VISIBILITY
│ │ │ │ -
38
│ │ │ │ -
39
│ │ │ │ -
40#include "pqxx/compiler-public.hxx"
│ │ │ │ -
41
│ │ │ │ -
42#endif
│ │ │ │ +
27
│ │ │ │ +
53class PQXX_LIBEXPORT binarystring
│ │ │ │ +
54{
│ │ │ │ +
55public:
│ │ │ │ +
56 using char_type = unsigned char;
│ │ │ │ +
57 using value_type = std::char_traits<char_type>::char_type;
│ │ │ │ +
58 using size_type = size_t;
│ │ │ │ +
59 using difference_type = long;
│ │ │ │ +
60 using const_reference = const value_type &;
│ │ │ │ +
61 using const_pointer = const value_type *;
│ │ │ │ + │ │ │ │ +
63 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
│ │ │ │ +
64
│ │ │ │ +
65 binarystring(const binarystring &) =default;
│ │ │ │ +
66
│ │ │ │ +
68
│ │ │ │ +
71 explicit binarystring(const field &); //[t62]
│ │ │ │ +
72
│ │ │ │ +
74 explicit binarystring(const std::string &);
│ │ │ │ +
75
│ │ │ │ +
77 binarystring(const void *, size_t);
│ │ │ │ +
78
│ │ │ │ +
80 size_type size() const noexcept { return m_size; } //[t62]
│ │ │ │ +
82 size_type length() const noexcept { return size(); } //[t62]
│ │ │ │ +
83 bool empty() const noexcept { return size()==0; } //[t62]
│ │ │ │ +
84
│ │ │ │ +
85 const_iterator begin() const noexcept { return data(); } //[t62]
│ │ │ │ +
86 const_iterator cbegin() const noexcept { return begin(); }
│ │ │ │ +
87 const_iterator end() const noexcept { return data()+m_size; } //[t62]
│ │ │ │ +
88 const_iterator cend() const noexcept { return end(); }
│ │ │ │ +
89
│ │ │ │ +
90 const_reference front() const noexcept { return *begin(); } //[t62]
│ │ │ │ +
91 const_reference back() const noexcept //[t62]
│ │ │ │ +
92 { return *(data()+m_size-1); }
│ │ │ │ +
93
│ │ │ │ + │ │ │ │ +
95 { return const_reverse_iterator{end()}; }
│ │ │ │ +
96 const_reverse_iterator crbegin() const { return rbegin(); }
│ │ │ │ + │ │ │ │ +
98 { return const_reverse_iterator{begin()}; }
│ │ │ │ +
99 const_reverse_iterator crend() const { return rend(); }
│ │ │ │ +
100
│ │ │ │ +
102 const value_type *data() const noexcept {return m_buf.get();} //[t62]
│ │ │ │ +
103
│ │ │ │ +
104 const_reference operator[](size_type i) const noexcept //[t62]
│ │ │ │ +
105 { return data()[i]; }
│ │ │ │ +
106
│ │ │ │ +
107 PQXX_PURE bool operator==(const binarystring &) const noexcept; //[t62]
│ │ │ │ +
108 bool operator!=(const binarystring &rhs) const noexcept //[t62]
│ │ │ │ +
109 { return not operator==(rhs); }
│ │ │ │ +
110
│ │ │ │ +
111 binarystring &operator=(const binarystring &);
│ │ │ │ +
112
│ │ │ │ +
114 const_reference at(size_type) const; //[t62]
│ │ │ │ +
115
│ │ │ │ +
117 void swap(binarystring &); //[t62]
│ │ │ │ +
118
│ │ │ │ +
120
│ │ │ │ +
123 const char *get() const noexcept //[t62]
│ │ │ │ +
124 { return reinterpret_cast<const char *>(m_buf.get()); }
│ │ │ │ +
125
│ │ │ │ +
127
│ │ │ │ +
133 std::string str() const; //[t62]
│ │ │ │ +
134
│ │ │ │ +
135private:
│ │ │ │ +
136 using smart_pointer_type = std::shared_ptr<value_type>;
│ │ │ │ +
137
│ │ │ │ +
139 static smart_pointer_type make_smart_pointer(unsigned char *buf=nullptr)
│ │ │ │ +
140 {
│ │ │ │ +
141 return smart_pointer_type{
│ │ │ │ +
142 buf,
│ │ │ │ +
143 internal::freemallocmem_templated<unsigned char>};
│ │ │ │ +
144 }
│ │ │ │ +
145
│ │ │ │ +
146 smart_pointer_type m_buf;
│ │ │ │ +
147 size_type m_size;
│ │ │ │ +
148};
│ │ │ │ +
149}
│ │ │ │ +
150
│ │ │ │ +
151#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
152
│ │ │ │ +
153#endif
│ │ │ │ +
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ +
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
│ │ │ │ +
const_reverse_iterator crend() const
Definition: binarystring.hxx:99
│ │ │ │ +
const_reverse_iterator rbegin() const
Definition: binarystring.hxx:94
│ │ │ │ +
const_pointer const_iterator
Definition: binarystring.hxx:62
│ │ │ │ +
const value_type & const_reference
Definition: binarystring.hxx:60
│ │ │ │ +
const value_type * const_pointer
Definition: binarystring.hxx:61
│ │ │ │ +
const_iterator end() const noexcept
Definition: binarystring.hxx:87
│ │ │ │ +
const_iterator begin() const noexcept
Definition: binarystring.hxx:85
│ │ │ │ +
std::char_traits< char_type >::char_type value_type
Definition: binarystring.hxx:57
│ │ │ │ +
long difference_type
Definition: binarystring.hxx:59
│ │ │ │ +
const_reverse_iterator crbegin() const
Definition: binarystring.hxx:96
│ │ │ │ +
const_reference front() const noexcept
Definition: binarystring.hxx:90
│ │ │ │ +
const_reference back() const noexcept
Definition: binarystring.hxx:91
│ │ │ │ +
bool operator!=(const binarystring &rhs) const noexcept
Definition: binarystring.hxx:108
│ │ │ │ +
bool empty() const noexcept
Definition: binarystring.hxx:83
│ │ │ │ +
binarystring(const binarystring &)=default
│ │ │ │ +
const_reference operator[](size_type i) const noexcept
Definition: binarystring.hxx:104
│ │ │ │ +
const_iterator cend() const noexcept
Definition: binarystring.hxx:88
│ │ │ │ +
const_reverse_iterator rend() const
Definition: binarystring.hxx:97
│ │ │ │ +
size_type length() const noexcept
Size of converted string in bytes.
Definition: binarystring.hxx:82
│ │ │ │ +
unsigned char char_type
Definition: binarystring.hxx:56
│ │ │ │ +
size_t size_type
Definition: binarystring.hxx:58
│ │ │ │ +
const value_type * data() const noexcept
Unescaped field contents.
Definition: binarystring.hxx:102
│ │ │ │ +
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: binarystring.hxx:63
│ │ │ │ +
const_iterator cbegin() const noexcept
Definition: binarystring.hxx:86
│ │ │ │ +
const char * get() const noexcept
Raw character buffer (no terminating zero is added)
Definition: binarystring.hxx:123
│ │ │ │ +
size_type size() const noexcept
Size of converted string in bytes.
Definition: binarystring.hxx:80
│ │ │ │ +
Reference to a field in a result set.
Definition: field.hxx:50
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,46 +1,200 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -compiler-internal.hxx │ │ │ │ │ +binarystring.hxx │ │ │ │ │ 1 │ │ │ │ │ - 11#ifndef PQXX_H_COMPILER_INTERNAL │ │ │ │ │ - 12#define PQXX_H_COMPILER_INTERNAL │ │ │ │ │ + 11#ifndef PQXX_H_BINARYSTRING │ │ │ │ │ + 12#define PQXX_H_BINARYSTRING │ │ │ │ │ 13 │ │ │ │ │ - 14 │ │ │ │ │ - 15// Workarounds & definitions needed to compile libpqxx into a library │ │ │ │ │ - 16#include "pqxx/config-internal-compiler.h" │ │ │ │ │ - 17 │ │ │ │ │ - 18#ifdef _WIN32 │ │ │ │ │ + 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 15#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 16 │ │ │ │ │ + 17#include │ │ │ │ │ + 18#include │ │ │ │ │ 19 │ │ │ │ │ - 20#ifdef PQXX_SHARED │ │ │ │ │ - 21#undef PQXX_LIBEXPORT │ │ │ │ │ - 22#define PQXX_LIBEXPORT __declspec(dllexport) │ │ │ │ │ - 23#define PQXX_PRIVATE __declspec() │ │ │ │ │ - 24#endif // PQXX_SHARED │ │ │ │ │ + 20#include "pqxx/result.hxx" │ │ │ │ │ + 21 │ │ │ │ │ + 22 │ │ │ │ │ + 23namespace pqxx │ │ │ │ │ + 24{ │ │ │ │ │ 25 │ │ │ │ │ - 26#ifdef _MSC_VER │ │ │ │ │ - 27#pragma warning (disable: 4251 4275 4273) │ │ │ │ │ - 28#pragma warning (disable: 4355) │ │ │ │ │ - 29#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy │ │ │ │ │ -(). │ │ │ │ │ - 30#endif │ │ │ │ │ - 31 │ │ │ │ │ - 32#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_VISIBILITY) // !_WIN32 │ │ │ │ │ - 33 │ │ │ │ │ - 34#define PQXX_LIBEXPORT __attribute__ ((visibility("default"))) │ │ │ │ │ - 35#define PQXX_PRIVATE __attribute__ ((visibility("hidden"))) │ │ │ │ │ - 36 │ │ │ │ │ - 37#endif // __GNUC__ && PQXX_HAVE_GCC_VISIBILITY │ │ │ │ │ - 38 │ │ │ │ │ - 39 │ │ │ │ │ - 40#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 41 │ │ │ │ │ - 42#endif │ │ │ │ │ + 27 │ │ │ │ │ +53class PQXX_LIBEXPORT binarystring │ │ │ │ │ + 54{ │ │ │ │ │ + 55public: │ │ │ │ │ +56 using char_type = unsigned char; │ │ │ │ │ +57 using value_type = std::char_traits::char_type; │ │ │ │ │ +58 using size_type = size_t; │ │ │ │ │ +59 using difference_type = long; │ │ │ │ │ +60 using const_reference = const value_type &; │ │ │ │ │ +61 using const_pointer = const value_type *; │ │ │ │ │ +62 using const_iterator = const_pointer; │ │ │ │ │ +63 using const_reverse_iterator = std::reverse_iterator; │ │ │ │ │ + 64 │ │ │ │ │ +65 binarystring(const binarystring &) =default; │ │ │ │ │ + 66 │ │ │ │ │ + 68 │ │ │ │ │ + 71 explicit binarystring(const field &); //[t62] │ │ │ │ │ + 72 │ │ │ │ │ + 74 explicit binarystring(const std::string &); │ │ │ │ │ + 75 │ │ │ │ │ + 77 binarystring(const void *, size_t); │ │ │ │ │ + 78 │ │ │ │ │ +80 size_type size() const noexcept { return m_size; } //[t62] │ │ │ │ │ +82 size_type length() const noexcept { return size(); } //[t62] │ │ │ │ │ +83 bool empty() const noexcept { return size()==0; } //[t62] │ │ │ │ │ + 84 │ │ │ │ │ +85 const_iterator begin() const noexcept { return data(); } //[t62] │ │ │ │ │ +86 const_iterator cbegin() const noexcept { return begin(); } │ │ │ │ │ +87 const_iterator end() const noexcept { return data()+m_size; } //[t62] │ │ │ │ │ +88 const_iterator cend() const noexcept { return end(); } │ │ │ │ │ + 89 │ │ │ │ │ +90 const_reference front() const noexcept { return *begin(); } //[t62] │ │ │ │ │ +91 const_reference back() const noexcept //[t62] │ │ │ │ │ + 92 { return *(data()+m_size-1); } │ │ │ │ │ + 93 │ │ │ │ │ +94 const_reverse_iterator rbegin() const //[t62] │ │ │ │ │ + 95 { return const_reverse_iterator{end()}; } │ │ │ │ │ +96 const_reverse_iterator crbegin() const { return rbegin(); } │ │ │ │ │ +97 const_reverse_iterator rend() const //[t62] │ │ │ │ │ + 98 { return const_reverse_iterator{begin()}; } │ │ │ │ │ +99 const_reverse_iterator crend() const { return rend(); } │ │ │ │ │ + 100 │ │ │ │ │ +102 const value_type *data() const noexcept {return m_buf.get();} //[t62] │ │ │ │ │ + 103 │ │ │ │ │ +104 const_reference operator[](size_type i) const noexcept //[t62] │ │ │ │ │ + 105 { return data()[i]; } │ │ │ │ │ + 106 │ │ │ │ │ + 107 PQXX_PURE bool operator==(const binarystring &) const noexcept; //[t62] │ │ │ │ │ +108 bool operator!=(const binarystring &rhs) const noexcept //[t62] │ │ │ │ │ + 109 { return not operator==(rhs); } │ │ │ │ │ + 110 │ │ │ │ │ + 111 binarystring &operator=(const binarystring &); │ │ │ │ │ + 112 │ │ │ │ │ + 114 const_reference at(size_type) const; //[t62] │ │ │ │ │ + 115 │ │ │ │ │ + 117 void swap(binarystring &); //[t62] │ │ │ │ │ + 118 │ │ │ │ │ + 120 │ │ │ │ │ +123 const char *get() const noexcept //[t62] │ │ │ │ │ + 124 { return reinterpret_cast(m_buf.get()); } │ │ │ │ │ + 125 │ │ │ │ │ + 127 │ │ │ │ │ + 133 std::string str() const; //[t62] │ │ │ │ │ + 134 │ │ │ │ │ + 135private: │ │ │ │ │ + 136 using smart_pointer_type = std::shared_ptr; │ │ │ │ │ + 137 │ │ │ │ │ + 139 static smart_pointer_type make_smart_pointer(unsigned char *buf=nullptr) │ │ │ │ │ + 140 { │ │ │ │ │ + 141 return smart_pointer_type{ │ │ │ │ │ + 142 buf, │ │ │ │ │ + 143 internal::freemallocmem_templated}; │ │ │ │ │ + 144 } │ │ │ │ │ + 145 │ │ │ │ │ + 146 smart_pointer_type m_buf; │ │ │ │ │ + 147 size_type m_size; │ │ │ │ │ + 148}; │ │ │ │ │ + 149} │ │ │ │ │ + 150 │ │ │ │ │ + 151#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 152 │ │ │ │ │ + 153#endif │ │ │ │ │ +pqxx │ │ │ │ │ +The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ +Definition: array.hxx:26 │ │ │ │ │ +pqxx::binarystring │ │ │ │ │ +Binary data corresponding to PostgreSQL's "BYTEA" binary-string type. │ │ │ │ │ +Definition: binarystring.hxx:54 │ │ │ │ │ +pqxx::binarystring::crend │ │ │ │ │ +const_reverse_iterator crend() const │ │ │ │ │ +Definition: binarystring.hxx:99 │ │ │ │ │ +pqxx::binarystring::rbegin │ │ │ │ │ +const_reverse_iterator rbegin() const │ │ │ │ │ +Definition: binarystring.hxx:94 │ │ │ │ │ +pqxx::binarystring::const_iterator │ │ │ │ │ +const_pointer const_iterator │ │ │ │ │ +Definition: binarystring.hxx:62 │ │ │ │ │ +pqxx::binarystring::const_reference │ │ │ │ │ +const value_type & const_reference │ │ │ │ │ +Definition: binarystring.hxx:60 │ │ │ │ │ +pqxx::binarystring::const_pointer │ │ │ │ │ +const value_type * const_pointer │ │ │ │ │ +Definition: binarystring.hxx:61 │ │ │ │ │ +pqxx::binarystring::end │ │ │ │ │ +const_iterator end() const noexcept │ │ │ │ │ +Definition: binarystring.hxx:87 │ │ │ │ │ +pqxx::binarystring::begin │ │ │ │ │ +const_iterator begin() const noexcept │ │ │ │ │ +Definition: binarystring.hxx:85 │ │ │ │ │ +pqxx::binarystring::value_type │ │ │ │ │ +std::char_traits< char_type >::char_type value_type │ │ │ │ │ +Definition: binarystring.hxx:57 │ │ │ │ │ +pqxx::binarystring::difference_type │ │ │ │ │ +long difference_type │ │ │ │ │ +Definition: binarystring.hxx:59 │ │ │ │ │ +pqxx::binarystring::crbegin │ │ │ │ │ +const_reverse_iterator crbegin() const │ │ │ │ │ +Definition: binarystring.hxx:96 │ │ │ │ │ +pqxx::binarystring::front │ │ │ │ │ +const_reference front() const noexcept │ │ │ │ │ +Definition: binarystring.hxx:90 │ │ │ │ │ +pqxx::binarystring::back │ │ │ │ │ +const_reference back() const noexcept │ │ │ │ │ +Definition: binarystring.hxx:91 │ │ │ │ │ +pqxx::binarystring::operator!= │ │ │ │ │ +bool operator!=(const binarystring &rhs) const noexcept │ │ │ │ │ +Definition: binarystring.hxx:108 │ │ │ │ │ +pqxx::binarystring::empty │ │ │ │ │ +bool empty() const noexcept │ │ │ │ │ +Definition: binarystring.hxx:83 │ │ │ │ │ +pqxx::binarystring::binarystring │ │ │ │ │ +binarystring(const binarystring &)=default │ │ │ │ │ +pqxx::binarystring::operator[] │ │ │ │ │ +const_reference operator[](size_type i) const noexcept │ │ │ │ │ +Definition: binarystring.hxx:104 │ │ │ │ │ +pqxx::binarystring::cend │ │ │ │ │ +const_iterator cend() const noexcept │ │ │ │ │ +Definition: binarystring.hxx:88 │ │ │ │ │ +pqxx::binarystring::rend │ │ │ │ │ +const_reverse_iterator rend() const │ │ │ │ │ +Definition: binarystring.hxx:97 │ │ │ │ │ +pqxx::binarystring::length │ │ │ │ │ +size_type length() const noexcept │ │ │ │ │ +Size of converted string in bytes. │ │ │ │ │ +Definition: binarystring.hxx:82 │ │ │ │ │ +pqxx::binarystring::char_type │ │ │ │ │ +unsigned char char_type │ │ │ │ │ +Definition: binarystring.hxx:56 │ │ │ │ │ +pqxx::binarystring::size_type │ │ │ │ │ +size_t size_type │ │ │ │ │ +Definition: binarystring.hxx:58 │ │ │ │ │ +pqxx::binarystring::data │ │ │ │ │ +const value_type * data() const noexcept │ │ │ │ │ +Unescaped field contents. │ │ │ │ │ +Definition: binarystring.hxx:102 │ │ │ │ │ +pqxx::binarystring::const_reverse_iterator │ │ │ │ │ +std::reverse_iterator< const_iterator > const_reverse_iterator │ │ │ │ │ +Definition: binarystring.hxx:63 │ │ │ │ │ +pqxx::binarystring::cbegin │ │ │ │ │ +const_iterator cbegin() const noexcept │ │ │ │ │ +Definition: binarystring.hxx:86 │ │ │ │ │ +pqxx::binarystring::get │ │ │ │ │ +const char * get() const noexcept │ │ │ │ │ +Raw character buffer (no terminating zero is added) │ │ │ │ │ +Definition: binarystring.hxx:123 │ │ │ │ │ +pqxx::binarystring::size │ │ │ │ │ +size_type size() const noexcept │ │ │ │ │ +Size of converted string in bytes. │ │ │ │ │ +Definition: binarystring.hxx:80 │ │ │ │ │ +pqxx::field │ │ │ │ │ +Reference to a field in a result set. │ │ │ │ │ +Definition: field.hxx:50 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * compiler-internal.hxx │ │ │ │ │ + * binarystring.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00089_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: cursor.hxx Source File │ │ │ │ +libpqxx: types.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,318 +55,87 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
cursor.hxx
│ │ │ │ +
types.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_CURSOR
│ │ │ │ -
14#define PQXX_H_CURSOR
│ │ │ │ -
15
│ │ │ │ -
16#include "pqxx/compiler-public.hxx"
│ │ │ │ -
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include <limits>
│ │ │ │ -
20#include <stdexcept>
│ │ │ │ -
21
│ │ │ │ -
22#include "pqxx/result.hxx"
│ │ │ │ -
23#include "pqxx/transaction_base.hxx"
│ │ │ │ -
24
│ │ │ │ +
10#ifndef PQXX_H_TYPES
│ │ │ │ +
11#define PQXX_H_TYPES
│ │ │ │ +
12
│ │ │ │ +
13#include <cstddef>
│ │ │ │ +
14
│ │ │ │ +
15namespace pqxx
│ │ │ │ +
16{
│ │ │ │ +
18using result_size_type = unsigned long;
│ │ │ │ +
19
│ │ │ │ +
21using result_difference_type = signed long;
│ │ │ │ +
22
│ │ │ │ +
24using row_size_type = unsigned int;
│ │ │ │
25
│ │ │ │ -
26namespace pqxx
│ │ │ │ -
27{
│ │ │ │ -
29
│ │ │ │ -
40class PQXX_LIBEXPORT cursor_base
│ │ │ │ -
41{
│ │ │ │ -
42public:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
45
│ │ │ │ -
47
│ │ │ │ - │ │ │ │ -
51 {
│ │ │ │ - │ │ │ │ -
55 random_access
│ │ │ │ -
56 };
│ │ │ │ -
57
│ │ │ │ -
59
│ │ │ │ - │ │ │ │ -
63 {
│ │ │ │ - │ │ │ │ -
67 update
│ │ │ │ -
68 };
│ │ │ │ -
69
│ │ │ │ -
71
│ │ │ │ - │ │ │ │ -
90 {
│ │ │ │ - │ │ │ │ -
94 loose
│ │ │ │ -
95 };
│ │ │ │ -
96
│ │ │ │ -
97 cursor_base() =delete;
│ │ │ │ -
98 cursor_base(const cursor_base &) =delete;
│ │ │ │ - │ │ │ │ -
100
│ │ │ │ -
105
│ │ │ │ -
107
│ │ │ │ -
110 static difference_type all() noexcept; //[t81]
│ │ │ │ -
111
│ │ │ │ -
113
│ │ │ │ -
115 static difference_type next() noexcept { return 1; } //[t81]
│ │ │ │ -
116
│ │ │ │ -
118
│ │ │ │ -
120 static difference_type prior() noexcept { return -1; } //[t00]
│ │ │ │ -
121
│ │ │ │ -
123
│ │ │ │ -
125 static difference_type backward_all() noexcept; //[t00]
│ │ │ │ -
126
│ │ │ │ -
128
│ │ │ │ -
130
│ │ │ │ -
135 const std::string &name() const noexcept { return m_name; } //[t81]
│ │ │ │ -
136
│ │ │ │ -
137protected:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
140 const std::string &Name,
│ │ │ │ -
141 bool embellish_name=true);
│ │ │ │ -
142
│ │ │ │ -
143 const std::string m_name;
│ │ │ │ -
144};
│ │ │ │ -
145} // namespace pqxx
│ │ │ │ -
146
│ │ │ │ -
147
│ │ │ │ -
148#include <pqxx/internal/sql_cursor.hxx>
│ │ │ │ -
149
│ │ │ │ -
150
│ │ │ │ -
151namespace pqxx
│ │ │ │ -
152{
│ │ │ │ -
154
│ │ │ │ -
160template<cursor_base::updatepolicy up, cursor_base::ownershippolicy op>
│ │ │ │ - │ │ │ │ -
162{
│ │ │ │ -
163public:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
166
│ │ │ │ - │ │ │ │ -
169 transaction_base &trans,
│ │ │ │ -
170 const std::string &query,
│ │ │ │ -
171 const std::string &cname,
│ │ │ │ -
172 bool hold) :
│ │ │ │ -
173 m_cur{trans, query, cname, cursor_base::random_access, up, op, hold}
│ │ │ │ -
174 {
│ │ │ │ -
175 }
│ │ │ │ -
176
│ │ │ │ - │ │ │ │ -
179 transaction_base &trans,
│ │ │ │ -
180 const std::string adopted_cursor) :
│ │ │ │ -
181 m_cur{trans, adopted_cursor, op}
│ │ │ │ -
182 {
│ │ │ │ -
183 // Put cursor in known position
│ │ │ │ -
184 m_cur.move(cursor_base::backward_all());
│ │ │ │ -
185 }
│ │ │ │ -
186
│ │ │ │ -
187 void close() noexcept { m_cur.close(); }
│ │ │ │ -
188
│ │ │ │ -
190
│ │ │ │ -
193 size_type size() { return internal::obtain_stateless_cursor_size(m_cur); }
│ │ │ │ -
194
│ │ │ │ -
196
│ │ │ │ - │ │ │ │ -
208 {
│ │ │ │ -
209 return internal::stateless_cursor_retrieve(
│ │ │ │ -
210 m_cur,
│ │ │ │ - │ │ │ │ -
212 begin_pos,
│ │ │ │ -
213 end_pos);
│ │ │ │ -
214 }
│ │ │ │ -
215
│ │ │ │ -
216 const std::string &name() const noexcept { return m_cur.name(); }
│ │ │ │ -
217
│ │ │ │ -
218private:
│ │ │ │ -
219 internal::sql_cursor m_cur;
│ │ │ │ -
220};
│ │ │ │ -
221
│ │ │ │ -
222
│ │ │ │ -
223class icursor_iterator;
│ │ │ │ -
224
│ │ │ │ -
225
│ │ │ │ -
226namespace internal
│ │ │ │ -
227{
│ │ │ │ -
228namespace gate
│ │ │ │ -
229{
│ │ │ │ -
230class icursor_iterator_icursorstream;
│ │ │ │ -
231class icursorstream_icursor_iterator;
│ │ │ │ -
232} // namespace internal::gate
│ │ │ │ -
233} // namespace internal
│ │ │ │ -
234
│ │ │ │ -
235
│ │ │ │ -
237
│ │ │ │ -
252class PQXX_LIBEXPORT icursorstream
│ │ │ │ -
253{
│ │ │ │ -
254public:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
257
│ │ │ │ -
259
│ │ │ │ - │ │ │ │ -
271 transaction_base &context,
│ │ │ │ -
272 const std::string &query,
│ │ │ │ -
273 const std::string &basename,
│ │ │ │ -
274 difference_type sstride=1); //[t81]
│ │ │ │ -
275
│ │ │ │ -
277
│ │ │ │ - │ │ │ │ -
302 transaction_base &context,
│ │ │ │ -
303 const field &cname,
│ │ │ │ -
304 difference_type sstride=1,
│ │ │ │ - │ │ │ │ -
306
│ │ │ │ -
307 operator bool() const noexcept { return not m_done; }
│ │ │ │ -
308
│ │ │ │ -
310
│ │ │ │ -
316 icursorstream &get(result &res) { res = fetchblock(); return *this; } //[t81]
│ │ │ │ -
318
│ │ │ │ -
324 icursorstream &operator>>(result &res) { return get(res); } //[t81]
│ │ │ │ -
325
│ │ │ │ -
327
│ │ │ │ -
331 icursorstream &ignore(std::streamsize n=1); //[t81]
│ │ │ │ -
332
│ │ │ │ -
334
│ │ │ │ -
337 void set_stride(difference_type stride); //[t81]
│ │ │ │ -
338 difference_type stride() const noexcept { return m_stride; } //[t81]
│ │ │ │ -
339
│ │ │ │ -
340private:
│ │ │ │ -
341 result fetchblock();
│ │ │ │ -
342
│ │ │ │ -
343 friend class internal::gate::icursorstream_icursor_iterator;
│ │ │ │ -
344 size_type forward(size_type n=1);
│ │ │ │ -
345 void insert_iterator(icursor_iterator *) noexcept;
│ │ │ │ -
346 void remove_iterator(icursor_iterator *) const noexcept;
│ │ │ │ -
347
│ │ │ │ -
348 void service_iterators(difference_type);
│ │ │ │ -
349
│ │ │ │ -
350 internal::sql_cursor m_cur;
│ │ │ │ -
351
│ │ │ │ -
352 difference_type m_stride;
│ │ │ │ -
353 difference_type m_realpos, m_reqpos;
│ │ │ │ -
354
│ │ │ │ -
355 mutable icursor_iterator *m_iterators;
│ │ │ │ -
356
│ │ │ │ -
357 bool m_done;
│ │ │ │ -
358};
│ │ │ │ -
359
│ │ │ │ -
360
│ │ │ │ -
362
│ │ │ │ -
388class PQXX_LIBEXPORT icursor_iterator
│ │ │ │ -
389{
│ │ │ │ -
390public:
│ │ │ │ -
391 using iterator_category = std::input_iterator_tag;
│ │ │ │ - │ │ │ │ -
393 using pointer = const result *;
│ │ │ │ -
394 using reference = const result &;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
398
│ │ │ │ -
399 icursor_iterator() noexcept; //[t84]
│ │ │ │ -
400 explicit icursor_iterator(istream_type &) noexcept; //[t84]
│ │ │ │ -
401 icursor_iterator(const icursor_iterator &) noexcept; //[t84]
│ │ │ │ -
402 ~icursor_iterator() noexcept;
│ │ │ │ -
403
│ │ │ │ -
404 const result &operator*() const { refresh(); return m_here; } //[t84]
│ │ │ │ -
405 const result *operator->() const { refresh(); return &m_here; } //[t84]
│ │ │ │ -
406 icursor_iterator &operator++(); //[t84]
│ │ │ │ -
407 icursor_iterator operator++(int); //[t84]
│ │ │ │ -
408 icursor_iterator &operator+=(difference_type); //[t84]
│ │ │ │ -
409 icursor_iterator &operator=(const icursor_iterator &) noexcept; //[t84]
│ │ │ │ -
410
│ │ │ │ -
411 bool operator==(const icursor_iterator &rhs) const; //[t84]
│ │ │ │ -
412 bool operator!=(const icursor_iterator &rhs) const noexcept //[t84]
│ │ │ │ -
413 { return not operator==(rhs); }
│ │ │ │ -
414 bool operator<(const icursor_iterator &rhs) const; //[t84]
│ │ │ │ -
415 bool operator>(const icursor_iterator &rhs) const //[t84]
│ │ │ │ -
416 { return rhs < *this; }
│ │ │ │ -
417 bool operator<=(const icursor_iterator &rhs) const //[t84]
│ │ │ │ -
418 { return not (*this > rhs); }
│ │ │ │ -
419 bool operator>=(const icursor_iterator &rhs) const //[t84]
│ │ │ │ -
420 { return not (*this < rhs); }
│ │ │ │ -
421
│ │ │ │ -
422private:
│ │ │ │ -
423 void refresh() const;
│ │ │ │ -
424
│ │ │ │ -
425 friend class internal::gate::icursor_iterator_icursorstream;
│ │ │ │ -
426 difference_type pos() const noexcept { return m_pos; }
│ │ │ │ -
427 void fill(const result &);
│ │ │ │ -
428
│ │ │ │ -
429 icursorstream *m_stream = nullptr;
│ │ │ │ -
430 result m_here;
│ │ │ │ -
431 difference_type m_pos;
│ │ │ │ -
432 icursor_iterator *m_prev = nullptr, *m_next = nullptr;
│ │ │ │ -
433};
│ │ │ │ -
434} // namespace pqxx
│ │ │ │ -
435
│ │ │ │ -
436#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
437#endif
│ │ │ │ -
STL namespace.
│ │ │ │ +
27using row_difference_type = signed int;
│ │ │ │ +
28
│ │ │ │ +
30using field_size_type = std::size_t;
│ │ │ │ +
31
│ │ │ │ + │ │ │ │ +
34
│ │ │ │ +
35
│ │ │ │ +
36// Forward declarations, to help break compilation dependencies.
│ │ │ │ +
37// These won't necessarily include all classes in libpqxx.
│ │ │ │ +
38class binarystring;
│ │ │ │ + │ │ │ │ +
40class connection_base;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
45class dbtransaction;
│ │ │ │ +
46class field;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
49class range_error;
│ │ │ │ +
50class result;
│ │ │ │ +
51class row;
│ │ │ │ +
52class tablereader;
│ │ │ │ + │ │ │ │ +
54
│ │ │ │ +
55} // namespace pqxx
│ │ │ │ +
56
│ │ │ │ +
57#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ +
signed int row_difference_type
Difference between row sizes.
Definition: types.hxx:27
│ │ │ │ +
long large_object_size_type
Number of bytes in a large object. (Unusual: it's signed.)
Definition: types.hxx:33
│ │ │ │
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
│ │ │ │ +
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
│ │ │ │
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
│ │ │ │ +
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
│ │ │ │ +
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
│ │ │ │
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ -
Common definitions for cursor types.
Definition: cursor.hxx:41
│ │ │ │ -
static difference_type prior() noexcept
Special value: read backwards, one row only.
Definition: cursor.hxx:120
│ │ │ │ -
static difference_type backward_all() noexcept
Special value: read backwards from current position back to origin.
Definition: cursor.cxx:35
│ │ │ │ -
cursor_base(const cursor_base &)=delete
│ │ │ │ -
accesspolicy
Cursor access-pattern policy.
Definition: cursor.hxx:51
│ │ │ │ -
@ forward_only
Cursor can move forward only.
Definition: cursor.hxx:53
│ │ │ │ -
result_size_type size_type
Definition: cursor.hxx:43
│ │ │ │ -
ownershippolicy
Cursor destruction policy.
Definition: cursor.hxx:90
│ │ │ │ -
@ owned
Destroy SQL cursor when cursor object is closed at end of transaction.
Definition: cursor.hxx:92
│ │ │ │ -
const std::string m_name
Definition: cursor.hxx:143
│ │ │ │ -
cursor_base()=delete
│ │ │ │ -
updatepolicy
Cursor update policy.
Definition: cursor.hxx:63
│ │ │ │ -
@ read_only
Cursor can be used to read data but not to write.
Definition: cursor.hxx:65
│ │ │ │ -
cursor_base & operator=(const cursor_base &)=delete
│ │ │ │ -
result_difference_type difference_type
Definition: cursor.hxx:44
│ │ │ │ -
"Stateless cursor" class: easy API for retrieving parts of result sets
Definition: cursor.hxx:162
│ │ │ │ -
const std::string & name() const noexcept
Definition: cursor.hxx:216
│ │ │ │ -
void close() noexcept
Definition: cursor.hxx:187
│ │ │ │ -
stateless_cursor(transaction_base &trans, const std::string adopted_cursor)
Adopt existing scrolling SQL cursor.
Definition: cursor.hxx:178
│ │ │ │ -
result_size_type size_type
Definition: cursor.hxx:164
│ │ │ │ -
result_difference_type difference_type
Definition: cursor.hxx:165
│ │ │ │ -
result retrieve(difference_type begin_pos, difference_type end_pos)
Retrieve rows from begin_pos (inclusive) to end_pos (exclusive)
Definition: cursor.hxx:207
│ │ │ │ -
stateless_cursor(transaction_base &trans, const std::string &query, const std::string &cname, bool hold)
Create cursor.
Definition: cursor.hxx:168
│ │ │ │ -
size_type size()
Number of rows in cursor's result set.
Definition: cursor.hxx:193
│ │ │ │ -
Simple read-only cursor represented as a stream of results.
Definition: cursor.hxx:253
│ │ │ │ -
cursor_base::size_type size_type
Definition: cursor.hxx:255
│ │ │ │ -
icursorstream & get(result &res)
Read new value into given result object; same as operator >>
Definition: cursor.hxx:316
│ │ │ │ -
difference_type stride() const noexcept
Definition: cursor.hxx:338
│ │ │ │ -
cursor_base::difference_type difference_type
Definition: cursor.hxx:256
│ │ │ │ -
icursorstream & operator>>(result &res)
Read new value into given result object; same as get(result &)
Definition: cursor.hxx:324
│ │ │ │ -
Approximate istream_iterator for icursorstream.
Definition: cursor.hxx:389
│ │ │ │ -
bool operator<=(const icursor_iterator &rhs) const
Definition: cursor.hxx:417
│ │ │ │ -
bool operator!=(const icursor_iterator &rhs) const noexcept
Definition: cursor.hxx:412
│ │ │ │ -
bool operator>(const icursor_iterator &rhs) const
Definition: cursor.hxx:415
│ │ │ │ -
istream_type::difference_type difference_type
Definition: cursor.hxx:397
│ │ │ │ -
const result * operator->() const
Definition: cursor.hxx:405
│ │ │ │ -
std::input_iterator_tag iterator_category
Definition: cursor.hxx:391
│ │ │ │ -
bool operator>=(const icursor_iterator &rhs) const
Definition: cursor.hxx:419
│ │ │ │ -
istream_type::size_type size_type
Definition: cursor.hxx:396
│ │ │ │ +
Definition: connectionpolicy.hxx:32
│ │ │ │ +
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ +
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:253
│ │ │ │
Reference to a field in a result set.
Definition: field.hxx:50
│ │ │ │ +
Accessor for large object's contents.
Definition: largeobject.hxx:138
│ │ │ │ +
Definition: notification.hxx:56
│ │ │ │
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ -
result_difference_type difference_type
Definition: result.hxx:73
│ │ │ │ +
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
│ │ │ │ +
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:122
│ │ │ │ +
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │ +
Iterator for fields in a row. Use as row::const_iterator.
Definition: row.hxx:208
│ │ │ │ +
Reverse iterator for a row. Use as row::const_reverse_iterator.
Definition: row.hxx:280
│ │ │ │ +
Definition: tablereader.hxx:30
│ │ │ │
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,419 +1,127 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -cursor.hxx │ │ │ │ │ +types.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_CURSOR │ │ │ │ │ - 14#define PQXX_H_CURSOR │ │ │ │ │ - 15 │ │ │ │ │ - 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include │ │ │ │ │ - 20#include │ │ │ │ │ - 21 │ │ │ │ │ - 22#include "pqxx/result.hxx" │ │ │ │ │ - 23#include "pqxx/transaction_base.hxx" │ │ │ │ │ - 24 │ │ │ │ │ + 10#ifndef PQXX_H_TYPES │ │ │ │ │ + 11#define PQXX_H_TYPES │ │ │ │ │ + 12 │ │ │ │ │ + 13#include │ │ │ │ │ + 14 │ │ │ │ │ + 15namespace pqxx │ │ │ │ │ + 16{ │ │ │ │ │ +18using result_size_type = unsigned long; │ │ │ │ │ + 19 │ │ │ │ │ +21using result_difference_type = signed long; │ │ │ │ │ + 22 │ │ │ │ │ +24using row_size_type = unsigned int; │ │ │ │ │ 25 │ │ │ │ │ - 26namespace pqxx │ │ │ │ │ - 27{ │ │ │ │ │ - 29 │ │ │ │ │ -40class PQXX_LIBEXPORT cursor_base │ │ │ │ │ - 41{ │ │ │ │ │ - 42public: │ │ │ │ │ -43 using size_type = result_size_type; │ │ │ │ │ -44 using difference_type = result_difference_type; │ │ │ │ │ - 45 │ │ │ │ │ - 47 │ │ │ │ │ -50 enum accesspolicy │ │ │ │ │ - 51 { │ │ │ │ │ -53 forward_only, │ │ │ │ │ - 55 random_access │ │ │ │ │ -56 }; │ │ │ │ │ - 57 │ │ │ │ │ - 59 │ │ │ │ │ -62 enum updatepolicy │ │ │ │ │ - 63 { │ │ │ │ │ -65 read_only, │ │ │ │ │ - 67 update │ │ │ │ │ -68 }; │ │ │ │ │ - 69 │ │ │ │ │ - 71 │ │ │ │ │ -89 enum ownershippolicy │ │ │ │ │ - 90 { │ │ │ │ │ -92 owned, │ │ │ │ │ - 94 loose │ │ │ │ │ -95 }; │ │ │ │ │ - 96 │ │ │ │ │ -97 cursor_base() =delete; │ │ │ │ │ -98 cursor_base(const cursor_base &) =delete; │ │ │ │ │ -99 cursor_base &operator=(const cursor_base &) =delete; │ │ │ │ │ - 100 │ │ │ │ │ - 105 │ │ │ │ │ - 107 │ │ │ │ │ - 110 static difference_type all() noexcept; //[t81] │ │ │ │ │ - 111 │ │ │ │ │ - 113 │ │ │ │ │ -115 static difference_type next() noexcept { return 1; } //[t81] │ │ │ │ │ - 116 │ │ │ │ │ - 118 │ │ │ │ │ -120 static difference_type prior() noexcept { return -1; } //[t00] │ │ │ │ │ - 121 │ │ │ │ │ - 123 │ │ │ │ │ - 125 static difference_type backward_all() noexcept; //[t00] │ │ │ │ │ - 126 │ │ │ │ │ - 128 │ │ │ │ │ - 130 │ │ │ │ │ -135 const std::string &name() const noexcept { return m_name; } //[t81] │ │ │ │ │ - 136 │ │ │ │ │ - 137protected: │ │ │ │ │ - 138 cursor_base( │ │ │ │ │ - 139 connection_base &, │ │ │ │ │ - 140 const std::string &Name, │ │ │ │ │ - 141 bool embellish_name=true); │ │ │ │ │ - 142 │ │ │ │ │ -143 const std::string m_name; │ │ │ │ │ - 144}; │ │ │ │ │ - 145} // namespace pqxx │ │ │ │ │ - 146 │ │ │ │ │ - 147 │ │ │ │ │ - 148#include │ │ │ │ │ - 149 │ │ │ │ │ - 150 │ │ │ │ │ - 151namespace pqxx │ │ │ │ │ - 152{ │ │ │ │ │ - 154 │ │ │ │ │ - 160template │ │ │ │ │ -161class stateless_cursor │ │ │ │ │ - 162{ │ │ │ │ │ - 163public: │ │ │ │ │ -164 using size_type = result_size_type; │ │ │ │ │ -165 using difference_type = result_difference_type; │ │ │ │ │ - 166 │ │ │ │ │ -168 stateless_cursor( │ │ │ │ │ - 169 transaction_base &trans, │ │ │ │ │ - 170 const std::string &query, │ │ │ │ │ - 171 const std::string &cname, │ │ │ │ │ - 172 bool hold) : │ │ │ │ │ - 173 m_cur{trans, query, cname, cursor_base::random_access, up, op, hold} │ │ │ │ │ - 174 { │ │ │ │ │ - 175 } │ │ │ │ │ - 176 │ │ │ │ │ -178 stateless_cursor( │ │ │ │ │ - 179 transaction_base &trans, │ │ │ │ │ - 180 const std::string adopted_cursor) : │ │ │ │ │ - 181 m_cur{trans, adopted_cursor, op} │ │ │ │ │ - 182 { │ │ │ │ │ - 183 // Put cursor in known position │ │ │ │ │ - 184 m_cur.move(cursor_base::backward_all()); │ │ │ │ │ - 185 } │ │ │ │ │ - 186 │ │ │ │ │ -187 void close() noexcept { m_cur.close(); } │ │ │ │ │ - 188 │ │ │ │ │ - 190 │ │ │ │ │ -193 size_type size() { return internal::obtain_stateless_cursor_size(m_cur); } │ │ │ │ │ - 194 │ │ │ │ │ - 196 │ │ │ │ │ -207 result retrieve(difference_type begin_pos, difference_type end_pos) │ │ │ │ │ - 208 { │ │ │ │ │ - 209 return internal::stateless_cursor_retrieve( │ │ │ │ │ - 210 m_cur, │ │ │ │ │ - 211 result::difference_type(size()), │ │ │ │ │ - 212 begin_pos, │ │ │ │ │ - 213 end_pos); │ │ │ │ │ - 214 } │ │ │ │ │ - 215 │ │ │ │ │ -216 const std::string &name() const noexcept { return m_cur.name(); } │ │ │ │ │ - 217 │ │ │ │ │ - 218private: │ │ │ │ │ - 219 internal::sql_cursor m_cur; │ │ │ │ │ - 220}; │ │ │ │ │ - 221 │ │ │ │ │ - 222 │ │ │ │ │ - 223class icursor_iterator; │ │ │ │ │ - 224 │ │ │ │ │ - 225 │ │ │ │ │ - 226namespace internal │ │ │ │ │ - 227{ │ │ │ │ │ - 228namespace gate │ │ │ │ │ - 229{ │ │ │ │ │ - 230class icursor_iterator_icursorstream; │ │ │ │ │ - 231class icursorstream_icursor_iterator; │ │ │ │ │ - 232} // namespace internal::gate │ │ │ │ │ - 233} // namespace internal │ │ │ │ │ - 234 │ │ │ │ │ - 235 │ │ │ │ │ - 237 │ │ │ │ │ -252class PQXX_LIBEXPORT icursorstream │ │ │ │ │ - 253{ │ │ │ │ │ - 254public: │ │ │ │ │ -255 using size_type = cursor_base::size_type; │ │ │ │ │ -256 using difference_type = cursor_base::difference_type; │ │ │ │ │ - 257 │ │ │ │ │ - 259 │ │ │ │ │ - 270 icursorstream( │ │ │ │ │ - 271 transaction_base &context, │ │ │ │ │ - 272 const std::string &query, │ │ │ │ │ - 273 const std::string &basename, │ │ │ │ │ - 274 difference_type sstride=1); //[t81] │ │ │ │ │ - 275 │ │ │ │ │ - 277 │ │ │ │ │ - 301 icursorstream( │ │ │ │ │ - 302 transaction_base &context, │ │ │ │ │ - 303 const field &cname, │ │ │ │ │ - 304 difference_type sstride=1, │ │ │ │ │ - 305 cursor_base::ownershippolicy op=cursor_base::owned); //[t84] │ │ │ │ │ - 306 │ │ │ │ │ -307 operator bool() const noexcept { return not m_done; } │ │ │ │ │ - 308 │ │ │ │ │ - 310 │ │ │ │ │ -316 icursorstream &get(result &res) { res = fetchblock(); return *this; } // │ │ │ │ │ -[t81] │ │ │ │ │ - 318 │ │ │ │ │ -324 icursorstream &operator>>(result &res) { return get(res); } //[t81] │ │ │ │ │ - 325 │ │ │ │ │ - 327 │ │ │ │ │ - 331 icursorstream &ignore(std::streamsize n=1); //[t81] │ │ │ │ │ - 332 │ │ │ │ │ - 334 │ │ │ │ │ - 337 void set_stride(difference_type stride); //[t81] │ │ │ │ │ -338 difference_type stride() const noexcept { return m_stride; } //[t81] │ │ │ │ │ - 339 │ │ │ │ │ - 340private: │ │ │ │ │ - 341 result fetchblock(); │ │ │ │ │ - 342 │ │ │ │ │ -343 friend class internal::gate::icursorstream_icursor_iterator; │ │ │ │ │ - 344 size_type forward(size_type n=1); │ │ │ │ │ - 345 void insert_iterator(icursor_iterator *) noexcept; │ │ │ │ │ - 346 void remove_iterator(icursor_iterator *) const noexcept; │ │ │ │ │ - 347 │ │ │ │ │ - 348 void service_iterators(difference_type); │ │ │ │ │ - 349 │ │ │ │ │ - 350 internal::sql_cursor m_cur; │ │ │ │ │ - 351 │ │ │ │ │ - 352 difference_type m_stride; │ │ │ │ │ - 353 difference_type m_realpos, m_reqpos; │ │ │ │ │ - 354 │ │ │ │ │ - 355 mutable icursor_iterator *m_iterators; │ │ │ │ │ - 356 │ │ │ │ │ - 357 bool m_done; │ │ │ │ │ - 358}; │ │ │ │ │ - 359 │ │ │ │ │ - 360 │ │ │ │ │ - 362 │ │ │ │ │ -388class PQXX_LIBEXPORT icursor_iterator │ │ │ │ │ - 389{ │ │ │ │ │ - 390public: │ │ │ │ │ -391 using iterator_category = std::input_iterator_tag; │ │ │ │ │ -392 using value_type = result; │ │ │ │ │ -393 using pointer = const result *; │ │ │ │ │ -394 using reference = const result &; │ │ │ │ │ -395 using istream_type = icursorstream; │ │ │ │ │ -396 using size_type = istream_type::size_type; │ │ │ │ │ -397 using difference_type = istream_type::difference_type; │ │ │ │ │ - 398 │ │ │ │ │ - 399 icursor_iterator() noexcept; //[t84] │ │ │ │ │ - 400 explicit icursor_iterator(istream_type &) noexcept; //[t84] │ │ │ │ │ - 401 icursor_iterator(const icursor_iterator &) noexcept; //[t84] │ │ │ │ │ - 402 ~icursor_iterator() noexcept; │ │ │ │ │ - 403 │ │ │ │ │ -404 const result &operator*() const { refresh(); return m_here; } //[t84] │ │ │ │ │ -405 const result *operator->() const { refresh(); return &m_here; } //[t84] │ │ │ │ │ - 406 icursor_iterator &operator++(); //[t84] │ │ │ │ │ - 407 icursor_iterator operator++(int); //[t84] │ │ │ │ │ - 408 icursor_iterator &operator+=(difference_type); //[t84] │ │ │ │ │ - 409 icursor_iterator &operator=(const icursor_iterator &) noexcept; //[t84] │ │ │ │ │ - 410 │ │ │ │ │ - 411 bool operator==(const icursor_iterator &rhs) const; //[t84] │ │ │ │ │ -412 bool operator!=(const icursor_iterator &rhs) const noexcept //[t84] │ │ │ │ │ - 413 { return not operator==(rhs); } │ │ │ │ │ - 414 bool operator<(const icursor_iterator &rhs) const; //[t84] │ │ │ │ │ -415 bool operator>(const icursor_iterator &rhs) const //[t84] │ │ │ │ │ - 416 { return rhs < *this; } │ │ │ │ │ -417 bool operator<=(const icursor_iterator &rhs) const //[t84] │ │ │ │ │ - 418 { return not (*this > rhs); } │ │ │ │ │ -419 bool operator>=(const icursor_iterator &rhs) const //[t84] │ │ │ │ │ - 420 { return not (*this < rhs); } │ │ │ │ │ - 421 │ │ │ │ │ - 422private: │ │ │ │ │ - 423 void refresh() const; │ │ │ │ │ - 424 │ │ │ │ │ -425 friend class internal::gate::icursor_iterator_icursorstream; │ │ │ │ │ - 426 difference_type pos() const noexcept { return m_pos; } │ │ │ │ │ - 427 void fill(const result &); │ │ │ │ │ - 428 │ │ │ │ │ - 429 icursorstream *m_stream = nullptr; │ │ │ │ │ - 430 result m_here; │ │ │ │ │ - 431 difference_type m_pos; │ │ │ │ │ - 432 icursor_iterator *m_prev = nullptr, *m_next = nullptr; │ │ │ │ │ - 433}; │ │ │ │ │ - 434} // namespace pqxx │ │ │ │ │ - 435 │ │ │ │ │ - 436#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 437#endif │ │ │ │ │ -std │ │ │ │ │ -STL namespace. │ │ │ │ │ +27using row_difference_type = signed int; │ │ │ │ │ + 28 │ │ │ │ │ +30using field_size_type = std::size_t; │ │ │ │ │ + 31 │ │ │ │ │ +33using large_object_size_type = long; │ │ │ │ │ + 34 │ │ │ │ │ + 35 │ │ │ │ │ + 36// Forward declarations, to help break compilation dependencies. │ │ │ │ │ + 37// These won't necessarily include all classes in libpqxx. │ │ │ │ │ + 38class binarystring; │ │ │ │ │ + 39class connectionpolicy; │ │ │ │ │ + 40class connection_base; │ │ │ │ │ + 41class const_result_iterator; │ │ │ │ │ + 42class const_reverse_result_iterator; │ │ │ │ │ + 43class const_reverse_row_iterator; │ │ │ │ │ + 44class const_row_iterator; │ │ │ │ │ + 45class dbtransaction; │ │ │ │ │ + 46class field; │ │ │ │ │ + 47class largeobjectaccess; │ │ │ │ │ + 48class notification_receiver; │ │ │ │ │ + 49class range_error; │ │ │ │ │ + 50class result; │ │ │ │ │ + 51class row; │ │ │ │ │ + 52class tablereader; │ │ │ │ │ + 53class transaction_base; │ │ │ │ │ + 54 │ │ │ │ │ + 55} // namespace pqxx │ │ │ │ │ + 56 │ │ │ │ │ + 57#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ +pqxx::row_difference_type │ │ │ │ │ +signed int row_difference_type │ │ │ │ │ +Difference between row sizes. │ │ │ │ │ +Definition: types.hxx:27 │ │ │ │ │ +pqxx::large_object_size_type │ │ │ │ │ +long large_object_size_type │ │ │ │ │ +Number of bytes in a large object. (Unusual: it's signed.) │ │ │ │ │ +Definition: types.hxx:33 │ │ │ │ │ pqxx::result_difference_type │ │ │ │ │ signed long result_difference_type │ │ │ │ │ Difference between result sizes. │ │ │ │ │ Definition: types.hxx:21 │ │ │ │ │ +pqxx::field_size_type │ │ │ │ │ +std::size_t field_size_type │ │ │ │ │ +Number of bytes in a field of database data. │ │ │ │ │ +Definition: types.hxx:30 │ │ │ │ │ pqxx::result_size_type │ │ │ │ │ unsigned long result_size_type │ │ │ │ │ Number of rows in a result set. │ │ │ │ │ Definition: types.hxx:18 │ │ │ │ │ +pqxx::row_size_type │ │ │ │ │ +unsigned int row_size_type │ │ │ │ │ +Number of fields in a row of database data. │ │ │ │ │ +Definition: types.hxx:24 │ │ │ │ │ +pqxx::binarystring │ │ │ │ │ +Binary data corresponding to PostgreSQL's "BYTEA" binary-string type. │ │ │ │ │ +Definition: binarystring.hxx:54 │ │ │ │ │ pqxx::connection_base │ │ │ │ │ connection_base abstract base class; represents a connection to a database. │ │ │ │ │ Definition: connection_base.hxx:140 │ │ │ │ │ -pqxx::cursor_base │ │ │ │ │ -Common definitions for cursor types. │ │ │ │ │ -Definition: cursor.hxx:41 │ │ │ │ │ -pqxx::cursor_base::prior │ │ │ │ │ -static difference_type prior() noexcept │ │ │ │ │ -Special value: read backwards, one row only. │ │ │ │ │ -Definition: cursor.hxx:120 │ │ │ │ │ -pqxx::cursor_base::backward_all │ │ │ │ │ -static difference_type backward_all() noexcept │ │ │ │ │ -Special value: read backwards from current position back to origin. │ │ │ │ │ -Definition: cursor.cxx:35 │ │ │ │ │ -pqxx::cursor_base::cursor_base │ │ │ │ │ -cursor_base(const cursor_base &)=delete │ │ │ │ │ -pqxx::cursor_base::accesspolicy │ │ │ │ │ -accesspolicy │ │ │ │ │ -Cursor access-pattern policy. │ │ │ │ │ -Definition: cursor.hxx:51 │ │ │ │ │ -pqxx::cursor_base::forward_only │ │ │ │ │ -@ forward_only │ │ │ │ │ -Cursor can move forward only. │ │ │ │ │ -Definition: cursor.hxx:53 │ │ │ │ │ -pqxx::cursor_base::size_type │ │ │ │ │ -result_size_type size_type │ │ │ │ │ -Definition: cursor.hxx:43 │ │ │ │ │ -pqxx::cursor_base::ownershippolicy │ │ │ │ │ -ownershippolicy │ │ │ │ │ -Cursor destruction policy. │ │ │ │ │ -Definition: cursor.hxx:90 │ │ │ │ │ -pqxx::cursor_base::owned │ │ │ │ │ -@ owned │ │ │ │ │ -Destroy SQL cursor when cursor object is closed at end of transaction. │ │ │ │ │ -Definition: cursor.hxx:92 │ │ │ │ │ -pqxx::cursor_base::m_name │ │ │ │ │ -const std::string m_name │ │ │ │ │ -Definition: cursor.hxx:143 │ │ │ │ │ -pqxx::cursor_base::cursor_base │ │ │ │ │ -cursor_base()=delete │ │ │ │ │ -pqxx::cursor_base::updatepolicy │ │ │ │ │ -updatepolicy │ │ │ │ │ -Cursor update policy. │ │ │ │ │ -Definition: cursor.hxx:63 │ │ │ │ │ -pqxx::cursor_base::read_only │ │ │ │ │ -@ read_only │ │ │ │ │ -Cursor can be used to read data but not to write. │ │ │ │ │ -Definition: cursor.hxx:65 │ │ │ │ │ -pqxx::cursor_base::operator= │ │ │ │ │ -cursor_base & operator=(const cursor_base &)=delete │ │ │ │ │ -pqxx::cursor_base::difference_type │ │ │ │ │ -result_difference_type difference_type │ │ │ │ │ -Definition: cursor.hxx:44 │ │ │ │ │ -pqxx::stateless_cursor │ │ │ │ │ -"Stateless cursor" class: easy API for retrieving parts of result sets │ │ │ │ │ -Definition: cursor.hxx:162 │ │ │ │ │ -pqxx::stateless_cursor::name │ │ │ │ │ -const std::string & name() const noexcept │ │ │ │ │ -Definition: cursor.hxx:216 │ │ │ │ │ -pqxx::stateless_cursor::close │ │ │ │ │ -void close() noexcept │ │ │ │ │ -Definition: cursor.hxx:187 │ │ │ │ │ -pqxx::stateless_cursor::stateless_cursor │ │ │ │ │ -stateless_cursor(transaction_base &trans, const std::string adopted_cursor) │ │ │ │ │ -Adopt existing scrolling SQL cursor. │ │ │ │ │ -Definition: cursor.hxx:178 │ │ │ │ │ -pqxx::stateless_cursor::size_type │ │ │ │ │ -result_size_type size_type │ │ │ │ │ -Definition: cursor.hxx:164 │ │ │ │ │ -pqxx::stateless_cursor::difference_type │ │ │ │ │ -result_difference_type difference_type │ │ │ │ │ -Definition: cursor.hxx:165 │ │ │ │ │ -pqxx::stateless_cursor::retrieve │ │ │ │ │ -result retrieve(difference_type begin_pos, difference_type end_pos) │ │ │ │ │ -Retrieve rows from begin_pos (inclusive) to end_pos (exclusive) │ │ │ │ │ -Definition: cursor.hxx:207 │ │ │ │ │ -pqxx::stateless_cursor::stateless_cursor │ │ │ │ │ -stateless_cursor(transaction_base &trans, const std::string &query, const std:: │ │ │ │ │ -string &cname, bool hold) │ │ │ │ │ -Create cursor. │ │ │ │ │ -Definition: cursor.hxx:168 │ │ │ │ │ -pqxx::stateless_cursor::size │ │ │ │ │ -size_type size() │ │ │ │ │ -Number of rows in cursor's result set. │ │ │ │ │ -Definition: cursor.hxx:193 │ │ │ │ │ -pqxx::icursorstream │ │ │ │ │ -Simple read-only cursor represented as a stream of results. │ │ │ │ │ -Definition: cursor.hxx:253 │ │ │ │ │ -pqxx::icursorstream::size_type │ │ │ │ │ -cursor_base::size_type size_type │ │ │ │ │ -Definition: cursor.hxx:255 │ │ │ │ │ -pqxx::icursorstream::get │ │ │ │ │ -icursorstream & get(result &res) │ │ │ │ │ -Read new value into given result object; same as operator >> │ │ │ │ │ -Definition: cursor.hxx:316 │ │ │ │ │ -pqxx::icursorstream::stride │ │ │ │ │ -difference_type stride() const noexcept │ │ │ │ │ -Definition: cursor.hxx:338 │ │ │ │ │ -pqxx::icursorstream::difference_type │ │ │ │ │ -cursor_base::difference_type difference_type │ │ │ │ │ -Definition: cursor.hxx:256 │ │ │ │ │ -pqxx::icursorstream::operator>> │ │ │ │ │ -icursorstream & operator>>(result &res) │ │ │ │ │ -Read new value into given result object; same as get(result &) │ │ │ │ │ -Definition: cursor.hxx:324 │ │ │ │ │ -pqxx::icursor_iterator │ │ │ │ │ -Approximate istream_iterator for icursorstream. │ │ │ │ │ -Definition: cursor.hxx:389 │ │ │ │ │ -pqxx::icursor_iterator::operator<= │ │ │ │ │ -bool operator<=(const icursor_iterator &rhs) const │ │ │ │ │ -Definition: cursor.hxx:417 │ │ │ │ │ -pqxx::icursor_iterator::operator!= │ │ │ │ │ -bool operator!=(const icursor_iterator &rhs) const noexcept │ │ │ │ │ -Definition: cursor.hxx:412 │ │ │ │ │ -pqxx::icursor_iterator::operator> │ │ │ │ │ -bool operator>(const icursor_iterator &rhs) const │ │ │ │ │ -Definition: cursor.hxx:415 │ │ │ │ │ -pqxx::icursor_iterator::difference_type │ │ │ │ │ -istream_type::difference_type difference_type │ │ │ │ │ -Definition: cursor.hxx:397 │ │ │ │ │ -pqxx::icursor_iterator::operator-> │ │ │ │ │ -const result * operator->() const │ │ │ │ │ -Definition: cursor.hxx:405 │ │ │ │ │ -pqxx::icursor_iterator::iterator_category │ │ │ │ │ -std::input_iterator_tag iterator_category │ │ │ │ │ -Definition: cursor.hxx:391 │ │ │ │ │ -pqxx::icursor_iterator::operator>= │ │ │ │ │ -bool operator>=(const icursor_iterator &rhs) const │ │ │ │ │ -Definition: cursor.hxx:419 │ │ │ │ │ -pqxx::icursor_iterator::size_type │ │ │ │ │ -istream_type::size_type size_type │ │ │ │ │ -Definition: cursor.hxx:396 │ │ │ │ │ +pqxx::connectionpolicy │ │ │ │ │ +Definition: connectionpolicy.hxx:32 │ │ │ │ │ +pqxx::dbtransaction │ │ │ │ │ +Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ +Definition: dbtransaction.hxx:63 │ │ │ │ │ +pqxx::range_error │ │ │ │ │ +Something is out of range, similar to std::out_of_range. │ │ │ │ │ +Definition: except.hxx:253 │ │ │ │ │ pqxx::field │ │ │ │ │ Reference to a field in a result set. │ │ │ │ │ Definition: field.hxx:50 │ │ │ │ │ +pqxx::largeobjectaccess │ │ │ │ │ +Accessor for large object's contents. │ │ │ │ │ +Definition: largeobject.hxx:138 │ │ │ │ │ +pqxx::notification_receiver │ │ │ │ │ +Definition: notification.hxx:56 │ │ │ │ │ pqxx::result │ │ │ │ │ Result set containing data returned by a query or command. │ │ │ │ │ Definition: result.hxx:70 │ │ │ │ │ -pqxx::result::difference_type │ │ │ │ │ -result_difference_type difference_type │ │ │ │ │ -Definition: result.hxx:73 │ │ │ │ │ +pqxx::const_result_iterator │ │ │ │ │ +Iterator for rows in a result. Use as result::const_iterator. │ │ │ │ │ +Definition: result_iterator.hxx:36 │ │ │ │ │ +pqxx::const_reverse_result_iterator │ │ │ │ │ +Reverse iterator for result. Use as result::const_reverse_iterator. │ │ │ │ │ +Definition: result_iterator.hxx:122 │ │ │ │ │ +pqxx::row │ │ │ │ │ +Reference to one row in a result. │ │ │ │ │ +Definition: row.hxx:41 │ │ │ │ │ +pqxx::const_row_iterator │ │ │ │ │ +Iterator for fields in a row. Use as row::const_iterator. │ │ │ │ │ +Definition: row.hxx:208 │ │ │ │ │ +pqxx::const_reverse_row_iterator │ │ │ │ │ +Reverse iterator for a row. Use as row::const_reverse_iterator. │ │ │ │ │ +Definition: row.hxx:280 │ │ │ │ │ +pqxx::tablereader │ │ │ │ │ +Definition: tablereader.hxx:30 │ │ │ │ │ pqxx::transaction_base │ │ │ │ │ Interface definition (and common code) for "transaction" classes. │ │ │ │ │ Definition: transaction_base.hxx:138 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * cursor.hxx │ │ │ │ │ + * types.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00092_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: version.hxx Source File │ │ │ │ +libpqxx: strconv.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,45 +55,322 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
version.hxx
│ │ │ │ +
strconv.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
11#ifndef PQXX_H_VERSION
│ │ │ │ -
12
│ │ │ │ -
13#include "pqxx/compiler-public.hxx"
│ │ │ │ -
14#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
11#ifndef PQXX_H_STRINGCONV
│ │ │ │ +
12#define PQXX_H_STRINGCONV
│ │ │ │ +
13
│ │ │ │ +
14#include "pqxx/compiler-public.hxx"
│ │ │ │
15
│ │ │ │ -
17#define PQXX_VERSION "6.4.4"
│ │ │ │ -
19#define PQXX_ABI "6.4"
│ │ │ │ +
16#include <limits>
│ │ │ │ +
17#include <sstream>
│ │ │ │ +
18#include <stdexcept>
│ │ │ │ +
19
│ │ │ │
20
│ │ │ │ -
22#define PQXX_VERSION_MAJOR 6
│ │ │ │ -
24#define PQXX_VERSION_MINOR 4
│ │ │ │ -
25
│ │ │ │ -
26namespace pqxx
│ │ │ │ -
27{
│ │ │ │ -
28namespace internal
│ │ │ │ -
29{
│ │ │ │ -
31
│ │ │ │ -
53template<int, int> PQXX_LIBEXPORT int check_library_version() noexcept;
│ │ │ │ -
54}
│ │ │ │ -
55}
│ │ │ │ -
56#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
57#endif
│ │ │ │ +
21namespace pqxx
│ │ │ │ +
22{
│ │ │ │ +
23
│ │ │ │ +
46
│ │ │ │ +
48
│ │ │ │ +
51template<typename T, typename = void> struct string_traits;
│ │ │ │ +
52
│ │ │ │ +
53namespace internal
│ │ │ │ +
54{
│ │ │ │ +
56[[noreturn]] PQXX_LIBEXPORT void throw_null_conversion(
│ │ │ │ +
57 const std::string &type);
│ │ │ │ +
58
│ │ │ │ +
60
│ │ │ │ +
67template<typename TYPE> struct type_name;
│ │ │ │ +
68#define PQXX_DECLARE_TYPE_NAME(TYPE) \
│ │ │ │ +
69 template<> struct type_name<TYPE> \
│ │ │ │ +
70 { static constexpr const char *value = #TYPE; }
│ │ │ │ +
71
│ │ │ │ + │ │ │ │ + │ │ │ │ +
74PQXX_DECLARE_TYPE_NAME(unsigned short);
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
80PQXX_DECLARE_TYPE_NAME(unsigned long long);
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
87PQXX_DECLARE_TYPE_NAME(const std::string);
│ │ │ │ +
88PQXX_DECLARE_TYPE_NAME(std::stringstream);
│ │ │ │ +
89#undef PQXX_DECLARE_TYPE_NAME
│ │ │ │ +
90
│ │ │ │ +
91template<size_t N> struct type_name<char[N]>
│ │ │ │ +
92{ static constexpr const char *value = "char[]"; };
│ │ │ │ +
93
│ │ │ │ +
94
│ │ │ │ +
96
│ │ │ │ +
102template<typename TYPE> struct PQXX_LIBEXPORT builtin_traits
│ │ │ │ +
103{
│ │ │ │ +
104 static constexpr const char *name() noexcept
│ │ │ │ + │ │ │ │ +
106 static constexpr bool has_null() noexcept { return false; }
│ │ │ │ +
107 static bool is_null(TYPE) { return false; }
│ │ │ │ +
108 [[noreturn]] static TYPE null() { throw_null_conversion(name()); }
│ │ │ │ +
109 static void from_string(const char Str[], TYPE &Obj);
│ │ │ │ +
110 static std::string to_string(TYPE Obj);
│ │ │ │ +
111};
│ │ │ │ +
112} // namespace pqxx::internal
│ │ │ │ +
113
│ │ │ │ +
114
│ │ │ │ +
116#define PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(TYPE) \
│ │ │ │ +
117 template<> struct PQXX_LIBEXPORT string_traits<TYPE> : \
│ │ │ │ +
118 internal::builtin_traits<TYPE> {};
│ │ │ │ +
119
│ │ │ │ +
120PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(bool)
│ │ │ │ +
121
│ │ │ │ +
122PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(short)
│ │ │ │ +
123PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned short)
│ │ │ │ +
124PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(int)
│ │ │ │ +
125PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned int)
│ │ │ │ +
126PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long)
│ │ │ │ +
127PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long)
│ │ │ │ +
128PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long long)
│ │ │ │ +
129PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long long)
│ │ │ │ +
130
│ │ │ │ +
131PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(float)
│ │ │ │ +
132PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(double)
│ │ │ │ +
133PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long double)
│ │ │ │ +
134
│ │ │ │ +
135#undef PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION
│ │ │ │ +
136
│ │ │ │ +
137
│ │ │ │ +
139
│ │ │ │ +
148template<typename ENUM>
│ │ │ │ + │ │ │ │ +
150{
│ │ │ │ +
151 using underlying_type = typename std::underlying_type<ENUM>::type;
│ │ │ │ + │ │ │ │ +
153
│ │ │ │ +
154 static constexpr bool has_null() noexcept { return false; }
│ │ │ │ +
155 [[noreturn]] static ENUM null()
│ │ │ │ +
156 { internal::throw_null_conversion("enum type"); }
│ │ │ │ +
157
│ │ │ │ +
158 static void from_string(const char Str[], ENUM &Obj)
│ │ │ │ +
159 {
│ │ │ │ +
160 underlying_type tmp;
│ │ │ │ +
161 underlying_traits::from_string(Str, tmp);
│ │ │ │ +
162 Obj = ENUM(tmp);
│ │ │ │ +
163 }
│ │ │ │ +
164
│ │ │ │ +
165 static std::string to_string(ENUM Obj)
│ │ │ │ +
166 { return underlying_traits::to_string(underlying_type(Obj)); }
│ │ │ │ +
167};
│ │ │ │ +
168
│ │ │ │ +
169
│ │ │ │ +
171
│ │ │ │ +
182#define PQXX_DECLARE_ENUM_CONVERSION(ENUM) \
│ │ │ │ +
183template<> \
│ │ │ │ +
184struct string_traits<ENUM> : pqxx::enum_traits<ENUM> \
│ │ │ │ +
185{ \
│ │ │ │ +
186 static constexpr const char *name() noexcept { return #ENUM; } \
│ │ │ │ +
187 [[noreturn]] static ENUM null() \
│ │ │ │ +
188 { internal::throw_null_conversion(name()); } \
│ │ │ │ +
189}
│ │ │ │ +
190
│ │ │ │ +
191
│ │ │ │ +
193template<> struct PQXX_LIBEXPORT string_traits<const char *>
│ │ │ │ +
194{
│ │ │ │ +
195 static constexpr const char *name() noexcept { return "const char *"; }
│ │ │ │ +
196 static constexpr bool has_null() noexcept { return true; }
│ │ │ │ +
197 static bool is_null(const char *t) { return t == nullptr; }
│ │ │ │ +
198 static const char *null() { return nullptr; }
│ │ │ │ +
199 static void from_string(const char Str[], const char *&Obj) { Obj = Str; }
│ │ │ │ +
200 static std::string to_string(const char *Obj) { return Obj; }
│ │ │ │ +
201};
│ │ │ │ +
202
│ │ │ │ +
204template<> struct PQXX_LIBEXPORT string_traits<char *>
│ │ │ │ +
205{
│ │ │ │ +
206 static constexpr const char *name() noexcept { return "char *"; }
│ │ │ │ +
207 static constexpr bool has_null() noexcept { return true; }
│ │ │ │ +
208 static bool is_null(const char *t) { return t == nullptr; }
│ │ │ │ +
209 static const char *null() { return nullptr; }
│ │ │ │ +
210
│ │ │ │ +
211 // Don't allow this conversion since it breaks const-safety.
│ │ │ │ +
212 // static void from_string(const char Str[], char *&Obj);
│ │ │ │ +
213
│ │ │ │ +
214 static std::string to_string(char *Obj) { return Obj; }
│ │ │ │ +
215};
│ │ │ │ +
216
│ │ │ │ +
218template<size_t N> struct PQXX_LIBEXPORT string_traits<char[N]>
│ │ │ │ +
219{
│ │ │ │ +
220 static constexpr const char *name() noexcept { return "char[]"; }
│ │ │ │ +
221 static constexpr bool has_null() noexcept { return true; }
│ │ │ │ +
222 static bool is_null(const char t[]) { return t == nullptr; }
│ │ │ │ +
223 static const char *null() { return nullptr; }
│ │ │ │ +
224 static std::string to_string(const char Obj[]) { return Obj; }
│ │ │ │ +
225};
│ │ │ │ +
226
│ │ │ │ +
227template<> struct PQXX_LIBEXPORT string_traits<std::string>
│ │ │ │ +
228{
│ │ │ │ +
229 static constexpr const char *name() noexcept { return "string"; }
│ │ │ │ +
230 static constexpr bool has_null() noexcept { return false; }
│ │ │ │ +
231 static bool is_null(const std::string &) { return false; }
│ │ │ │ +
232 [[noreturn]] static std::string null()
│ │ │ │ + │ │ │ │ +
234 static void from_string(const char Str[], std::string &Obj) { Obj=Str; }
│ │ │ │ +
235 static std::string to_string(const std::string &Obj) { return Obj; }
│ │ │ │ +
236};
│ │ │ │ +
237
│ │ │ │ +
238template<> struct PQXX_LIBEXPORT string_traits<const std::string>
│ │ │ │ +
239{
│ │ │ │ +
240 static constexpr const char *name() noexcept { return "const string"; }
│ │ │ │ +
241 static constexpr bool has_null() noexcept { return false; }
│ │ │ │ +
242 static bool is_null(const std::string &) { return false; }
│ │ │ │ +
243 [[noreturn]] static const std::string null()
│ │ │ │ + │ │ │ │ +
245 static const std::string to_string(const std::string &Obj) { return Obj; }
│ │ │ │ +
246};
│ │ │ │ +
247
│ │ │ │ +
248template<> struct PQXX_LIBEXPORT string_traits<std::stringstream>
│ │ │ │ +
249{
│ │ │ │ +
250 static constexpr const char *name() noexcept { return "stringstream"; }
│ │ │ │ +
251 static constexpr bool has_null() noexcept { return false; }
│ │ │ │ +
252 static bool is_null(const std::stringstream &) { return false; }
│ │ │ │ +
253 [[noreturn]] static std::stringstream null()
│ │ │ │ + │ │ │ │ +
255 static void from_string(const char Str[], std::stringstream &Obj)
│ │ │ │ +
256 { Obj.clear(); Obj << Str; }
│ │ │ │ +
257 static std::string to_string(const std::stringstream &Obj)
│ │ │ │ +
258 { return Obj.str(); }
│ │ │ │ +
259};
│ │ │ │ +
260
│ │ │ │ +
261
│ │ │ │ +
262// TODO: Implement date conversions.
│ │ │ │ +
263
│ │ │ │ +
265
│ │ │ │ +
277template<typename T>
│ │ │ │ +
278 inline void from_string(const char Str[], T &Obj)
│ │ │ │ +
279{
│ │ │ │ +
280 if (Str == nullptr) throw std::runtime_error{"Attempt to read null string."};
│ │ │ │ + │ │ │ │ +
282}
│ │ │ │ +
283
│ │ │ │ +
284
│ │ │ │ +
286
│ │ │ │ +
292template<typename T> inline void from_string(const char Str[], T &Obj, size_t)
│ │ │ │ +
293{
│ │ │ │ +
294 return from_string(Str, Obj);
│ │ │ │ +
295}
│ │ │ │ +
296
│ │ │ │ +
297template<>
│ │ │ │ +
298 inline void from_string<std::string>( //[t00]
│ │ │ │ +
299 const char Str[],
│ │ │ │ +
300 std::string &Obj,
│ │ │ │ +
301 size_t len)
│ │ │ │ +
302{
│ │ │ │ +
303 if (Str == nullptr) throw std::runtime_error{"Attempt to read null string."};
│ │ │ │ +
304 Obj.assign(Str, len);
│ │ │ │ +
305}
│ │ │ │ +
306
│ │ │ │ +
307template<typename T>
│ │ │ │ +
308 inline void from_string(const std::string &Str, T &Obj) //[t45]
│ │ │ │ +
309 { from_string(Str.c_str(), Obj); }
│ │ │ │ +
310
│ │ │ │ +
311template<typename T>
│ │ │ │ +
312 inline void from_string(const std::stringstream &Str, T &Obj) //[t00]
│ │ │ │ +
313 { from_string(Str.str(), Obj); }
│ │ │ │ +
314
│ │ │ │ +
315template<> inline void
│ │ │ │ +
316from_string(const std::string &Str, std::string &Obj) //[t46]
│ │ │ │ +
317 { Obj = Str; }
│ │ │ │ +
318
│ │ │ │ +
319
│ │ │ │ +
320namespace internal
│ │ │ │ +
321{
│ │ │ │ +
323constexpr int digit_to_number(char c) noexcept { return c-'0'; }
│ │ │ │ +
324constexpr char number_to_digit(int i) noexcept
│ │ │ │ +
325 { return static_cast<char>(i+'0'); }
│ │ │ │ +
326} // namespace pqxx::internal
│ │ │ │ +
327
│ │ │ │ +
328
│ │ │ │ +
330
│ │ │ │ +
334template<typename T> inline std::string to_string(const T &Obj)
│ │ │ │ +
335 { return string_traits<T>::to_string(Obj); }
│ │ │ │ +
336
│ │ │ │ +
338
│ │ │ │ +
339} // namespace pqxx
│ │ │ │ +
340
│ │ │ │ +
341#endif
│ │ │ │ +
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
int check_library_version() noexcept
Library version check stub.
│ │ │ │ +
void from_string(const field &F, T &Obj)
Convert a field's string contents to another type.
Definition: field.hxx:365
│ │ │ │ +
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
│ │ │ │ +
PQXX_DECLARE_TYPE_NAME(bool)
│ │ │ │ +
constexpr char number_to_digit(int i) noexcept
Definition: strconv.hxx:324
│ │ │ │ +
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
│ │ │ │ +
void throw_null_conversion(const std::string &type)
Throw exception for attempt to convert null to given type.
Definition: strconv.cxx:58
│ │ │ │ +
Traits class for use in string conversions.
Definition: strconv.hxx:51
│ │ │ │ +
Give a human-readable name for a type, at compile time.
Definition: strconv.hxx:67
│ │ │ │ +
Helper: string traits implementation for built-in types.
Definition: strconv.hxx:103
│ │ │ │ +
static void from_string(const char Str[], TYPE &Obj)
│ │ │ │ +
static bool is_null(TYPE)
Definition: strconv.hxx:107
│ │ │ │ +
static std::string to_string(TYPE Obj)
│ │ │ │ +
static TYPE null()
Definition: strconv.hxx:108
│ │ │ │ +
static constexpr const char * name() noexcept
Definition: strconv.hxx:104
│ │ │ │ +
static constexpr bool has_null() noexcept
Definition: strconv.hxx:106
│ │ │ │ +
Helper class for defining enum conversions.
Definition: strconv.hxx:150
│ │ │ │ +
static std::string to_string(ENUM Obj)
Definition: strconv.hxx:165
│ │ │ │ +
static ENUM null()
Definition: strconv.hxx:155
│ │ │ │ +
static constexpr bool has_null() noexcept
Definition: strconv.hxx:154
│ │ │ │ +
static void from_string(const char Str[], ENUM &Obj)
Definition: strconv.hxx:158
│ │ │ │ +
typename std::underlying_type< ENUM >::type underlying_type
Definition: strconv.hxx:151
│ │ │ │ +
static const char * null()
Definition: strconv.hxx:198
│ │ │ │ +
static std::string to_string(const char *Obj)
Definition: strconv.hxx:200
│ │ │ │ +
static bool is_null(const char *t)
Definition: strconv.hxx:197
│ │ │ │ +
static constexpr const char * name() noexcept
Definition: strconv.hxx:195
│ │ │ │ +
static void from_string(const char Str[], const char *&Obj)
Definition: strconv.hxx:199
│ │ │ │ +
static constexpr bool has_null() noexcept
Definition: strconv.hxx:196
│ │ │ │ +
static constexpr const char * name() noexcept
Definition: strconv.hxx:206
│ │ │ │ +
static bool is_null(const char *t)
Definition: strconv.hxx:208
│ │ │ │ +
static std::string to_string(char *Obj)
Definition: strconv.hxx:214
│ │ │ │ +
static constexpr bool has_null() noexcept
Definition: strconv.hxx:207
│ │ │ │ +
static const char * null()
Definition: strconv.hxx:209
│ │ │ │ +
static constexpr bool has_null() noexcept
Definition: strconv.hxx:221
│ │ │ │ +
static constexpr const char * name() noexcept
Definition: strconv.hxx:220
│ │ │ │ +
static const char * null()
Definition: strconv.hxx:223
│ │ │ │ +
static bool is_null(const char t[])
Definition: strconv.hxx:222
│ │ │ │ +
static std::string to_string(const char Obj[])
Definition: strconv.hxx:224
│ │ │ │ +
static bool is_null(const std::string &)
Definition: strconv.hxx:231
│ │ │ │ +
static void from_string(const char Str[], std::string &Obj)
Definition: strconv.hxx:234
│ │ │ │ +
static std::string to_string(const std::string &Obj)
Definition: strconv.hxx:235
│ │ │ │ +
static constexpr bool has_null() noexcept
Definition: strconv.hxx:230
│ │ │ │ +
static constexpr const char * name() noexcept
Definition: strconv.hxx:229
│ │ │ │ +
static std::string null()
Definition: strconv.hxx:232
│ │ │ │ +
static const std::string null()
Definition: strconv.hxx:243
│ │ │ │ +
static constexpr const char * name() noexcept
Definition: strconv.hxx:240
│ │ │ │ +
static const std::string to_string(const std::string &Obj)
Definition: strconv.hxx:245
│ │ │ │ +
static bool is_null(const std::string &)
Definition: strconv.hxx:242
│ │ │ │ +
static constexpr bool has_null() noexcept
Definition: strconv.hxx:241
│ │ │ │ +
static constexpr bool has_null() noexcept
Definition: strconv.hxx:251
│ │ │ │ +
static bool is_null(const std::stringstream &)
Definition: strconv.hxx:252
│ │ │ │ +
static std::string to_string(const std::stringstream &Obj)
Definition: strconv.hxx:257
│ │ │ │ +
static void from_string(const char Str[], std::stringstream &Obj)
Definition: strconv.hxx:255
│ │ │ │ +
static constexpr const char * name() noexcept
Definition: strconv.hxx:250
│ │ │ │ +
static std::stringstream null()
Definition: strconv.hxx:253
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,40 +1,428 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -version.hxx │ │ │ │ │ +strconv.hxx │ │ │ │ │ 1 │ │ │ │ │ - 11#ifndef PQXX_H_VERSION │ │ │ │ │ - 12 │ │ │ │ │ - 13#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 14#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 11#ifndef PQXX_H_STRINGCONV │ │ │ │ │ + 12#define PQXX_H_STRINGCONV │ │ │ │ │ + 13 │ │ │ │ │ + 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ 15 │ │ │ │ │ - 17#define PQXX_VERSION "6.4.4" │ │ │ │ │ - 19#define PQXX_ABI "6.4" │ │ │ │ │ + 16#include │ │ │ │ │ + 17#include │ │ │ │ │ + 18#include │ │ │ │ │ + 19 │ │ │ │ │ 20 │ │ │ │ │ - 22#define PQXX_VERSION_MAJOR 6 │ │ │ │ │ - 24#define PQXX_VERSION_MINOR 4 │ │ │ │ │ - 25 │ │ │ │ │ - 26namespace pqxx │ │ │ │ │ - 27{ │ │ │ │ │ - 28namespace internal │ │ │ │ │ - 29{ │ │ │ │ │ - 31 │ │ │ │ │ -53template PQXX_LIBEXPORT int check_library_version() noexcept; │ │ │ │ │ - 54} │ │ │ │ │ - 55} │ │ │ │ │ - 56#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 57#endif │ │ │ │ │ + 21namespace pqxx │ │ │ │ │ + 22{ │ │ │ │ │ + 23 │ │ │ │ │ + 46 │ │ │ │ │ + 48 │ │ │ │ │ +51template struct string_traits; │ │ │ │ │ + 52 │ │ │ │ │ + 53namespace internal │ │ │ │ │ + 54{ │ │ │ │ │ + 56[[noreturn]] PQXX_LIBEXPORT void throw_null_conversion( │ │ │ │ │ + 57 const std::string &type); │ │ │ │ │ + 58 │ │ │ │ │ + 60 │ │ │ │ │ +67template struct type_name; │ │ │ │ │ + 68#define PQXX_DECLARE_TYPE_NAME(TYPE) \ │ │ │ │ │ + 69 template<> struct type_name \ │ │ │ │ │ + 70 { static constexpr const char *value = #TYPE; } │ │ │ │ │ + 71 │ │ │ │ │ +72PQXX_DECLARE_TYPE_NAME(bool); │ │ │ │ │ +73PQXX_DECLARE_TYPE_NAME(short); │ │ │ │ │ +74PQXX_DECLARE_TYPE_NAME(unsigned short); │ │ │ │ │ +75PQXX_DECLARE_TYPE_NAME(int); │ │ │ │ │ +76PQXX_DECLARE_TYPE_NAME(unsigned int); │ │ │ │ │ +77PQXX_DECLARE_TYPE_NAME(long); │ │ │ │ │ +78PQXX_DECLARE_TYPE_NAME(unsigned long); │ │ │ │ │ +79PQXX_DECLARE_TYPE_NAME(long long); │ │ │ │ │ +80PQXX_DECLARE_TYPE_NAME(unsigned long long); │ │ │ │ │ +81PQXX_DECLARE_TYPE_NAME(float); │ │ │ │ │ +82PQXX_DECLARE_TYPE_NAME(double); │ │ │ │ │ +83PQXX_DECLARE_TYPE_NAME(long double); │ │ │ │ │ +84PQXX_DECLARE_TYPE_NAME(char *); │ │ │ │ │ +85PQXX_DECLARE_TYPE_NAME(const char *); │ │ │ │ │ +86PQXX_DECLARE_TYPE_NAME(std::string); │ │ │ │ │ + 87PQXX_DECLARE_TYPE_NAME(const std::string); │ │ │ │ │ +88PQXX_DECLARE_TYPE_NAME(std::stringstream); │ │ │ │ │ + 89#undef PQXX_DECLARE_TYPE_NAME │ │ │ │ │ + 90 │ │ │ │ │ +91template struct type_name │ │ │ │ │ +92{ static constexpr const char *value = "char[]"; }; │ │ │ │ │ + 93 │ │ │ │ │ + 94 │ │ │ │ │ + 96 │ │ │ │ │ +102template struct PQXX_LIBEXPORT builtin_traits │ │ │ │ │ + 103{ │ │ │ │ │ +104 static constexpr const char *name() noexcept │ │ │ │ │ + 105 { return internal::type_name::value; } │ │ │ │ │ +106 static constexpr bool has_null() noexcept { return false; } │ │ │ │ │ +107 static bool is_null(TYPE) { return false; } │ │ │ │ │ +108 [[noreturn]] static TYPE null() { throw_null_conversion(name()); } │ │ │ │ │ +109 static void from_string(const char Str[], TYPE &Obj); │ │ │ │ │ +110 static std::string to_string(TYPE Obj); │ │ │ │ │ + 111}; │ │ │ │ │ + 112} // namespace pqxx::internal │ │ │ │ │ + 113 │ │ │ │ │ + 114 │ │ │ │ │ + 116#define PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(TYPE) \ │ │ │ │ │ + 117 template<> struct PQXX_LIBEXPORT string_traits : \ │ │ │ │ │ + 118 internal::builtin_traits {}; │ │ │ │ │ + 119 │ │ │ │ │ + 120PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(bool) │ │ │ │ │ + 121 │ │ │ │ │ + 122PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(short) │ │ │ │ │ + 123PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned short) │ │ │ │ │ + 124PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(int) │ │ │ │ │ + 125PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned int) │ │ │ │ │ + 126PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long) │ │ │ │ │ + 127PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long) │ │ │ │ │ + 128PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long long) │ │ │ │ │ + 129PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(unsigned long long) │ │ │ │ │ + 130 │ │ │ │ │ + 131PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(float) │ │ │ │ │ + 132PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(double) │ │ │ │ │ + 133PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(long double) │ │ │ │ │ + 134 │ │ │ │ │ + 135#undef PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION │ │ │ │ │ + 136 │ │ │ │ │ + 137 │ │ │ │ │ + 139 │ │ │ │ │ + 148template │ │ │ │ │ +149struct enum_traits │ │ │ │ │ + 150{ │ │ │ │ │ +151 using underlying_type = typename std::underlying_type::type; │ │ │ │ │ +152 using underlying_traits = string_traits; │ │ │ │ │ + 153 │ │ │ │ │ +154 static constexpr bool has_null() noexcept { return false; } │ │ │ │ │ +155 [[noreturn]] static ENUM null() │ │ │ │ │ + 156 { internal::throw_null_conversion("enum type"); } │ │ │ │ │ + 157 │ │ │ │ │ +158 static void from_string(const char Str[], ENUM &Obj) │ │ │ │ │ + 159 { │ │ │ │ │ + 160 underlying_type tmp; │ │ │ │ │ + 161 underlying_traits::from_string(Str, tmp); │ │ │ │ │ + 162 Obj = ENUM(tmp); │ │ │ │ │ + 163 } │ │ │ │ │ + 164 │ │ │ │ │ +165 static std::string to_string(ENUM Obj) │ │ │ │ │ + 166 { return underlying_traits::to_string(underlying_type(Obj)); } │ │ │ │ │ + 167}; │ │ │ │ │ + 168 │ │ │ │ │ + 169 │ │ │ │ │ + 171 │ │ │ │ │ + 182#define PQXX_DECLARE_ENUM_CONVERSION(ENUM) \ │ │ │ │ │ + 183template<> \ │ │ │ │ │ + 184struct string_traits : pqxx::enum_traits \ │ │ │ │ │ + 185{ \ │ │ │ │ │ + 186 static constexpr const char *name() noexcept { return #ENUM; } \ │ │ │ │ │ + 187 [[noreturn]] static ENUM null() \ │ │ │ │ │ + 188 { internal::throw_null_conversion(name()); } \ │ │ │ │ │ + 189} │ │ │ │ │ + 190 │ │ │ │ │ + 191 │ │ │ │ │ +193template<> struct PQXX_LIBEXPORT string_traits │ │ │ │ │ + 194{ │ │ │ │ │ +195 static constexpr const char *name() noexcept { return "const char *"; } │ │ │ │ │ +196 static constexpr bool has_null() noexcept { return true; } │ │ │ │ │ +197 static bool is_null(const char *t) { return t == nullptr; } │ │ │ │ │ +198 static const char *null() { return nullptr; } │ │ │ │ │ +199 static void from_string(const char Str[], const char *&Obj) { Obj = Str; } │ │ │ │ │ +200 static std::string to_string(const char *Obj) { return Obj; } │ │ │ │ │ + 201}; │ │ │ │ │ + 202 │ │ │ │ │ +204template<> struct PQXX_LIBEXPORT string_traits │ │ │ │ │ + 205{ │ │ │ │ │ +206 static constexpr const char *name() noexcept { return "char *"; } │ │ │ │ │ +207 static constexpr bool has_null() noexcept { return true; } │ │ │ │ │ +208 static bool is_null(const char *t) { return t == nullptr; } │ │ │ │ │ +209 static const char *null() { return nullptr; } │ │ │ │ │ + 210 │ │ │ │ │ + 211 // Don't allow this conversion since it breaks const-safety. │ │ │ │ │ + 212 // static void from_string(const char Str[], char *&Obj); │ │ │ │ │ + 213 │ │ │ │ │ +214 static std::string to_string(char *Obj) { return Obj; } │ │ │ │ │ + 215}; │ │ │ │ │ + 216 │ │ │ │ │ +218template struct PQXX_LIBEXPORT string_traits │ │ │ │ │ + 219{ │ │ │ │ │ +220 static constexpr const char *name() noexcept { return "char[]"; } │ │ │ │ │ +221 static constexpr bool has_null() noexcept { return true; } │ │ │ │ │ +222 static bool is_null(const char t[]) { return t == nullptr; } │ │ │ │ │ +223 static const char *null() { return nullptr; } │ │ │ │ │ +224 static std::string to_string(const char Obj[]) { return Obj; } │ │ │ │ │ + 225}; │ │ │ │ │ + 226 │ │ │ │ │ +227template<> struct PQXX_LIBEXPORT string_traits │ │ │ │ │ + 228{ │ │ │ │ │ +229 static constexpr const char *name() noexcept { return "string"; } │ │ │ │ │ +230 static constexpr bool has_null() noexcept { return false; } │ │ │ │ │ +231 static bool is_null(const std::string &) { return false; } │ │ │ │ │ +232 [[noreturn]] static std::string null() │ │ │ │ │ + 233 { internal::throw_null_conversion(name()); } │ │ │ │ │ +234 static void from_string(const char Str[], std::string &Obj) { Obj=Str; } │ │ │ │ │ +235 static std::string to_string(const std::string &Obj) { return Obj; } │ │ │ │ │ + 236}; │ │ │ │ │ + 237 │ │ │ │ │ +238template<> struct PQXX_LIBEXPORT string_traits │ │ │ │ │ + 239{ │ │ │ │ │ +240 static constexpr const char *name() noexcept { return "const string"; } │ │ │ │ │ +241 static constexpr bool has_null() noexcept { return false; } │ │ │ │ │ +242 static bool is_null(const std::string &) { return false; } │ │ │ │ │ +243 [[noreturn]] static const std::string null() │ │ │ │ │ + 244 { internal::throw_null_conversion(name()); } │ │ │ │ │ +245 static const std::string to_string(const std::string &Obj) { return Obj; } │ │ │ │ │ + 246}; │ │ │ │ │ + 247 │ │ │ │ │ +248template<> struct PQXX_LIBEXPORT string_traits │ │ │ │ │ + 249{ │ │ │ │ │ +250 static constexpr const char *name() noexcept { return "stringstream"; } │ │ │ │ │ +251 static constexpr bool has_null() noexcept { return false; } │ │ │ │ │ +252 static bool is_null(const std::stringstream &) { return false; } │ │ │ │ │ +253 [[noreturn]] static std::stringstream null() │ │ │ │ │ + 254 { internal::throw_null_conversion(name()); } │ │ │ │ │ +255 static void from_string(const char Str[], std::stringstream &Obj) │ │ │ │ │ + 256 { Obj.clear(); Obj << Str; } │ │ │ │ │ +257 static std::string to_string(const std::stringstream &Obj) │ │ │ │ │ + 258 { return Obj.str(); } │ │ │ │ │ + 259}; │ │ │ │ │ + 260 │ │ │ │ │ + 261 │ │ │ │ │ + 262// TODO: Implement date conversions. │ │ │ │ │ + 263 │ │ │ │ │ + 265 │ │ │ │ │ + 277template │ │ │ │ │ +278 inline void from_string(const char Str[], T &Obj) │ │ │ │ │ + 279{ │ │ │ │ │ + 280 if (Str == nullptr) throw std::runtime_error{"Attempt to read null │ │ │ │ │ +string."}; │ │ │ │ │ + 281 string_traits::from_string(Str, Obj); │ │ │ │ │ + 282} │ │ │ │ │ + 283 │ │ │ │ │ + 284 │ │ │ │ │ + 286 │ │ │ │ │ +292template inline void from_string(const char Str[], T &Obj, │ │ │ │ │ +size_t) │ │ │ │ │ + 293{ │ │ │ │ │ + 294 return from_string(Str, Obj); │ │ │ │ │ + 295} │ │ │ │ │ + 296 │ │ │ │ │ + 297template<> │ │ │ │ │ +298 inline void from_string( //[t00] │ │ │ │ │ + 299 const char Str[], │ │ │ │ │ + 300 std::string &Obj, │ │ │ │ │ + 301 size_t len) │ │ │ │ │ + 302{ │ │ │ │ │ + 303 if (Str == nullptr) throw std::runtime_error{"Attempt to read null │ │ │ │ │ +string."}; │ │ │ │ │ + 304 Obj.assign(Str, len); │ │ │ │ │ + 305} │ │ │ │ │ + 306 │ │ │ │ │ + 307template │ │ │ │ │ +308 inline void from_string(const std::string &Str, T &Obj) //[t45] │ │ │ │ │ + 309 { from_string(Str.c_str(), Obj); } │ │ │ │ │ + 310 │ │ │ │ │ + 311template │ │ │ │ │ +312 inline void from_string(const std::stringstream &Str, T &Obj) //[t00] │ │ │ │ │ + 313 { from_string(Str.str(), Obj); } │ │ │ │ │ + 314 │ │ │ │ │ + 315template<> inline void │ │ │ │ │ +316from_string(const std::string &Str, std::string &Obj) //[t46] │ │ │ │ │ + 317 { Obj = Str; } │ │ │ │ │ + 318 │ │ │ │ │ + 319 │ │ │ │ │ + 320namespace internal │ │ │ │ │ + 321{ │ │ │ │ │ +323constexpr int digit_to_number(char c) noexcept { return c-'0'; } │ │ │ │ │ +324constexpr char number_to_digit(int i) noexcept │ │ │ │ │ + 325 { return static_cast(i+'0'); } │ │ │ │ │ + 326} // namespace pqxx::internal │ │ │ │ │ + 327 │ │ │ │ │ + 328 │ │ │ │ │ + 330 │ │ │ │ │ +334template inline std::string to_string(const T &Obj) │ │ │ │ │ + 335 { return string_traits::to_string(Obj); } │ │ │ │ │ + 336 │ │ │ │ │ + 338 │ │ │ │ │ + 339} // namespace pqxx │ │ │ │ │ + 340 │ │ │ │ │ + 341#endif │ │ │ │ │ +std │ │ │ │ │ +STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::internal::check_library_version │ │ │ │ │ -int check_library_version() noexcept │ │ │ │ │ -Library version check stub. │ │ │ │ │ +pqxx::from_string │ │ │ │ │ +void from_string(const field &F, T &Obj) │ │ │ │ │ +Convert a field's string contents to another type. │ │ │ │ │ +Definition: field.hxx:365 │ │ │ │ │ +pqxx::to_string │ │ │ │ │ +std::string to_string(const field &Obj) │ │ │ │ │ +Convert a field to a string. │ │ │ │ │ +Definition: result.cxx:451 │ │ │ │ │ +pqxx::internal::PQXX_DECLARE_TYPE_NAME │ │ │ │ │ +PQXX_DECLARE_TYPE_NAME(bool) │ │ │ │ │ +pqxx::internal::number_to_digit │ │ │ │ │ +constexpr char number_to_digit(int i) noexcept │ │ │ │ │ +Definition: strconv.hxx:324 │ │ │ │ │ +pqxx::internal::digit_to_number │ │ │ │ │ +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 │ │ │ │ │ +pqxx::internal::throw_null_conversion │ │ │ │ │ +void throw_null_conversion(const std::string &type) │ │ │ │ │ +Throw exception for attempt to convert null to given type. │ │ │ │ │ +Definition: strconv.cxx:58 │ │ │ │ │ +pqxx::string_traits │ │ │ │ │ +Traits class for use in string conversions. │ │ │ │ │ +Definition: strconv.hxx:51 │ │ │ │ │ +pqxx::internal::type_name │ │ │ │ │ +Give a human-readable name for a type, at compile time. │ │ │ │ │ +Definition: strconv.hxx:67 │ │ │ │ │ +pqxx::internal::builtin_traits │ │ │ │ │ +Helper: string traits implementation for built-in types. │ │ │ │ │ +Definition: strconv.hxx:103 │ │ │ │ │ +pqxx::internal::builtin_traits::from_string │ │ │ │ │ +static void from_string(const char Str[], TYPE &Obj) │ │ │ │ │ +pqxx::internal::builtin_traits::is_null │ │ │ │ │ +static bool is_null(TYPE) │ │ │ │ │ +Definition: strconv.hxx:107 │ │ │ │ │ +pqxx::internal::builtin_traits::to_string │ │ │ │ │ +static std::string to_string(TYPE Obj) │ │ │ │ │ +pqxx::internal::builtin_traits::null │ │ │ │ │ +static TYPE null() │ │ │ │ │ +Definition: strconv.hxx:108 │ │ │ │ │ +pqxx::internal::builtin_traits::name │ │ │ │ │ +static constexpr const char * name() noexcept │ │ │ │ │ +Definition: strconv.hxx:104 │ │ │ │ │ +pqxx::internal::builtin_traits::has_null │ │ │ │ │ +static constexpr bool has_null() noexcept │ │ │ │ │ +Definition: strconv.hxx:106 │ │ │ │ │ +pqxx::enum_traits │ │ │ │ │ +Helper class for defining enum conversions. │ │ │ │ │ +Definition: strconv.hxx:150 │ │ │ │ │ +pqxx::enum_traits::to_string │ │ │ │ │ +static std::string to_string(ENUM Obj) │ │ │ │ │ +Definition: strconv.hxx:165 │ │ │ │ │ +pqxx::enum_traits::null │ │ │ │ │ +static ENUM null() │ │ │ │ │ +Definition: strconv.hxx:155 │ │ │ │ │ +pqxx::enum_traits::has_null │ │ │ │ │ +static constexpr bool has_null() noexcept │ │ │ │ │ +Definition: strconv.hxx:154 │ │ │ │ │ +pqxx::enum_traits::from_string │ │ │ │ │ +static void from_string(const char Str[], ENUM &Obj) │ │ │ │ │ +Definition: strconv.hxx:158 │ │ │ │ │ +pqxx::enum_traits::underlying_type │ │ │ │ │ +typename std::underlying_type< ENUM >::type underlying_type │ │ │ │ │ +Definition: strconv.hxx:151 │ │ │ │ │ +pqxx::string_traits<_const_char_*_>::null │ │ │ │ │ +static const char * null() │ │ │ │ │ +Definition: strconv.hxx:198 │ │ │ │ │ +pqxx::string_traits<_const_char_*_>::to_string │ │ │ │ │ +static std::string to_string(const char *Obj) │ │ │ │ │ +Definition: strconv.hxx:200 │ │ │ │ │ +pqxx::string_traits<_const_char_*_>::is_null │ │ │ │ │ +static bool is_null(const char *t) │ │ │ │ │ +Definition: strconv.hxx:197 │ │ │ │ │ +pqxx::string_traits<_const_char_*_>::name │ │ │ │ │ +static constexpr const char * name() noexcept │ │ │ │ │ +Definition: strconv.hxx:195 │ │ │ │ │ +pqxx::string_traits<_const_char_*_>::from_string │ │ │ │ │ +static void from_string(const char Str[], const char *&Obj) │ │ │ │ │ +Definition: strconv.hxx:199 │ │ │ │ │ +pqxx::string_traits<_const_char_*_>::has_null │ │ │ │ │ +static constexpr bool has_null() noexcept │ │ │ │ │ +Definition: strconv.hxx:196 │ │ │ │ │ +pqxx::string_traits<_char_*_>::name │ │ │ │ │ +static constexpr const char * name() noexcept │ │ │ │ │ +Definition: strconv.hxx:206 │ │ │ │ │ +pqxx::string_traits<_char_*_>::is_null │ │ │ │ │ +static bool is_null(const char *t) │ │ │ │ │ +Definition: strconv.hxx:208 │ │ │ │ │ +pqxx::string_traits<_char_*_>::to_string │ │ │ │ │ +static std::string to_string(char *Obj) │ │ │ │ │ +Definition: strconv.hxx:214 │ │ │ │ │ +pqxx::string_traits<_char_*_>::has_null │ │ │ │ │ +static constexpr bool has_null() noexcept │ │ │ │ │ +Definition: strconv.hxx:207 │ │ │ │ │ +pqxx::string_traits<_char_*_>::null │ │ │ │ │ +static const char * null() │ │ │ │ │ +Definition: strconv.hxx:209 │ │ │ │ │ +pqxx::string_traits<_char[N]>::has_null │ │ │ │ │ +static constexpr bool has_null() noexcept │ │ │ │ │ +Definition: strconv.hxx:221 │ │ │ │ │ +pqxx::string_traits<_char[N]>::name │ │ │ │ │ +static constexpr const char * name() noexcept │ │ │ │ │ +Definition: strconv.hxx:220 │ │ │ │ │ +pqxx::string_traits<_char[N]>::null │ │ │ │ │ +static const char * null() │ │ │ │ │ +Definition: strconv.hxx:223 │ │ │ │ │ +pqxx::string_traits<_char[N]>::is_null │ │ │ │ │ +static bool is_null(const char t[]) │ │ │ │ │ +Definition: strconv.hxx:222 │ │ │ │ │ +pqxx::string_traits<_char[N]>::to_string │ │ │ │ │ +static std::string to_string(const char Obj[]) │ │ │ │ │ +Definition: strconv.hxx:224 │ │ │ │ │ +pqxx::string_traits<_std::string_>::is_null │ │ │ │ │ +static bool is_null(const std::string &) │ │ │ │ │ +Definition: strconv.hxx:231 │ │ │ │ │ +pqxx::string_traits<_std::string_>::from_string │ │ │ │ │ +static void from_string(const char Str[], std::string &Obj) │ │ │ │ │ +Definition: strconv.hxx:234 │ │ │ │ │ +pqxx::string_traits<_std::string_>::to_string │ │ │ │ │ +static std::string to_string(const std::string &Obj) │ │ │ │ │ +Definition: strconv.hxx:235 │ │ │ │ │ +pqxx::string_traits<_std::string_>::has_null │ │ │ │ │ +static constexpr bool has_null() noexcept │ │ │ │ │ +Definition: strconv.hxx:230 │ │ │ │ │ +pqxx::string_traits<_std::string_>::name │ │ │ │ │ +static constexpr const char * name() noexcept │ │ │ │ │ +Definition: strconv.hxx:229 │ │ │ │ │ +pqxx::string_traits<_std::string_>::null │ │ │ │ │ +static std::string null() │ │ │ │ │ +Definition: strconv.hxx:232 │ │ │ │ │ +pqxx::string_traits<_const_std::string_>::null │ │ │ │ │ +static const std::string null() │ │ │ │ │ +Definition: strconv.hxx:243 │ │ │ │ │ +pqxx::string_traits<_const_std::string_>::name │ │ │ │ │ +static constexpr const char * name() noexcept │ │ │ │ │ +Definition: strconv.hxx:240 │ │ │ │ │ +pqxx::string_traits<_const_std::string_>::to_string │ │ │ │ │ +static const std::string to_string(const std::string &Obj) │ │ │ │ │ +Definition: strconv.hxx:245 │ │ │ │ │ +pqxx::string_traits<_const_std::string_>::is_null │ │ │ │ │ +static bool is_null(const std::string &) │ │ │ │ │ +Definition: strconv.hxx:242 │ │ │ │ │ +pqxx::string_traits<_const_std::string_>::has_null │ │ │ │ │ +static constexpr bool has_null() noexcept │ │ │ │ │ +Definition: strconv.hxx:241 │ │ │ │ │ +pqxx::string_traits<_std::stringstream_>::has_null │ │ │ │ │ +static constexpr bool has_null() noexcept │ │ │ │ │ +Definition: strconv.hxx:251 │ │ │ │ │ +pqxx::string_traits<_std::stringstream_>::is_null │ │ │ │ │ +static bool is_null(const std::stringstream &) │ │ │ │ │ +Definition: strconv.hxx:252 │ │ │ │ │ +pqxx::string_traits<_std::stringstream_>::to_string │ │ │ │ │ +static std::string to_string(const std::stringstream &Obj) │ │ │ │ │ +Definition: strconv.hxx:257 │ │ │ │ │ +pqxx::string_traits<_std::stringstream_>::from_string │ │ │ │ │ +static void from_string(const char Str[], std::stringstream &Obj) │ │ │ │ │ +Definition: strconv.hxx:255 │ │ │ │ │ +pqxx::string_traits<_std::stringstream_>::name │ │ │ │ │ +static constexpr const char * name() noexcept │ │ │ │ │ +Definition: strconv.hxx:250 │ │ │ │ │ +pqxx::string_traits<_std::stringstream_>::null │ │ │ │ │ +static std::stringstream null() │ │ │ │ │ +Definition: strconv.hxx:253 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * version.hxx │ │ │ │ │ + * strconv.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00095_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: stream_to.hxx Source File │ │ │ │ +libpqxx: errorhandler.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,162 +55,83 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
stream_to.hxx
│ │ │ │ +
errorhandler.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_STREAM_TO
│ │ │ │ -
14#define PQXX_H_STREAM_TO
│ │ │ │ +
13#ifndef PQXX_H_ERRORHANDLER
│ │ │ │ +
14#define PQXX_H_ERRORHANDLER
│ │ │ │
15
│ │ │ │
16#include "pqxx/compiler-public.hxx"
│ │ │ │
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18#include "pqxx/transaction_base.hxx"
│ │ │ │ -
19#include "pqxx/stream_base.hxx"
│ │ │ │ -
20#include "pqxx/stream_from.hxx"
│ │ │ │ -
21#include "pqxx/internal/type_utils.hxx"
│ │ │ │ -
22
│ │ │ │ -
23#include <string>
│ │ │ │ -
24
│ │ │ │ -
25
│ │ │ │ -
26namespace pqxx
│ │ │ │ +
18
│ │ │ │ +
19#include "pqxx/types.hxx"
│ │ │ │ +
20
│ │ │ │ +
21
│ │ │ │ +
22namespace pqxx
│ │ │ │ +
23{
│ │ │ │ +
24namespace internal
│ │ │ │ +
25{
│ │ │ │ +
26namespace gate
│ │ │ │
27{
│ │ │ │ -
28
│ │ │ │ -
30
│ │ │ │ -
59class PQXX_LIBEXPORT stream_to : public stream_base
│ │ │ │ -
60{
│ │ │ │ -
61public:
│ │ │ │ -
63
│ │ │ │ -
70 stream_to(transaction_base &, const std::string &table_name);
│ │ │ │ -
71
│ │ │ │ -
73 template<typename Columns> stream_to(
│ │ │ │ - │ │ │ │ -
75 const std::string &table_name,
│ │ │ │ -
76 const Columns& columns
│ │ │ │ -
77 );
│ │ │ │ +
28class errorhandler_connection_base;
│ │ │ │ +
29}
│ │ │ │ +
30}
│ │ │ │ +
31
│ │ │ │ +
38
│ │ │ │ +
54class PQXX_LIBEXPORT errorhandler
│ │ │ │ +
55{
│ │ │ │ +
56public:
│ │ │ │ +
57 explicit errorhandler(connection_base &);
│ │ │ │ +
58 virtual ~errorhandler();
│ │ │ │ +
59
│ │ │ │ +
61
│ │ │ │ +
65 virtual bool operator()(const char msg[]) noexcept =0;
│ │ │ │ +
66
│ │ │ │ +
67private:
│ │ │ │ +
68 connection_base *m_home;
│ │ │ │ +
69
│ │ │ │ +
70 friend class internal::gate::errorhandler_connection_base;
│ │ │ │ +
71 void unregister() noexcept;
│ │ │ │ +
72
│ │ │ │ +
73 errorhandler() =delete;
│ │ │ │ +
74 errorhandler(const errorhandler &) =delete;
│ │ │ │ +
75 errorhandler &operator=(const errorhandler &) =delete;
│ │ │ │ +
76};
│ │ │ │ +
77
│ │ │ │
78
│ │ │ │ -
80 template<typename Iter> stream_to(
│ │ │ │ - │ │ │ │ -
82 const std::string &table_name,
│ │ │ │ -
83 Iter columns_begin,
│ │ │ │ -
84 Iter columns_end
│ │ │ │ -
85 );
│ │ │ │ -
86
│ │ │ │ -
87 ~stream_to() noexcept;
│ │ │ │ -
88
│ │ │ │ -
90
│ │ │ │ -
96 void complete() override;
│ │ │ │ -
97
│ │ │ │ -
99
│ │ │ │ -
106 template<typename Tuple> stream_to & operator<<(const Tuple &);
│ │ │ │ -
107
│ │ │ │ -
109
│ │ │ │ - │ │ │ │ -
114
│ │ │ │ -
115private:
│ │ │ │ -
117 void write_raw_line(const std::string &);
│ │ │ │ -
118
│ │ │ │ -
119 void set_up(transaction_base &, const std::string &table_name);
│ │ │ │ -
120 void set_up(
│ │ │ │ - │ │ │ │ -
122 const std::string &table_name,
│ │ │ │ -
123 const std::string &columns
│ │ │ │ -
124 );
│ │ │ │ -
125
│ │ │ │ -
126 void close() override;
│ │ │ │ -
127};
│ │ │ │ -
128
│ │ │ │ -
129
│ │ │ │ -
130template<typename Columns> inline stream_to::stream_to(
│ │ │ │ - │ │ │ │ -
132 const std::string &table_name,
│ │ │ │ -
133 const Columns& columns
│ │ │ │ -
134) : stream_to{
│ │ │ │ -
135 tb,
│ │ │ │ -
136 table_name,
│ │ │ │ -
137 std::begin(columns),
│ │ │ │ -
138 std::end(columns)
│ │ │ │ -
139}
│ │ │ │ -
140{}
│ │ │ │ -
141
│ │ │ │ -
142
│ │ │ │ -
143template<typename Iter> inline stream_to::stream_to(
│ │ │ │ - │ │ │ │ -
145 const std::string &table_name,
│ │ │ │ -
146 Iter columns_begin,
│ │ │ │ -
147 Iter columns_end
│ │ │ │ -
148) :
│ │ │ │ -
149 namedclass{"stream_from", table_name},
│ │ │ │ -
150 stream_base{tb}
│ │ │ │ -
151{
│ │ │ │ -
152 set_up(
│ │ │ │ -
153 tb,
│ │ │ │ -
154 table_name,
│ │ │ │ -
155 columnlist(columns_begin, columns_end)
│ │ │ │ -
156 );
│ │ │ │ -
157}
│ │ │ │ -
158
│ │ │ │ -
159
│ │ │ │ -
160namespace internal
│ │ │ │ -
161{
│ │ │ │ -
162
│ │ │ │ -
163class PQXX_LIBEXPORT TypedCopyEscaper
│ │ │ │ -
164{
│ │ │ │ -
165 static std::string escape(const std::string &);
│ │ │ │ -
166public:
│ │ │ │ -
167 template<typename T> std::string operator()(const T* t) const
│ │ │ │ -
168 {
│ │ │ │ -
169 return string_traits<T>::is_null(*t) ? "\\N" : escape(to_string(*t));
│ │ │ │ -
170 }
│ │ │ │ -
171};
│ │ │ │ -
172
│ │ │ │ -
173// Explicit specialization so we don't need a string_traits<> for nullptr_t
│ │ │ │ -
174template<> inline std::string TypedCopyEscaper::operator()<std::nullptr_t>(
│ │ │ │ -
175 const std::nullptr_t*
│ │ │ │ -
176) const
│ │ │ │ -
177{ return "\\N"; }
│ │ │ │ -
178
│ │ │ │ -
179} // namespace pqxx::internal
│ │ │ │ -
180
│ │ │ │ -
181
│ │ │ │ -
182template<typename Tuple> stream_to & stream_to::operator<<(const Tuple &t)
│ │ │ │ -
183{
│ │ │ │ -
184 write_raw_line(separated_list("\t", t, internal::TypedCopyEscaper()));
│ │ │ │ -
185 return *this;
│ │ │ │ -
186}
│ │ │ │ -
187
│ │ │ │ -
188} // namespace pqxx
│ │ │ │ -
189
│ │ │ │ -
190
│ │ │ │ -
191#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
192#endif
│ │ │ │ -
STL namespace.
│ │ │ │ + │ │ │ │ +
81{
│ │ │ │ +
82public:
│ │ │ │ + │ │ │ │ +
84
│ │ │ │ +
85 virtual bool operator()(const char[]) noexcept override { return false; }
│ │ │ │ +
86};
│ │ │ │ +
87
│ │ │ │ +
92} // namespace pqxx
│ │ │ │ +
93
│ │ │ │ +
94#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
95
│ │ │ │ +
96#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
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
│ │ │ │ -
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
│ │ │ │ -
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
│ │ │ │ -
std::string escape(const std::string &s, const std::string &null)
Definition: tablewriter.cxx:131
│ │ │ │ -
Traits class for use in string conversions.
Definition: strconv.hxx:51
│ │ │ │ -
Definition: stream_base.hxx:29
│ │ │ │ -
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
│ │ │ │ -
Efficiently pull data directly out of a table.
Definition: stream_from.hxx:30
│ │ │ │ -
Efficiently write data directly to a database table.
Definition: stream_to.hxx:60
│ │ │ │ -
stream_to(transaction_base &, const std::string &table_name)
Create a stream, without specifying columns.
Definition: stream_to.cxx:18
│ │ │ │ -
stream_to & operator<<(const Tuple &)
Insert a row of data.
Definition: stream_to.hxx:182
│ │ │ │ -
Definition: stream_to.hxx:164
│ │ │ │ -
std::string operator()(const T *t) const
Definition: stream_to.hxx:167
│ │ │ │ -
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │ +
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ +
Base class for error-handler callbacks.
Definition: errorhandler.hxx:55
│ │ │ │ +
virtual bool operator()(const char msg[]) noexcept=0
Define in subclass: receive an error or warning message from the database.
│ │ │ │ +
An error handler that suppresses any previously registered error handlers.
Definition: errorhandler.hxx:81
│ │ │ │ +
virtual bool operator()(const char[]) noexcept override
Define in subclass: receive an error or warning message from the database.
Definition: errorhandler.hxx:85
│ │ │ │ +
quiet_errorhandler(connection_base &conn)
Definition: errorhandler.hxx:83
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,189 +1,89 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -stream_to.hxx │ │ │ │ │ +errorhandler.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_STREAM_TO │ │ │ │ │ - 14#define PQXX_H_STREAM_TO │ │ │ │ │ + 13#ifndef PQXX_H_ERRORHANDLER │ │ │ │ │ + 14#define PQXX_H_ERRORHANDLER │ │ │ │ │ 15 │ │ │ │ │ 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18#include "pqxx/transaction_base.hxx" │ │ │ │ │ - 19#include "pqxx/stream_base.hxx" │ │ │ │ │ - 20#include "pqxx/stream_from.hxx" │ │ │ │ │ - 21#include "pqxx/internal/type_utils.hxx" │ │ │ │ │ - 22 │ │ │ │ │ - 23#include │ │ │ │ │ - 24 │ │ │ │ │ - 25 │ │ │ │ │ - 26namespace pqxx │ │ │ │ │ + 18 │ │ │ │ │ + 19#include "pqxx/types.hxx" │ │ │ │ │ + 20 │ │ │ │ │ + 21 │ │ │ │ │ + 22namespace pqxx │ │ │ │ │ + 23{ │ │ │ │ │ + 24namespace internal │ │ │ │ │ + 25{ │ │ │ │ │ + 26namespace gate │ │ │ │ │ 27{ │ │ │ │ │ - 28 │ │ │ │ │ - 30 │ │ │ │ │ -59class PQXX_LIBEXPORT stream_to : public stream_base │ │ │ │ │ - 60{ │ │ │ │ │ - 61public: │ │ │ │ │ - 63 │ │ │ │ │ - 70 stream_to(transaction_base &, const std::string &table_name); │ │ │ │ │ - 71 │ │ │ │ │ - 73 template stream_to( │ │ │ │ │ - 74 transaction_base &, │ │ │ │ │ - 75 const std::string &table_name, │ │ │ │ │ - 76 const Columns& columns │ │ │ │ │ - 77 ); │ │ │ │ │ + 28class errorhandler_connection_base; │ │ │ │ │ + 29} │ │ │ │ │ + 30} │ │ │ │ │ + 31 │ │ │ │ │ + 38 │ │ │ │ │ +54class PQXX_LIBEXPORT errorhandler │ │ │ │ │ + 55{ │ │ │ │ │ + 56public: │ │ │ │ │ + 57 explicit errorhandler(connection_base &); │ │ │ │ │ + 58 virtual ~errorhandler(); │ │ │ │ │ + 59 │ │ │ │ │ + 61 │ │ │ │ │ +65 virtual bool operator()(const char msg[]) noexcept =0; │ │ │ │ │ + 66 │ │ │ │ │ + 67private: │ │ │ │ │ + 68 connection_base *m_home; │ │ │ │ │ + 69 │ │ │ │ │ +70 friend class internal::gate::errorhandler_connection_base; │ │ │ │ │ + 71 void unregister() noexcept; │ │ │ │ │ + 72 │ │ │ │ │ + 73 errorhandler() =delete; │ │ │ │ │ + 74 errorhandler(const errorhandler &) =delete; │ │ │ │ │ + 75 errorhandler &operator=(const errorhandler &) =delete; │ │ │ │ │ + 76}; │ │ │ │ │ + 77 │ │ │ │ │ 78 │ │ │ │ │ - 80 template stream_to( │ │ │ │ │ - 81 transaction_base &, │ │ │ │ │ - 82 const std::string &table_name, │ │ │ │ │ - 83 Iter columns_begin, │ │ │ │ │ - 84 Iter columns_end │ │ │ │ │ - 85 ); │ │ │ │ │ - 86 │ │ │ │ │ - 87 ~stream_to() noexcept; │ │ │ │ │ - 88 │ │ │ │ │ - 90 │ │ │ │ │ - 96 void complete() override; │ │ │ │ │ - 97 │ │ │ │ │ - 99 │ │ │ │ │ - 106 template stream_to & operator<<(const Tuple &); │ │ │ │ │ - 107 │ │ │ │ │ - 109 │ │ │ │ │ - 113 stream_to &operator<<(stream_from &); │ │ │ │ │ - 114 │ │ │ │ │ - 115private: │ │ │ │ │ - 117 void write_raw_line(const std::string &); │ │ │ │ │ - 118 │ │ │ │ │ - 119 void set_up(transaction_base &, const std::string &table_name); │ │ │ │ │ - 120 void set_up( │ │ │ │ │ - 121 transaction_base &, │ │ │ │ │ - 122 const std::string &table_name, │ │ │ │ │ - 123 const std::string &columns │ │ │ │ │ - 124 ); │ │ │ │ │ - 125 │ │ │ │ │ - 126 void close() override; │ │ │ │ │ - 127}; │ │ │ │ │ - 128 │ │ │ │ │ - 129 │ │ │ │ │ -130template inline stream_to::stream_to( │ │ │ │ │ - 131 transaction_base &tb, │ │ │ │ │ - 132 const std::string &table_name, │ │ │ │ │ - 133 const Columns& columns │ │ │ │ │ - 134) : stream_to{ │ │ │ │ │ - 135 tb, │ │ │ │ │ - 136 table_name, │ │ │ │ │ - 137 std::begin(columns), │ │ │ │ │ - 138 std::end(columns) │ │ │ │ │ - 139} │ │ │ │ │ - 140{} │ │ │ │ │ - 141 │ │ │ │ │ - 142 │ │ │ │ │ -143template inline stream_to::stream_to( │ │ │ │ │ - 144 transaction_base &tb, │ │ │ │ │ - 145 const std::string &table_name, │ │ │ │ │ - 146 Iter columns_begin, │ │ │ │ │ - 147 Iter columns_end │ │ │ │ │ - 148) : │ │ │ │ │ - 149 namedclass{"stream_from", table_name}, │ │ │ │ │ - 150 stream_base{tb} │ │ │ │ │ - 151{ │ │ │ │ │ - 152 set_up( │ │ │ │ │ - 153 tb, │ │ │ │ │ - 154 table_name, │ │ │ │ │ - 155 columnlist(columns_begin, columns_end) │ │ │ │ │ - 156 ); │ │ │ │ │ - 157} │ │ │ │ │ - 158 │ │ │ │ │ - 159 │ │ │ │ │ - 160namespace internal │ │ │ │ │ - 161{ │ │ │ │ │ - 162 │ │ │ │ │ -163class PQXX_LIBEXPORT TypedCopyEscaper │ │ │ │ │ - 164{ │ │ │ │ │ - 165 static std::string escape(const std::string &); │ │ │ │ │ - 166public: │ │ │ │ │ -167 template std::string operator()(const T* t) const │ │ │ │ │ - 168 { │ │ │ │ │ - 169 return string_traits::is_null(*t) ? "\\N" : escape(to_string(*t)); │ │ │ │ │ - 170 } │ │ │ │ │ - 171}; │ │ │ │ │ - 172 │ │ │ │ │ - 173// Explicit specialization so we don't need a string_traits<> for nullptr_t │ │ │ │ │ -174template<> inline std::string TypedCopyEscaper::operator()( │ │ │ │ │ - 175 const std::nullptr_t* │ │ │ │ │ - 176) const │ │ │ │ │ - 177{ return "\\N"; } │ │ │ │ │ - 178 │ │ │ │ │ - 179} // namespace pqxx::internal │ │ │ │ │ - 180 │ │ │ │ │ - 181 │ │ │ │ │ -182template stream_to & stream_to::operator<<(const Tuple &t) │ │ │ │ │ - 183{ │ │ │ │ │ - 184 write_raw_line(separated_list("\t", t, internal::TypedCopyEscaper())); │ │ │ │ │ - 185 return *this; │ │ │ │ │ - 186} │ │ │ │ │ - 187 │ │ │ │ │ - 188} // namespace pqxx │ │ │ │ │ - 189 │ │ │ │ │ - 190 │ │ │ │ │ - 191#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 192#endif │ │ │ │ │ -std │ │ │ │ │ -STL namespace. │ │ │ │ │ +80class quiet_errorhandler : public errorhandler │ │ │ │ │ + 81{ │ │ │ │ │ + 82public: │ │ │ │ │ +83 quiet_errorhandler(connection_base &conn) : errorhandler{conn} {} │ │ │ │ │ + 84 │ │ │ │ │ +85 virtual bool operator()(const char[]) noexcept override { return false; } │ │ │ │ │ + 86}; │ │ │ │ │ + 87 │ │ │ │ │ + 92} // namespace pqxx │ │ │ │ │ + 93 │ │ │ │ │ + 94#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 95 │ │ │ │ │ + 96#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::operator<< │ │ │ │ │ -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 │ │ │ │ │ -pqxx::to_string │ │ │ │ │ -std::string to_string(const field &Obj) │ │ │ │ │ -Convert a field to a string. │ │ │ │ │ -Definition: result.cxx:451 │ │ │ │ │ -pqxx::separated_list │ │ │ │ │ -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 │ │ │ │ │ -pqxx::internal::escape │ │ │ │ │ -std::string escape(const std::string &s, const std::string &null) │ │ │ │ │ -Definition: tablewriter.cxx:131 │ │ │ │ │ -pqxx::string_traits │ │ │ │ │ -Traits class for use in string conversions. │ │ │ │ │ -Definition: strconv.hxx:51 │ │ │ │ │ -pqxx::stream_base │ │ │ │ │ -Definition: stream_base.hxx:29 │ │ │ │ │ -pqxx::stream_base::columnlist │ │ │ │ │ -static std::string columnlist(const C &) │ │ │ │ │ -Definition: stream_base.hxx:48 │ │ │ │ │ -pqxx::stream_from │ │ │ │ │ -Efficiently pull data directly out of a table. │ │ │ │ │ -Definition: stream_from.hxx:30 │ │ │ │ │ -pqxx::stream_to │ │ │ │ │ -Efficiently write data directly to a database table. │ │ │ │ │ -Definition: stream_to.hxx:60 │ │ │ │ │ -pqxx::stream_to::stream_to │ │ │ │ │ -stream_to(transaction_base &, const std::string &table_name) │ │ │ │ │ -Create a stream, without specifying columns. │ │ │ │ │ -Definition: stream_to.cxx:18 │ │ │ │ │ -pqxx::stream_to::operator<< │ │ │ │ │ -stream_to & operator<<(const Tuple &) │ │ │ │ │ -Insert a row of data. │ │ │ │ │ -Definition: stream_to.hxx:182 │ │ │ │ │ -pqxx::internal::TypedCopyEscaper │ │ │ │ │ -Definition: stream_to.hxx:164 │ │ │ │ │ -pqxx::internal::TypedCopyEscaper::operator() │ │ │ │ │ -std::string operator()(const T *t) const │ │ │ │ │ -Definition: stream_to.hxx:167 │ │ │ │ │ -pqxx::transaction_base │ │ │ │ │ -Interface definition (and common code) for "transaction" classes. │ │ │ │ │ -Definition: transaction_base.hxx:138 │ │ │ │ │ +pqxx::connection_base │ │ │ │ │ +connection_base abstract base class; represents a connection to a database. │ │ │ │ │ +Definition: connection_base.hxx:140 │ │ │ │ │ +pqxx::errorhandler │ │ │ │ │ +Base class for error-handler callbacks. │ │ │ │ │ +Definition: errorhandler.hxx:55 │ │ │ │ │ +pqxx::errorhandler::operator() │ │ │ │ │ +virtual bool operator()(const char msg[]) noexcept=0 │ │ │ │ │ +Define in subclass: receive an error or warning message from the database. │ │ │ │ │ +pqxx::quiet_errorhandler │ │ │ │ │ +An error handler that suppresses any previously registered error handlers. │ │ │ │ │ +Definition: errorhandler.hxx:81 │ │ │ │ │ +pqxx::quiet_errorhandler::operator() │ │ │ │ │ +virtual bool operator()(const char[]) noexcept override │ │ │ │ │ +Define in subclass: receive an error or warning message from the database. │ │ │ │ │ +Definition: errorhandler.hxx:85 │ │ │ │ │ +pqxx::quiet_errorhandler::quiet_errorhandler │ │ │ │ │ +quiet_errorhandler(connection_base &conn) │ │ │ │ │ +Definition: errorhandler.hxx:83 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * stream_to.hxx │ │ │ │ │ + * errorhandler.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00098_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: robusttransaction.hxx Source File │ │ │ │ +libpqxx: compiler-public.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,106 +55,133 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
robusttransaction.hxx
│ │ │ │ +
compiler-public.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_ROBUSTTRANSACTION
│ │ │ │ -
14#define PQXX_H_ROBUSTTRANSACTION
│ │ │ │ -
15
│ │ │ │ -
16#include "pqxx/compiler-public.hxx"
│ │ │ │ -
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
9#ifndef PQXX_H_COMPILER_PUBLIC
│ │ │ │ +
10#define PQXX_H_COMPILER_PUBLIC
│ │ │ │ +
11
│ │ │ │ +
12// Workarounds & definitions that need to be included even in library's headers
│ │ │ │ +
13#include "pqxx/config-public-compiler.h"
│ │ │ │ +
14
│ │ │ │ +
15// Some compilers, Visual Studio in particular, don't seem to support the
│ │ │ │ +
16// standard's ISO-646 keywords out of the box.
│ │ │ │ +
17#include <ciso646>
│ │ │ │
18
│ │ │ │ -
19#include "pqxx/dbtransaction.hxx"
│ │ │ │ -
20
│ │ │ │ -
21
│ │ │ │ -
22// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ -
23
│ │ │ │ -
24namespace pqxx
│ │ │ │ -
25{
│ │ │ │ +
19
│ │ │ │ +
20#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_CONST)
│ │ │ │ +
22#define PQXX_CONST __attribute__ ((const))
│ │ │ │ +
23#else
│ │ │ │ +
24#define PQXX_CONST
│ │ │ │ +
25#endif
│ │ │ │
26
│ │ │ │ -
27namespace internal
│ │ │ │ -
28{
│ │ │ │ -
30class PQXX_LIBEXPORT PQXX_NOVTABLE basic_robusttransaction :
│ │ │ │ -
31 public dbtransaction
│ │ │ │ -
32{
│ │ │ │ -
33public:
│ │ │ │ - │ │ │ │ -
36
│ │ │ │ -
37 virtual ~basic_robusttransaction() =0; //[t16]
│ │ │ │ -
38
│ │ │ │ -
39protected:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
42 const std::string &IsolationLevel,
│ │ │ │ -
43 const std::string &table_name=std::string{}); //[t16]
│ │ │ │ -
44
│ │ │ │ -
45private:
│ │ │ │ -
46 using IDType = unsigned long;
│ │ │ │ -
47 IDType m_record_id = 0;
│ │ │ │ -
48 std::string m_xid;
│ │ │ │ -
49 std::string m_log_table;
│ │ │ │ -
50 std::string m_sequence;
│ │ │ │ -
51 int m_backendpid = -1;
│ │ │ │ -
52
│ │ │ │ -
53 virtual void do_begin() override; //[t18]
│ │ │ │ -
54 virtual void do_commit() override; //[t16]
│ │ │ │ -
55 virtual void do_abort() override; //[t18]
│ │ │ │ -
56
│ │ │ │ -
57 PQXX_PRIVATE void CreateLogTable();
│ │ │ │ -
58 PQXX_PRIVATE void CreateTransactionRecord();
│ │ │ │ -
59 PQXX_PRIVATE std::string sql_delete() const;
│ │ │ │ -
60 PQXX_PRIVATE void DeleteTransactionRecord() noexcept;
│ │ │ │ -
61 PQXX_PRIVATE bool CheckTransactionRecord();
│ │ │ │ -
62};
│ │ │ │ -
63} // namespace internal
│ │ │ │ -
64
│ │ │ │ -
65
│ │ │ │ -
73
│ │ │ │ -
139template<isolation_level ISOLATIONLEVEL=read_committed>
│ │ │ │ -
140class robusttransaction : public internal::basic_robusttransaction
│ │ │ │ -
141{
│ │ │ │ -
142public:
│ │ │ │ - │ │ │ │ -
144
│ │ │ │ -
146
│ │ │ │ - │ │ │ │ - │ │ │ │ -
152 const std::string &Name=std::string{}) :
│ │ │ │ -
153 namedclass{fullname("robusttransaction",isolation_tag::name()), Name},
│ │ │ │ -
154 internal::basic_robusttransaction(C, isolation_tag::name())
│ │ │ │ -
155 { Begin(); }
│ │ │ │ -
156
│ │ │ │ -
157 virtual ~robusttransaction() noexcept
│ │ │ │ -
158 { End(); }
│ │ │ │ -
159};
│ │ │ │ -
160
│ │ │ │ -
165} // namespace pqxx
│ │ │ │ -
166
│ │ │ │ -
167#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
168#endif
│ │ │ │ -
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:57
│ │ │ │ -
@ read_committed
Definition: isolation.hxx:59
│ │ │ │ -
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ -
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ -
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
│ │ │ │ -
Helper base class for the robusttransaction class template.
Definition: robusttransaction.hxx:32
│ │ │ │ -
Slightly slower, better-fortified version of transaction.
Definition: robusttransaction.hxx:141
│ │ │ │ -
virtual ~robusttransaction() noexcept
Definition: robusttransaction.hxx:157
│ │ │ │ -
robusttransaction(connection_base &C, const std::string &Name=std::string{})
Constructor.
Definition: robusttransaction.hxx:150
│ │ │ │ +
27#if defined(PQXX_HAVE_DEPRECATED)
│ │ │ │ +
29#define PQXX_DEPRECATED [[deprecated]]
│ │ │ │ +
30#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_DEPRECATED)
│ │ │ │ +
31#define PQXX_DEPRECATED __attribute__ ((deprecated))
│ │ │ │ +
32#else
│ │ │ │ +
33#define PQXX_DEPRECATED
│ │ │ │ +
34#endif
│ │ │ │ +
35
│ │ │ │ +
36#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_PURE)
│ │ │ │ +
38#define PQXX_PURE __attribute__ ((pure))
│ │ │ │ +
39#else
│ │ │ │ +
40#define PQXX_PURE
│ │ │ │ +
41#endif
│ │ │ │ +
42
│ │ │ │ +
43
│ │ │ │ +
44// Workarounds for Windows
│ │ │ │ +
45#ifdef _WIN32
│ │ │ │ +
46
│ │ │ │ +
47/* For now, export DLL symbols if _DLL is defined. This is done automatically
│ │ │ │ +
48 * by the compiler when linking to the dynamic version of the runtime library,
│ │ │ │ +
49 * according to "gzh"
│ │ │ │ +
50 */
│ │ │ │ +
51#if !defined(PQXX_LIBEXPORT) && defined(PQXX_SHARED)
│ │ │ │ +
52#define PQXX_LIBEXPORT __declspec(dllimport)
│ │ │ │ +
53#endif // !PQXX_LIBEXPORT && PQXX_SHARED
│ │ │ │ +
54
│ │ │ │ +
55
│ │ │ │ +
56// Workarounds for Microsoft Visual C++
│ │ │ │ +
57#ifdef _MSC_VER
│ │ │ │ +
58
│ │ │ │ +
59// Suppress vtables on abstract classes.
│ │ │ │ +
60#define PQXX_NOVTABLE __declspec(novtable)
│ │ │ │ +
61
│ │ │ │ +
62// Automatically link with the appropriate libpq (static or dynamic, debug or
│ │ │ │ +
63// release). The default is to use the release DLL. Define PQXX_PQ_STATIC to
│ │ │ │ +
64// link to a static version of libpq, and _DEBUG to link to a debug version.
│ │ │ │ +
65// The two may be combined.
│ │ │ │ +
66#if defined(PQXX_AUTOLINK)
│ │ │ │ +
67#if defined(PQXX_PQ_STATIC)
│ │ │ │ +
68#ifdef _DEBUG
│ │ │ │ +
69#pragma comment(lib, "libpqd")
│ │ │ │ +
70#else
│ │ │ │ +
71#pragma comment(lib, "libpq")
│ │ │ │ +
72#endif
│ │ │ │ +
73#else
│ │ │ │ +
74#ifdef _DEBUG
│ │ │ │ +
75#pragma comment(lib, "libpqddll")
│ │ │ │ +
76#else
│ │ │ │ +
77#pragma comment(lib, "libpqdll")
│ │ │ │ +
78#endif
│ │ │ │ +
79#endif
│ │ │ │ +
80#endif
│ │ │ │ +
81
│ │ │ │ +
82// If we're not compiling libpqxx itself, automatically link with the
│ │ │ │ +
83// appropriate libpqxx library. To link with the libpqxx DLL, define
│ │ │ │ +
84// PQXX_SHARED; the default is to link with the static library. A static link
│ │ │ │ +
85// is the recommended practice.
│ │ │ │ +
86//
│ │ │ │ +
87// The preprocessor macro PQXX_INTERNAL is used to detect whether we
│ │ │ │ +
88// are compiling the libpqxx library itself. When you compile the library
│ │ │ │ +
89// yourself using your own project file, make sure to include this macro.
│ │ │ │ +
90#if defined(PQXX_AUTOLINK) && !defined(PQXX_INTERNAL)
│ │ │ │ +
91 #ifdef PQXX_SHARED
│ │ │ │ +
92 #ifdef _DEBUG
│ │ │ │ +
93 #pragma comment(lib, "libpqxxD")
│ │ │ │ +
94 #else
│ │ │ │ +
95 #pragma comment(lib, "libpqxx")
│ │ │ │ +
96 #endif
│ │ │ │ +
97 #else // !PQXX_SHARED
│ │ │ │ +
98 #ifdef _DEBUG
│ │ │ │ +
99 #pragma comment(lib, "libpqxx_staticD")
│ │ │ │ +
100 #else
│ │ │ │ +
101 #pragma comment(lib, "libpqxx_static")
│ │ │ │ +
102 #endif
│ │ │ │ +
103 #endif
│ │ │ │ +
104#endif
│ │ │ │ +
105
│ │ │ │ +
106#endif // _MSC_VER
│ │ │ │ +
107#endif // _WIN32
│ │ │ │ +
108
│ │ │ │ +
109
│ │ │ │ +
110#ifndef PQXX_LIBEXPORT
│ │ │ │ +
111#define PQXX_LIBEXPORT
│ │ │ │ +
112#endif
│ │ │ │ +
113
│ │ │ │ +
114#ifndef PQXX_PRIVATE
│ │ │ │ +
115#define PQXX_PRIVATE
│ │ │ │ +
116#endif
│ │ │ │ +
117
│ │ │ │ +
118#ifndef PQXX_NOVTABLE
│ │ │ │ +
119#define PQXX_NOVTABLE
│ │ │ │ +
120#endif
│ │ │ │ +
121
│ │ │ │ +
122#endif
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,119 +1,129 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -robusttransaction.hxx │ │ │ │ │ +compiler-public.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_ROBUSTTRANSACTION │ │ │ │ │ - 14#define PQXX_H_ROBUSTTRANSACTION │ │ │ │ │ - 15 │ │ │ │ │ - 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 9#ifndef PQXX_H_COMPILER_PUBLIC │ │ │ │ │ + 10#define PQXX_H_COMPILER_PUBLIC │ │ │ │ │ + 11 │ │ │ │ │ + 12// Workarounds & definitions that need to be included even in library's │ │ │ │ │ +headers │ │ │ │ │ + 13#include "pqxx/config-public-compiler.h" │ │ │ │ │ + 14 │ │ │ │ │ + 15// Some compilers, Visual Studio in particular, don't seem to support the │ │ │ │ │ + 16// standard's ISO-646 keywords out of the box. │ │ │ │ │ + 17#include │ │ │ │ │ 18 │ │ │ │ │ - 19#include "pqxx/dbtransaction.hxx" │ │ │ │ │ - 20 │ │ │ │ │ - 21 │ │ │ │ │ - 22// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ - 23 │ │ │ │ │ - 24namespace pqxx │ │ │ │ │ - 25{ │ │ │ │ │ + 19 │ │ │ │ │ + 20#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_CONST) │ │ │ │ │ + 22#define PQXX_CONST __attribute__ ((const)) │ │ │ │ │ + 23#else │ │ │ │ │ + 24#define PQXX_CONST │ │ │ │ │ + 25#endif │ │ │ │ │ 26 │ │ │ │ │ - 27namespace internal │ │ │ │ │ - 28{ │ │ │ │ │ -30class PQXX_LIBEXPORT PQXX_NOVTABLE basic_robusttransaction : │ │ │ │ │ - 31 public dbtransaction │ │ │ │ │ - 32{ │ │ │ │ │ - 33public: │ │ │ │ │ -35 using isolation_tag = isolation_traits; │ │ │ │ │ - 36 │ │ │ │ │ - 37 virtual ~basic_robusttransaction() =0; //[t16] │ │ │ │ │ - 38 │ │ │ │ │ - 39protected: │ │ │ │ │ - 40 basic_robusttransaction( │ │ │ │ │ - 41 connection_base &C, │ │ │ │ │ - 42 const std::string &IsolationLevel, │ │ │ │ │ - 43 const std::string &table_name=std::string{}); //[t16] │ │ │ │ │ - 44 │ │ │ │ │ - 45private: │ │ │ │ │ - 46 using IDType = unsigned long; │ │ │ │ │ - 47 IDType m_record_id = 0; │ │ │ │ │ - 48 std::string m_xid; │ │ │ │ │ - 49 std::string m_log_table; │ │ │ │ │ - 50 std::string m_sequence; │ │ │ │ │ - 51 int m_backendpid = -1; │ │ │ │ │ - 52 │ │ │ │ │ - 53 virtual void do_begin() override; //[t18] │ │ │ │ │ - 54 virtual void do_commit() override; //[t16] │ │ │ │ │ - 55 virtual void do_abort() override; //[t18] │ │ │ │ │ - 56 │ │ │ │ │ - 57 PQXX_PRIVATE void CreateLogTable(); │ │ │ │ │ - 58 PQXX_PRIVATE void CreateTransactionRecord(); │ │ │ │ │ - 59 PQXX_PRIVATE std::string sql_delete() const; │ │ │ │ │ - 60 PQXX_PRIVATE void DeleteTransactionRecord() noexcept; │ │ │ │ │ - 61 PQXX_PRIVATE bool CheckTransactionRecord(); │ │ │ │ │ - 62}; │ │ │ │ │ - 63} // namespace internal │ │ │ │ │ - 64 │ │ │ │ │ - 65 │ │ │ │ │ - 73 │ │ │ │ │ - 139template │ │ │ │ │ -140class robusttransaction : public internal::basic_robusttransaction │ │ │ │ │ - 141{ │ │ │ │ │ - 142public: │ │ │ │ │ -143 using isolation_tag = isolation_traits; │ │ │ │ │ - 144 │ │ │ │ │ - 146 │ │ │ │ │ -150 explicit robusttransaction( │ │ │ │ │ - 151 connection_base &C, │ │ │ │ │ - 152 const std::string &Name=std::string{}) : │ │ │ │ │ - 153 namedclass{fullname("robusttransaction",isolation_tag::name()), Name}, │ │ │ │ │ - 154 internal::basic_robusttransaction(C, isolation_tag::name()) │ │ │ │ │ - 155 { Begin(); } │ │ │ │ │ - 156 │ │ │ │ │ -157 virtual ~robusttransaction() noexcept │ │ │ │ │ - 158 { End(); } │ │ │ │ │ - 159}; │ │ │ │ │ - 160 │ │ │ │ │ - 165} // namespace pqxx │ │ │ │ │ - 166 │ │ │ │ │ - 167#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 168#endif │ │ │ │ │ -pqxx │ │ │ │ │ -The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ -Definition: array.hxx:26 │ │ │ │ │ -pqxx::isolation_level │ │ │ │ │ -isolation_level │ │ │ │ │ -Transaction isolation levels. │ │ │ │ │ -Definition: isolation.hxx:57 │ │ │ │ │ -pqxx::read_committed │ │ │ │ │ -@ read_committed │ │ │ │ │ -Definition: isolation.hxx:59 │ │ │ │ │ -pqxx::connection_base │ │ │ │ │ -connection_base abstract base class; represents a connection to a database. │ │ │ │ │ -Definition: connection_base.hxx:140 │ │ │ │ │ -pqxx::dbtransaction │ │ │ │ │ -Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ -Definition: dbtransaction.hxx:63 │ │ │ │ │ -pqxx::isolation_traits │ │ │ │ │ -Traits class to describe an isolation level; primarly for libpqxx's own use. │ │ │ │ │ -Definition: isolation.hxx:66 │ │ │ │ │ -pqxx::internal::basic_robusttransaction │ │ │ │ │ -Helper base class for the robusttransaction class template. │ │ │ │ │ -Definition: robusttransaction.hxx:32 │ │ │ │ │ -pqxx::robusttransaction │ │ │ │ │ -Slightly slower, better-fortified version of transaction. │ │ │ │ │ -Definition: robusttransaction.hxx:141 │ │ │ │ │ -pqxx::robusttransaction::~robusttransaction │ │ │ │ │ -virtual ~robusttransaction() noexcept │ │ │ │ │ -Definition: robusttransaction.hxx:157 │ │ │ │ │ -pqxx::robusttransaction::robusttransaction │ │ │ │ │ -robusttransaction(connection_base &C, const std::string &Name=std::string{}) │ │ │ │ │ -Constructor. │ │ │ │ │ -Definition: robusttransaction.hxx:150 │ │ │ │ │ + 27#if defined(PQXX_HAVE_DEPRECATED) │ │ │ │ │ + 29#define PQXX_DEPRECATED [[deprecated]] │ │ │ │ │ + 30#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_DEPRECATED) │ │ │ │ │ + 31#define PQXX_DEPRECATED __attribute__ ((deprecated)) │ │ │ │ │ + 32#else │ │ │ │ │ + 33#define PQXX_DEPRECATED │ │ │ │ │ + 34#endif │ │ │ │ │ + 35 │ │ │ │ │ + 36#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_PURE) │ │ │ │ │ + 38#define PQXX_PURE __attribute__ ((pure)) │ │ │ │ │ + 39#else │ │ │ │ │ + 40#define PQXX_PURE │ │ │ │ │ + 41#endif │ │ │ │ │ + 42 │ │ │ │ │ + 43 │ │ │ │ │ + 44// Workarounds for Windows │ │ │ │ │ + 45#ifdef _WIN32 │ │ │ │ │ + 46 │ │ │ │ │ + 47/* For now, export DLL symbols if _DLL is defined. This is done │ │ │ │ │ +automatically │ │ │ │ │ + 48 * by the compiler when linking to the dynamic version of the runtime │ │ │ │ │ +library, │ │ │ │ │ + 49 * according to "gzh" │ │ │ │ │ + 50 */ │ │ │ │ │ + 51#if !defined(PQXX_LIBEXPORT) && defined(PQXX_SHARED) │ │ │ │ │ + 52#define PQXX_LIBEXPORT __declspec(dllimport) │ │ │ │ │ + 53#endif // !PQXX_LIBEXPORT && PQXX_SHARED │ │ │ │ │ + 54 │ │ │ │ │ + 55 │ │ │ │ │ + 56// Workarounds for Microsoft Visual C++ │ │ │ │ │ + 57#ifdef _MSC_VER │ │ │ │ │ + 58 │ │ │ │ │ + 59// Suppress vtables on abstract classes. │ │ │ │ │ + 60#define PQXX_NOVTABLE __declspec(novtable) │ │ │ │ │ + 61 │ │ │ │ │ + 62// Automatically link with the appropriate libpq (static or dynamic, debug │ │ │ │ │ +or │ │ │ │ │ + 63// release). The default is to use the release DLL. Define PQXX_PQ_STATIC to │ │ │ │ │ + 64// link to a static version of libpq, and _DEBUG to link to a debug version. │ │ │ │ │ + 65// The two may be combined. │ │ │ │ │ + 66#if defined(PQXX_AUTOLINK) │ │ │ │ │ + 67#if defined(PQXX_PQ_STATIC) │ │ │ │ │ + 68#ifdef _DEBUG │ │ │ │ │ + 69#pragma comment(lib, "libpqd") │ │ │ │ │ + 70#else │ │ │ │ │ + 71#pragma comment(lib, "libpq") │ │ │ │ │ + 72#endif │ │ │ │ │ + 73#else │ │ │ │ │ + 74#ifdef _DEBUG │ │ │ │ │ + 75#pragma comment(lib, "libpqddll") │ │ │ │ │ + 76#else │ │ │ │ │ + 77#pragma comment(lib, "libpqdll") │ │ │ │ │ + 78#endif │ │ │ │ │ + 79#endif │ │ │ │ │ + 80#endif │ │ │ │ │ + 81 │ │ │ │ │ + 82// If we're not compiling libpqxx itself, automatically link with the │ │ │ │ │ + 83// appropriate libpqxx library. To link with the libpqxx DLL, define │ │ │ │ │ + 84// PQXX_SHARED; the default is to link with the static library. A static │ │ │ │ │ +link │ │ │ │ │ + 85// is the recommended practice. │ │ │ │ │ + 86// │ │ │ │ │ + 87// The preprocessor macro PQXX_INTERNAL is used to detect whether we │ │ │ │ │ + 88// are compiling the libpqxx library itself. When you compile the library │ │ │ │ │ + 89// yourself using your own project file, make sure to include this macro. │ │ │ │ │ + 90#if defined(PQXX_AUTOLINK) && !defined(PQXX_INTERNAL) │ │ │ │ │ + 91 #ifdef PQXX_SHARED │ │ │ │ │ + 92 #ifdef _DEBUG │ │ │ │ │ + 93 #pragma comment(lib, "libpqxxD") │ │ │ │ │ + 94 #else │ │ │ │ │ + 95 #pragma comment(lib, "libpqxx") │ │ │ │ │ + 96 #endif │ │ │ │ │ + 97 #else // !PQXX_SHARED │ │ │ │ │ + 98 #ifdef _DEBUG │ │ │ │ │ + 99 #pragma comment(lib, "libpqxx_staticD") │ │ │ │ │ + 100 #else │ │ │ │ │ + 101 #pragma comment(lib, "libpqxx_static") │ │ │ │ │ + 102 #endif │ │ │ │ │ + 103 #endif │ │ │ │ │ + 104#endif │ │ │ │ │ + 105 │ │ │ │ │ + 106#endif // _MSC_VER │ │ │ │ │ + 107#endif // _WIN32 │ │ │ │ │ + 108 │ │ │ │ │ + 109 │ │ │ │ │ + 110#ifndef PQXX_LIBEXPORT │ │ │ │ │ + 111#define PQXX_LIBEXPORT │ │ │ │ │ + 112#endif │ │ │ │ │ + 113 │ │ │ │ │ + 114#ifndef PQXX_PRIVATE │ │ │ │ │ + 115#define PQXX_PRIVATE │ │ │ │ │ + 116#endif │ │ │ │ │ + 117 │ │ │ │ │ + 118#ifndef PQXX_NOVTABLE │ │ │ │ │ + 119#define PQXX_NOVTABLE │ │ │ │ │ + 120#endif │ │ │ │ │ + 121 │ │ │ │ │ + 122#endif │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * robusttransaction.hxx │ │ │ │ │ + * compiler-public.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00101_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: transaction.hxx Source File │ │ │ │ +libpqxx: result.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,105 +55,224 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
transaction.hxx
│ │ │ │ +
result.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
12#ifndef PQXX_H_TRANSACTION
│ │ │ │ -
13#define PQXX_H_TRANSACTION
│ │ │ │ -
14
│ │ │ │ -
15#include "pqxx/compiler-public.hxx"
│ │ │ │ -
16#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
17
│ │ │ │ -
18#include "pqxx/dbtransaction.hxx"
│ │ │ │ -
19
│ │ │ │ -
20
│ │ │ │ -
21/* Methods tested in eg. self-test program test1 are marked with "//[t01]"
│ │ │ │ -
22 */
│ │ │ │ -
23
│ │ │ │ -
24
│ │ │ │ -
25namespace pqxx
│ │ │ │ -
26{
│ │ │ │ -
27
│ │ │ │ -
28namespace internal
│ │ │ │ -
29{
│ │ │ │ -
31class PQXX_LIBEXPORT basic_transaction : public dbtransaction
│ │ │ │ -
32{
│ │ │ │ -
33protected:
│ │ │ │ -
34 basic_transaction( //[t01]
│ │ │ │ - │ │ │ │ -
36 const std::string &IsolationLevel,
│ │ │ │ - │ │ │ │ -
38
│ │ │ │ -
39private:
│ │ │ │ -
40 virtual void do_commit() override; //[t01]
│ │ │ │ -
41};
│ │ │ │ -
42} // namespace internal
│ │ │ │ -
43
│ │ │ │ -
44
│ │ │ │ +
13#ifndef PQXX_H_RESULT
│ │ │ │ +
14#define PQXX_H_RESULT
│ │ │ │ +
15
│ │ │ │ +
16#include "pqxx/compiler-public.hxx"
│ │ │ │ +
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
18
│ │ │ │ +
19#include <ios>
│ │ │ │ +
20#include <memory>
│ │ │ │ +
21#include <stdexcept>
│ │ │ │ +
22
│ │ │ │ +
23#include "pqxx/except.hxx"
│ │ │ │ +
24#include "pqxx/types.hxx"
│ │ │ │ +
25#include "pqxx/util.hxx"
│ │ │ │ +
26
│ │ │ │ +
27#include "pqxx/internal/encodings.hxx"
│ │ │ │ +
28
│ │ │ │ +
29
│ │ │ │ +
30// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ +
31
│ │ │ │ +
32namespace pqxx
│ │ │ │ +
33{
│ │ │ │ +
34namespace internal
│ │ │ │ +
35{
│ │ │ │ +
36PQXX_LIBEXPORT void clear_result(const pq::PGresult *);
│ │ │ │ +
37
│ │ │ │ +
38namespace gate
│ │ │ │ +
39{
│ │ │ │ +
40class result_connection;
│ │ │ │ +
41class result_creation;
│ │ │ │ +
42class result_row;
│ │ │ │ +
43class result_sql_cursor;
│ │ │ │ +
44} // namespace internal::gate
│ │ │ │ +
45} // namespace internal
│ │ │ │ +
46
│ │ │ │ +
47
│ │ │ │
49
│ │ │ │ -
51
│ │ │ │ -
79template<
│ │ │ │ -
80 isolation_level ISOLATIONLEVEL=read_committed,
│ │ │ │ - │ │ │ │ - │ │ │ │ -
83{
│ │ │ │ -
84public:
│ │ │ │ - │ │ │ │ -
86
│ │ │ │ -
88
│ │ │ │ -
93 explicit transaction(connection_base &C, const std::string &TName): //[t01]
│ │ │ │ -
94 namedclass{fullname("transaction", isolation_tag::name()), TName},
│ │ │ │ -
95 internal::basic_transaction(C, isolation_tag::name(), READWRITE)
│ │ │ │ -
96 { Begin(); }
│ │ │ │ -
97
│ │ │ │ -
98 explicit transaction(connection_base &C) : //[t01]
│ │ │ │ -
99 transaction(C, "") {}
│ │ │ │ -
100
│ │ │ │ -
101 virtual ~transaction() noexcept
│ │ │ │ -
102 { End(); }
│ │ │ │ -
103};
│ │ │ │ -
104
│ │ │ │ -
105
│ │ │ │ - │ │ │ │ +
69class PQXX_LIBEXPORT result
│ │ │ │ +
70{
│ │ │ │ +
71public:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
74 using reference = row;
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
80
│ │ │ │ +
81 result() noexcept : //[t03]
│ │ │ │ +
82 m_data(make_data_pointer()),
│ │ │ │ +
83 m_query(),
│ │ │ │ +
84 m_encoding(internal::encoding_group::MONOBYTE)
│ │ │ │ +
85 {}
│ │ │ │ +
86 result(const result &rhs) noexcept =default; //[t01]
│ │ │ │ +
87
│ │ │ │ +
88 result &operator=(const result &rhs) noexcept =default; //[t10]
│ │ │ │ +
89
│ │ │ │ +
94 bool operator==(const result &) const noexcept; //[t70]
│ │ │ │ +
95 bool operator!=(const result &rhs) const noexcept //[t70]
│ │ │ │ +
96 { return not operator==(rhs); }
│ │ │ │ +
98
│ │ │ │ +
99 const_reverse_iterator rbegin() const; //[t75]
│ │ │ │ +
100 const_reverse_iterator crbegin() const;
│ │ │ │ +
101 const_reverse_iterator rend() const; //[t75]
│ │ │ │ +
102 const_reverse_iterator crend() const;
│ │ │ │ +
103
│ │ │ │ +
104 const_iterator begin() const noexcept; //[t01]
│ │ │ │ +
105 const_iterator cbegin() const noexcept;
│ │ │ │ +
106 inline const_iterator end() const noexcept; //[t01]
│ │ │ │ +
107 inline const_iterator cend() const noexcept;
│ │ │ │
108
│ │ │ │ - │ │ │ │ +
109 reference front() const noexcept; //[t74]
│ │ │ │ +
110 reference back() const noexcept; //[t75]
│ │ │ │
111
│ │ │ │ -
113}
│ │ │ │ -
114
│ │ │ │ -
115#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
116#endif
│ │ │ │ +
112 PQXX_PURE size_type size() const noexcept; //[t02]
│ │ │ │ +
113 PQXX_PURE bool empty() const noexcept; //[t11]
│ │ │ │ +
114 size_type capacity() const noexcept { return size(); } //[t20]
│ │ │ │ +
115
│ │ │ │ +
116 void swap(result &) noexcept; //[t77]
│ │ │ │ +
117
│ │ │ │ +
118 const row operator[](size_type i) const noexcept; //[t02]
│ │ │ │ +
119 const row at(size_type) const; //[t10]
│ │ │ │ +
120
│ │ │ │ +
121 void clear() noexcept { m_data.reset(); m_query = nullptr; } //[t20]
│ │ │ │ +
122
│ │ │ │ +
128 PQXX_PURE row_size_type columns() const noexcept; //[t11]
│ │ │ │ +
129
│ │ │ │ +
131 row_size_type column_number(const char ColName[]) const; //[t11]
│ │ │ │ +
132
│ │ │ │ +
134 row_size_type column_number(const std::string &Name) const //[t11]
│ │ │ │ +
135 {return column_number(Name.c_str());}
│ │ │ │ +
136
│ │ │ │ +
138 const char *column_name(row_size_type Number) const; //[t11]
│ │ │ │ +
139
│ │ │ │ +
141 oid column_type(row_size_type ColNum) const; //[t07]
│ │ │ │ +
143 oid column_type(int ColNum) const //[t07]
│ │ │ │ +
144 { return column_type(row_size_type(ColNum)); }
│ │ │ │ +
145
│ │ │ │ +
147 oid column_type(const std::string &ColName) const //[t07]
│ │ │ │ +
148 { return column_type(column_number(ColName)); }
│ │ │ │ +
149
│ │ │ │ +
151 oid column_type(const char ColName[]) const //[t07]
│ │ │ │ +
152 { return column_type(column_number(ColName)); }
│ │ │ │ +
153
│ │ │ │ +
155 oid column_table(row_size_type ColNum) const; //[t02]
│ │ │ │ +
156
│ │ │ │ +
158 oid column_table(int ColNum) const //[t02]
│ │ │ │ +
159 { return column_table(row_size_type(ColNum)); }
│ │ │ │ +
160
│ │ │ │ +
162 oid column_table(const std::string &ColName) const //[t02]
│ │ │ │ +
163 { return column_table(column_number(ColName)); }
│ │ │ │ +
164
│ │ │ │ +
166 row_size_type table_column(row_size_type ColNum) const; //[t93]
│ │ │ │ +
167
│ │ │ │ +
169 row_size_type table_column(int ColNum) const //[t93]
│ │ │ │ +
170 { return table_column(row_size_type(ColNum)); }
│ │ │ │ +
171
│ │ │ │ +
173 row_size_type table_column(const std::string &ColName) const //[t93]
│ │ │ │ +
174 { return table_column(column_number(ColName)); }
│ │ │ │ +
176
│ │ │ │ +
178 PQXX_PURE const std::string &query() const noexcept; //[t70]
│ │ │ │ +
179
│ │ │ │ +
181
│ │ │ │ +
184 PQXX_PURE oid inserted_oid() const; //[t13]
│ │ │ │ +
185
│ │ │ │ +
187
│ │ │ │ +
190 PQXX_PURE size_type affected_rows() const; //[t07]
│ │ │ │ +
191
│ │ │ │ +
192
│ │ │ │ +
193private:
│ │ │ │ +
194 using data_pointer = std::shared_ptr<const internal::pq::PGresult>;
│ │ │ │ +
195
│ │ │ │ +
197 data_pointer m_data;
│ │ │ │ +
198
│ │ │ │ +
200 static data_pointer make_data_pointer(
│ │ │ │ +
201 const internal::pq::PGresult *res=nullptr)
│ │ │ │ +
202 { return data_pointer{res, internal::clear_result}; }
│ │ │ │ +
203
│ │ │ │ +
205 std::shared_ptr<std::string> m_query;
│ │ │ │ +
206
│ │ │ │ +
207 internal::encoding_group m_encoding;
│ │ │ │ +
208
│ │ │ │ +
209 static const std::string s_empty_string;
│ │ │ │ +
210
│ │ │ │ +
211 friend class pqxx::field;
│ │ │ │ +
212 PQXX_PURE const char *GetValue(size_type Row, row_size_type Col) const;
│ │ │ │ +
213 PQXX_PURE bool get_is_null(size_type Row, row_size_type Col) const;
│ │ │ │ +
214 PQXX_PURE field_size_type get_length(
│ │ │ │ +
215 size_type,
│ │ │ │ +
216 row_size_type) const noexcept;
│ │ │ │ +
217
│ │ │ │ +
218 friend class pqxx::internal::gate::result_creation;
│ │ │ │ +
219 result(
│ │ │ │ +
220 internal::pq::PGresult *rhs,
│ │ │ │ +
221 const std::string &Query,
│ │ │ │ +
222 internal::encoding_group enc);
│ │ │ │ +
223
│ │ │ │ +
224 PQXX_PRIVATE void check_status() const;
│ │ │ │ +
225
│ │ │ │ +
226 friend class pqxx::internal::gate::result_connection;
│ │ │ │ +
227 friend class pqxx::internal::gate::result_row;
│ │ │ │ +
228 bool operator!() const noexcept { return not m_data.get(); }
│ │ │ │ +
229 operator bool() const noexcept { return m_data.get() != nullptr; }
│ │ │ │ +
230
│ │ │ │ +
231 [[noreturn]] PQXX_PRIVATE void ThrowSQLError(
│ │ │ │ +
232 const std::string &Err,
│ │ │ │ +
233 const std::string &Query) const;
│ │ │ │ +
234 PQXX_PRIVATE PQXX_PURE int errorposition() const;
│ │ │ │ +
235 PQXX_PRIVATE std::string StatusError() const;
│ │ │ │ +
236
│ │ │ │ +
237 friend class pqxx::internal::gate::result_sql_cursor;
│ │ │ │ +
238 PQXX_PURE const char *cmd_status() const noexcept;
│ │ │ │ +
239};
│ │ │ │ +
240} // namespace pqxx
│ │ │ │ +
241#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
242#endif
│ │ │ │ +
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
readwrite_policy
Definition: dbtransaction.hxx:25
│ │ │ │ -
@ read_write
Definition: dbtransaction.hxx:27
│ │ │ │ -
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:57
│ │ │ │ -
@ read_committed
Definition: isolation.hxx:59
│ │ │ │ -
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ -
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ -
static std::string fullname(const std::string &ttype, const std::string &isolation)
Definition: dbtransaction.cxx:95
│ │ │ │ -
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
│ │ │ │ -
Helper base class for the transaction class template.
Definition: transaction.hxx:32
│ │ │ │ -
basic_transaction(connection_base &C, const std::string &IsolationLevel, readwrite_policy)
Definition: transaction.cxx:20
│ │ │ │ -
Standard back-end transaction, templatized on isolation level.
Definition: transaction.hxx:83
│ │ │ │ -
transaction(connection_base &C, const std::string &TName)
Create a transaction.
Definition: transaction.hxx:93
│ │ │ │ -
transaction(connection_base &C)
Definition: transaction.hxx:98
│ │ │ │ -
virtual ~transaction() noexcept
Definition: transaction.hxx:101
│ │ │ │ -
void Begin()
Begin transaction (to be called by implementing class)
Definition: transaction_base.cxx:386
│ │ │ │ -
void End() noexcept
End transaction. To be called by implementing class' destructor.
Definition: transaction_base.cxx:408
│ │ │ │ -
namedclass(const std::string &Classname)
Definition: util.hxx:236
│ │ │ │ -
const std::string & name() const noexcept
Object name, or the empty string if no name was given.
Definition: util.hxx:249
│ │ │ │ +
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
│ │ │ │ +
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
│ │ │ │ +
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
│ │ │ │ +
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
│ │ │ │ +
void clear_result(const pq::PGresult *)
C++ wrapper for libpq's PQclear.
Definition: result.cxx:30
│ │ │ │ +
Reference to a field in a result set.
Definition: field.hxx:50
│ │ │ │ +
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ +
oid column_type(const char ColName[]) const
Type of given column.
Definition: result.hxx:151
│ │ │ │ +
row_size_type table_column(int ColNum) const
What column in its table did this column come from?
Definition: result.hxx:169
│ │ │ │ +
result() noexcept
Definition: result.hxx:81
│ │ │ │ +
oid column_type(const std::string &ColName) const
Type of given column.
Definition: result.hxx:147
│ │ │ │ +
result_size_type size_type
Definition: result.hxx:72
│ │ │ │ +
oid column_type(int ColNum) const
Type of given column.
Definition: result.hxx:143
│ │ │ │ +
void clear() noexcept
Definition: result.hxx:121
│ │ │ │ +
oid column_table(int ColNum) const
What table did this column come from?
Definition: result.hxx:158
│ │ │ │ +
result & operator=(const result &rhs) noexcept=default
│ │ │ │ +
oid column_table(const std::string &ColName) const
What table did this column come from?
Definition: result.hxx:162
│ │ │ │ +
result_difference_type difference_type
Definition: result.hxx:73
│ │ │ │ +
result(const result &rhs) noexcept=default
│ │ │ │ +
row_size_type table_column(const std::string &ColName) const
What column in its table did this column come from?
Definition: result.hxx:173
│ │ │ │ +
bool operator!=(const result &rhs) const noexcept
Definition: result.hxx:95
│ │ │ │ +
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
│ │ │ │ +
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:122
│ │ │ │ +
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,141 +1,276 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -transaction.hxx │ │ │ │ │ +result.hxx │ │ │ │ │ 1 │ │ │ │ │ - 12#ifndef PQXX_H_TRANSACTION │ │ │ │ │ - 13#define PQXX_H_TRANSACTION │ │ │ │ │ - 14 │ │ │ │ │ - 15#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 16#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 17 │ │ │ │ │ - 18#include "pqxx/dbtransaction.hxx" │ │ │ │ │ - 19 │ │ │ │ │ - 20 │ │ │ │ │ - 21/* Methods tested in eg. self-test program test1 are marked with "//[t01]" │ │ │ │ │ - 22 */ │ │ │ │ │ - 23 │ │ │ │ │ - 24 │ │ │ │ │ - 25namespace pqxx │ │ │ │ │ - 26{ │ │ │ │ │ - 27 │ │ │ │ │ - 28namespace internal │ │ │ │ │ - 29{ │ │ │ │ │ -31class PQXX_LIBEXPORT basic_transaction : public dbtransaction │ │ │ │ │ - 32{ │ │ │ │ │ - 33protected: │ │ │ │ │ - 34 basic_transaction( //[t01] │ │ │ │ │ - 35 connection_base &C, │ │ │ │ │ - 36 const std::string &IsolationLevel, │ │ │ │ │ - 37 readwrite_policy); │ │ │ │ │ - 38 │ │ │ │ │ - 39private: │ │ │ │ │ - 40 virtual void do_commit() override; //[t01] │ │ │ │ │ - 41}; │ │ │ │ │ - 42} // namespace internal │ │ │ │ │ - 43 │ │ │ │ │ - 44 │ │ │ │ │ + 13#ifndef PQXX_H_RESULT │ │ │ │ │ + 14#define PQXX_H_RESULT │ │ │ │ │ + 15 │ │ │ │ │ + 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 18 │ │ │ │ │ + 19#include │ │ │ │ │ + 20#include │ │ │ │ │ + 21#include │ │ │ │ │ + 22 │ │ │ │ │ + 23#include "pqxx/except.hxx" │ │ │ │ │ + 24#include "pqxx/types.hxx" │ │ │ │ │ + 25#include "pqxx/util.hxx" │ │ │ │ │ + 26 │ │ │ │ │ + 27#include "pqxx/internal/encodings.hxx" │ │ │ │ │ + 28 │ │ │ │ │ + 29 │ │ │ │ │ + 30// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ + 31 │ │ │ │ │ + 32namespace pqxx │ │ │ │ │ + 33{ │ │ │ │ │ + 34namespace internal │ │ │ │ │ + 35{ │ │ │ │ │ + 36PQXX_LIBEXPORT void clear_result(const pq::PGresult *); │ │ │ │ │ + 37 │ │ │ │ │ + 38namespace gate │ │ │ │ │ + 39{ │ │ │ │ │ + 40class result_connection; │ │ │ │ │ + 41class result_creation; │ │ │ │ │ + 42class result_row; │ │ │ │ │ + 43class result_sql_cursor; │ │ │ │ │ + 44} // namespace internal::gate │ │ │ │ │ + 45} // namespace internal │ │ │ │ │ + 46 │ │ │ │ │ + 47 │ │ │ │ │ 49 │ │ │ │ │ - 51 │ │ │ │ │ - 79template< │ │ │ │ │ - 80 isolation_level ISOLATIONLEVEL=read_committed, │ │ │ │ │ - 81 readwrite_policy READWRITE=read_write> │ │ │ │ │ -82class transaction : public internal::basic_transaction │ │ │ │ │ - 83{ │ │ │ │ │ - 84public: │ │ │ │ │ -85 using isolation_tag = isolation_traits; │ │ │ │ │ - 86 │ │ │ │ │ - 88 │ │ │ │ │ -93 explicit transaction(connection_base &C, const std::string &TName): //[t01] │ │ │ │ │ - 94 namedclass{fullname("transaction", isolation_tag::name()), TName}, │ │ │ │ │ - 95 internal::basic_transaction(C, isolation_tag::name(), READWRITE) │ │ │ │ │ - 96 { Begin(); } │ │ │ │ │ - 97 │ │ │ │ │ -98 explicit transaction(connection_base &C) : //[t01] │ │ │ │ │ - 99 transaction(C, "") {} │ │ │ │ │ - 100 │ │ │ │ │ -101 virtual ~transaction() noexcept │ │ │ │ │ - 102 { End(); } │ │ │ │ │ - 103}; │ │ │ │ │ - 104 │ │ │ │ │ - 105 │ │ │ │ │ -107using work = transaction<>; │ │ │ │ │ +69class PQXX_LIBEXPORT result │ │ │ │ │ + 70{ │ │ │ │ │ + 71public: │ │ │ │ │ +72 using size_type = result_size_type; │ │ │ │ │ +73 using difference_type = result_difference_type; │ │ │ │ │ +74 using reference = row; │ │ │ │ │ +75 using const_iterator = const_result_iterator; │ │ │ │ │ +76 using pointer = const_iterator; │ │ │ │ │ +77 using iterator = const_iterator; │ │ │ │ │ +78 using const_reverse_iterator = const_reverse_result_iterator; │ │ │ │ │ +79 using reverse_iterator = const_reverse_iterator; │ │ │ │ │ + 80 │ │ │ │ │ +81 result() noexcept : //[t03] │ │ │ │ │ + 82 m_data(make_data_pointer()), │ │ │ │ │ + 83 m_query(), │ │ │ │ │ + 84 m_encoding(internal::encoding_group::MONOBYTE) │ │ │ │ │ + 85 {} │ │ │ │ │ +86 result(const result &rhs) noexcept =default; //[t01] │ │ │ │ │ + 87 │ │ │ │ │ +88 result &operator=(const result &rhs) noexcept =default; //[t10] │ │ │ │ │ + 89 │ │ │ │ │ + 94 bool operator==(const result &) const noexcept; //[t70] │ │ │ │ │ +95 bool operator!=(const result &rhs) const noexcept //[t70] │ │ │ │ │ + 96 { return not operator==(rhs); } │ │ │ │ │ + 98 │ │ │ │ │ + 99 const_reverse_iterator rbegin() const; //[t75] │ │ │ │ │ + 100 const_reverse_iterator crbegin() const; │ │ │ │ │ + 101 const_reverse_iterator rend() const; //[t75] │ │ │ │ │ + 102 const_reverse_iterator crend() const; │ │ │ │ │ + 103 │ │ │ │ │ + 104 const_iterator begin() const noexcept; //[t01] │ │ │ │ │ + 105 const_iterator cbegin() const noexcept; │ │ │ │ │ + 106 inline const_iterator end() const noexcept; //[t01] │ │ │ │ │ + 107 inline const_iterator cend() const noexcept; │ │ │ │ │ 108 │ │ │ │ │ -110using read_transaction = transaction; │ │ │ │ │ + 109 reference front() const noexcept; //[t74] │ │ │ │ │ + 110 reference back() const noexcept; //[t75] │ │ │ │ │ 111 │ │ │ │ │ - 113} │ │ │ │ │ - 114 │ │ │ │ │ - 115#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 116#endif │ │ │ │ │ + 112 PQXX_PURE size_type size() const noexcept; //[t02] │ │ │ │ │ + 113 PQXX_PURE bool empty() const noexcept; //[t11] │ │ │ │ │ +114 size_type capacity() const noexcept { return size(); } //[t20] │ │ │ │ │ + 115 │ │ │ │ │ + 116 void swap(result &) noexcept; //[t77] │ │ │ │ │ + 117 │ │ │ │ │ + 118 const row operator[](size_type i) const noexcept; //[t02] │ │ │ │ │ + 119 const row at(size_type) const; //[t10] │ │ │ │ │ + 120 │ │ │ │ │ +121 void clear() noexcept { m_data.reset(); m_query = nullptr; } //[t20] │ │ │ │ │ + 122 │ │ │ │ │ + 128 PQXX_PURE row_size_type columns() const noexcept; //[t11] │ │ │ │ │ + 129 │ │ │ │ │ + 131 row_size_type column_number(const char ColName[]) const; //[t11] │ │ │ │ │ + 132 │ │ │ │ │ +134 row_size_type column_number(const std::string &Name) const //[t11] │ │ │ │ │ + 135 {return column_number(Name.c_str());} │ │ │ │ │ + 136 │ │ │ │ │ + 138 const char *column_name(row_size_type Number) const; //[t11] │ │ │ │ │ + 139 │ │ │ │ │ + 141 oid column_type(row_size_type ColNum) const; //[t07] │ │ │ │ │ +143 oid column_type(int ColNum) const //[t07] │ │ │ │ │ + 144 { return column_type(row_size_type(ColNum)); } │ │ │ │ │ + 145 │ │ │ │ │ +147 oid column_type(const std::string &ColName) const //[t07] │ │ │ │ │ + 148 { return column_type(column_number(ColName)); } │ │ │ │ │ + 149 │ │ │ │ │ +151 oid column_type(const char ColName[]) const //[t07] │ │ │ │ │ + 152 { return column_type(column_number(ColName)); } │ │ │ │ │ + 153 │ │ │ │ │ + 155 oid column_table(row_size_type ColNum) const; //[t02] │ │ │ │ │ + 156 │ │ │ │ │ +158 oid column_table(int ColNum) const //[t02] │ │ │ │ │ + 159 { return column_table(row_size_type(ColNum)); } │ │ │ │ │ + 160 │ │ │ │ │ +162 oid column_table(const std::string &ColName) const //[t02] │ │ │ │ │ + 163 { return column_table(column_number(ColName)); } │ │ │ │ │ + 164 │ │ │ │ │ + 166 row_size_type table_column(row_size_type ColNum) const; //[t93] │ │ │ │ │ + 167 │ │ │ │ │ +169 row_size_type table_column(int ColNum) const //[t93] │ │ │ │ │ + 170 { return table_column(row_size_type(ColNum)); } │ │ │ │ │ + 171 │ │ │ │ │ +173 row_size_type table_column(const std::string &ColName) const //[t93] │ │ │ │ │ + 174 { return table_column(column_number(ColName)); } │ │ │ │ │ + 176 │ │ │ │ │ + 178 PQXX_PURE const std::string &query() const noexcept; //[t70] │ │ │ │ │ + 179 │ │ │ │ │ + 181 │ │ │ │ │ + 184 PQXX_PURE oid inserted_oid() const; //[t13] │ │ │ │ │ + 185 │ │ │ │ │ + 187 │ │ │ │ │ + 190 PQXX_PURE size_type affected_rows() const; //[t07] │ │ │ │ │ + 191 │ │ │ │ │ + 192 │ │ │ │ │ + 193private: │ │ │ │ │ + 194 using data_pointer = std::shared_ptr; │ │ │ │ │ + 195 │ │ │ │ │ + 197 data_pointer m_data; │ │ │ │ │ + 198 │ │ │ │ │ + 200 static data_pointer make_data_pointer( │ │ │ │ │ + 201 const internal::pq::PGresult *res=nullptr) │ │ │ │ │ + 202 { return data_pointer{res, internal::clear_result}; } │ │ │ │ │ + 203 │ │ │ │ │ + 205 std::shared_ptr m_query; │ │ │ │ │ + 206 │ │ │ │ │ + 207 internal::encoding_group m_encoding; │ │ │ │ │ + 208 │ │ │ │ │ + 209 static const std::string s_empty_string; │ │ │ │ │ + 210 │ │ │ │ │ +211 friend class pqxx::field; │ │ │ │ │ + 212 PQXX_PURE const char *GetValue(size_type Row, row_size_type Col) const; │ │ │ │ │ + 213 PQXX_PURE bool get_is_null(size_type Row, row_size_type Col) const; │ │ │ │ │ + 214 PQXX_PURE field_size_type get_length( │ │ │ │ │ + 215 size_type, │ │ │ │ │ + 216 row_size_type) const noexcept; │ │ │ │ │ + 217 │ │ │ │ │ +218 friend class pqxx::internal::gate::result_creation; │ │ │ │ │ + 219 result( │ │ │ │ │ + 220 internal::pq::PGresult *rhs, │ │ │ │ │ + 221 const std::string &Query, │ │ │ │ │ + 222 internal::encoding_group enc); │ │ │ │ │ + 223 │ │ │ │ │ + 224 PQXX_PRIVATE void check_status() const; │ │ │ │ │ + 225 │ │ │ │ │ +226 friend class pqxx::internal::gate::result_connection; │ │ │ │ │ +227 friend class pqxx::internal::gate::result_row; │ │ │ │ │ + 228 bool operator!() const noexcept { return not m_data.get(); } │ │ │ │ │ + 229 operator bool() const noexcept { return m_data.get() != nullptr; } │ │ │ │ │ + 230 │ │ │ │ │ + 231 [[noreturn]] PQXX_PRIVATE void ThrowSQLError( │ │ │ │ │ + 232 const std::string &Err, │ │ │ │ │ + 233 const std::string &Query) const; │ │ │ │ │ + 234 PQXX_PRIVATE PQXX_PURE int errorposition() const; │ │ │ │ │ + 235 PQXX_PRIVATE std::string StatusError() const; │ │ │ │ │ + 236 │ │ │ │ │ +237 friend class pqxx::internal::gate::result_sql_cursor; │ │ │ │ │ + 238 PQXX_PURE const char *cmd_status() const noexcept; │ │ │ │ │ + 239}; │ │ │ │ │ + 240} // namespace pqxx │ │ │ │ │ + 241#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 242#endif │ │ │ │ │ +std │ │ │ │ │ +STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::readwrite_policy │ │ │ │ │ -readwrite_policy │ │ │ │ │ -Definition: dbtransaction.hxx:25 │ │ │ │ │ -pqxx::read_write │ │ │ │ │ -@ read_write │ │ │ │ │ -Definition: dbtransaction.hxx:27 │ │ │ │ │ -pqxx::isolation_level │ │ │ │ │ -isolation_level │ │ │ │ │ -Transaction isolation levels. │ │ │ │ │ -Definition: isolation.hxx:57 │ │ │ │ │ -pqxx::read_committed │ │ │ │ │ -@ read_committed │ │ │ │ │ -Definition: isolation.hxx:59 │ │ │ │ │ -pqxx::connection_base │ │ │ │ │ -connection_base abstract base class; represents a connection to a database. │ │ │ │ │ -Definition: connection_base.hxx:140 │ │ │ │ │ -pqxx::dbtransaction │ │ │ │ │ -Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ -Definition: dbtransaction.hxx:63 │ │ │ │ │ -pqxx::dbtransaction::fullname │ │ │ │ │ -static std::string fullname(const std::string &ttype, const std::string │ │ │ │ │ -&isolation) │ │ │ │ │ -Definition: dbtransaction.cxx:95 │ │ │ │ │ -pqxx::isolation_traits │ │ │ │ │ -Traits class to describe an isolation level; primarly for libpqxx's own use. │ │ │ │ │ -Definition: isolation.hxx:66 │ │ │ │ │ -pqxx::internal::basic_transaction │ │ │ │ │ -Helper base class for the transaction class template. │ │ │ │ │ -Definition: transaction.hxx:32 │ │ │ │ │ -pqxx::internal::basic_transaction::basic_transaction │ │ │ │ │ -basic_transaction(connection_base &C, const std::string &IsolationLevel, │ │ │ │ │ -readwrite_policy) │ │ │ │ │ -Definition: transaction.cxx:20 │ │ │ │ │ -pqxx::transaction │ │ │ │ │ -Standard back-end transaction, templatized on isolation level. │ │ │ │ │ -Definition: transaction.hxx:83 │ │ │ │ │ -pqxx::transaction::transaction │ │ │ │ │ -transaction(connection_base &C, const std::string &TName) │ │ │ │ │ -Create a transaction. │ │ │ │ │ -Definition: transaction.hxx:93 │ │ │ │ │ -pqxx::transaction::transaction │ │ │ │ │ -transaction(connection_base &C) │ │ │ │ │ -Definition: transaction.hxx:98 │ │ │ │ │ -pqxx::transaction::~transaction │ │ │ │ │ -virtual ~transaction() noexcept │ │ │ │ │ -Definition: transaction.hxx:101 │ │ │ │ │ -pqxx::transaction_base::Begin │ │ │ │ │ -void Begin() │ │ │ │ │ -Begin transaction (to be called by implementing class) │ │ │ │ │ -Definition: transaction_base.cxx:386 │ │ │ │ │ -pqxx::transaction_base::End │ │ │ │ │ -void End() noexcept │ │ │ │ │ -End transaction. To be called by implementing class' destructor. │ │ │ │ │ -Definition: transaction_base.cxx:408 │ │ │ │ │ -pqxx::internal::namedclass::namedclass │ │ │ │ │ -namedclass(const std::string &Classname) │ │ │ │ │ -Definition: util.hxx:236 │ │ │ │ │ -pqxx::internal::namedclass::name │ │ │ │ │ -const std::string & name() const noexcept │ │ │ │ │ -Object name, or the empty string if no name was given. │ │ │ │ │ -Definition: util.hxx:249 │ │ │ │ │ +pqxx::result_difference_type │ │ │ │ │ +signed long result_difference_type │ │ │ │ │ +Difference between result sizes. │ │ │ │ │ +Definition: types.hxx:21 │ │ │ │ │ +pqxx::field_size_type │ │ │ │ │ +std::size_t field_size_type │ │ │ │ │ +Number of bytes in a field of database data. │ │ │ │ │ +Definition: types.hxx:30 │ │ │ │ │ +pqxx::result_size_type │ │ │ │ │ +unsigned long result_size_type │ │ │ │ │ +Number of rows in a result set. │ │ │ │ │ +Definition: types.hxx:18 │ │ │ │ │ +pqxx::row_size_type │ │ │ │ │ +unsigned int row_size_type │ │ │ │ │ +Number of fields in a row of database data. │ │ │ │ │ +Definition: types.hxx:24 │ │ │ │ │ +pqxx::internal::clear_result │ │ │ │ │ +void clear_result(const pq::PGresult *) │ │ │ │ │ +C++ wrapper for libpq's PQclear. │ │ │ │ │ +Definition: result.cxx:30 │ │ │ │ │ +pqxx::field │ │ │ │ │ +Reference to a field in a result set. │ │ │ │ │ +Definition: field.hxx:50 │ │ │ │ │ +pqxx::result │ │ │ │ │ +Result set containing data returned by a query or command. │ │ │ │ │ +Definition: result.hxx:70 │ │ │ │ │ +pqxx::result::column_type │ │ │ │ │ +oid column_type(const char ColName[]) const │ │ │ │ │ +Type of given column. │ │ │ │ │ +Definition: result.hxx:151 │ │ │ │ │ +pqxx::result::table_column │ │ │ │ │ +row_size_type table_column(int ColNum) const │ │ │ │ │ +What column in its table did this column come from? │ │ │ │ │ +Definition: result.hxx:169 │ │ │ │ │ +pqxx::result::result │ │ │ │ │ +result() noexcept │ │ │ │ │ +Definition: result.hxx:81 │ │ │ │ │ +pqxx::result::column_type │ │ │ │ │ +oid column_type(const std::string &ColName) const │ │ │ │ │ +Type of given column. │ │ │ │ │ +Definition: result.hxx:147 │ │ │ │ │ +pqxx::result::size_type │ │ │ │ │ +result_size_type size_type │ │ │ │ │ +Definition: result.hxx:72 │ │ │ │ │ +pqxx::result::column_type │ │ │ │ │ +oid column_type(int ColNum) const │ │ │ │ │ +Type of given column. │ │ │ │ │ +Definition: result.hxx:143 │ │ │ │ │ +pqxx::result::clear │ │ │ │ │ +void clear() noexcept │ │ │ │ │ +Definition: result.hxx:121 │ │ │ │ │ +pqxx::result::column_table │ │ │ │ │ +oid column_table(int ColNum) const │ │ │ │ │ +What table did this column come from? │ │ │ │ │ +Definition: result.hxx:158 │ │ │ │ │ +pqxx::result::operator= │ │ │ │ │ +result & operator=(const result &rhs) noexcept=default │ │ │ │ │ +pqxx::result::column_table │ │ │ │ │ +oid column_table(const std::string &ColName) const │ │ │ │ │ +What table did this column come from? │ │ │ │ │ +Definition: result.hxx:162 │ │ │ │ │ +pqxx::result::difference_type │ │ │ │ │ +result_difference_type difference_type │ │ │ │ │ +Definition: result.hxx:73 │ │ │ │ │ +pqxx::result::result │ │ │ │ │ +result(const result &rhs) noexcept=default │ │ │ │ │ +pqxx::result::table_column │ │ │ │ │ +row_size_type table_column(const std::string &ColName) const │ │ │ │ │ +What column in its table did this column come from? │ │ │ │ │ +Definition: result.hxx:173 │ │ │ │ │ +pqxx::result::operator!= │ │ │ │ │ +bool operator!=(const result &rhs) const noexcept │ │ │ │ │ +Definition: result.hxx:95 │ │ │ │ │ +pqxx::const_result_iterator │ │ │ │ │ +Iterator for rows in a result. Use as result::const_iterator. │ │ │ │ │ +Definition: result_iterator.hxx:36 │ │ │ │ │ +pqxx::const_reverse_result_iterator │ │ │ │ │ +Reverse iterator for result. Use as result::const_reverse_iterator. │ │ │ │ │ +Definition: result_iterator.hxx:122 │ │ │ │ │ +pqxx::row │ │ │ │ │ +Reference to one row in a result. │ │ │ │ │ +Definition: row.hxx:41 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * transaction.hxx │ │ │ │ │ + * result.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00104_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: largeobject.hxx Source File │ │ │ │ +libpqxx: config-internal-autotools.h Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,537 +55,30 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
largeobject.hxx
│ │ │ │ +
config-internal-autotools.h
│ │ │ │
│ │ │ │
│ │ │ │ -
1
│ │ │ │ -
13#ifndef PQXX_H_LARGEOBJECT
│ │ │ │ -
14#define PQXX_H_LARGEOBJECT
│ │ │ │ -
15
│ │ │ │ -
16#include "pqxx/compiler-public.hxx"
│ │ │ │ -
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include <streambuf>
│ │ │ │ -
20
│ │ │ │ -
21#include "pqxx/dbtransaction.hxx"
│ │ │ │ -
22
│ │ │ │ -
23
│ │ │ │ -
24namespace pqxx
│ │ │ │ -
25{
│ │ │ │ -
27
│ │ │ │ -
34class PQXX_LIBEXPORT largeobject
│ │ │ │ -
35{
│ │ │ │ -
36public:
│ │ │ │ - │ │ │ │ -
38
│ │ │ │ -
40 largeobject() noexcept =default; //[t48]
│ │ │ │ -
41
│ │ │ │ -
43
│ │ │ │ -
45 explicit largeobject(dbtransaction &T); //[t48]
│ │ │ │ -
46
│ │ │ │ -
48
│ │ │ │ -
52 explicit largeobject(oid O) noexcept : m_id{O} {} //[t48]
│ │ │ │ -
53
│ │ │ │ -
55
│ │ │ │ -
59 largeobject(dbtransaction &T, const std::string &File); //[t53]
│ │ │ │ -
60
│ │ │ │ -
62
│ │ │ │ -
66 largeobject(const largeobjectaccess &O) noexcept; //[t50]
│ │ │ │ -
67
│ │ │ │ -
69
│ │ │ │ -
73 oid id() const noexcept { return m_id; } //[t48]
│ │ │ │ -
74
│ │ │ │ -
84
│ │ │ │ -
85 bool operator==(const largeobject &other) const //[t51]
│ │ │ │ -
86 { return m_id == other.m_id; }
│ │ │ │ -
88
│ │ │ │ -
89 bool operator!=(const largeobject &other) const //[t51]
│ │ │ │ -
90 { return m_id != other.m_id; }
│ │ │ │ -
92
│ │ │ │ -
93 bool operator<=(const largeobject &other) const //[t51]
│ │ │ │ -
94 { return m_id <= other.m_id; }
│ │ │ │ -
96
│ │ │ │ -
97 bool operator>=(const largeobject &other) const //[t51]
│ │ │ │ -
98 { return m_id >= other.m_id; }
│ │ │ │ -
100
│ │ │ │ -
101 bool operator<(const largeobject &other) const //[t51]
│ │ │ │ -
102 { return m_id < other.m_id; }
│ │ │ │ -
104
│ │ │ │ -
105 bool operator>(const largeobject &other) const //[t51]
│ │ │ │ -
106 { return m_id > other.m_id; }
│ │ │ │ -
108
│ │ │ │ -
110
│ │ │ │ -
114 void to_file(dbtransaction &T, const std::string &File) const; //[t52]
│ │ │ │ -
115
│ │ │ │ -
117
│ │ │ │ -
121 void remove(dbtransaction &T) const; //[t48]
│ │ │ │ -
122
│ │ │ │ -
123protected:
│ │ │ │ -
124 PQXX_PURE static internal::pq::PGconn *raw_connection(
│ │ │ │ -
125 const dbtransaction &T);
│ │ │ │ -
126
│ │ │ │ -
127 PQXX_PRIVATE std::string reason(const connection_base &, int err) const;
│ │ │ │ -
128
│ │ │ │ -
129private:
│ │ │ │ -
130 oid m_id = oid_none;
│ │ │ │ -
131};
│ │ │ │ -
132
│ │ │ │ -
133
│ │ │ │ -
134// TODO: New hierarchy with separate read / write / mixed-mode access
│ │ │ │ -
135
│ │ │ │ -
137class PQXX_LIBEXPORT largeobjectaccess : private largeobject
│ │ │ │ -
138{
│ │ │ │ -
139public:
│ │ │ │ - │ │ │ │ -
141 using off_type = long;
│ │ │ │ - │ │ │ │ -
143
│ │ │ │ -
145
│ │ │ │ -
149 using openmode = std::ios::openmode;
│ │ │ │ -
150
│ │ │ │ -
152
│ │ │ │ -
156 using seekdir = std::ios::seekdir;
│ │ │ │ -
157
│ │ │ │ -
159
│ │ │ │ -
163 explicit largeobjectaccess( //[t51]
│ │ │ │ -
164 dbtransaction &T,
│ │ │ │ -
165 openmode mode=std::ios::in|std::ios::out);
│ │ │ │ -
166
│ │ │ │ -
168
│ │ │ │ -
174 largeobjectaccess( //[t52]
│ │ │ │ -
175 dbtransaction &T,
│ │ │ │ -
176 oid O,
│ │ │ │ -
177 openmode mode=std::ios::in|std::ios::out);
│ │ │ │ -
178
│ │ │ │ -
180
│ │ │ │ -
185 largeobjectaccess( //[t50]
│ │ │ │ -
186 dbtransaction &T,
│ │ │ │ -
187 largeobject O,
│ │ │ │ -
188 openmode mode=std::ios::in|std::ios::out);
│ │ │ │ -
189
│ │ │ │ -
191
│ │ │ │ -
196 largeobjectaccess( //[t55]
│ │ │ │ -
197 dbtransaction &T,
│ │ │ │ -
198 const std::string &File,
│ │ │ │ -
199 openmode mode=std::ios::in|std::ios::out);
│ │ │ │ -
200
│ │ │ │ -
201 ~largeobjectaccess() noexcept { close(); }
│ │ │ │ -
202
│ │ │ │ -
204
│ │ │ │ -
207 using largeobject::id;
│ │ │ │ -
208
│ │ │ │ -
210
│ │ │ │ -
213 void to_file(const std::string &File) const //[t54]
│ │ │ │ -
214 { largeobject::to_file(m_trans, File); }
│ │ │ │ -
215
│ │ │ │ - │ │ │ │ -
217
│ │ │ │ -
223
│ │ │ │ -
227 void write(const char Buf[], size_type Len); //[t51]
│ │ │ │ -
228
│ │ │ │ -
230
│ │ │ │ -
233 void write(const std::string &Buf) //[t50]
│ │ │ │ -
234 { write(Buf.c_str(), static_cast<size_type>(Buf.size())); }
│ │ │ │ -
235
│ │ │ │ -
237
│ │ │ │ -
243 size_type read(char Buf[], size_type Len); //[t50]
│ │ │ │ -
244
│ │ │ │ -
246
│ │ │ │ -
249 size_type seek(size_type dest, seekdir dir); //[t51]
│ │ │ │ -
250
│ │ │ │ -
252
│ │ │ │ -
255 size_type tell() const; //[t50]
│ │ │ │ -
257
│ │ │ │ -
268
│ │ │ │ -
276 pos_type cseek(off_type dest, seekdir dir) noexcept; //[t50]
│ │ │ │ -
277
│ │ │ │ -
279
│ │ │ │ -
285 off_type cwrite(const char Buf[], size_type Len) noexcept; //[t50]
│ │ │ │ -
286
│ │ │ │ -
288
│ │ │ │ -
294 off_type cread(char Buf[], size_type Len) noexcept; //[t50]
│ │ │ │ -
295
│ │ │ │ -
297
│ │ │ │ -
301 pos_type ctell() const noexcept; //[t50]
│ │ │ │ -
303
│ │ │ │ -
309 void process_notice(const std::string &) noexcept; //[t50]
│ │ │ │ -
311
│ │ │ │ -
312 using largeobject::remove;
│ │ │ │ -
313
│ │ │ │ -
314 using largeobject::operator==;
│ │ │ │ -
315 using largeobject::operator!=;
│ │ │ │ -
316 using largeobject::operator<;
│ │ │ │ -
317 using largeobject::operator<=;
│ │ │ │ -
318 using largeobject::operator>;
│ │ │ │ -
319 using largeobject::operator>=;
│ │ │ │ -
320
│ │ │ │ -
321private:
│ │ │ │ -
322 PQXX_PRIVATE std::string reason(int err) const;
│ │ │ │ -
323 internal::pq::PGconn *raw_connection() const
│ │ │ │ -
324 { return largeobject::raw_connection(m_trans); }
│ │ │ │ -
325
│ │ │ │ -
326 PQXX_PRIVATE void open(openmode mode);
│ │ │ │ -
327 void close() noexcept;
│ │ │ │ -
328
│ │ │ │ -
329 dbtransaction &m_trans;
│ │ │ │ -
330 int m_fd = -1;
│ │ │ │ -
331
│ │ │ │ -
332 largeobjectaccess() =delete;
│ │ │ │ -
333 largeobjectaccess(const largeobjectaccess &) =delete;
│ │ │ │ -
334 largeobjectaccess operator=(const largeobjectaccess &) =delete;
│ │ │ │ -
335};
│ │ │ │ -
336
│ │ │ │ -
337
│ │ │ │ -
339
│ │ │ │ -
347template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ - │ │ │ │ -
349 public std::basic_streambuf<CHAR, TRAITS>
│ │ │ │ -
350{
│ │ │ │ -
351 using size_type = long;
│ │ │ │ -
352public:
│ │ │ │ -
353 using char_type = CHAR;
│ │ │ │ -
354 using traits_type = TRAITS;
│ │ │ │ -
355 using int_type = typename traits_type::int_type;
│ │ │ │ -
356 using pos_type = typename traits_type::pos_type;
│ │ │ │ -
357 using off_type = typename traits_type::off_type;
│ │ │ │ - │ │ │ │ - │ │ │ │ -
360
│ │ │ │ - │ │ │ │ -
362 dbtransaction &T,
│ │ │ │ -
363 largeobject O,
│ │ │ │ -
364 openmode mode=std::ios::in|std::ios::out,
│ │ │ │ -
365 size_type BufSize=512) :
│ │ │ │ -
366 m_bufsize{BufSize},
│ │ │ │ -
367 m_obj{T, O, mode},
│ │ │ │ -
368 m_g{nullptr},
│ │ │ │ -
369 m_p{nullptr}
│ │ │ │ -
370 { initialize(mode); }
│ │ │ │ -
371
│ │ │ │ - │ │ │ │ -
373 dbtransaction &T,
│ │ │ │ -
374 oid O,
│ │ │ │ -
375 openmode mode=std::ios::in|std::ios::out,
│ │ │ │ -
376 size_type BufSize=512) :
│ │ │ │ -
377 m_bufsize{BufSize},
│ │ │ │ -
378 m_obj{T, O, mode},
│ │ │ │ -
379 m_g{nullptr},
│ │ │ │ -
380 m_p{nullptr}
│ │ │ │ -
381 { initialize(mode); }
│ │ │ │ -
382
│ │ │ │ -
383 virtual ~largeobject_streambuf() noexcept
│ │ │ │ -
384 { delete [] m_p; delete [] m_g; }
│ │ │ │ -
385
│ │ │ │ -
386
│ │ │ │ -
388 void process_notice(const std::string &s) { m_obj.process_notice(s); }
│ │ │ │ -
389
│ │ │ │ -
390protected:
│ │ │ │ -
391 virtual int sync() override
│ │ │ │ -
392 {
│ │ │ │ -
393 // setg() sets eback, gptr, egptr
│ │ │ │ -
394 this->setg(this->eback(), this->eback(), this->egptr());
│ │ │ │ -
395 return overflow(EoF());
│ │ │ │ -
396 }
│ │ │ │ -
397
│ │ │ │ - │ │ │ │ -
399 off_type offset,
│ │ │ │ -
400 seekdir dir,
│ │ │ │ -
401 openmode)
│ │ │ │ -
402 override
│ │ │ │ -
403 {
│ │ │ │ -
404 return AdjustEOF(m_obj.cseek(largeobjectaccess::off_type(offset), dir));
│ │ │ │ -
405 }
│ │ │ │ -
406
│ │ │ │ -
407 virtual pos_type seekpos(pos_type pos, openmode) override
│ │ │ │ -
408 {
│ │ │ │ -
409 const largeobjectaccess::pos_type newpos = m_obj.cseek(
│ │ │ │ - │ │ │ │ -
411 std::ios::beg);
│ │ │ │ -
412 return AdjustEOF(newpos);
│ │ │ │ -
413 }
│ │ │ │ -
414
│ │ │ │ -
415 virtual int_type overflow(int_type ch = EoF()) override
│ │ │ │ -
416 {
│ │ │ │ -
417 char *const pp = this->pptr();
│ │ │ │ -
418 if (pp == nullptr) return EoF();
│ │ │ │ -
419 char *const pb = this->pbase();
│ │ │ │ -
420 int_type res = 0;
│ │ │ │ -
421
│ │ │ │ -
422 if (pp > pb) res = int_type(AdjustEOF(m_obj.cwrite(pb, pp-pb)));
│ │ │ │ -
423 this->setp(m_p, m_p + m_bufsize);
│ │ │ │ -
424
│ │ │ │ -
425 // Write that one more character, if it's there.
│ │ │ │ -
426 if (ch != EoF())
│ │ │ │ -
427 {
│ │ │ │ -
428 *this->pptr() = char(ch);
│ │ │ │ -
429 this->pbump(1);
│ │ │ │ -
430 }
│ │ │ │ -
431 return res;
│ │ │ │ -
432 }
│ │ │ │ -
433
│ │ │ │ -
434 virtual int_type underflow() override
│ │ │ │ -
435 {
│ │ │ │ -
436 if (this->gptr() == nullptr) return EoF();
│ │ │ │ -
437 char *const eb = this->eback();
│ │ │ │ -
438 const int_type res(static_cast<int_type>(
│ │ │ │ -
439 AdjustEOF(m_obj.cread(this->eback(), m_bufsize))));
│ │ │ │ -
440 this->setg(eb, eb, eb + ((res==EoF()) ? 0 : res));
│ │ │ │ -
441 return ((res == 0) or (res == EoF())) ? EoF() : *eb;
│ │ │ │ -
442 }
│ │ │ │ -
443
│ │ │ │ -
444private:
│ │ │ │ -
446 static int_type EoF() { return traits_type::eof(); }
│ │ │ │ -
447
│ │ │ │ -
449 template<typename INTYPE>
│ │ │ │ -
450 static std::streampos AdjustEOF(INTYPE pos)
│ │ │ │ -
451 { return (pos==-1) ? std::streampos(EoF()) : std::streampos(pos); }
│ │ │ │ -
452
│ │ │ │ -
453 void initialize(openmode mode)
│ │ │ │ -
454 {
│ │ │ │ -
455 if (mode & std::ios::in)
│ │ │ │ -
456 {
│ │ │ │ -
457 m_g = new char_type[unsigned(m_bufsize)];
│ │ │ │ -
458 this->setg(m_g, m_g, m_g);
│ │ │ │ -
459 }
│ │ │ │ -
460 if (mode & std::ios::out)
│ │ │ │ -
461 {
│ │ │ │ -
462 m_p = new char_type[unsigned(m_bufsize)];
│ │ │ │ -
463 this->setp(m_p, m_p + m_bufsize);
│ │ │ │ -
464 }
│ │ │ │ -
465 }
│ │ │ │ -
466
│ │ │ │ -
467 const size_type m_bufsize;
│ │ │ │ -
468 largeobjectaccess m_obj;
│ │ │ │ -
469
│ │ │ │ -
471 char_type *m_g, *m_p;
│ │ │ │ -
472};
│ │ │ │ -
473
│ │ │ │ -
474
│ │ │ │ -
476
│ │ │ │ -
484template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ - │ │ │ │ -
486 public std::basic_istream<CHAR, TRAITS>
│ │ │ │ -
487{
│ │ │ │ -
488 using super = std::basic_istream<CHAR, TRAITS>;
│ │ │ │ -
489
│ │ │ │ -
490public:
│ │ │ │ -
491 using char_type = CHAR;
│ │ │ │ -
492 using traits_type = TRAITS;
│ │ │ │ -
493 using int_type = typename traits_type::int_type;
│ │ │ │ -
494 using pos_type = typename traits_type::pos_type;
│ │ │ │ -
495 using off_type = typename traits_type::off_type;
│ │ │ │ -
496
│ │ │ │ -
498
│ │ │ │ - │ │ │ │ -
504 dbtransaction &T,
│ │ │ │ -
505 largeobject O,
│ │ │ │ -
506 largeobject::size_type BufSize=512) :
│ │ │ │ -
507 super{nullptr},
│ │ │ │ -
508 m_buf{T, O, std::ios::in, BufSize}
│ │ │ │ -
509 { super::init(&m_buf); }
│ │ │ │ -
510
│ │ │ │ -
512
│ │ │ │ - │ │ │ │ -
518 dbtransaction &T,
│ │ │ │ -
519 oid O,
│ │ │ │ -
520 largeobject::size_type BufSize=512) :
│ │ │ │ -
521 super{nullptr},
│ │ │ │ -
522 m_buf{T, O, std::ios::in, BufSize}
│ │ │ │ -
523 { super::init(&m_buf); }
│ │ │ │ -
524
│ │ │ │ -
525private:
│ │ │ │ - │ │ │ │ -
527};
│ │ │ │ -
528
│ │ │ │ - │ │ │ │ -
530
│ │ │ │ -
531
│ │ │ │ -
533
│ │ │ │ -
541template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ - │ │ │ │ -
543 public std::basic_ostream<CHAR, TRAITS>
│ │ │ │ -
544{
│ │ │ │ -
545 using super = std::basic_ostream<CHAR, TRAITS>;
│ │ │ │ -
546public:
│ │ │ │ -
547 using char_type = CHAR;
│ │ │ │ -
548 using traits_type = TRAITS;
│ │ │ │ -
549 using int_type = typename traits_type::int_type;
│ │ │ │ -
550 using pos_type = typename traits_type::pos_type;
│ │ │ │ -
551 using off_type = typename traits_type::off_type;
│ │ │ │ -
552
│ │ │ │ -
554
│ │ │ │ - │ │ │ │ -
560 dbtransaction &T,
│ │ │ │ -
561 largeobject O,
│ │ │ │ -
562 largeobject::size_type BufSize=512) :
│ │ │ │ -
563 super{nullptr},
│ │ │ │ -
564 m_buf{T, O, std::ios::out, BufSize}
│ │ │ │ -
565 { super::init(&m_buf); }
│ │ │ │ -
566
│ │ │ │ -
568
│ │ │ │ - │ │ │ │ -
574 dbtransaction &T,
│ │ │ │ -
575 oid O,
│ │ │ │ -
576 largeobject::size_type BufSize=512) :
│ │ │ │ -
577 super{nullptr},
│ │ │ │ -
578 m_buf{T, O, std::ios::out, BufSize}
│ │ │ │ -
579 { super::init(&m_buf); }
│ │ │ │ -
580
│ │ │ │ - │ │ │ │ -
582 {
│ │ │ │ -
583 try
│ │ │ │ -
584 {
│ │ │ │ -
585 m_buf.pubsync(); m_buf.pubsync();
│ │ │ │ -
586 }
│ │ │ │ -
587 catch (const std::exception &e)
│ │ │ │ -
588 {
│ │ │ │ -
589 m_buf.process_notice(e.what());
│ │ │ │ -
590 }
│ │ │ │ -
591 }
│ │ │ │ -
592
│ │ │ │ -
593private:
│ │ │ │ - │ │ │ │ -
595};
│ │ │ │ -
596
│ │ │ │ - │ │ │ │ -
598
│ │ │ │ -
599
│ │ │ │ -
601
│ │ │ │ -
609template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ - │ │ │ │ -
611 public std::basic_iostream<CHAR, TRAITS>
│ │ │ │ -
612{
│ │ │ │ -
613 using super = std::basic_iostream<CHAR, TRAITS>;
│ │ │ │ -
614
│ │ │ │ -
615public:
│ │ │ │ -
616 using char_type = CHAR;
│ │ │ │ -
617 using traits_type = TRAITS;
│ │ │ │ -
618 using int_type = typename traits_type::int_type;
│ │ │ │ -
619 using pos_type = typename traits_type::pos_type;
│ │ │ │ -
620 using off_type = typename traits_type::off_type;
│ │ │ │ -
621
│ │ │ │ -
623
│ │ │ │ - │ │ │ │ -
629 dbtransaction &T,
│ │ │ │ -
630 largeobject O,
│ │ │ │ -
631 largeobject::size_type BufSize=512) :
│ │ │ │ -
632 super{nullptr},
│ │ │ │ -
633 m_buf{T, O, std::ios::in | std::ios::out, BufSize}
│ │ │ │ -
634 { super::init(&m_buf); }
│ │ │ │ -
635
│ │ │ │ -
637
│ │ │ │ - │ │ │ │ -
643 dbtransaction &T,
│ │ │ │ -
644 oid O,
│ │ │ │ -
645 largeobject::size_type BufSize=512) :
│ │ │ │ -
646 super{nullptr},
│ │ │ │ -
647 m_buf{T, O, std::ios::in | std::ios::out, BufSize}
│ │ │ │ -
648 { super::init(&m_buf); }
│ │ │ │ -
649
│ │ │ │ - │ │ │ │ -
651 {
│ │ │ │ -
652 try
│ │ │ │ -
653 {
│ │ │ │ -
654 m_buf.pubsync(); m_buf.pubsync();
│ │ │ │ -
655 }
│ │ │ │ -
656 catch (const std::exception &e)
│ │ │ │ -
657 {
│ │ │ │ -
658 m_buf.process_notice(e.what());
│ │ │ │ -
659 }
│ │ │ │ -
660 }
│ │ │ │ -
661
│ │ │ │ -
662private:
│ │ │ │ - │ │ │ │ -
664};
│ │ │ │ -
665
│ │ │ │ - │ │ │ │ -
667
│ │ │ │ -
668} // namespace pqxx
│ │ │ │ -
669
│ │ │ │ -
670#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
671
│ │ │ │ -
672#endif
│ │ │ │ -
STL namespace.
│ │ │ │ -
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
long large_object_size_type
Number of bytes in a large object. (Unusual: it's signed.)
Definition: types.hxx:33
│ │ │ │ -
constexpr oid oid_none
The "null" oid.
Definition: util.hxx:77
│ │ │ │ -
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ -
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ -
Identity of a large object.
Definition: largeobject.hxx:35
│ │ │ │ -
static PQXX_PURE internal::pq::PGconn * raw_connection(const dbtransaction &T)
Definition: largeobject.cxx:134
│ │ │ │ -
large_object_size_type size_type
Definition: largeobject.hxx:37
│ │ │ │ -
bool operator<(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:101
│ │ │ │ -
bool operator==(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:85
│ │ │ │ -
void to_file(dbtransaction &T, const std::string &File) const
Export large object's contents to a local file.
Definition: largeobject.cxx:106
│ │ │ │ -
bool operator>(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:105
│ │ │ │ -
bool operator<=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:93
│ │ │ │ -
largeobject() noexcept=default
Refer to a nonexistent large object (similar to what a null pointer does)
│ │ │ │ -
bool operator!=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:89
│ │ │ │ -
bool operator>=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:97
│ │ │ │ -
oid id() const noexcept
Object identifier.
Definition: largeobject.hxx:73
│ │ │ │ -
Accessor for large object's contents.
Definition: largeobject.hxx:138
│ │ │ │ -
size_type pos_type
Definition: largeobject.hxx:142
│ │ │ │ -
std::ios::openmode openmode
Open mode: in, out (can be combined with the "or" operator)
Definition: largeobject.hxx:149
│ │ │ │ -
std::ios::seekdir seekdir
Seek direction: beg, cur, end.
Definition: largeobject.hxx:156
│ │ │ │ -
void write(const std::string &Buf)
Write string to large object.
Definition: largeobject.hxx:233
│ │ │ │ -
long off_type
Definition: largeobject.hxx:141
│ │ │ │ -
~largeobjectaccess() noexcept
Definition: largeobject.hxx:201
│ │ │ │ -
void to_file(const std::string &File) const
Export large object's contents to a local file.
Definition: largeobject.hxx:213
│ │ │ │ -
Streambuf to use large objects in standard I/O streams.
Definition: largeobject.hxx:350
│ │ │ │ -
virtual pos_type seekoff(off_type offset, seekdir dir, openmode) override
Definition: largeobject.hxx:398
│ │ │ │ -
TRAITS traits_type
Definition: largeobject.hxx:354
│ │ │ │ -
typename traits_type::int_type int_type
Definition: largeobject.hxx:355
│ │ │ │ -
virtual pos_type seekpos(pos_type pos, openmode) override
Definition: largeobject.hxx:407
│ │ │ │ -
void process_notice(const std::string &s)
For use by large object stream classes.
Definition: largeobject.hxx:388
│ │ │ │ -
CHAR char_type
Definition: largeobject.hxx:353
│ │ │ │ -
typename traits_type::off_type off_type
Definition: largeobject.hxx:357
│ │ │ │ -
largeobject_streambuf(dbtransaction &T, largeobject O, openmode mode=std::ios::in|std::ios::out, size_type BufSize=512)
Definition: largeobject.hxx:361
│ │ │ │ -
largeobject_streambuf(dbtransaction &T, oid O, openmode mode=std::ios::in|std::ios::out, size_type BufSize=512)
Definition: largeobject.hxx:372
│ │ │ │ -
virtual ~largeobject_streambuf() noexcept
Definition: largeobject.hxx:383
│ │ │ │ -
virtual int sync() override
Definition: largeobject.hxx:391
│ │ │ │ -
largeobjectaccess::seekdir seekdir
Definition: largeobject.hxx:359
│ │ │ │ -
virtual int_type underflow() override
Definition: largeobject.hxx:434
│ │ │ │ -
virtual int_type overflow(int_type ch=EoF()) override
Definition: largeobject.hxx:415
│ │ │ │ -
largeobjectaccess::openmode openmode
Definition: largeobject.hxx:358
│ │ │ │ -
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:356
│ │ │ │ -
Input stream that gets its data from a large object.
Definition: largeobject.hxx:487
│ │ │ │ -
CHAR char_type
Definition: largeobject.hxx:491
│ │ │ │ -
basic_ilostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_ilostream.
Definition: largeobject.hxx:503
│ │ │ │ -
typename traits_type::int_type int_type
Definition: largeobject.hxx:493
│ │ │ │ -
TRAITS traits_type
Definition: largeobject.hxx:492
│ │ │ │ -
typename traits_type::off_type off_type
Definition: largeobject.hxx:495
│ │ │ │ -
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:494
│ │ │ │ -
basic_ilostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_ilostream.
Definition: largeobject.hxx:517
│ │ │ │ -
Output stream that writes data back to a large object.
Definition: largeobject.hxx:544
│ │ │ │ -
typename traits_type::off_type off_type
Definition: largeobject.hxx:551
│ │ │ │ -
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:550
│ │ │ │ -
typename traits_type::int_type int_type
Definition: largeobject.hxx:549
│ │ │ │ -
~basic_olostream()
Definition: largeobject.hxx:581
│ │ │ │ -
basic_olostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_olostream.
Definition: largeobject.hxx:559
│ │ │ │ -
CHAR char_type
Definition: largeobject.hxx:547
│ │ │ │ -
TRAITS traits_type
Definition: largeobject.hxx:548
│ │ │ │ -
basic_olostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_olostream.
Definition: largeobject.hxx:573
│ │ │ │ -
Stream that reads and writes a large object.
Definition: largeobject.hxx:612
│ │ │ │ -
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:619
│ │ │ │ -
~basic_lostream()
Definition: largeobject.hxx:650
│ │ │ │ -
basic_lostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_lostream.
Definition: largeobject.hxx:642
│ │ │ │ -
typename traits_type::int_type int_type
Definition: largeobject.hxx:618
│ │ │ │ -
basic_lostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_lostream.
Definition: largeobject.hxx:628
│ │ │ │ -
typename traits_type::off_type off_type
Definition: largeobject.hxx:620
│ │ │ │ -
TRAITS traits_type
Definition: largeobject.hxx:617
│ │ │ │ -
CHAR char_type
Definition: largeobject.hxx:616
│ │ │ │ +
1/* Automatically generated from config.h: internal/autotools config. */
│ │ │ │ +
2
│ │ │ │ +
3#define PACKAGE "libpqxx"
│ │ │ │ +
4#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen"
│ │ │ │ +
5#define PACKAGE_NAME "libpqxx"
│ │ │ │ +
6#define PACKAGE_STRING "libpqxx 6.4.5"
│ │ │ │ +
7#define PACKAGE_TARNAME "libpqxx"
│ │ │ │ +
8#define PACKAGE_VERSION "6.4.5"
│ │ │ │ +
9#define VERSION "6.4.5"
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,691 +1,21 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -largeobject.hxx │ │ │ │ │ - 1 │ │ │ │ │ - 13#ifndef PQXX_H_LARGEOBJECT │ │ │ │ │ - 14#define PQXX_H_LARGEOBJECT │ │ │ │ │ - 15 │ │ │ │ │ - 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include │ │ │ │ │ - 20 │ │ │ │ │ - 21#include "pqxx/dbtransaction.hxx" │ │ │ │ │ - 22 │ │ │ │ │ - 23 │ │ │ │ │ - 24namespace pqxx │ │ │ │ │ - 25{ │ │ │ │ │ - 27 │ │ │ │ │ -34class PQXX_LIBEXPORT largeobject │ │ │ │ │ - 35{ │ │ │ │ │ - 36public: │ │ │ │ │ -37 using size_type = large_object_size_type; │ │ │ │ │ - 38 │ │ │ │ │ -40 largeobject() noexcept =default; //[t48] │ │ │ │ │ - 41 │ │ │ │ │ - 43 │ │ │ │ │ - 45 explicit largeobject(dbtransaction &T); //[t48] │ │ │ │ │ - 46 │ │ │ │ │ - 48 │ │ │ │ │ -52 explicit largeobject(oid O) noexcept : m_id{O} {} //[t48] │ │ │ │ │ - 53 │ │ │ │ │ - 55 │ │ │ │ │ - 59 largeobject(dbtransaction &T, const std::string &File); //[t53] │ │ │ │ │ - 60 │ │ │ │ │ - 62 │ │ │ │ │ - 66 largeobject(const largeobjectaccess &O) noexcept; //[t50] │ │ │ │ │ - 67 │ │ │ │ │ - 69 │ │ │ │ │ -73 oid id() const noexcept { return m_id; } //[t48] │ │ │ │ │ - 74 │ │ │ │ │ - 84 │ │ │ │ │ -85 bool operator==(const largeobject &other) const //[t51] │ │ │ │ │ - 86 { return m_id == other.m_id; } │ │ │ │ │ - 88 │ │ │ │ │ -89 bool operator!=(const largeobject &other) const //[t51] │ │ │ │ │ - 90 { return m_id != other.m_id; } │ │ │ │ │ - 92 │ │ │ │ │ -93 bool operator<=(const largeobject &other) const //[t51] │ │ │ │ │ - 94 { return m_id <= other.m_id; } │ │ │ │ │ - 96 │ │ │ │ │ -97 bool operator>=(const largeobject &other) const //[t51] │ │ │ │ │ - 98 { return m_id >= other.m_id; } │ │ │ │ │ - 100 │ │ │ │ │ -101 bool operator<(const largeobject &other) const //[t51] │ │ │ │ │ - 102 { return m_id < other.m_id; } │ │ │ │ │ - 104 │ │ │ │ │ -105 bool operator>(const largeobject &other) const //[t51] │ │ │ │ │ - 106 { return m_id > other.m_id; } │ │ │ │ │ - 108 │ │ │ │ │ - 110 │ │ │ │ │ - 114 void to_file(dbtransaction &T, const std::string &File) const; //[t52] │ │ │ │ │ - 115 │ │ │ │ │ - 117 │ │ │ │ │ - 121 void remove(dbtransaction &T) const; //[t48] │ │ │ │ │ - 122 │ │ │ │ │ - 123protected: │ │ │ │ │ - 124 PQXX_PURE static internal::pq::PGconn *raw_connection( │ │ │ │ │ - 125 const dbtransaction &T); │ │ │ │ │ - 126 │ │ │ │ │ - 127 PQXX_PRIVATE std::string reason(const connection_base &, int err) const; │ │ │ │ │ - 128 │ │ │ │ │ - 129private: │ │ │ │ │ - 130 oid m_id = oid_none; │ │ │ │ │ - 131}; │ │ │ │ │ - 132 │ │ │ │ │ - 133 │ │ │ │ │ - 134// TODO: New hierarchy with separate read / write / mixed-mode access │ │ │ │ │ - 135 │ │ │ │ │ -137class PQXX_LIBEXPORT largeobjectaccess : private largeobject │ │ │ │ │ - 138{ │ │ │ │ │ - 139public: │ │ │ │ │ - 140 using largeobject::size_type; │ │ │ │ │ -141 using off_type = long; │ │ │ │ │ -142 using pos_type = size_type; │ │ │ │ │ - 143 │ │ │ │ │ - 145 │ │ │ │ │ -149 using openmode = std::ios::openmode; │ │ │ │ │ - 150 │ │ │ │ │ - 152 │ │ │ │ │ -156 using seekdir = std::ios::seekdir; │ │ │ │ │ - 157 │ │ │ │ │ - 159 │ │ │ │ │ - 163 explicit largeobjectaccess( //[t51] │ │ │ │ │ - 164 dbtransaction &T, │ │ │ │ │ - 165 openmode mode=std::ios::in|std::ios::out); │ │ │ │ │ - 166 │ │ │ │ │ - 168 │ │ │ │ │ - 174 largeobjectaccess( //[t52] │ │ │ │ │ - 175 dbtransaction &T, │ │ │ │ │ - 176 oid O, │ │ │ │ │ - 177 openmode mode=std::ios::in|std::ios::out); │ │ │ │ │ - 178 │ │ │ │ │ - 180 │ │ │ │ │ - 185 largeobjectaccess( //[t50] │ │ │ │ │ - 186 dbtransaction &T, │ │ │ │ │ - 187 largeobject O, │ │ │ │ │ - 188 openmode mode=std::ios::in|std::ios::out); │ │ │ │ │ - 189 │ │ │ │ │ - 191 │ │ │ │ │ - 196 largeobjectaccess( //[t55] │ │ │ │ │ - 197 dbtransaction &T, │ │ │ │ │ - 198 const std::string &File, │ │ │ │ │ - 199 openmode mode=std::ios::in|std::ios::out); │ │ │ │ │ - 200 │ │ │ │ │ -201 ~largeobjectaccess() noexcept { close(); } │ │ │ │ │ - 202 │ │ │ │ │ - 204 │ │ │ │ │ - 207 using largeobject::id; │ │ │ │ │ - 208 │ │ │ │ │ - 210 │ │ │ │ │ -213 void to_file(const std::string &File) const //[t54] │ │ │ │ │ - 214 { largeobject::to_file(m_trans, File); } │ │ │ │ │ - 215 │ │ │ │ │ - 216 using largeobject::to_file; │ │ │ │ │ - 217 │ │ │ │ │ - 223 │ │ │ │ │ - 227 void write(const char Buf[], size_type Len); //[t51] │ │ │ │ │ - 228 │ │ │ │ │ - 230 │ │ │ │ │ -233 void write(const std::string &Buf) //[t50] │ │ │ │ │ - 234 { write(Buf.c_str(), static_cast(Buf.size())); } │ │ │ │ │ - 235 │ │ │ │ │ - 237 │ │ │ │ │ - 243 size_type read(char Buf[], size_type Len); //[t50] │ │ │ │ │ - 244 │ │ │ │ │ - 246 │ │ │ │ │ - 249 size_type seek(size_type dest, seekdir dir); //[t51] │ │ │ │ │ - 250 │ │ │ │ │ - 252 │ │ │ │ │ - 255 size_type tell() const; //[t50] │ │ │ │ │ - 257 │ │ │ │ │ - 268 │ │ │ │ │ - 276 pos_type cseek(off_type dest, seekdir dir) noexcept; //[t50] │ │ │ │ │ - 277 │ │ │ │ │ - 279 │ │ │ │ │ - 285 off_type cwrite(const char Buf[], size_type Len) noexcept; //[t50] │ │ │ │ │ - 286 │ │ │ │ │ - 288 │ │ │ │ │ - 294 off_type cread(char Buf[], size_type Len) noexcept; //[t50] │ │ │ │ │ - 295 │ │ │ │ │ - 297 │ │ │ │ │ - 301 pos_type ctell() const noexcept; //[t50] │ │ │ │ │ - 303 │ │ │ │ │ - 309 void process_notice(const std::string &) noexcept; //[t50] │ │ │ │ │ - 311 │ │ │ │ │ - 312 using largeobject::remove; │ │ │ │ │ - 313 │ │ │ │ │ - 314 using largeobject::operator==; │ │ │ │ │ - 315 using largeobject::operator!=; │ │ │ │ │ - 316 using largeobject::operator<; │ │ │ │ │ - 317 using largeobject::operator<=; │ │ │ │ │ - 318 using largeobject::operator>; │ │ │ │ │ - 319 using largeobject::operator>=; │ │ │ │ │ - 320 │ │ │ │ │ - 321private: │ │ │ │ │ - 322 PQXX_PRIVATE std::string reason(int err) const; │ │ │ │ │ - 323 internal::pq::PGconn *raw_connection() const │ │ │ │ │ - 324 { return largeobject::raw_connection(m_trans); } │ │ │ │ │ - 325 │ │ │ │ │ - 326 PQXX_PRIVATE void open(openmode mode); │ │ │ │ │ - 327 void close() noexcept; │ │ │ │ │ - 328 │ │ │ │ │ - 329 dbtransaction &m_trans; │ │ │ │ │ - 330 int m_fd = -1; │ │ │ │ │ - 331 │ │ │ │ │ - 332 largeobjectaccess() =delete; │ │ │ │ │ - 333 largeobjectaccess(const largeobjectaccess &) =delete; │ │ │ │ │ - 334 largeobjectaccess operator=(const largeobjectaccess &) =delete; │ │ │ │ │ - 335}; │ │ │ │ │ - 336 │ │ │ │ │ - 337 │ │ │ │ │ - 339 │ │ │ │ │ - 347template> │ │ │ │ │ -348 class largeobject_streambuf : │ │ │ │ │ - 349 public std::basic_streambuf │ │ │ │ │ - 350{ │ │ │ │ │ - 351 using size_type = long; │ │ │ │ │ - 352public: │ │ │ │ │ -353 using char_type = CHAR; │ │ │ │ │ -354 using traits_type = TRAITS; │ │ │ │ │ -355 using int_type = typename traits_type::int_type; │ │ │ │ │ -356 using pos_type = typename traits_type::pos_type; │ │ │ │ │ -357 using off_type = typename traits_type::off_type; │ │ │ │ │ -358 using openmode = largeobjectaccess::openmode; │ │ │ │ │ -359 using seekdir = largeobjectaccess::seekdir; │ │ │ │ │ - 360 │ │ │ │ │ -361 largeobject_streambuf( //[t48] │ │ │ │ │ - 362 dbtransaction &T, │ │ │ │ │ - 363 largeobject O, │ │ │ │ │ - 364 openmode mode=std::ios::in|std::ios::out, │ │ │ │ │ - 365 size_type BufSize=512) : │ │ │ │ │ - 366 m_bufsize{BufSize}, │ │ │ │ │ - 367 m_obj{T, O, mode}, │ │ │ │ │ - 368 m_g{nullptr}, │ │ │ │ │ - 369 m_p{nullptr} │ │ │ │ │ - 370 { initialize(mode); } │ │ │ │ │ - 371 │ │ │ │ │ -372 largeobject_streambuf( //[t48] │ │ │ │ │ - 373 dbtransaction &T, │ │ │ │ │ - 374 oid O, │ │ │ │ │ - 375 openmode mode=std::ios::in|std::ios::out, │ │ │ │ │ - 376 size_type BufSize=512) : │ │ │ │ │ - 377 m_bufsize{BufSize}, │ │ │ │ │ - 378 m_obj{T, O, mode}, │ │ │ │ │ - 379 m_g{nullptr}, │ │ │ │ │ - 380 m_p{nullptr} │ │ │ │ │ - 381 { initialize(mode); } │ │ │ │ │ - 382 │ │ │ │ │ -383 virtual ~largeobject_streambuf() noexcept │ │ │ │ │ - 384 { delete [] m_p; delete [] m_g; } │ │ │ │ │ - 385 │ │ │ │ │ - 386 │ │ │ │ │ -388 void process_notice(const std::string &s) { m_obj.process_notice(s); } │ │ │ │ │ - 389 │ │ │ │ │ - 390protected: │ │ │ │ │ -391 virtual int sync() override │ │ │ │ │ - 392 { │ │ │ │ │ - 393 // setg() sets eback, gptr, egptr │ │ │ │ │ - 394 this->setg(this->eback(), this->eback(), this->egptr()); │ │ │ │ │ - 395 return overflow(EoF()); │ │ │ │ │ - 396 } │ │ │ │ │ - 397 │ │ │ │ │ -398 virtual pos_type seekoff( │ │ │ │ │ - 399 off_type offset, │ │ │ │ │ - 400 seekdir dir, │ │ │ │ │ - 401 openmode) │ │ │ │ │ - 402 override │ │ │ │ │ - 403 { │ │ │ │ │ - 404 return AdjustEOF(m_obj.cseek(largeobjectaccess::off_type(offset), dir)); │ │ │ │ │ - 405 } │ │ │ │ │ - 406 │ │ │ │ │ -407 virtual pos_type seekpos(pos_type pos, openmode) override │ │ │ │ │ - 408 { │ │ │ │ │ - 409 const largeobjectaccess::pos_type newpos = m_obj.cseek( │ │ │ │ │ - 410 largeobjectaccess::off_type(pos), │ │ │ │ │ - 411 std::ios::beg); │ │ │ │ │ - 412 return AdjustEOF(newpos); │ │ │ │ │ - 413 } │ │ │ │ │ - 414 │ │ │ │ │ -415 virtual int_type overflow(int_type ch = EoF()) override │ │ │ │ │ - 416 { │ │ │ │ │ - 417 char *const pp = this->pptr(); │ │ │ │ │ - 418 if (pp == nullptr) return EoF(); │ │ │ │ │ - 419 char *const pb = this->pbase(); │ │ │ │ │ - 420 int_type res = 0; │ │ │ │ │ - 421 │ │ │ │ │ - 422 if (pp > pb) res = int_type(AdjustEOF(m_obj.cwrite(pb, pp-pb))); │ │ │ │ │ - 423 this->setp(m_p, m_p + m_bufsize); │ │ │ │ │ - 424 │ │ │ │ │ - 425 // Write that one more character, if it's there. │ │ │ │ │ - 426 if (ch != EoF()) │ │ │ │ │ - 427 { │ │ │ │ │ - 428 *this->pptr() = char(ch); │ │ │ │ │ - 429 this->pbump(1); │ │ │ │ │ - 430 } │ │ │ │ │ - 431 return res; │ │ │ │ │ - 432 } │ │ │ │ │ - 433 │ │ │ │ │ -434 virtual int_type underflow() override │ │ │ │ │ - 435 { │ │ │ │ │ - 436 if (this->gptr() == nullptr) return EoF(); │ │ │ │ │ - 437 char *const eb = this->eback(); │ │ │ │ │ - 438 const int_type res(static_cast( │ │ │ │ │ - 439 AdjustEOF(m_obj.cread(this->eback(), m_bufsize)))); │ │ │ │ │ - 440 this->setg(eb, eb, eb + ((res==EoF()) ? 0 : res)); │ │ │ │ │ - 441 return ((res == 0) or (res == EoF())) ? EoF() : *eb; │ │ │ │ │ - 442 } │ │ │ │ │ - 443 │ │ │ │ │ - 444private: │ │ │ │ │ - 446 static int_type EoF() { return traits_type::eof(); } │ │ │ │ │ - 447 │ │ │ │ │ - 449 template │ │ │ │ │ - 450 static std::streampos AdjustEOF(INTYPE pos) │ │ │ │ │ - 451 { return (pos==-1) ? std::streampos(EoF()) : std::streampos(pos); } │ │ │ │ │ - 452 │ │ │ │ │ - 453 void initialize(openmode mode) │ │ │ │ │ - 454 { │ │ │ │ │ - 455 if (mode & std::ios::in) │ │ │ │ │ - 456 { │ │ │ │ │ - 457 m_g = new char_type[unsigned(m_bufsize)]; │ │ │ │ │ - 458 this->setg(m_g, m_g, m_g); │ │ │ │ │ - 459 } │ │ │ │ │ - 460 if (mode & std::ios::out) │ │ │ │ │ - 461 { │ │ │ │ │ - 462 m_p = new char_type[unsigned(m_bufsize)]; │ │ │ │ │ - 463 this->setp(m_p, m_p + m_bufsize); │ │ │ │ │ - 464 } │ │ │ │ │ - 465 } │ │ │ │ │ - 466 │ │ │ │ │ - 467 const size_type m_bufsize; │ │ │ │ │ - 468 largeobjectaccess m_obj; │ │ │ │ │ - 469 │ │ │ │ │ - 471 char_type *m_g, *m_p; │ │ │ │ │ - 472}; │ │ │ │ │ - 473 │ │ │ │ │ - 474 │ │ │ │ │ - 476 │ │ │ │ │ - 484template> │ │ │ │ │ -485 class basic_ilostream : │ │ │ │ │ - 486 public std::basic_istream │ │ │ │ │ - 487{ │ │ │ │ │ - 488 using super = std::basic_istream; │ │ │ │ │ - 489 │ │ │ │ │ - 490public: │ │ │ │ │ -491 using char_type = CHAR; │ │ │ │ │ -492 using traits_type = TRAITS; │ │ │ │ │ -493 using int_type = typename traits_type::int_type; │ │ │ │ │ -494 using pos_type = typename traits_type::pos_type; │ │ │ │ │ -495 using off_type = typename traits_type::off_type; │ │ │ │ │ - 496 │ │ │ │ │ - 498 │ │ │ │ │ -503 basic_ilostream( //[t57] │ │ │ │ │ - 504 dbtransaction &T, │ │ │ │ │ - 505 largeobject O, │ │ │ │ │ - 506 largeobject::size_type BufSize=512) : │ │ │ │ │ - 507 super{nullptr}, │ │ │ │ │ - 508 m_buf{T, O, std::ios::in, BufSize} │ │ │ │ │ - 509 { super::init(&m_buf); } │ │ │ │ │ - 510 │ │ │ │ │ - 512 │ │ │ │ │ -517 basic_ilostream( //[t48] │ │ │ │ │ - 518 dbtransaction &T, │ │ │ │ │ - 519 oid O, │ │ │ │ │ - 520 largeobject::size_type BufSize=512) : │ │ │ │ │ - 521 super{nullptr}, │ │ │ │ │ - 522 m_buf{T, O, std::ios::in, BufSize} │ │ │ │ │ - 523 { super::init(&m_buf); } │ │ │ │ │ - 524 │ │ │ │ │ - 525private: │ │ │ │ │ - 526 largeobject_streambuf m_buf; │ │ │ │ │ - 527}; │ │ │ │ │ - 528 │ │ │ │ │ -529using ilostream = basic_ilostream; │ │ │ │ │ - 530 │ │ │ │ │ - 531 │ │ │ │ │ - 533 │ │ │ │ │ - 541template> │ │ │ │ │ -542 class basic_olostream : │ │ │ │ │ - 543 public std::basic_ostream │ │ │ │ │ - 544{ │ │ │ │ │ - 545 using super = std::basic_ostream; │ │ │ │ │ - 546public: │ │ │ │ │ -547 using char_type = CHAR; │ │ │ │ │ -548 using traits_type = TRAITS; │ │ │ │ │ -549 using int_type = typename traits_type::int_type; │ │ │ │ │ -550 using pos_type = typename traits_type::pos_type; │ │ │ │ │ -551 using off_type = typename traits_type::off_type; │ │ │ │ │ - 552 │ │ │ │ │ - 554 │ │ │ │ │ -559 basic_olostream( //[t48] │ │ │ │ │ - 560 dbtransaction &T, │ │ │ │ │ - 561 largeobject O, │ │ │ │ │ - 562 largeobject::size_type BufSize=512) : │ │ │ │ │ - 563 super{nullptr}, │ │ │ │ │ - 564 m_buf{T, O, std::ios::out, BufSize} │ │ │ │ │ - 565 { super::init(&m_buf); } │ │ │ │ │ - 566 │ │ │ │ │ - 568 │ │ │ │ │ -573 basic_olostream( //[t57] │ │ │ │ │ - 574 dbtransaction &T, │ │ │ │ │ - 575 oid O, │ │ │ │ │ - 576 largeobject::size_type BufSize=512) : │ │ │ │ │ - 577 super{nullptr}, │ │ │ │ │ - 578 m_buf{T, O, std::ios::out, BufSize} │ │ │ │ │ - 579 { super::init(&m_buf); } │ │ │ │ │ - 580 │ │ │ │ │ -581 ~basic_olostream() │ │ │ │ │ - 582 { │ │ │ │ │ - 583 try │ │ │ │ │ - 584 { │ │ │ │ │ - 585 m_buf.pubsync(); m_buf.pubsync(); │ │ │ │ │ - 586 } │ │ │ │ │ - 587 catch (const std::exception &e) │ │ │ │ │ - 588 { │ │ │ │ │ - 589 m_buf.process_notice(e.what()); │ │ │ │ │ - 590 } │ │ │ │ │ - 591 } │ │ │ │ │ - 592 │ │ │ │ │ - 593private: │ │ │ │ │ - 594 largeobject_streambuf m_buf; │ │ │ │ │ - 595}; │ │ │ │ │ - 596 │ │ │ │ │ -597using olostream = basic_olostream; │ │ │ │ │ - 598 │ │ │ │ │ - 599 │ │ │ │ │ - 601 │ │ │ │ │ - 609template> │ │ │ │ │ -610 class basic_lostream : │ │ │ │ │ - 611 public std::basic_iostream │ │ │ │ │ - 612{ │ │ │ │ │ - 613 using super = std::basic_iostream; │ │ │ │ │ - 614 │ │ │ │ │ - 615public: │ │ │ │ │ -616 using char_type = CHAR; │ │ │ │ │ -617 using traits_type = TRAITS; │ │ │ │ │ -618 using int_type = typename traits_type::int_type; │ │ │ │ │ -619 using pos_type = typename traits_type::pos_type; │ │ │ │ │ -620 using off_type = typename traits_type::off_type; │ │ │ │ │ - 621 │ │ │ │ │ - 623 │ │ │ │ │ -628 basic_lostream( //[t59] │ │ │ │ │ - 629 dbtransaction &T, │ │ │ │ │ - 630 largeobject O, │ │ │ │ │ - 631 largeobject::size_type BufSize=512) : │ │ │ │ │ - 632 super{nullptr}, │ │ │ │ │ - 633 m_buf{T, O, std::ios::in | std::ios::out, BufSize} │ │ │ │ │ - 634 { super::init(&m_buf); } │ │ │ │ │ - 635 │ │ │ │ │ - 637 │ │ │ │ │ -642 basic_lostream( //[t59] │ │ │ │ │ - 643 dbtransaction &T, │ │ │ │ │ - 644 oid O, │ │ │ │ │ - 645 largeobject::size_type BufSize=512) : │ │ │ │ │ - 646 super{nullptr}, │ │ │ │ │ - 647 m_buf{T, O, std::ios::in | std::ios::out, BufSize} │ │ │ │ │ - 648 { super::init(&m_buf); } │ │ │ │ │ - 649 │ │ │ │ │ -650 ~basic_lostream() │ │ │ │ │ - 651 { │ │ │ │ │ - 652 try │ │ │ │ │ - 653 { │ │ │ │ │ - 654 m_buf.pubsync(); m_buf.pubsync(); │ │ │ │ │ - 655 } │ │ │ │ │ - 656 catch (const std::exception &e) │ │ │ │ │ - 657 { │ │ │ │ │ - 658 m_buf.process_notice(e.what()); │ │ │ │ │ - 659 } │ │ │ │ │ - 660 } │ │ │ │ │ - 661 │ │ │ │ │ - 662private: │ │ │ │ │ - 663 largeobject_streambuf m_buf; │ │ │ │ │ - 664}; │ │ │ │ │ - 665 │ │ │ │ │ -666using lostream = basic_lostream; │ │ │ │ │ - 667 │ │ │ │ │ - 668} // namespace pqxx │ │ │ │ │ - 669 │ │ │ │ │ - 670#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 671 │ │ │ │ │ - 672#endif │ │ │ │ │ -std │ │ │ │ │ -STL namespace. │ │ │ │ │ -pqxx │ │ │ │ │ -The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ -Definition: array.hxx:26 │ │ │ │ │ -pqxx::large_object_size_type │ │ │ │ │ -long large_object_size_type │ │ │ │ │ -Number of bytes in a large object. (Unusual: it's signed.) │ │ │ │ │ -Definition: types.hxx:33 │ │ │ │ │ -pqxx::oid_none │ │ │ │ │ -constexpr oid oid_none │ │ │ │ │ -The "null" oid. │ │ │ │ │ -Definition: util.hxx:77 │ │ │ │ │ -pqxx::connection_base │ │ │ │ │ -connection_base abstract base class; represents a connection to a database. │ │ │ │ │ -Definition: connection_base.hxx:140 │ │ │ │ │ -pqxx::dbtransaction │ │ │ │ │ -Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ -Definition: dbtransaction.hxx:63 │ │ │ │ │ -pqxx::largeobject │ │ │ │ │ -Identity of a large object. │ │ │ │ │ -Definition: largeobject.hxx:35 │ │ │ │ │ -pqxx::largeobject::raw_connection │ │ │ │ │ -static PQXX_PURE internal::pq::PGconn * raw_connection(const dbtransaction &T) │ │ │ │ │ -Definition: largeobject.cxx:134 │ │ │ │ │ -pqxx::largeobject::size_type │ │ │ │ │ -large_object_size_type size_type │ │ │ │ │ -Definition: largeobject.hxx:37 │ │ │ │ │ -pqxx::largeobject::operator< │ │ │ │ │ -bool operator<(const largeobject &other) const │ │ │ │ │ -Compare object identities. │ │ │ │ │ -Definition: largeobject.hxx:101 │ │ │ │ │ -pqxx::largeobject::operator== │ │ │ │ │ -bool operator==(const largeobject &other) const │ │ │ │ │ -Compare object identities. │ │ │ │ │ -Definition: largeobject.hxx:85 │ │ │ │ │ -pqxx::largeobject::to_file │ │ │ │ │ -void to_file(dbtransaction &T, const std::string &File) const │ │ │ │ │ -Export large object's contents to a local file. │ │ │ │ │ -Definition: largeobject.cxx:106 │ │ │ │ │ -pqxx::largeobject::operator> │ │ │ │ │ -bool operator>(const largeobject &other) const │ │ │ │ │ -Compare object identities. │ │ │ │ │ -Definition: largeobject.hxx:105 │ │ │ │ │ -pqxx::largeobject::operator<= │ │ │ │ │ -bool operator<=(const largeobject &other) const │ │ │ │ │ -Compare object identities. │ │ │ │ │ -Definition: largeobject.hxx:93 │ │ │ │ │ -pqxx::largeobject::largeobject │ │ │ │ │ -largeobject() noexcept=default │ │ │ │ │ -Refer to a nonexistent large object (similar to what a null pointer does) │ │ │ │ │ -pqxx::largeobject::operator!= │ │ │ │ │ -bool operator!=(const largeobject &other) const │ │ │ │ │ -Compare object identities. │ │ │ │ │ -Definition: largeobject.hxx:89 │ │ │ │ │ -pqxx::largeobject::operator>= │ │ │ │ │ -bool operator>=(const largeobject &other) const │ │ │ │ │ -Compare object identities. │ │ │ │ │ -Definition: largeobject.hxx:97 │ │ │ │ │ -pqxx::largeobject::id │ │ │ │ │ -oid id() const noexcept │ │ │ │ │ -Object identifier. │ │ │ │ │ -Definition: largeobject.hxx:73 │ │ │ │ │ -pqxx::largeobjectaccess │ │ │ │ │ -Accessor for large object's contents. │ │ │ │ │ -Definition: largeobject.hxx:138 │ │ │ │ │ -pqxx::largeobjectaccess::pos_type │ │ │ │ │ -size_type pos_type │ │ │ │ │ -Definition: largeobject.hxx:142 │ │ │ │ │ -pqxx::largeobjectaccess::openmode │ │ │ │ │ -std::ios::openmode openmode │ │ │ │ │ -Open mode: in, out (can be combined with the "or" operator) │ │ │ │ │ -Definition: largeobject.hxx:149 │ │ │ │ │ -pqxx::largeobjectaccess::seekdir │ │ │ │ │ -std::ios::seekdir seekdir │ │ │ │ │ -Seek direction: beg, cur, end. │ │ │ │ │ -Definition: largeobject.hxx:156 │ │ │ │ │ -pqxx::largeobjectaccess::write │ │ │ │ │ -void write(const std::string &Buf) │ │ │ │ │ -Write string to large object. │ │ │ │ │ -Definition: largeobject.hxx:233 │ │ │ │ │ -pqxx::largeobjectaccess::off_type │ │ │ │ │ -long off_type │ │ │ │ │ -Definition: largeobject.hxx:141 │ │ │ │ │ -pqxx::largeobjectaccess::~largeobjectaccess │ │ │ │ │ -~largeobjectaccess() noexcept │ │ │ │ │ -Definition: largeobject.hxx:201 │ │ │ │ │ -pqxx::largeobjectaccess::to_file │ │ │ │ │ -void to_file(const std::string &File) const │ │ │ │ │ -Export large object's contents to a local file. │ │ │ │ │ -Definition: largeobject.hxx:213 │ │ │ │ │ -pqxx::largeobject_streambuf │ │ │ │ │ -Streambuf to use large objects in standard I/O streams. │ │ │ │ │ -Definition: largeobject.hxx:350 │ │ │ │ │ -pqxx::largeobject_streambuf::seekoff │ │ │ │ │ -virtual pos_type seekoff(off_type offset, seekdir dir, openmode) override │ │ │ │ │ -Definition: largeobject.hxx:398 │ │ │ │ │ -pqxx::largeobject_streambuf::traits_type │ │ │ │ │ -TRAITS traits_type │ │ │ │ │ -Definition: largeobject.hxx:354 │ │ │ │ │ -pqxx::largeobject_streambuf::int_type │ │ │ │ │ -typename traits_type::int_type int_type │ │ │ │ │ -Definition: largeobject.hxx:355 │ │ │ │ │ -pqxx::largeobject_streambuf::seekpos │ │ │ │ │ -virtual pos_type seekpos(pos_type pos, openmode) override │ │ │ │ │ -Definition: largeobject.hxx:407 │ │ │ │ │ -pqxx::largeobject_streambuf::process_notice │ │ │ │ │ -void process_notice(const std::string &s) │ │ │ │ │ -For use by large object stream classes. │ │ │ │ │ -Definition: largeobject.hxx:388 │ │ │ │ │ -pqxx::largeobject_streambuf::char_type │ │ │ │ │ -CHAR char_type │ │ │ │ │ -Definition: largeobject.hxx:353 │ │ │ │ │ -pqxx::largeobject_streambuf::off_type │ │ │ │ │ -typename traits_type::off_type off_type │ │ │ │ │ -Definition: largeobject.hxx:357 │ │ │ │ │ -pqxx::largeobject_streambuf::largeobject_streambuf │ │ │ │ │ -largeobject_streambuf(dbtransaction &T, largeobject O, openmode mode=std::ios:: │ │ │ │ │ -in|std::ios::out, size_type BufSize=512) │ │ │ │ │ -Definition: largeobject.hxx:361 │ │ │ │ │ -pqxx::largeobject_streambuf::largeobject_streambuf │ │ │ │ │ -largeobject_streambuf(dbtransaction &T, oid O, openmode mode=std::ios::in|std:: │ │ │ │ │ -ios::out, size_type BufSize=512) │ │ │ │ │ -Definition: largeobject.hxx:372 │ │ │ │ │ -pqxx::largeobject_streambuf::~largeobject_streambuf │ │ │ │ │ -virtual ~largeobject_streambuf() noexcept │ │ │ │ │ -Definition: largeobject.hxx:383 │ │ │ │ │ -pqxx::largeobject_streambuf::sync │ │ │ │ │ -virtual int sync() override │ │ │ │ │ -Definition: largeobject.hxx:391 │ │ │ │ │ -pqxx::largeobject_streambuf::seekdir │ │ │ │ │ -largeobjectaccess::seekdir seekdir │ │ │ │ │ -Definition: largeobject.hxx:359 │ │ │ │ │ -pqxx::largeobject_streambuf::underflow │ │ │ │ │ -virtual int_type underflow() override │ │ │ │ │ -Definition: largeobject.hxx:434 │ │ │ │ │ -pqxx::largeobject_streambuf::overflow │ │ │ │ │ -virtual int_type overflow(int_type ch=EoF()) override │ │ │ │ │ -Definition: largeobject.hxx:415 │ │ │ │ │ -pqxx::largeobject_streambuf::openmode │ │ │ │ │ -largeobjectaccess::openmode openmode │ │ │ │ │ -Definition: largeobject.hxx:358 │ │ │ │ │ -pqxx::largeobject_streambuf::pos_type │ │ │ │ │ -typename traits_type::pos_type pos_type │ │ │ │ │ -Definition: largeobject.hxx:356 │ │ │ │ │ -pqxx::basic_ilostream │ │ │ │ │ -Input stream that gets its data from a large object. │ │ │ │ │ -Definition: largeobject.hxx:487 │ │ │ │ │ -pqxx::basic_ilostream::char_type │ │ │ │ │ -CHAR char_type │ │ │ │ │ -Definition: largeobject.hxx:491 │ │ │ │ │ -pqxx::basic_ilostream::basic_ilostream │ │ │ │ │ -basic_ilostream(dbtransaction &T, largeobject O, largeobject::size_type │ │ │ │ │ -BufSize=512) │ │ │ │ │ -Create a basic_ilostream. │ │ │ │ │ -Definition: largeobject.hxx:503 │ │ │ │ │ -pqxx::basic_ilostream::int_type │ │ │ │ │ -typename traits_type::int_type int_type │ │ │ │ │ -Definition: largeobject.hxx:493 │ │ │ │ │ -pqxx::basic_ilostream::traits_type │ │ │ │ │ -TRAITS traits_type │ │ │ │ │ -Definition: largeobject.hxx:492 │ │ │ │ │ -pqxx::basic_ilostream::off_type │ │ │ │ │ -typename traits_type::off_type off_type │ │ │ │ │ -Definition: largeobject.hxx:495 │ │ │ │ │ -pqxx::basic_ilostream::pos_type │ │ │ │ │ -typename traits_type::pos_type pos_type │ │ │ │ │ -Definition: largeobject.hxx:494 │ │ │ │ │ -pqxx::basic_ilostream::basic_ilostream │ │ │ │ │ -basic_ilostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512) │ │ │ │ │ -Create a basic_ilostream. │ │ │ │ │ -Definition: largeobject.hxx:517 │ │ │ │ │ -pqxx::basic_olostream │ │ │ │ │ -Output stream that writes data back to a large object. │ │ │ │ │ -Definition: largeobject.hxx:544 │ │ │ │ │ -pqxx::basic_olostream::off_type │ │ │ │ │ -typename traits_type::off_type off_type │ │ │ │ │ -Definition: largeobject.hxx:551 │ │ │ │ │ -pqxx::basic_olostream::pos_type │ │ │ │ │ -typename traits_type::pos_type pos_type │ │ │ │ │ -Definition: largeobject.hxx:550 │ │ │ │ │ -pqxx::basic_olostream::int_type │ │ │ │ │ -typename traits_type::int_type int_type │ │ │ │ │ -Definition: largeobject.hxx:549 │ │ │ │ │ -pqxx::basic_olostream::~basic_olostream │ │ │ │ │ -~basic_olostream() │ │ │ │ │ -Definition: largeobject.hxx:581 │ │ │ │ │ -pqxx::basic_olostream::basic_olostream │ │ │ │ │ -basic_olostream(dbtransaction &T, largeobject O, largeobject::size_type │ │ │ │ │ -BufSize=512) │ │ │ │ │ -Create a basic_olostream. │ │ │ │ │ -Definition: largeobject.hxx:559 │ │ │ │ │ -pqxx::basic_olostream::char_type │ │ │ │ │ -CHAR char_type │ │ │ │ │ -Definition: largeobject.hxx:547 │ │ │ │ │ -pqxx::basic_olostream::traits_type │ │ │ │ │ -TRAITS traits_type │ │ │ │ │ -Definition: largeobject.hxx:548 │ │ │ │ │ -pqxx::basic_olostream::basic_olostream │ │ │ │ │ -basic_olostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512) │ │ │ │ │ -Create a basic_olostream. │ │ │ │ │ -Definition: largeobject.hxx:573 │ │ │ │ │ -pqxx::basic_lostream │ │ │ │ │ -Stream that reads and writes a large object. │ │ │ │ │ -Definition: largeobject.hxx:612 │ │ │ │ │ -pqxx::basic_lostream::pos_type │ │ │ │ │ -typename traits_type::pos_type pos_type │ │ │ │ │ -Definition: largeobject.hxx:619 │ │ │ │ │ -pqxx::basic_lostream::~basic_lostream │ │ │ │ │ -~basic_lostream() │ │ │ │ │ -Definition: largeobject.hxx:650 │ │ │ │ │ -pqxx::basic_lostream::basic_lostream │ │ │ │ │ -basic_lostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512) │ │ │ │ │ -Create a basic_lostream. │ │ │ │ │ -Definition: largeobject.hxx:642 │ │ │ │ │ -pqxx::basic_lostream::int_type │ │ │ │ │ -typename traits_type::int_type int_type │ │ │ │ │ -Definition: largeobject.hxx:618 │ │ │ │ │ -pqxx::basic_lostream::basic_lostream │ │ │ │ │ -basic_lostream(dbtransaction &T, largeobject O, largeobject::size_type │ │ │ │ │ -BufSize=512) │ │ │ │ │ -Create a basic_lostream. │ │ │ │ │ -Definition: largeobject.hxx:628 │ │ │ │ │ -pqxx::basic_lostream::off_type │ │ │ │ │ -typename traits_type::off_type off_type │ │ │ │ │ -Definition: largeobject.hxx:620 │ │ │ │ │ -pqxx::basic_lostream::traits_type │ │ │ │ │ -TRAITS traits_type │ │ │ │ │ -Definition: largeobject.hxx:617 │ │ │ │ │ -pqxx::basic_lostream::char_type │ │ │ │ │ -CHAR char_type │ │ │ │ │ -Definition: largeobject.hxx:616 │ │ │ │ │ +config-internal-autotools.h │ │ │ │ │ + 1/* Automatically generated from config.h: internal/autotools config. */ │ │ │ │ │ + 2 │ │ │ │ │ + 3#define PACKAGE "libpqxx" │ │ │ │ │ + 4#define PACKAGE_BUGREPORT "Jeroen T. Vermeulen" │ │ │ │ │ + 5#define PACKAGE_NAME "libpqxx" │ │ │ │ │ + 6#define PACKAGE_STRING "libpqxx 6.4.5" │ │ │ │ │ + 7#define PACKAGE_TARNAME "libpqxx" │ │ │ │ │ + 8#define PACKAGE_VERSION "6.4.5" │ │ │ │ │ + 9#define VERSION "6.4.5" │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * largeobject.hxx │ │ │ │ │ + * config-internal-autotools.h │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00107_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: connectionpolicy.hxx Source File │ │ │ │ +libpqxx: stream_from.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,69 +55,229 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
connectionpolicy.hxx
│ │ │ │ +
stream_from.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
12#ifndef PQXX_H_CONNECTIONPOLICY
│ │ │ │ -
13#define PQXX_H_CONNECTIONPOLICY
│ │ │ │ -
14
│ │ │ │ -
15#include "pqxx/compiler-public.hxx"
│ │ │ │ -
16#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
17
│ │ │ │ -
18#include <string>
│ │ │ │ -
19
│ │ │ │ -
20#include "pqxx/internal/libpq-forward.hxx"
│ │ │ │ +
13#ifndef PQXX_H_STREAM_FROM
│ │ │ │ +
14#define PQXX_H_STREAM_FROM
│ │ │ │ +
15
│ │ │ │ +
16#include "pqxx/compiler-public.hxx"
│ │ │ │ +
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
18#include "pqxx/transaction_base.hxx"
│ │ │ │ +
19#include "pqxx/stream_base.hxx"
│ │ │ │ +
20#include "pqxx/internal/type_utils.hxx"
│ │ │ │
21
│ │ │ │ -
22
│ │ │ │ -
23namespace pqxx
│ │ │ │ -
24{
│ │ │ │ -
25
│ │ │ │ -
30
│ │ │ │ -
31class PQXX_LIBEXPORT connectionpolicy
│ │ │ │ -
32{
│ │ │ │ -
33public:
│ │ │ │ -
34 using handle = internal::pq::PGconn *;
│ │ │ │ -
35
│ │ │ │ -
36 explicit connectionpolicy(const std::string &opts);
│ │ │ │ -
37 virtual ~connectionpolicy() noexcept;
│ │ │ │ -
38
│ │ │ │ -
39 const std::string &options() const noexcept { return m_options; }
│ │ │ │ -
40
│ │ │ │ -
41 virtual handle do_startconnect(handle orig);
│ │ │ │ -
42 virtual handle do_completeconnect(handle orig);
│ │ │ │ -
43 virtual handle do_dropconnect(handle orig) noexcept;
│ │ │ │ -
44 virtual handle do_disconnect(handle orig) noexcept;
│ │ │ │ -
45 virtual bool is_ready(handle) const noexcept;
│ │ │ │ -
46
│ │ │ │ -
47protected:
│ │ │ │ -
48 handle normalconnect(handle);
│ │ │ │ +
22#include <string>
│ │ │ │ +
23
│ │ │ │ +
24
│ │ │ │ +
25namespace pqxx
│ │ │ │ +
26{
│ │ │ │ +
27
│ │ │ │ +
29class PQXX_LIBEXPORT stream_from : public stream_base
│ │ │ │ +
30{
│ │ │ │ +
31public:
│ │ │ │ + │ │ │ │ + │ │ │ │ +
34 const std::string &table_name
│ │ │ │ +
35 );
│ │ │ │ +
36 template<typename Columns> stream_from(
│ │ │ │ + │ │ │ │ +
38 const std::string &table_name,
│ │ │ │ +
39 const Columns& columns
│ │ │ │ +
40 );
│ │ │ │ +
41 template<typename Iter> stream_from(
│ │ │ │ + │ │ │ │ +
43 const std::string &table_name,
│ │ │ │ +
44 Iter columns_begin,
│ │ │ │ +
45 Iter columns_end
│ │ │ │ +
46 );
│ │ │ │ +
47
│ │ │ │ +
48 ~stream_from() noexcept;
│ │ │ │
49
│ │ │ │ -
50private:
│ │ │ │ -
51 std::string m_options;
│ │ │ │ -
52};
│ │ │ │ -
53
│ │ │ │ -
55} // namespace
│ │ │ │ -
56
│ │ │ │ -
57#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
58
│ │ │ │ -
59#endif
│ │ │ │ +
50 void complete() override;
│ │ │ │ +
51
│ │ │ │ +
52 bool get_raw_line(std::string &);
│ │ │ │ +
53 template<typename Tuple> stream_from & operator>>(Tuple &);
│ │ │ │ +
54
│ │ │ │ +
55private:
│ │ │ │ +
56 internal::encoding_group m_copy_encoding;
│ │ │ │ +
57 std::string m_current_line;
│ │ │ │ +
58 bool m_retry_line;
│ │ │ │ +
59
│ │ │ │ +
60 void set_up(transaction_base &, const std::string &table_name);
│ │ │ │ +
61 void set_up(
│ │ │ │ + │ │ │ │ +
63 const std::string &table_name,
│ │ │ │ +
64 const std::string &columns
│ │ │ │ +
65 );
│ │ │ │ +
66
│ │ │ │ +
67 void close() override;
│ │ │ │ +
68
│ │ │ │ +
69 bool extract_field(
│ │ │ │ +
70 const std::string &,
│ │ │ │ +
71 std::string::size_type &,
│ │ │ │ +
72 std::string &
│ │ │ │ +
73 ) const;
│ │ │ │ +
74
│ │ │ │ +
75 template<typename Tuple, std::size_t I> auto tokenize_ith(
│ │ │ │ +
76 const std::string &,
│ │ │ │ +
77 Tuple &,
│ │ │ │ +
78 std::string::size_type,
│ │ │ │ +
79 std::string &
│ │ │ │ +
80 ) const -> typename std::enable_if<(
│ │ │ │ +
81 std::tuple_size<Tuple>::value > I
│ │ │ │ +
82 )>::type;
│ │ │ │ +
83 template<typename Tuple, std::size_t I> auto tokenize_ith(
│ │ │ │ +
84 const std::string &,
│ │ │ │ +
85 Tuple &,
│ │ │ │ +
86 std::string::size_type,
│ │ │ │ +
87 std::string &
│ │ │ │ +
88 ) const -> typename std::enable_if<(
│ │ │ │ +
89 std::tuple_size<Tuple>::value <= I
│ │ │ │ +
90 )>::type;
│ │ │ │ +
91
│ │ │ │ +
92 template<typename T> void extract_value(
│ │ │ │ +
93 const std::string &line,
│ │ │ │ +
94 T& t,
│ │ │ │ +
95 std::string::size_type &here,
│ │ │ │ +
96 std::string &workspace
│ │ │ │ +
97 ) const;
│ │ │ │ +
98};
│ │ │ │ +
99
│ │ │ │ +
100
│ │ │ │ +
101template<typename Columns> stream_from::stream_from(
│ │ │ │ + │ │ │ │ +
103 const std::string &table_name,
│ │ │ │ +
104 const Columns& columns
│ │ │ │ +
105) : stream_from{
│ │ │ │ +
106 tb,
│ │ │ │ +
107 table_name,
│ │ │ │ +
108 std::begin(columns),
│ │ │ │ +
109 std::end(columns)
│ │ │ │ +
110} {}
│ │ │ │ +
111
│ │ │ │ +
112
│ │ │ │ +
113template<typename Iter> stream_from::stream_from(
│ │ │ │ + │ │ │ │ +
115 const std::string &table_name,
│ │ │ │ +
116 Iter columns_begin,
│ │ │ │ +
117 Iter columns_end
│ │ │ │ +
118) :
│ │ │ │ +
119 namedclass{"stream_from", table_name},
│ │ │ │ +
120 stream_base{tb}
│ │ │ │ +
121{
│ │ │ │ +
122 set_up(
│ │ │ │ +
123 tb,
│ │ │ │ +
124 table_name,
│ │ │ │ +
125 columnlist(columns_begin, columns_end)
│ │ │ │ +
126 );
│ │ │ │ +
127}
│ │ │ │ +
128
│ │ │ │ +
129
│ │ │ │ +
130template<typename Tuple> stream_from & stream_from::operator>>(
│ │ │ │ +
131 Tuple &t
│ │ │ │ +
132)
│ │ │ │ +
133{
│ │ │ │ +
134 if (m_retry_line or get_raw_line(m_current_line))
│ │ │ │ +
135 {
│ │ │ │ +
136 std::string workspace;
│ │ │ │ +
137 try
│ │ │ │ +
138 {
│ │ │ │ +
139 tokenize_ith<Tuple, 0>(m_current_line, t, 0, workspace);
│ │ │ │ +
140 m_retry_line = false;
│ │ │ │ +
141 }
│ │ │ │ +
142 catch (...)
│ │ │ │ +
143 {
│ │ │ │ +
144 m_retry_line = true;
│ │ │ │ +
145 throw;
│ │ │ │ +
146 }
│ │ │ │ +
147 }
│ │ │ │ +
148 return *this;
│ │ │ │ +
149}
│ │ │ │ +
150
│ │ │ │ +
151
│ │ │ │ +
152template<typename Tuple, std::size_t I> auto stream_from::tokenize_ith(
│ │ │ │ +
153 const std::string &line,
│ │ │ │ +
154 Tuple &t,
│ │ │ │ +
155 std::string::size_type here,
│ │ │ │ +
156 std::string &workspace
│ │ │ │ +
157) const -> typename std::enable_if<(
│ │ │ │ +
158 std::tuple_size<Tuple>::value > I
│ │ │ │ +
159)>::type
│ │ │ │ +
160{
│ │ │ │ +
161 if (here >= line.size())
│ │ │ │ +
162 throw usage_error{"Too few fields to extract from stream_from line."};
│ │ │ │ +
163
│ │ │ │ +
164 extract_value(line, std::get<I>(t), here, workspace);
│ │ │ │ +
165 tokenize_ith<Tuple, I+1>(line, t, here, workspace);
│ │ │ │ +
166}
│ │ │ │ +
167
│ │ │ │ +
168
│ │ │ │ +
169template<typename Tuple, std::size_t I> auto stream_from::tokenize_ith(
│ │ │ │ +
170 const std::string &line,
│ │ │ │ +
171 Tuple & /* t */,
│ │ │ │ +
172 std::string::size_type here,
│ │ │ │ +
173 std::string & /* workspace */
│ │ │ │ +
174) const -> typename std::enable_if<(
│ │ │ │ +
175 std::tuple_size<Tuple>::value <= I
│ │ │ │ +
176)>::type
│ │ │ │ +
177{
│ │ │ │ +
178 // Zero-column line may still have a trailing newline
│ │ │ │ +
179 if (
│ │ │ │ +
180 here < line.size() and
│ │ │ │ +
181 not (here == line.size() - 1 and line[here] == '\n'))
│ │ │ │ +
182 throw usage_error{"Not all fields extracted from stream_from line"};
│ │ │ │ +
183}
│ │ │ │ +
184
│ │ │ │ +
185
│ │ │ │ +
186template<typename T> void stream_from::extract_value(
│ │ │ │ +
187 const std::string &line,
│ │ │ │ +
188 T& t,
│ │ │ │ +
189 std::string::size_type &here,
│ │ │ │ +
190 std::string &workspace
│ │ │ │ +
191) const
│ │ │ │ +
192{
│ │ │ │ +
193 if (extract_field(line, here, workspace))
│ │ │ │ +
194 from_string<T>(workspace, t);
│ │ │ │ +
195 else
│ │ │ │ +
196 t = internal::null_value<T>();
│ │ │ │ +
197}
│ │ │ │ +
198
│ │ │ │ +
199template<> void stream_from::extract_value<std::nullptr_t>(
│ │ │ │ +
200 const std::string &line,
│ │ │ │ +
201 std::nullptr_t&,
│ │ │ │ +
202 std::string::size_type &here,
│ │ │ │ +
203 std::string &workspace
│ │ │ │ +
204) const;
│ │ │ │ +
205
│ │ │ │ +
206} // namespace pqxx
│ │ │ │ +
207
│ │ │ │ +
208
│ │ │ │ +
209#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
210#endif
│ │ │ │
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
Definition: connectionpolicy.hxx:32
│ │ │ │ -
internal::pq::PGconn * handle
Definition: connectionpolicy.hxx:34
│ │ │ │ +
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:220
│ │ │ │ +
Definition: stream_base.hxx:29
│ │ │ │ +
static std::string columnlist(const C &)
Definition: stream_base.hxx:48
│ │ │ │ +
Efficiently pull data directly out of a table.
Definition: stream_from.hxx:30
│ │ │ │ +
stream_from & operator>>(Tuple &)
Definition: stream_from.hxx:130
│ │ │ │ +
stream_from(transaction_base &, const std::string &table_name)
Definition: stream_from.cxx:41
│ │ │ │ +
bool get_raw_line(std::string &)
Definition: stream_from.cxx:72
│ │ │ │ +
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,66 +1,238 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -connectionpolicy.hxx │ │ │ │ │ +stream_from.hxx │ │ │ │ │ 1 │ │ │ │ │ - 12#ifndef PQXX_H_CONNECTIONPOLICY │ │ │ │ │ - 13#define PQXX_H_CONNECTIONPOLICY │ │ │ │ │ - 14 │ │ │ │ │ - 15#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 16#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 17 │ │ │ │ │ - 18#include │ │ │ │ │ - 19 │ │ │ │ │ - 20#include "pqxx/internal/libpq-forward.hxx" │ │ │ │ │ + 13#ifndef PQXX_H_STREAM_FROM │ │ │ │ │ + 14#define PQXX_H_STREAM_FROM │ │ │ │ │ + 15 │ │ │ │ │ + 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 18#include "pqxx/transaction_base.hxx" │ │ │ │ │ + 19#include "pqxx/stream_base.hxx" │ │ │ │ │ + 20#include "pqxx/internal/type_utils.hxx" │ │ │ │ │ 21 │ │ │ │ │ - 22 │ │ │ │ │ - 23namespace pqxx │ │ │ │ │ - 24{ │ │ │ │ │ - 25 │ │ │ │ │ - 30 │ │ │ │ │ -31class PQXX_LIBEXPORT connectionpolicy │ │ │ │ │ - 32{ │ │ │ │ │ - 33public: │ │ │ │ │ -34 using handle = internal::pq::PGconn *; │ │ │ │ │ - 35 │ │ │ │ │ - 36 explicit connectionpolicy(const std::string &opts); │ │ │ │ │ - 37 virtual ~connectionpolicy() noexcept; │ │ │ │ │ - 38 │ │ │ │ │ -39 const std::string &options() const noexcept { return m_options; } │ │ │ │ │ - 40 │ │ │ │ │ - 41 virtual handle do_startconnect(handle orig); │ │ │ │ │ - 42 virtual handle do_completeconnect(handle orig); │ │ │ │ │ - 43 virtual handle do_dropconnect(handle orig) noexcept; │ │ │ │ │ - 44 virtual handle do_disconnect(handle orig) noexcept; │ │ │ │ │ - 45 virtual bool is_ready(handle) const noexcept; │ │ │ │ │ - 46 │ │ │ │ │ - 47protected: │ │ │ │ │ - 48 handle normalconnect(handle); │ │ │ │ │ + 22#include │ │ │ │ │ + 23 │ │ │ │ │ + 24 │ │ │ │ │ + 25namespace pqxx │ │ │ │ │ + 26{ │ │ │ │ │ + 27 │ │ │ │ │ +29class PQXX_LIBEXPORT stream_from : public stream_base │ │ │ │ │ + 30{ │ │ │ │ │ + 31public: │ │ │ │ │ + 32 stream_from( │ │ │ │ │ + 33 transaction_base &, │ │ │ │ │ + 34 const std::string &table_name │ │ │ │ │ + 35 ); │ │ │ │ │ + 36 template stream_from( │ │ │ │ │ + 37 transaction_base &, │ │ │ │ │ + 38 const std::string &table_name, │ │ │ │ │ + 39 const Columns& columns │ │ │ │ │ + 40 ); │ │ │ │ │ + 41 template stream_from( │ │ │ │ │ + 42 transaction_base &, │ │ │ │ │ + 43 const std::string &table_name, │ │ │ │ │ + 44 Iter columns_begin, │ │ │ │ │ + 45 Iter columns_end │ │ │ │ │ + 46 ); │ │ │ │ │ + 47 │ │ │ │ │ + 48 ~stream_from() noexcept; │ │ │ │ │ 49 │ │ │ │ │ - 50private: │ │ │ │ │ - 51 std::string m_options; │ │ │ │ │ - 52}; │ │ │ │ │ - 53 │ │ │ │ │ - 55} // namespace │ │ │ │ │ - 56 │ │ │ │ │ - 57#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 58 │ │ │ │ │ - 59#endif │ │ │ │ │ + 50 void complete() override; │ │ │ │ │ + 51 │ │ │ │ │ + 52 bool get_raw_line(std::string &); │ │ │ │ │ + 53 template stream_from & operator>>(Tuple &); │ │ │ │ │ + 54 │ │ │ │ │ + 55private: │ │ │ │ │ + 56 internal::encoding_group m_copy_encoding; │ │ │ │ │ + 57 std::string m_current_line; │ │ │ │ │ + 58 bool m_retry_line; │ │ │ │ │ + 59 │ │ │ │ │ + 60 void set_up(transaction_base &, const std::string &table_name); │ │ │ │ │ + 61 void set_up( │ │ │ │ │ + 62 transaction_base &, │ │ │ │ │ + 63 const std::string &table_name, │ │ │ │ │ + 64 const std::string &columns │ │ │ │ │ + 65 ); │ │ │ │ │ + 66 │ │ │ │ │ + 67 void close() override; │ │ │ │ │ + 68 │ │ │ │ │ + 69 bool extract_field( │ │ │ │ │ + 70 const std::string &, │ │ │ │ │ + 71 std::string::size_type &, │ │ │ │ │ + 72 std::string & │ │ │ │ │ + 73 ) const; │ │ │ │ │ + 74 │ │ │ │ │ + 75 template auto tokenize_ith( │ │ │ │ │ + 76 const std::string &, │ │ │ │ │ + 77 Tuple &, │ │ │ │ │ + 78 std::string::size_type, │ │ │ │ │ + 79 std::string & │ │ │ │ │ + 80 ) const -> typename std::enable_if<( │ │ │ │ │ + 81 std::tuple_size::value > I │ │ │ │ │ + 82 )>::type; │ │ │ │ │ + 83 template auto tokenize_ith( │ │ │ │ │ + 84 const std::string &, │ │ │ │ │ + 85 Tuple &, │ │ │ │ │ + 86 std::string::size_type, │ │ │ │ │ + 87 std::string & │ │ │ │ │ + 88 ) const -> typename std::enable_if<( │ │ │ │ │ + 89 std::tuple_size::value <= I │ │ │ │ │ + 90 )>::type; │ │ │ │ │ + 91 │ │ │ │ │ + 92 template void extract_value( │ │ │ │ │ + 93 const std::string &line, │ │ │ │ │ + 94 T& t, │ │ │ │ │ + 95 std::string::size_type &here, │ │ │ │ │ + 96 std::string &workspace │ │ │ │ │ + 97 ) const; │ │ │ │ │ + 98}; │ │ │ │ │ + 99 │ │ │ │ │ + 100 │ │ │ │ │ +101template stream_from::stream_from( │ │ │ │ │ + 102 transaction_base &tb, │ │ │ │ │ + 103 const std::string &table_name, │ │ │ │ │ + 104 const Columns& columns │ │ │ │ │ + 105) : stream_from{ │ │ │ │ │ + 106 tb, │ │ │ │ │ + 107 table_name, │ │ │ │ │ + 108 std::begin(columns), │ │ │ │ │ + 109 std::end(columns) │ │ │ │ │ + 110} {} │ │ │ │ │ + 111 │ │ │ │ │ + 112 │ │ │ │ │ +113template stream_from::stream_from( │ │ │ │ │ + 114 transaction_base &tb, │ │ │ │ │ + 115 const std::string &table_name, │ │ │ │ │ + 116 Iter columns_begin, │ │ │ │ │ + 117 Iter columns_end │ │ │ │ │ + 118) : │ │ │ │ │ + 119 namedclass{"stream_from", table_name}, │ │ │ │ │ + 120 stream_base{tb} │ │ │ │ │ + 121{ │ │ │ │ │ + 122 set_up( │ │ │ │ │ + 123 tb, │ │ │ │ │ + 124 table_name, │ │ │ │ │ + 125 columnlist(columns_begin, columns_end) │ │ │ │ │ + 126 ); │ │ │ │ │ + 127} │ │ │ │ │ + 128 │ │ │ │ │ + 129 │ │ │ │ │ +130template stream_from & stream_from::operator>>( │ │ │ │ │ + 131 Tuple &t │ │ │ │ │ + 132) │ │ │ │ │ + 133{ │ │ │ │ │ + 134 if (m_retry_line or get_raw_line(m_current_line)) │ │ │ │ │ + 135 { │ │ │ │ │ + 136 std::string workspace; │ │ │ │ │ + 137 try │ │ │ │ │ + 138 { │ │ │ │ │ + 139 tokenize_ith(m_current_line, t, 0, workspace); │ │ │ │ │ + 140 m_retry_line = false; │ │ │ │ │ + 141 } │ │ │ │ │ + 142 catch (...) │ │ │ │ │ + 143 { │ │ │ │ │ + 144 m_retry_line = true; │ │ │ │ │ + 145 throw; │ │ │ │ │ + 146 } │ │ │ │ │ + 147 } │ │ │ │ │ + 148 return *this; │ │ │ │ │ + 149} │ │ │ │ │ + 150 │ │ │ │ │ + 151 │ │ │ │ │ + 152template auto stream_from::tokenize_ith( │ │ │ │ │ + 153 const std::string &line, │ │ │ │ │ + 154 Tuple &t, │ │ │ │ │ + 155 std::string::size_type here, │ │ │ │ │ + 156 std::string &workspace │ │ │ │ │ + 157) const -> typename std::enable_if<( │ │ │ │ │ + 158 std::tuple_size::value > I │ │ │ │ │ + 159)>::type │ │ │ │ │ + 160{ │ │ │ │ │ + 161 if (here >= line.size()) │ │ │ │ │ + 162 throw usage_error{"Too few fields to extract from stream_from line."}; │ │ │ │ │ + 163 │ │ │ │ │ + 164 extract_value(line, std::get(t), here, workspace); │ │ │ │ │ + 165 tokenize_ith(line, t, here, workspace); │ │ │ │ │ + 166} │ │ │ │ │ + 167 │ │ │ │ │ + 168 │ │ │ │ │ + 169template auto stream_from::tokenize_ith( │ │ │ │ │ + 170 const std::string &line, │ │ │ │ │ + 171 Tuple & /* t */, │ │ │ │ │ + 172 std::string::size_type here, │ │ │ │ │ + 173 std::string & /* workspace */ │ │ │ │ │ + 174) const -> typename std::enable_if<( │ │ │ │ │ + 175 std::tuple_size::value <= I │ │ │ │ │ + 176)>::type │ │ │ │ │ + 177{ │ │ │ │ │ + 178 // Zero-column line may still have a trailing newline │ │ │ │ │ + 179 if ( │ │ │ │ │ + 180 here < line.size() and │ │ │ │ │ + 181 not (here == line.size() - 1 and line[here] == '\n')) │ │ │ │ │ + 182 throw usage_error{"Not all fields extracted from stream_from line"}; │ │ │ │ │ + 183} │ │ │ │ │ + 184 │ │ │ │ │ + 185 │ │ │ │ │ + 186template void stream_from::extract_value( │ │ │ │ │ + 187 const std::string &line, │ │ │ │ │ + 188 T& t, │ │ │ │ │ + 189 std::string::size_type &here, │ │ │ │ │ + 190 std::string &workspace │ │ │ │ │ + 191) const │ │ │ │ │ + 192{ │ │ │ │ │ + 193 if (extract_field(line, here, workspace)) │ │ │ │ │ + 194 from_string(workspace, t); │ │ │ │ │ + 195 else │ │ │ │ │ + 196 t = internal::null_value(); │ │ │ │ │ + 197} │ │ │ │ │ + 198 │ │ │ │ │ +199template<> void stream_from::extract_value( │ │ │ │ │ + 200 const std::string &line, │ │ │ │ │ + 201 std::nullptr_t&, │ │ │ │ │ + 202 std::string::size_type &here, │ │ │ │ │ + 203 std::string &workspace │ │ │ │ │ + 204) const; │ │ │ │ │ + 205 │ │ │ │ │ + 206} // namespace pqxx │ │ │ │ │ + 207 │ │ │ │ │ + 208 │ │ │ │ │ + 209#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 210#endif │ │ │ │ │ std │ │ │ │ │ STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::connectionpolicy │ │ │ │ │ -Definition: connectionpolicy.hxx:32 │ │ │ │ │ -pqxx::connectionpolicy::handle │ │ │ │ │ -internal::pq::PGconn * handle │ │ │ │ │ -Definition: connectionpolicy.hxx:34 │ │ │ │ │ +pqxx::usage_error │ │ │ │ │ +Error in usage of libpqxx library, similar to std::logic_error. │ │ │ │ │ +Definition: except.hxx:220 │ │ │ │ │ +pqxx::stream_base │ │ │ │ │ +Definition: stream_base.hxx:29 │ │ │ │ │ +pqxx::stream_base::columnlist │ │ │ │ │ +static std::string columnlist(const C &) │ │ │ │ │ +Definition: stream_base.hxx:48 │ │ │ │ │ +pqxx::stream_from │ │ │ │ │ +Efficiently pull data directly out of a table. │ │ │ │ │ +Definition: stream_from.hxx:30 │ │ │ │ │ +pqxx::stream_from::operator>> │ │ │ │ │ +stream_from & operator>>(Tuple &) │ │ │ │ │ +Definition: stream_from.hxx:130 │ │ │ │ │ +pqxx::stream_from::stream_from │ │ │ │ │ +stream_from(transaction_base &, const std::string &table_name) │ │ │ │ │ +Definition: stream_from.cxx:41 │ │ │ │ │ +pqxx::stream_from::get_raw_line │ │ │ │ │ +bool get_raw_line(std::string &) │ │ │ │ │ +Definition: stream_from.cxx:72 │ │ │ │ │ +pqxx::transaction_base │ │ │ │ │ +Interface definition (and common code) for "transaction" classes. │ │ │ │ │ +Definition: transaction_base.hxx:138 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * connectionpolicy.hxx │ │ │ │ │ + * stream_from.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00110_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: prepared_statement.hxx Source File │ │ │ │ +libpqxx: compiler-internal-pre.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,138 +55,43 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
prepared_statement.hxx
│ │ │ │ +
compiler-internal-pre.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
11#ifndef PQXX_H_PREPARED_STATEMENT
│ │ │ │ -
12#define PQXX_H_PREPARED_STATEMENT
│ │ │ │ -
13
│ │ │ │ -
14#include "pqxx/compiler-public.hxx"
│ │ │ │ -
15#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
15// NO GUARDS HERE! This code should be executed every time!
│ │ │ │
16
│ │ │ │ -
17#include "pqxx/types.hxx"
│ │ │ │ -
18#include "pqxx/internal/statement_parameters.hxx"
│ │ │ │ +
17#ifdef _WIN32
│ │ │ │ +
18#ifdef _MSC_VER
│ │ │ │
19
│ │ │ │ -
20
│ │ │ │ -
21
│ │ │ │ -
22namespace pqxx
│ │ │ │ -
23{
│ │ │ │ -
25namespace prepare
│ │ │ │ -
26{
│ │ │ │ -
28
│ │ │ │ -
43template<typename IT> inline pqxx::internal::dynamic_params<IT>
│ │ │ │ -
44make_dynamic_params(IT begin, IT end)
│ │ │ │ -
45{
│ │ │ │ -
46 return pqxx::internal::dynamic_params<IT>(begin, end);
│ │ │ │ -
47}
│ │ │ │ -
48
│ │ │ │ -
49
│ │ │ │ -
51
│ │ │ │ -
65template<typename C>
│ │ │ │ -
66inline pqxx::internal::dynamic_params<typename C::const_iterator>
│ │ │ │ -
67make_dynamic_params(const C &container)
│ │ │ │ -
68{
│ │ │ │ -
69 return pqxx::internal::dynamic_params<typename C::const_iterator>(container);
│ │ │ │ -
70}
│ │ │ │ -
71} // namespace prepare
│ │ │ │ -
72} // namespace pqxx
│ │ │ │ -
73
│ │ │ │ -
74namespace pqxx
│ │ │ │ -
75{
│ │ │ │ -
76namespace prepare
│ │ │ │ -
77{
│ │ │ │ -
79
│ │ │ │ -
81class PQXX_LIBEXPORT invocation : internal::statement_parameters
│ │ │ │ -
82{
│ │ │ │ -
83public:
│ │ │ │ -
84 PQXX_DEPRECATED invocation(transaction_base &, const std::string &statement);
│ │ │ │ -
85 invocation &operator=(const invocation &) =delete;
│ │ │ │ -
86
│ │ │ │ -
88 result exec() const;
│ │ │ │ -
89
│ │ │ │ -
91 bool exists() const;
│ │ │ │ -
92
│ │ │ │ -
94 invocation &operator()() { add_param(); return *this; }
│ │ │ │ -
95
│ │ │ │ -
97
│ │ │ │ -
100 template<typename T> invocation &operator()(const T &v)
│ │ │ │ -
101 { add_param(v, true); return *this; }
│ │ │ │ -
102
│ │ │ │ -
104
│ │ │ │ - │ │ │ │ -
108 { add_binary_param(v, true); return *this; }
│ │ │ │ -
109
│ │ │ │ -
111
│ │ │ │ -
115 template<typename T> invocation &operator()(const T &v, bool nonnull)
│ │ │ │ -
116 { add_param(v, nonnull); return *this; }
│ │ │ │ -
117
│ │ │ │ -
119
│ │ │ │ -
123 invocation &operator()(const binarystring &v, bool nonnull)
│ │ │ │ -
124 { add_binary_param(v, nonnull); return *this; }
│ │ │ │ -
125
│ │ │ │ -
127
│ │ │ │ -
134 template<typename T> invocation &operator()(T *v, bool nonnull=true)
│ │ │ │ -
135 { add_param(v, nonnull); return *this; }
│ │ │ │ -
136
│ │ │ │ -
138
│ │ │ │ -
142 invocation &operator()(const char *v, bool nonnull=true)
│ │ │ │ -
143 { add_param(v, nonnull); return *this; }
│ │ │ │ -
144
│ │ │ │ -
145private:
│ │ │ │ -
146 transaction_base &m_home;
│ │ │ │ -
147 const std::string m_statement;
│ │ │ │ -
148
│ │ │ │ -
149 invocation &setparam(const std::string &, bool nonnull);
│ │ │ │ -
150};
│ │ │ │ -
151
│ │ │ │ -
152
│ │ │ │ -
153namespace internal
│ │ │ │ -
154{
│ │ │ │ -
156struct PQXX_LIBEXPORT prepared_def
│ │ │ │ -
157{
│ │ │ │ -
159 std::string definition;
│ │ │ │ -
161 bool registered = false;
│ │ │ │ -
162
│ │ │ │ -
163 prepared_def() =default;
│ │ │ │ -
164 explicit prepared_def(const std::string &);
│ │ │ │ -
165};
│ │ │ │ -
166
│ │ │ │ -
167} // namespace pqxx::prepare::internal
│ │ │ │ -
168} // namespace pqxx::prepare
│ │ │ │ -
169} // namespace pqxx
│ │ │ │ -
170
│ │ │ │ -
171#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
172#endif
│ │ │ │ -
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
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
│ │ │ │ -
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:54
│ │ │ │ -
Helper class for passing parameters to, and executing, prepared statements.
Definition: prepared_statement.hxx:82
│ │ │ │ -
invocation & operator()(const binarystring &v, bool nonnull)
Pass binary parameter value for a BYTEA field.
Definition: prepared_statement.hxx:123
│ │ │ │ -
invocation & operator()(const binarystring &v)
Pass binary parameter value for a BYTEA field.
Definition: prepared_statement.hxx:107
│ │ │ │ -
invocation & operator()(T *v, bool nonnull=true)
Pass C-style parameter string, or null if pointer is null.
Definition: prepared_statement.hxx:134
│ │ │ │ -
invocation & operator=(const invocation &)=delete
│ │ │ │ -
invocation & operator()(const char *v, bool nonnull=true)
Pass C-style string parameter, or null if pointer is null.
Definition: prepared_statement.hxx:142
│ │ │ │ -
invocation & operator()()
Pass null parameter.
Definition: prepared_statement.hxx:94
│ │ │ │ -
invocation & operator()(const T &v, bool nonnull)
Pass parameter value.
Definition: prepared_statement.hxx:115
│ │ │ │ -
invocation & operator()(const T &v)
Pass parameter value.
Definition: prepared_statement.hxx:100
│ │ │ │ -
Internal representation of a prepared statement definition.
Definition: prepared_statement.hxx:157
│ │ │ │ - │ │ │ │ -
std::string definition
Text of prepared query.
Definition: prepared_statement.hxx:159
│ │ │ │ -
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ -
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │ +
20// Save client program warning state, and set warning level 4.
│ │ │ │ +
21// Setting the warning level explicitly ensures that libpqxx
│ │ │ │ +
22// headers will work with this warning level as well.
│ │ │ │ +
23#pragma warning (push,4)
│ │ │ │ +
24
│ │ │ │ +
25#pragma warning (disable: 4251)
│ │ │ │ +
26#pragma warning (disable: 4273)
│ │ │ │ +
27#pragma warning (disable: 4275)
│ │ │ │ +
28#pragma warning (disable: 4355)
│ │ │ │ +
29#pragma warning (disable: 4511) // Copy constructor could not be generated.
│ │ │ │ +
30#pragma warning (disable: 4512) // Assignment operator could not be generated.
│ │ │ │ +
31#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy().
│ │ │ │ +
32
│ │ │ │ +
33#endif // _MSC_VER
│ │ │ │ +
34#endif // _WIN32
│ │ │ │ +
35
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,172 +1,36 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -prepared_statement.hxx │ │ │ │ │ +compiler-internal-pre.hxx │ │ │ │ │ 1 │ │ │ │ │ - 11#ifndef PQXX_H_PREPARED_STATEMENT │ │ │ │ │ - 12#define PQXX_H_PREPARED_STATEMENT │ │ │ │ │ - 13 │ │ │ │ │ - 14#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 15#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 15// NO GUARDS HERE! This code should be executed every time! │ │ │ │ │ 16 │ │ │ │ │ - 17#include "pqxx/types.hxx" │ │ │ │ │ - 18#include "pqxx/internal/statement_parameters.hxx" │ │ │ │ │ + 17#ifdef _WIN32 │ │ │ │ │ + 18#ifdef _MSC_VER │ │ │ │ │ 19 │ │ │ │ │ - 20 │ │ │ │ │ - 21 │ │ │ │ │ - 22namespace pqxx │ │ │ │ │ - 23{ │ │ │ │ │ -25namespace prepare │ │ │ │ │ - 26{ │ │ │ │ │ - 28 │ │ │ │ │ - 43template inline pqxx::internal::dynamic_params │ │ │ │ │ -44make_dynamic_params(IT begin, IT end) │ │ │ │ │ - 45{ │ │ │ │ │ - 46 return pqxx::internal::dynamic_params(begin, end); │ │ │ │ │ - 47} │ │ │ │ │ - 48 │ │ │ │ │ - 49 │ │ │ │ │ - 51 │ │ │ │ │ - 65template │ │ │ │ │ - 66inline pqxx::internal::dynamic_params │ │ │ │ │ -67make_dynamic_params(const C &container) │ │ │ │ │ - 68{ │ │ │ │ │ - 69 return pqxx::internal::dynamic_params │ │ │ │ │ -(container); │ │ │ │ │ - 70} │ │ │ │ │ - 71} // namespace prepare │ │ │ │ │ - 72} // namespace pqxx │ │ │ │ │ - 73 │ │ │ │ │ - 74namespace pqxx │ │ │ │ │ - 75{ │ │ │ │ │ - 76namespace prepare │ │ │ │ │ - 77{ │ │ │ │ │ - 79 │ │ │ │ │ -81class PQXX_LIBEXPORT invocation : internal::statement_parameters │ │ │ │ │ - 82{ │ │ │ │ │ - 83public: │ │ │ │ │ - 84 PQXX_DEPRECATED invocation(transaction_base &, const std::string │ │ │ │ │ -&statement); │ │ │ │ │ -85 invocation &operator=(const invocation &) =delete; │ │ │ │ │ - 86 │ │ │ │ │ - 88 result exec() const; │ │ │ │ │ - 89 │ │ │ │ │ - 91 bool exists() const; │ │ │ │ │ - 92 │ │ │ │ │ -94 invocation &operator()() { add_param(); return *this; } │ │ │ │ │ - 95 │ │ │ │ │ - 97 │ │ │ │ │ -100 template invocation &operator()(const T &v) │ │ │ │ │ - 101 { add_param(v, true); return *this; } │ │ │ │ │ - 102 │ │ │ │ │ - 104 │ │ │ │ │ -107 invocation &operator()(const binarystring &v) │ │ │ │ │ - 108 { add_binary_param(v, true); return *this; } │ │ │ │ │ - 109 │ │ │ │ │ - 111 │ │ │ │ │ -115 template invocation &operator()(const T &v, bool nonnull) │ │ │ │ │ - 116 { add_param(v, nonnull); return *this; } │ │ │ │ │ - 117 │ │ │ │ │ - 119 │ │ │ │ │ -123 invocation &operator()(const binarystring &v, bool nonnull) │ │ │ │ │ - 124 { add_binary_param(v, nonnull); return *this; } │ │ │ │ │ - 125 │ │ │ │ │ - 127 │ │ │ │ │ -134 template invocation &operator()(T *v, bool nonnull=true) │ │ │ │ │ - 135 { add_param(v, nonnull); return *this; } │ │ │ │ │ - 136 │ │ │ │ │ - 138 │ │ │ │ │ -142 invocation &operator()(const char *v, bool nonnull=true) │ │ │ │ │ - 143 { add_param(v, nonnull); return *this; } │ │ │ │ │ - 144 │ │ │ │ │ - 145private: │ │ │ │ │ - 146 transaction_base &m_home; │ │ │ │ │ - 147 const std::string m_statement; │ │ │ │ │ - 148 │ │ │ │ │ - 149 invocation &setparam(const std::string &, bool nonnull); │ │ │ │ │ - 150}; │ │ │ │ │ - 151 │ │ │ │ │ - 152 │ │ │ │ │ -153namespace internal │ │ │ │ │ - 154{ │ │ │ │ │ -156struct PQXX_LIBEXPORT prepared_def │ │ │ │ │ - 157{ │ │ │ │ │ -159 std::string definition; │ │ │ │ │ -161 bool registered = false; │ │ │ │ │ - 162 │ │ │ │ │ -163 prepared_def() =default; │ │ │ │ │ - 164 explicit prepared_def(const std::string &); │ │ │ │ │ - 165}; │ │ │ │ │ - 166 │ │ │ │ │ - 167} // namespace pqxx::prepare::internal │ │ │ │ │ - 168} // namespace pqxx::prepare │ │ │ │ │ - 169} // namespace pqxx │ │ │ │ │ - 170 │ │ │ │ │ - 171#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 172#endif │ │ │ │ │ -pqxx │ │ │ │ │ -The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ -Definition: array.hxx:26 │ │ │ │ │ -pqxx::prepare::make_dynamic_params │ │ │ │ │ -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 │ │ │ │ │ -pqxx::binarystring │ │ │ │ │ -Binary data corresponding to PostgreSQL's "BYTEA" binary-string type. │ │ │ │ │ -Definition: binarystring.hxx:54 │ │ │ │ │ -pqxx::prepare::invocation │ │ │ │ │ -Helper class for passing parameters to, and executing, prepared statements. │ │ │ │ │ -Definition: prepared_statement.hxx:82 │ │ │ │ │ -pqxx::prepare::invocation::operator() │ │ │ │ │ -invocation & operator()(const binarystring &v, bool nonnull) │ │ │ │ │ -Pass binary parameter value for a BYTEA field. │ │ │ │ │ -Definition: prepared_statement.hxx:123 │ │ │ │ │ -pqxx::prepare::invocation::operator() │ │ │ │ │ -invocation & operator()(const binarystring &v) │ │ │ │ │ -Pass binary parameter value for a BYTEA field. │ │ │ │ │ -Definition: prepared_statement.hxx:107 │ │ │ │ │ -pqxx::prepare::invocation::operator() │ │ │ │ │ -invocation & operator()(T *v, bool nonnull=true) │ │ │ │ │ -Pass C-style parameter string, or null if pointer is null. │ │ │ │ │ -Definition: prepared_statement.hxx:134 │ │ │ │ │ -pqxx::prepare::invocation::operator= │ │ │ │ │ -invocation & operator=(const invocation &)=delete │ │ │ │ │ -pqxx::prepare::invocation::operator() │ │ │ │ │ -invocation & operator()(const char *v, bool nonnull=true) │ │ │ │ │ -Pass C-style string parameter, or null if pointer is null. │ │ │ │ │ -Definition: prepared_statement.hxx:142 │ │ │ │ │ -pqxx::prepare::invocation::operator() │ │ │ │ │ -invocation & operator()() │ │ │ │ │ -Pass null parameter. │ │ │ │ │ -Definition: prepared_statement.hxx:94 │ │ │ │ │ -pqxx::prepare::invocation::operator() │ │ │ │ │ -invocation & operator()(const T &v, bool nonnull) │ │ │ │ │ -Pass parameter value. │ │ │ │ │ -Definition: prepared_statement.hxx:115 │ │ │ │ │ -pqxx::prepare::invocation::operator() │ │ │ │ │ -invocation & operator()(const T &v) │ │ │ │ │ -Pass parameter value. │ │ │ │ │ -Definition: prepared_statement.hxx:100 │ │ │ │ │ -pqxx::prepare::internal::prepared_def │ │ │ │ │ -Internal representation of a prepared statement definition. │ │ │ │ │ -Definition: prepared_statement.hxx:157 │ │ │ │ │ -pqxx::prepare::internal::prepared_def::prepared_def │ │ │ │ │ -prepared_def()=default │ │ │ │ │ -pqxx::prepare::internal::prepared_def::definition │ │ │ │ │ -std::string definition │ │ │ │ │ -Text of prepared query. │ │ │ │ │ -Definition: prepared_statement.hxx:159 │ │ │ │ │ -pqxx::result │ │ │ │ │ -Result set containing data returned by a query or command. │ │ │ │ │ -Definition: result.hxx:70 │ │ │ │ │ -pqxx::transaction_base │ │ │ │ │ -Interface definition (and common code) for "transaction" classes. │ │ │ │ │ -Definition: transaction_base.hxx:138 │ │ │ │ │ + 20// Save client program warning state, and set warning level 4. │ │ │ │ │ + 21// Setting the warning level explicitly ensures that libpqxx │ │ │ │ │ + 22// headers will work with this warning level as well. │ │ │ │ │ + 23#pragma warning (push,4) │ │ │ │ │ + 24 │ │ │ │ │ + 25#pragma warning (disable: 4251) │ │ │ │ │ + 26#pragma warning (disable: 4273) │ │ │ │ │ + 27#pragma warning (disable: 4275) │ │ │ │ │ + 28#pragma warning (disable: 4355) │ │ │ │ │ + 29#pragma warning (disable: 4511) // Copy constructor could not be generated. │ │ │ │ │ + 30#pragma warning (disable: 4512) // Assignment operator could not be │ │ │ │ │ +generated. │ │ │ │ │ + 31#pragma warning (disable: 4996) // Deprecation warning, e.g. about strncpy │ │ │ │ │ +(). │ │ │ │ │ + 32 │ │ │ │ │ + 33#endif // _MSC_VER │ │ │ │ │ + 34#endif // _WIN32 │ │ │ │ │ + 35 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * prepared_statement.hxx │ │ │ │ │ + * compiler-internal-pre.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00113_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: tablereader.hxx Source File │ │ │ │ +libpqxx: largeobject.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,134 +55,537 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
tablereader.hxx
│ │ │ │ +
largeobject.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_TABLEREADER
│ │ │ │ -
14#define PQXX_H_TABLEREADER
│ │ │ │ +
13#ifndef PQXX_H_LARGEOBJECT
│ │ │ │ +
14#define PQXX_H_LARGEOBJECT
│ │ │ │
15
│ │ │ │
16#include "pqxx/compiler-public.hxx"
│ │ │ │
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18#include "pqxx/result.hxx"
│ │ │ │ -
19#include "pqxx/tablestream.hxx"
│ │ │ │ +
18
│ │ │ │ +
19#include <streambuf>
│ │ │ │
20
│ │ │ │ -
21
│ │ │ │ -
22namespace pqxx
│ │ │ │ -
23{
│ │ │ │ -
25
│ │ │ │ -
29class PQXX_LIBEXPORT tablereader : public tablestream
│ │ │ │ -
30{
│ │ │ │ -
31public:
│ │ │ │ -
32 PQXX_DEPRECATED tablereader(
│ │ │ │ - │ │ │ │ -
34 const std::string &Name,
│ │ │ │ -
35 const std::string &Null=std::string{});
│ │ │ │ -
36 template<typename ITER>
│ │ │ │ -
37 PQXX_DEPRECATED tablereader(
│ │ │ │ - │ │ │ │ -
39 const std::string &Name,
│ │ │ │ -
40 ITER begincolumns,
│ │ │ │ -
41 ITER endcolumns);
│ │ │ │ -
42 template<typename ITER>
│ │ │ │ -
43 PQXX_DEPRECATED tablereader(
│ │ │ │ - │ │ │ │ -
45 const std::string &Name,
│ │ │ │ -
46 ITER begincolumns,
│ │ │ │ -
47 ITER endcolumns,
│ │ │ │ -
48 const std::string &Null);
│ │ │ │ -
49 ~tablereader() noexcept;
│ │ │ │ -
50 template<typename TUPLE> tablereader &operator>>(TUPLE &);
│ │ │ │ -
51 operator bool() const noexcept { return not m_done; }
│ │ │ │ -
52 bool operator!() const noexcept { return m_done; }
│ │ │ │ -
53 bool get_raw_line(std::string &Line);
│ │ │ │ -
54 template<typename TUPLE>
│ │ │ │ -
55 void tokenize(std::string, TUPLE &) const;
│ │ │ │ -
56 virtual void complete() override;
│ │ │ │ -
57private:
│ │ │ │ -
58 void set_up(
│ │ │ │ - │ │ │ │ -
60 const std::string &RName,
│ │ │ │ -
61 const std::string &Columns=std::string{});
│ │ │ │ -
62 PQXX_PRIVATE void reader_close();
│ │ │ │ -
63 std::string extract_field(
│ │ │ │ -
64 const std::string &,
│ │ │ │ -
65 std::string::size_type &) const;
│ │ │ │ -
66 bool m_done;
│ │ │ │ -
67};
│ │ │ │ -
68
│ │ │ │ +
21#include "pqxx/dbtransaction.hxx"
│ │ │ │ +
22
│ │ │ │ +
23
│ │ │ │ +
24namespace pqxx
│ │ │ │ +
25{
│ │ │ │ +
27
│ │ │ │ +
34class PQXX_LIBEXPORT largeobject
│ │ │ │ +
35{
│ │ │ │ +
36public:
│ │ │ │ + │ │ │ │ +
38
│ │ │ │ +
40 largeobject() noexcept =default; //[t48]
│ │ │ │ +
41
│ │ │ │ +
43
│ │ │ │ +
45 explicit largeobject(dbtransaction &T); //[t48]
│ │ │ │ +
46
│ │ │ │ +
48
│ │ │ │ +
52 explicit largeobject(oid O) noexcept : m_id{O} {} //[t48]
│ │ │ │ +
53
│ │ │ │ +
55
│ │ │ │ +
59 largeobject(dbtransaction &T, const std::string &File); //[t53]
│ │ │ │ +
60
│ │ │ │ +
62
│ │ │ │ +
66 largeobject(const largeobjectaccess &O) noexcept; //[t50]
│ │ │ │ +
67
│ │ │ │
69
│ │ │ │ -
70template<typename ITER> inline
│ │ │ │ - │ │ │ │ - │ │ │ │ -
73 const std::string &Name,
│ │ │ │ -
74 ITER begincolumns,
│ │ │ │ -
75 ITER endcolumns) :
│ │ │ │ -
76 namedclass{Name, "tablereader"},
│ │ │ │ -
77 tablestream{T, std::string{}},
│ │ │ │ -
78 m_done{true}
│ │ │ │ -
79{
│ │ │ │ -
80 set_up(T, Name, columnlist(begincolumns, endcolumns));
│ │ │ │ -
81}
│ │ │ │ -
82
│ │ │ │ -
83
│ │ │ │ -
84template<typename ITER> inline
│ │ │ │ - │ │ │ │ - │ │ │ │ -
87 const std::string &Name,
│ │ │ │ -
88 ITER begincolumns,
│ │ │ │ -
89 ITER endcolumns,
│ │ │ │ -
90 const std::string &Null) :
│ │ │ │ -
91 namedclass{Name, "tablereader"},
│ │ │ │ -
92 tablestream{T, Null},
│ │ │ │ -
93 m_done{true}
│ │ │ │ -
94{
│ │ │ │ -
95 set_up(T, Name, columnlist(begincolumns, endcolumns));
│ │ │ │ -
96}
│ │ │ │ -
97
│ │ │ │ -
98
│ │ │ │ -
99template<typename TUPLE>
│ │ │ │ -
100inline void tablereader::tokenize(std::string Line, TUPLE &T) const
│ │ │ │ -
101{
│ │ │ │ -
102 std::back_insert_iterator<TUPLE> ins = std::back_inserter(T);
│ │ │ │ -
103 std::string::size_type here = 0;
│ │ │ │ -
104 while (here < Line.size()) *ins++ = extract_field(Line, here);
│ │ │ │ -
105}
│ │ │ │ -
106
│ │ │ │ -
107
│ │ │ │ -
108template<typename TUPLE>
│ │ │ │ - │ │ │ │ -
110{
│ │ │ │ -
111 std::string Line;
│ │ │ │ -
112 if (get_raw_line(Line)) tokenize(Line, T);
│ │ │ │ -
113 return *this;
│ │ │ │ -
114}
│ │ │ │ -
115} // namespace pqxx
│ │ │ │ -
116
│ │ │ │ -
117#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
118#endif
│ │ │ │ +
73 oid id() const noexcept { return m_id; } //[t48]
│ │ │ │ +
74
│ │ │ │ +
84
│ │ │ │ +
85 bool operator==(const largeobject &other) const //[t51]
│ │ │ │ +
86 { return m_id == other.m_id; }
│ │ │ │ +
88
│ │ │ │ +
89 bool operator!=(const largeobject &other) const //[t51]
│ │ │ │ +
90 { return m_id != other.m_id; }
│ │ │ │ +
92
│ │ │ │ +
93 bool operator<=(const largeobject &other) const //[t51]
│ │ │ │ +
94 { return m_id <= other.m_id; }
│ │ │ │ +
96
│ │ │ │ +
97 bool operator>=(const largeobject &other) const //[t51]
│ │ │ │ +
98 { return m_id >= other.m_id; }
│ │ │ │ +
100
│ │ │ │ +
101 bool operator<(const largeobject &other) const //[t51]
│ │ │ │ +
102 { return m_id < other.m_id; }
│ │ │ │ +
104
│ │ │ │ +
105 bool operator>(const largeobject &other) const //[t51]
│ │ │ │ +
106 { return m_id > other.m_id; }
│ │ │ │ +
108
│ │ │ │ +
110
│ │ │ │ +
114 void to_file(dbtransaction &T, const std::string &File) const; //[t52]
│ │ │ │ +
115
│ │ │ │ +
117
│ │ │ │ +
121 void remove(dbtransaction &T) const; //[t48]
│ │ │ │ +
122
│ │ │ │ +
123protected:
│ │ │ │ +
124 PQXX_PURE static internal::pq::PGconn *raw_connection(
│ │ │ │ +
125 const dbtransaction &T);
│ │ │ │ +
126
│ │ │ │ +
127 PQXX_PRIVATE std::string reason(const connection_base &, int err) const;
│ │ │ │ +
128
│ │ │ │ +
129private:
│ │ │ │ +
130 oid m_id = oid_none;
│ │ │ │ +
131};
│ │ │ │ +
132
│ │ │ │ +
133
│ │ │ │ +
134// TODO: New hierarchy with separate read / write / mixed-mode access
│ │ │ │ +
135
│ │ │ │ +
137class PQXX_LIBEXPORT largeobjectaccess : private largeobject
│ │ │ │ +
138{
│ │ │ │ +
139public:
│ │ │ │ + │ │ │ │ +
141 using off_type = long;
│ │ │ │ + │ │ │ │ +
143
│ │ │ │ +
145
│ │ │ │ +
149 using openmode = std::ios::openmode;
│ │ │ │ +
150
│ │ │ │ +
152
│ │ │ │ +
156 using seekdir = std::ios::seekdir;
│ │ │ │ +
157
│ │ │ │ +
159
│ │ │ │ +
163 explicit largeobjectaccess( //[t51]
│ │ │ │ +
164 dbtransaction &T,
│ │ │ │ +
165 openmode mode=std::ios::in|std::ios::out);
│ │ │ │ +
166
│ │ │ │ +
168
│ │ │ │ +
174 largeobjectaccess( //[t52]
│ │ │ │ +
175 dbtransaction &T,
│ │ │ │ +
176 oid O,
│ │ │ │ +
177 openmode mode=std::ios::in|std::ios::out);
│ │ │ │ +
178
│ │ │ │ +
180
│ │ │ │ +
185 largeobjectaccess( //[t50]
│ │ │ │ +
186 dbtransaction &T,
│ │ │ │ +
187 largeobject O,
│ │ │ │ +
188 openmode mode=std::ios::in|std::ios::out);
│ │ │ │ +
189
│ │ │ │ +
191
│ │ │ │ +
196 largeobjectaccess( //[t55]
│ │ │ │ +
197 dbtransaction &T,
│ │ │ │ +
198 const std::string &File,
│ │ │ │ +
199 openmode mode=std::ios::in|std::ios::out);
│ │ │ │ +
200
│ │ │ │ +
201 ~largeobjectaccess() noexcept { close(); }
│ │ │ │ +
202
│ │ │ │ +
204
│ │ │ │ +
207 using largeobject::id;
│ │ │ │ +
208
│ │ │ │ +
210
│ │ │ │ +
213 void to_file(const std::string &File) const //[t54]
│ │ │ │ +
214 { largeobject::to_file(m_trans, File); }
│ │ │ │ +
215
│ │ │ │ + │ │ │ │ +
217
│ │ │ │ +
223
│ │ │ │ +
227 void write(const char Buf[], size_type Len); //[t51]
│ │ │ │ +
228
│ │ │ │ +
230
│ │ │ │ +
233 void write(const std::string &Buf) //[t50]
│ │ │ │ +
234 { write(Buf.c_str(), static_cast<size_type>(Buf.size())); }
│ │ │ │ +
235
│ │ │ │ +
237
│ │ │ │ +
243 size_type read(char Buf[], size_type Len); //[t50]
│ │ │ │ +
244
│ │ │ │ +
246
│ │ │ │ +
249 size_type seek(size_type dest, seekdir dir); //[t51]
│ │ │ │ +
250
│ │ │ │ +
252
│ │ │ │ +
255 size_type tell() const; //[t50]
│ │ │ │ +
257
│ │ │ │ +
268
│ │ │ │ +
276 pos_type cseek(off_type dest, seekdir dir) noexcept; //[t50]
│ │ │ │ +
277
│ │ │ │ +
279
│ │ │ │ +
285 off_type cwrite(const char Buf[], size_type Len) noexcept; //[t50]
│ │ │ │ +
286
│ │ │ │ +
288
│ │ │ │ +
294 off_type cread(char Buf[], size_type Len) noexcept; //[t50]
│ │ │ │ +
295
│ │ │ │ +
297
│ │ │ │ +
301 pos_type ctell() const noexcept; //[t50]
│ │ │ │ +
303
│ │ │ │ +
309 void process_notice(const std::string &) noexcept; //[t50]
│ │ │ │ +
311
│ │ │ │ +
312 using largeobject::remove;
│ │ │ │ +
313
│ │ │ │ +
314 using largeobject::operator==;
│ │ │ │ +
315 using largeobject::operator!=;
│ │ │ │ +
316 using largeobject::operator<;
│ │ │ │ +
317 using largeobject::operator<=;
│ │ │ │ +
318 using largeobject::operator>;
│ │ │ │ +
319 using largeobject::operator>=;
│ │ │ │ +
320
│ │ │ │ +
321private:
│ │ │ │ +
322 PQXX_PRIVATE std::string reason(int err) const;
│ │ │ │ +
323 internal::pq::PGconn *raw_connection() const
│ │ │ │ +
324 { return largeobject::raw_connection(m_trans); }
│ │ │ │ +
325
│ │ │ │ +
326 PQXX_PRIVATE void open(openmode mode);
│ │ │ │ +
327 void close() noexcept;
│ │ │ │ +
328
│ │ │ │ +
329 dbtransaction &m_trans;
│ │ │ │ +
330 int m_fd = -1;
│ │ │ │ +
331
│ │ │ │ +
332 largeobjectaccess() =delete;
│ │ │ │ +
333 largeobjectaccess(const largeobjectaccess &) =delete;
│ │ │ │ +
334 largeobjectaccess operator=(const largeobjectaccess &) =delete;
│ │ │ │ +
335};
│ │ │ │ +
336
│ │ │ │ +
337
│ │ │ │ +
339
│ │ │ │ +
347template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ + │ │ │ │ +
349 public std::basic_streambuf<CHAR, TRAITS>
│ │ │ │ +
350{
│ │ │ │ +
351 using size_type = long;
│ │ │ │ +
352public:
│ │ │ │ +
353 using char_type = CHAR;
│ │ │ │ +
354 using traits_type = TRAITS;
│ │ │ │ +
355 using int_type = typename traits_type::int_type;
│ │ │ │ +
356 using pos_type = typename traits_type::pos_type;
│ │ │ │ +
357 using off_type = typename traits_type::off_type;
│ │ │ │ + │ │ │ │ + │ │ │ │ +
360
│ │ │ │ + │ │ │ │ +
362 dbtransaction &T,
│ │ │ │ +
363 largeobject O,
│ │ │ │ +
364 openmode mode=std::ios::in|std::ios::out,
│ │ │ │ +
365 size_type BufSize=512) :
│ │ │ │ +
366 m_bufsize{BufSize},
│ │ │ │ +
367 m_obj{T, O, mode},
│ │ │ │ +
368 m_g{nullptr},
│ │ │ │ +
369 m_p{nullptr}
│ │ │ │ +
370 { initialize(mode); }
│ │ │ │ +
371
│ │ │ │ + │ │ │ │ +
373 dbtransaction &T,
│ │ │ │ +
374 oid O,
│ │ │ │ +
375 openmode mode=std::ios::in|std::ios::out,
│ │ │ │ +
376 size_type BufSize=512) :
│ │ │ │ +
377 m_bufsize{BufSize},
│ │ │ │ +
378 m_obj{T, O, mode},
│ │ │ │ +
379 m_g{nullptr},
│ │ │ │ +
380 m_p{nullptr}
│ │ │ │ +
381 { initialize(mode); }
│ │ │ │ +
382
│ │ │ │ +
383 virtual ~largeobject_streambuf() noexcept
│ │ │ │ +
384 { delete [] m_p; delete [] m_g; }
│ │ │ │ +
385
│ │ │ │ +
386
│ │ │ │ +
388 void process_notice(const std::string &s) { m_obj.process_notice(s); }
│ │ │ │ +
389
│ │ │ │ +
390protected:
│ │ │ │ +
391 virtual int sync() override
│ │ │ │ +
392 {
│ │ │ │ +
393 // setg() sets eback, gptr, egptr
│ │ │ │ +
394 this->setg(this->eback(), this->eback(), this->egptr());
│ │ │ │ +
395 return overflow(EoF());
│ │ │ │ +
396 }
│ │ │ │ +
397
│ │ │ │ + │ │ │ │ +
399 off_type offset,
│ │ │ │ +
400 seekdir dir,
│ │ │ │ +
401 openmode)
│ │ │ │ +
402 override
│ │ │ │ +
403 {
│ │ │ │ +
404 return AdjustEOF(m_obj.cseek(largeobjectaccess::off_type(offset), dir));
│ │ │ │ +
405 }
│ │ │ │ +
406
│ │ │ │ +
407 virtual pos_type seekpos(pos_type pos, openmode) override
│ │ │ │ +
408 {
│ │ │ │ +
409 const largeobjectaccess::pos_type newpos = m_obj.cseek(
│ │ │ │ + │ │ │ │ +
411 std::ios::beg);
│ │ │ │ +
412 return AdjustEOF(newpos);
│ │ │ │ +
413 }
│ │ │ │ +
414
│ │ │ │ +
415 virtual int_type overflow(int_type ch = EoF()) override
│ │ │ │ +
416 {
│ │ │ │ +
417 char *const pp = this->pptr();
│ │ │ │ +
418 if (pp == nullptr) return EoF();
│ │ │ │ +
419 char *const pb = this->pbase();
│ │ │ │ +
420 int_type res = 0;
│ │ │ │ +
421
│ │ │ │ +
422 if (pp > pb) res = int_type(AdjustEOF(m_obj.cwrite(pb, pp-pb)));
│ │ │ │ +
423 this->setp(m_p, m_p + m_bufsize);
│ │ │ │ +
424
│ │ │ │ +
425 // Write that one more character, if it's there.
│ │ │ │ +
426 if (ch != EoF())
│ │ │ │ +
427 {
│ │ │ │ +
428 *this->pptr() = char(ch);
│ │ │ │ +
429 this->pbump(1);
│ │ │ │ +
430 }
│ │ │ │ +
431 return res;
│ │ │ │ +
432 }
│ │ │ │ +
433
│ │ │ │ +
434 virtual int_type underflow() override
│ │ │ │ +
435 {
│ │ │ │ +
436 if (this->gptr() == nullptr) return EoF();
│ │ │ │ +
437 char *const eb = this->eback();
│ │ │ │ +
438 const int_type res(static_cast<int_type>(
│ │ │ │ +
439 AdjustEOF(m_obj.cread(this->eback(), m_bufsize))));
│ │ │ │ +
440 this->setg(eb, eb, eb + ((res==EoF()) ? 0 : res));
│ │ │ │ +
441 return ((res == 0) or (res == EoF())) ? EoF() : *eb;
│ │ │ │ +
442 }
│ │ │ │ +
443
│ │ │ │ +
444private:
│ │ │ │ +
446 static int_type EoF() { return traits_type::eof(); }
│ │ │ │ +
447
│ │ │ │ +
449 template<typename INTYPE>
│ │ │ │ +
450 static std::streampos AdjustEOF(INTYPE pos)
│ │ │ │ +
451 { return (pos==-1) ? std::streampos(EoF()) : std::streampos(pos); }
│ │ │ │ +
452
│ │ │ │ +
453 void initialize(openmode mode)
│ │ │ │ +
454 {
│ │ │ │ +
455 if (mode & std::ios::in)
│ │ │ │ +
456 {
│ │ │ │ +
457 m_g = new char_type[unsigned(m_bufsize)];
│ │ │ │ +
458 this->setg(m_g, m_g, m_g);
│ │ │ │ +
459 }
│ │ │ │ +
460 if (mode & std::ios::out)
│ │ │ │ +
461 {
│ │ │ │ +
462 m_p = new char_type[unsigned(m_bufsize)];
│ │ │ │ +
463 this->setp(m_p, m_p + m_bufsize);
│ │ │ │ +
464 }
│ │ │ │ +
465 }
│ │ │ │ +
466
│ │ │ │ +
467 const size_type m_bufsize;
│ │ │ │ +
468 largeobjectaccess m_obj;
│ │ │ │ +
469
│ │ │ │ +
471 char_type *m_g, *m_p;
│ │ │ │ +
472};
│ │ │ │ +
473
│ │ │ │ +
474
│ │ │ │ +
476
│ │ │ │ +
484template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ + │ │ │ │ +
486 public std::basic_istream<CHAR, TRAITS>
│ │ │ │ +
487{
│ │ │ │ +
488 using super = std::basic_istream<CHAR, TRAITS>;
│ │ │ │ +
489
│ │ │ │ +
490public:
│ │ │ │ +
491 using char_type = CHAR;
│ │ │ │ +
492 using traits_type = TRAITS;
│ │ │ │ +
493 using int_type = typename traits_type::int_type;
│ │ │ │ +
494 using pos_type = typename traits_type::pos_type;
│ │ │ │ +
495 using off_type = typename traits_type::off_type;
│ │ │ │ +
496
│ │ │ │ +
498
│ │ │ │ + │ │ │ │ +
504 dbtransaction &T,
│ │ │ │ +
505 largeobject O,
│ │ │ │ +
506 largeobject::size_type BufSize=512) :
│ │ │ │ +
507 super{nullptr},
│ │ │ │ +
508 m_buf{T, O, std::ios::in, BufSize}
│ │ │ │ +
509 { super::init(&m_buf); }
│ │ │ │ +
510
│ │ │ │ +
512
│ │ │ │ + │ │ │ │ +
518 dbtransaction &T,
│ │ │ │ +
519 oid O,
│ │ │ │ +
520 largeobject::size_type BufSize=512) :
│ │ │ │ +
521 super{nullptr},
│ │ │ │ +
522 m_buf{T, O, std::ios::in, BufSize}
│ │ │ │ +
523 { super::init(&m_buf); }
│ │ │ │ +
524
│ │ │ │ +
525private:
│ │ │ │ + │ │ │ │ +
527};
│ │ │ │ +
528
│ │ │ │ + │ │ │ │ +
530
│ │ │ │ +
531
│ │ │ │ +
533
│ │ │ │ +
541template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ + │ │ │ │ +
543 public std::basic_ostream<CHAR, TRAITS>
│ │ │ │ +
544{
│ │ │ │ +
545 using super = std::basic_ostream<CHAR, TRAITS>;
│ │ │ │ +
546public:
│ │ │ │ +
547 using char_type = CHAR;
│ │ │ │ +
548 using traits_type = TRAITS;
│ │ │ │ +
549 using int_type = typename traits_type::int_type;
│ │ │ │ +
550 using pos_type = typename traits_type::pos_type;
│ │ │ │ +
551 using off_type = typename traits_type::off_type;
│ │ │ │ +
552
│ │ │ │ +
554
│ │ │ │ + │ │ │ │ +
560 dbtransaction &T,
│ │ │ │ +
561 largeobject O,
│ │ │ │ +
562 largeobject::size_type BufSize=512) :
│ │ │ │ +
563 super{nullptr},
│ │ │ │ +
564 m_buf{T, O, std::ios::out, BufSize}
│ │ │ │ +
565 { super::init(&m_buf); }
│ │ │ │ +
566
│ │ │ │ +
568
│ │ │ │ + │ │ │ │ +
574 dbtransaction &T,
│ │ │ │ +
575 oid O,
│ │ │ │ +
576 largeobject::size_type BufSize=512) :
│ │ │ │ +
577 super{nullptr},
│ │ │ │ +
578 m_buf{T, O, std::ios::out, BufSize}
│ │ │ │ +
579 { super::init(&m_buf); }
│ │ │ │ +
580
│ │ │ │ + │ │ │ │ +
582 {
│ │ │ │ +
583 try
│ │ │ │ +
584 {
│ │ │ │ +
585 m_buf.pubsync(); m_buf.pubsync();
│ │ │ │ +
586 }
│ │ │ │ +
587 catch (const std::exception &e)
│ │ │ │ +
588 {
│ │ │ │ +
589 m_buf.process_notice(e.what());
│ │ │ │ +
590 }
│ │ │ │ +
591 }
│ │ │ │ +
592
│ │ │ │ +
593private:
│ │ │ │ + │ │ │ │ +
595};
│ │ │ │ +
596
│ │ │ │ + │ │ │ │ +
598
│ │ │ │ +
599
│ │ │ │ +
601
│ │ │ │ +
609template<typename CHAR=char, typename TRAITS=std::char_traits<CHAR>>
│ │ │ │ + │ │ │ │ +
611 public std::basic_iostream<CHAR, TRAITS>
│ │ │ │ +
612{
│ │ │ │ +
613 using super = std::basic_iostream<CHAR, TRAITS>;
│ │ │ │ +
614
│ │ │ │ +
615public:
│ │ │ │ +
616 using char_type = CHAR;
│ │ │ │ +
617 using traits_type = TRAITS;
│ │ │ │ +
618 using int_type = typename traits_type::int_type;
│ │ │ │ +
619 using pos_type = typename traits_type::pos_type;
│ │ │ │ +
620 using off_type = typename traits_type::off_type;
│ │ │ │ +
621
│ │ │ │ +
623
│ │ │ │ + │ │ │ │ +
629 dbtransaction &T,
│ │ │ │ +
630 largeobject O,
│ │ │ │ +
631 largeobject::size_type BufSize=512) :
│ │ │ │ +
632 super{nullptr},
│ │ │ │ +
633 m_buf{T, O, std::ios::in | std::ios::out, BufSize}
│ │ │ │ +
634 { super::init(&m_buf); }
│ │ │ │ +
635
│ │ │ │ +
637
│ │ │ │ + │ │ │ │ +
643 dbtransaction &T,
│ │ │ │ +
644 oid O,
│ │ │ │ +
645 largeobject::size_type BufSize=512) :
│ │ │ │ +
646 super{nullptr},
│ │ │ │ +
647 m_buf{T, O, std::ios::in | std::ios::out, BufSize}
│ │ │ │ +
648 { super::init(&m_buf); }
│ │ │ │ +
649
│ │ │ │ + │ │ │ │ +
651 {
│ │ │ │ +
652 try
│ │ │ │ +
653 {
│ │ │ │ +
654 m_buf.pubsync(); m_buf.pubsync();
│ │ │ │ +
655 }
│ │ │ │ +
656 catch (const std::exception &e)
│ │ │ │ +
657 {
│ │ │ │ +
658 m_buf.process_notice(e.what());
│ │ │ │ +
659 }
│ │ │ │ +
660 }
│ │ │ │ +
661
│ │ │ │ +
662private:
│ │ │ │ + │ │ │ │ +
664};
│ │ │ │ +
665
│ │ │ │ + │ │ │ │ +
667
│ │ │ │ +
668} // namespace pqxx
│ │ │ │ +
669
│ │ │ │ +
670#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
671
│ │ │ │ +
672#endif
│ │ │ │
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
Definition: tablereader.hxx:30
│ │ │ │ -
void tokenize(std::string, TUPLE &) const
Definition: tablereader.hxx:100
│ │ │ │ -
tablereader(transaction_base &, const std::string &Name, const std::string &Null=std::string{})
Definition: tablereader.cxx:21
│ │ │ │ -
bool operator!() const noexcept
Definition: tablereader.hxx:52
│ │ │ │ -
tablereader & operator>>(TUPLE &)
Definition: tablereader.hxx:109
│ │ │ │ -
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
│ │ │ │ -
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
│ │ │ │ -
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │ +
long large_object_size_type
Number of bytes in a large object. (Unusual: it's signed.)
Definition: types.hxx:33
│ │ │ │ +
constexpr oid oid_none
The "null" oid.
Definition: util.hxx:77
│ │ │ │ +
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ +
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ +
Identity of a large object.
Definition: largeobject.hxx:35
│ │ │ │ +
static PQXX_PURE internal::pq::PGconn * raw_connection(const dbtransaction &T)
Definition: largeobject.cxx:134
│ │ │ │ +
large_object_size_type size_type
Definition: largeobject.hxx:37
│ │ │ │ +
bool operator<(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:101
│ │ │ │ +
bool operator==(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:85
│ │ │ │ +
void to_file(dbtransaction &T, const std::string &File) const
Export large object's contents to a local file.
Definition: largeobject.cxx:106
│ │ │ │ +
bool operator>(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:105
│ │ │ │ +
bool operator<=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:93
│ │ │ │ +
largeobject() noexcept=default
Refer to a nonexistent large object (similar to what a null pointer does)
│ │ │ │ +
bool operator!=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:89
│ │ │ │ +
bool operator>=(const largeobject &other) const
Compare object identities.
Definition: largeobject.hxx:97
│ │ │ │ +
oid id() const noexcept
Object identifier.
Definition: largeobject.hxx:73
│ │ │ │ +
Accessor for large object's contents.
Definition: largeobject.hxx:138
│ │ │ │ +
size_type pos_type
Definition: largeobject.hxx:142
│ │ │ │ +
std::ios::openmode openmode
Open mode: in, out (can be combined with the "or" operator)
Definition: largeobject.hxx:149
│ │ │ │ +
std::ios::seekdir seekdir
Seek direction: beg, cur, end.
Definition: largeobject.hxx:156
│ │ │ │ +
void write(const std::string &Buf)
Write string to large object.
Definition: largeobject.hxx:233
│ │ │ │ +
long off_type
Definition: largeobject.hxx:141
│ │ │ │ +
~largeobjectaccess() noexcept
Definition: largeobject.hxx:201
│ │ │ │ +
void to_file(const std::string &File) const
Export large object's contents to a local file.
Definition: largeobject.hxx:213
│ │ │ │ +
Streambuf to use large objects in standard I/O streams.
Definition: largeobject.hxx:350
│ │ │ │ +
virtual pos_type seekoff(off_type offset, seekdir dir, openmode) override
Definition: largeobject.hxx:398
│ │ │ │ +
TRAITS traits_type
Definition: largeobject.hxx:354
│ │ │ │ +
typename traits_type::int_type int_type
Definition: largeobject.hxx:355
│ │ │ │ +
virtual pos_type seekpos(pos_type pos, openmode) override
Definition: largeobject.hxx:407
│ │ │ │ +
void process_notice(const std::string &s)
For use by large object stream classes.
Definition: largeobject.hxx:388
│ │ │ │ +
CHAR char_type
Definition: largeobject.hxx:353
│ │ │ │ +
typename traits_type::off_type off_type
Definition: largeobject.hxx:357
│ │ │ │ +
largeobject_streambuf(dbtransaction &T, largeobject O, openmode mode=std::ios::in|std::ios::out, size_type BufSize=512)
Definition: largeobject.hxx:361
│ │ │ │ +
largeobject_streambuf(dbtransaction &T, oid O, openmode mode=std::ios::in|std::ios::out, size_type BufSize=512)
Definition: largeobject.hxx:372
│ │ │ │ +
virtual ~largeobject_streambuf() noexcept
Definition: largeobject.hxx:383
│ │ │ │ +
virtual int sync() override
Definition: largeobject.hxx:391
│ │ │ │ +
largeobjectaccess::seekdir seekdir
Definition: largeobject.hxx:359
│ │ │ │ +
virtual int_type underflow() override
Definition: largeobject.hxx:434
│ │ │ │ +
virtual int_type overflow(int_type ch=EoF()) override
Definition: largeobject.hxx:415
│ │ │ │ +
largeobjectaccess::openmode openmode
Definition: largeobject.hxx:358
│ │ │ │ +
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:356
│ │ │ │ +
Input stream that gets its data from a large object.
Definition: largeobject.hxx:487
│ │ │ │ +
CHAR char_type
Definition: largeobject.hxx:491
│ │ │ │ +
basic_ilostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_ilostream.
Definition: largeobject.hxx:503
│ │ │ │ +
typename traits_type::int_type int_type
Definition: largeobject.hxx:493
│ │ │ │ +
TRAITS traits_type
Definition: largeobject.hxx:492
│ │ │ │ +
typename traits_type::off_type off_type
Definition: largeobject.hxx:495
│ │ │ │ +
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:494
│ │ │ │ +
basic_ilostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_ilostream.
Definition: largeobject.hxx:517
│ │ │ │ +
Output stream that writes data back to a large object.
Definition: largeobject.hxx:544
│ │ │ │ +
typename traits_type::off_type off_type
Definition: largeobject.hxx:551
│ │ │ │ +
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:550
│ │ │ │ +
typename traits_type::int_type int_type
Definition: largeobject.hxx:549
│ │ │ │ +
~basic_olostream()
Definition: largeobject.hxx:581
│ │ │ │ +
basic_olostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_olostream.
Definition: largeobject.hxx:559
│ │ │ │ +
CHAR char_type
Definition: largeobject.hxx:547
│ │ │ │ +
TRAITS traits_type
Definition: largeobject.hxx:548
│ │ │ │ +
basic_olostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_olostream.
Definition: largeobject.hxx:573
│ │ │ │ +
Stream that reads and writes a large object.
Definition: largeobject.hxx:612
│ │ │ │ +
typename traits_type::pos_type pos_type
Definition: largeobject.hxx:619
│ │ │ │ +
~basic_lostream()
Definition: largeobject.hxx:650
│ │ │ │ +
basic_lostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512)
Create a basic_lostream.
Definition: largeobject.hxx:642
│ │ │ │ +
typename traits_type::int_type int_type
Definition: largeobject.hxx:618
│ │ │ │ +
basic_lostream(dbtransaction &T, largeobject O, largeobject::size_type BufSize=512)
Create a basic_lostream.
Definition: largeobject.hxx:628
│ │ │ │ +
typename traits_type::off_type off_type
Definition: largeobject.hxx:620
│ │ │ │ +
TRAITS traits_type
Definition: largeobject.hxx:617
│ │ │ │ +
CHAR char_type
Definition: largeobject.hxx:616
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,144 +1,691 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -tablereader.hxx │ │ │ │ │ +largeobject.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_TABLEREADER │ │ │ │ │ - 14#define PQXX_H_TABLEREADER │ │ │ │ │ + 13#ifndef PQXX_H_LARGEOBJECT │ │ │ │ │ + 14#define PQXX_H_LARGEOBJECT │ │ │ │ │ 15 │ │ │ │ │ 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18#include "pqxx/result.hxx" │ │ │ │ │ - 19#include "pqxx/tablestream.hxx" │ │ │ │ │ + 18 │ │ │ │ │ + 19#include │ │ │ │ │ 20 │ │ │ │ │ - 21 │ │ │ │ │ - 22namespace pqxx │ │ │ │ │ - 23{ │ │ │ │ │ - 25 │ │ │ │ │ -29class PQXX_LIBEXPORT tablereader : public tablestream │ │ │ │ │ - 30{ │ │ │ │ │ - 31public: │ │ │ │ │ - 32 PQXX_DEPRECATED tablereader( │ │ │ │ │ - 33 transaction_base &, │ │ │ │ │ - 34 const std::string &Name, │ │ │ │ │ - 35 const std::string &Null=std::string{}); │ │ │ │ │ - 36 template │ │ │ │ │ - 37 PQXX_DEPRECATED tablereader( │ │ │ │ │ - 38 transaction_base &, │ │ │ │ │ - 39 const std::string &Name, │ │ │ │ │ - 40 ITER begincolumns, │ │ │ │ │ - 41 ITER endcolumns); │ │ │ │ │ - 42 template │ │ │ │ │ - 43 PQXX_DEPRECATED tablereader( │ │ │ │ │ - 44 transaction_base &, │ │ │ │ │ - 45 const std::string &Name, │ │ │ │ │ - 46 ITER begincolumns, │ │ │ │ │ - 47 ITER endcolumns, │ │ │ │ │ - 48 const std::string &Null); │ │ │ │ │ - 49 ~tablereader() noexcept; │ │ │ │ │ - 50 template tablereader &operator>>(TUPLE &); │ │ │ │ │ -51 operator bool() const noexcept { return not m_done; } │ │ │ │ │ -52 bool operator!() const noexcept { return m_done; } │ │ │ │ │ - 53 bool get_raw_line(std::string &Line); │ │ │ │ │ - 54 template │ │ │ │ │ - 55 void tokenize(std::string, TUPLE &) const; │ │ │ │ │ - 56 virtual void complete() override; │ │ │ │ │ - 57private: │ │ │ │ │ - 58 void set_up( │ │ │ │ │ - 59 transaction_base &T, │ │ │ │ │ - 60 const std::string &RName, │ │ │ │ │ - 61 const std::string &Columns=std::string{}); │ │ │ │ │ - 62 PQXX_PRIVATE void reader_close(); │ │ │ │ │ - 63 std::string extract_field( │ │ │ │ │ - 64 const std::string &, │ │ │ │ │ - 65 std::string::size_type &) const; │ │ │ │ │ - 66 bool m_done; │ │ │ │ │ - 67}; │ │ │ │ │ - 68 │ │ │ │ │ + 21#include "pqxx/dbtransaction.hxx" │ │ │ │ │ + 22 │ │ │ │ │ + 23 │ │ │ │ │ + 24namespace pqxx │ │ │ │ │ + 25{ │ │ │ │ │ + 27 │ │ │ │ │ +34class PQXX_LIBEXPORT largeobject │ │ │ │ │ + 35{ │ │ │ │ │ + 36public: │ │ │ │ │ +37 using size_type = large_object_size_type; │ │ │ │ │ + 38 │ │ │ │ │ +40 largeobject() noexcept =default; //[t48] │ │ │ │ │ + 41 │ │ │ │ │ + 43 │ │ │ │ │ + 45 explicit largeobject(dbtransaction &T); //[t48] │ │ │ │ │ + 46 │ │ │ │ │ + 48 │ │ │ │ │ +52 explicit largeobject(oid O) noexcept : m_id{O} {} //[t48] │ │ │ │ │ + 53 │ │ │ │ │ + 55 │ │ │ │ │ + 59 largeobject(dbtransaction &T, const std::string &File); //[t53] │ │ │ │ │ + 60 │ │ │ │ │ + 62 │ │ │ │ │ + 66 largeobject(const largeobjectaccess &O) noexcept; //[t50] │ │ │ │ │ + 67 │ │ │ │ │ 69 │ │ │ │ │ - 70template inline │ │ │ │ │ -71tablereader::tablereader( │ │ │ │ │ - 72 transaction_base &T, │ │ │ │ │ - 73 const std::string &Name, │ │ │ │ │ - 74 ITER begincolumns, │ │ │ │ │ - 75 ITER endcolumns) : │ │ │ │ │ - 76 namedclass{Name, "tablereader"}, │ │ │ │ │ - 77 tablestream{T, std::string{}}, │ │ │ │ │ - 78 m_done{true} │ │ │ │ │ - 79{ │ │ │ │ │ - 80 set_up(T, Name, columnlist(begincolumns, endcolumns)); │ │ │ │ │ - 81} │ │ │ │ │ - 82 │ │ │ │ │ - 83 │ │ │ │ │ - 84template inline │ │ │ │ │ -85tablereader::tablereader( │ │ │ │ │ - 86 transaction_base &T, │ │ │ │ │ - 87 const std::string &Name, │ │ │ │ │ - 88 ITER begincolumns, │ │ │ │ │ - 89 ITER endcolumns, │ │ │ │ │ - 90 const std::string &Null) : │ │ │ │ │ - 91 namedclass{Name, "tablereader"}, │ │ │ │ │ - 92 tablestream{T, Null}, │ │ │ │ │ - 93 m_done{true} │ │ │ │ │ - 94{ │ │ │ │ │ - 95 set_up(T, Name, columnlist(begincolumns, endcolumns)); │ │ │ │ │ - 96} │ │ │ │ │ - 97 │ │ │ │ │ - 98 │ │ │ │ │ - 99template │ │ │ │ │ -100inline void tablereader::tokenize(std::string Line, TUPLE &T) const │ │ │ │ │ - 101{ │ │ │ │ │ - 102 std::back_insert_iterator ins = std::back_inserter(T); │ │ │ │ │ - 103 std::string::size_type here = 0; │ │ │ │ │ - 104 while (here < Line.size()) *ins++ = extract_field(Line, here); │ │ │ │ │ - 105} │ │ │ │ │ - 106 │ │ │ │ │ - 107 │ │ │ │ │ - 108template │ │ │ │ │ -109inline tablereader &pqxx::tablereader::operator>>(TUPLE &T) │ │ │ │ │ - 110{ │ │ │ │ │ - 111 std::string Line; │ │ │ │ │ - 112 if (get_raw_line(Line)) tokenize(Line, T); │ │ │ │ │ - 113 return *this; │ │ │ │ │ - 114} │ │ │ │ │ - 115} // namespace pqxx │ │ │ │ │ - 116 │ │ │ │ │ - 117#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 118#endif │ │ │ │ │ +73 oid id() const noexcept { return m_id; } //[t48] │ │ │ │ │ + 74 │ │ │ │ │ + 84 │ │ │ │ │ +85 bool operator==(const largeobject &other) const //[t51] │ │ │ │ │ + 86 { return m_id == other.m_id; } │ │ │ │ │ + 88 │ │ │ │ │ +89 bool operator!=(const largeobject &other) const //[t51] │ │ │ │ │ + 90 { return m_id != other.m_id; } │ │ │ │ │ + 92 │ │ │ │ │ +93 bool operator<=(const largeobject &other) const //[t51] │ │ │ │ │ + 94 { return m_id <= other.m_id; } │ │ │ │ │ + 96 │ │ │ │ │ +97 bool operator>=(const largeobject &other) const //[t51] │ │ │ │ │ + 98 { return m_id >= other.m_id; } │ │ │ │ │ + 100 │ │ │ │ │ +101 bool operator<(const largeobject &other) const //[t51] │ │ │ │ │ + 102 { return m_id < other.m_id; } │ │ │ │ │ + 104 │ │ │ │ │ +105 bool operator>(const largeobject &other) const //[t51] │ │ │ │ │ + 106 { return m_id > other.m_id; } │ │ │ │ │ + 108 │ │ │ │ │ + 110 │ │ │ │ │ + 114 void to_file(dbtransaction &T, const std::string &File) const; //[t52] │ │ │ │ │ + 115 │ │ │ │ │ + 117 │ │ │ │ │ + 121 void remove(dbtransaction &T) const; //[t48] │ │ │ │ │ + 122 │ │ │ │ │ + 123protected: │ │ │ │ │ + 124 PQXX_PURE static internal::pq::PGconn *raw_connection( │ │ │ │ │ + 125 const dbtransaction &T); │ │ │ │ │ + 126 │ │ │ │ │ + 127 PQXX_PRIVATE std::string reason(const connection_base &, int err) const; │ │ │ │ │ + 128 │ │ │ │ │ + 129private: │ │ │ │ │ + 130 oid m_id = oid_none; │ │ │ │ │ + 131}; │ │ │ │ │ + 132 │ │ │ │ │ + 133 │ │ │ │ │ + 134// TODO: New hierarchy with separate read / write / mixed-mode access │ │ │ │ │ + 135 │ │ │ │ │ +137class PQXX_LIBEXPORT largeobjectaccess : private largeobject │ │ │ │ │ + 138{ │ │ │ │ │ + 139public: │ │ │ │ │ + 140 using largeobject::size_type; │ │ │ │ │ +141 using off_type = long; │ │ │ │ │ +142 using pos_type = size_type; │ │ │ │ │ + 143 │ │ │ │ │ + 145 │ │ │ │ │ +149 using openmode = std::ios::openmode; │ │ │ │ │ + 150 │ │ │ │ │ + 152 │ │ │ │ │ +156 using seekdir = std::ios::seekdir; │ │ │ │ │ + 157 │ │ │ │ │ + 159 │ │ │ │ │ + 163 explicit largeobjectaccess( //[t51] │ │ │ │ │ + 164 dbtransaction &T, │ │ │ │ │ + 165 openmode mode=std::ios::in|std::ios::out); │ │ │ │ │ + 166 │ │ │ │ │ + 168 │ │ │ │ │ + 174 largeobjectaccess( //[t52] │ │ │ │ │ + 175 dbtransaction &T, │ │ │ │ │ + 176 oid O, │ │ │ │ │ + 177 openmode mode=std::ios::in|std::ios::out); │ │ │ │ │ + 178 │ │ │ │ │ + 180 │ │ │ │ │ + 185 largeobjectaccess( //[t50] │ │ │ │ │ + 186 dbtransaction &T, │ │ │ │ │ + 187 largeobject O, │ │ │ │ │ + 188 openmode mode=std::ios::in|std::ios::out); │ │ │ │ │ + 189 │ │ │ │ │ + 191 │ │ │ │ │ + 196 largeobjectaccess( //[t55] │ │ │ │ │ + 197 dbtransaction &T, │ │ │ │ │ + 198 const std::string &File, │ │ │ │ │ + 199 openmode mode=std::ios::in|std::ios::out); │ │ │ │ │ + 200 │ │ │ │ │ +201 ~largeobjectaccess() noexcept { close(); } │ │ │ │ │ + 202 │ │ │ │ │ + 204 │ │ │ │ │ + 207 using largeobject::id; │ │ │ │ │ + 208 │ │ │ │ │ + 210 │ │ │ │ │ +213 void to_file(const std::string &File) const //[t54] │ │ │ │ │ + 214 { largeobject::to_file(m_trans, File); } │ │ │ │ │ + 215 │ │ │ │ │ + 216 using largeobject::to_file; │ │ │ │ │ + 217 │ │ │ │ │ + 223 │ │ │ │ │ + 227 void write(const char Buf[], size_type Len); //[t51] │ │ │ │ │ + 228 │ │ │ │ │ + 230 │ │ │ │ │ +233 void write(const std::string &Buf) //[t50] │ │ │ │ │ + 234 { write(Buf.c_str(), static_cast(Buf.size())); } │ │ │ │ │ + 235 │ │ │ │ │ + 237 │ │ │ │ │ + 243 size_type read(char Buf[], size_type Len); //[t50] │ │ │ │ │ + 244 │ │ │ │ │ + 246 │ │ │ │ │ + 249 size_type seek(size_type dest, seekdir dir); //[t51] │ │ │ │ │ + 250 │ │ │ │ │ + 252 │ │ │ │ │ + 255 size_type tell() const; //[t50] │ │ │ │ │ + 257 │ │ │ │ │ + 268 │ │ │ │ │ + 276 pos_type cseek(off_type dest, seekdir dir) noexcept; //[t50] │ │ │ │ │ + 277 │ │ │ │ │ + 279 │ │ │ │ │ + 285 off_type cwrite(const char Buf[], size_type Len) noexcept; //[t50] │ │ │ │ │ + 286 │ │ │ │ │ + 288 │ │ │ │ │ + 294 off_type cread(char Buf[], size_type Len) noexcept; //[t50] │ │ │ │ │ + 295 │ │ │ │ │ + 297 │ │ │ │ │ + 301 pos_type ctell() const noexcept; //[t50] │ │ │ │ │ + 303 │ │ │ │ │ + 309 void process_notice(const std::string &) noexcept; //[t50] │ │ │ │ │ + 311 │ │ │ │ │ + 312 using largeobject::remove; │ │ │ │ │ + 313 │ │ │ │ │ + 314 using largeobject::operator==; │ │ │ │ │ + 315 using largeobject::operator!=; │ │ │ │ │ + 316 using largeobject::operator<; │ │ │ │ │ + 317 using largeobject::operator<=; │ │ │ │ │ + 318 using largeobject::operator>; │ │ │ │ │ + 319 using largeobject::operator>=; │ │ │ │ │ + 320 │ │ │ │ │ + 321private: │ │ │ │ │ + 322 PQXX_PRIVATE std::string reason(int err) const; │ │ │ │ │ + 323 internal::pq::PGconn *raw_connection() const │ │ │ │ │ + 324 { return largeobject::raw_connection(m_trans); } │ │ │ │ │ + 325 │ │ │ │ │ + 326 PQXX_PRIVATE void open(openmode mode); │ │ │ │ │ + 327 void close() noexcept; │ │ │ │ │ + 328 │ │ │ │ │ + 329 dbtransaction &m_trans; │ │ │ │ │ + 330 int m_fd = -1; │ │ │ │ │ + 331 │ │ │ │ │ + 332 largeobjectaccess() =delete; │ │ │ │ │ + 333 largeobjectaccess(const largeobjectaccess &) =delete; │ │ │ │ │ + 334 largeobjectaccess operator=(const largeobjectaccess &) =delete; │ │ │ │ │ + 335}; │ │ │ │ │ + 336 │ │ │ │ │ + 337 │ │ │ │ │ + 339 │ │ │ │ │ + 347template> │ │ │ │ │ +348 class largeobject_streambuf : │ │ │ │ │ + 349 public std::basic_streambuf │ │ │ │ │ + 350{ │ │ │ │ │ + 351 using size_type = long; │ │ │ │ │ + 352public: │ │ │ │ │ +353 using char_type = CHAR; │ │ │ │ │ +354 using traits_type = TRAITS; │ │ │ │ │ +355 using int_type = typename traits_type::int_type; │ │ │ │ │ +356 using pos_type = typename traits_type::pos_type; │ │ │ │ │ +357 using off_type = typename traits_type::off_type; │ │ │ │ │ +358 using openmode = largeobjectaccess::openmode; │ │ │ │ │ +359 using seekdir = largeobjectaccess::seekdir; │ │ │ │ │ + 360 │ │ │ │ │ +361 largeobject_streambuf( //[t48] │ │ │ │ │ + 362 dbtransaction &T, │ │ │ │ │ + 363 largeobject O, │ │ │ │ │ + 364 openmode mode=std::ios::in|std::ios::out, │ │ │ │ │ + 365 size_type BufSize=512) : │ │ │ │ │ + 366 m_bufsize{BufSize}, │ │ │ │ │ + 367 m_obj{T, O, mode}, │ │ │ │ │ + 368 m_g{nullptr}, │ │ │ │ │ + 369 m_p{nullptr} │ │ │ │ │ + 370 { initialize(mode); } │ │ │ │ │ + 371 │ │ │ │ │ +372 largeobject_streambuf( //[t48] │ │ │ │ │ + 373 dbtransaction &T, │ │ │ │ │ + 374 oid O, │ │ │ │ │ + 375 openmode mode=std::ios::in|std::ios::out, │ │ │ │ │ + 376 size_type BufSize=512) : │ │ │ │ │ + 377 m_bufsize{BufSize}, │ │ │ │ │ + 378 m_obj{T, O, mode}, │ │ │ │ │ + 379 m_g{nullptr}, │ │ │ │ │ + 380 m_p{nullptr} │ │ │ │ │ + 381 { initialize(mode); } │ │ │ │ │ + 382 │ │ │ │ │ +383 virtual ~largeobject_streambuf() noexcept │ │ │ │ │ + 384 { delete [] m_p; delete [] m_g; } │ │ │ │ │ + 385 │ │ │ │ │ + 386 │ │ │ │ │ +388 void process_notice(const std::string &s) { m_obj.process_notice(s); } │ │ │ │ │ + 389 │ │ │ │ │ + 390protected: │ │ │ │ │ +391 virtual int sync() override │ │ │ │ │ + 392 { │ │ │ │ │ + 393 // setg() sets eback, gptr, egptr │ │ │ │ │ + 394 this->setg(this->eback(), this->eback(), this->egptr()); │ │ │ │ │ + 395 return overflow(EoF()); │ │ │ │ │ + 396 } │ │ │ │ │ + 397 │ │ │ │ │ +398 virtual pos_type seekoff( │ │ │ │ │ + 399 off_type offset, │ │ │ │ │ + 400 seekdir dir, │ │ │ │ │ + 401 openmode) │ │ │ │ │ + 402 override │ │ │ │ │ + 403 { │ │ │ │ │ + 404 return AdjustEOF(m_obj.cseek(largeobjectaccess::off_type(offset), dir)); │ │ │ │ │ + 405 } │ │ │ │ │ + 406 │ │ │ │ │ +407 virtual pos_type seekpos(pos_type pos, openmode) override │ │ │ │ │ + 408 { │ │ │ │ │ + 409 const largeobjectaccess::pos_type newpos = m_obj.cseek( │ │ │ │ │ + 410 largeobjectaccess::off_type(pos), │ │ │ │ │ + 411 std::ios::beg); │ │ │ │ │ + 412 return AdjustEOF(newpos); │ │ │ │ │ + 413 } │ │ │ │ │ + 414 │ │ │ │ │ +415 virtual int_type overflow(int_type ch = EoF()) override │ │ │ │ │ + 416 { │ │ │ │ │ + 417 char *const pp = this->pptr(); │ │ │ │ │ + 418 if (pp == nullptr) return EoF(); │ │ │ │ │ + 419 char *const pb = this->pbase(); │ │ │ │ │ + 420 int_type res = 0; │ │ │ │ │ + 421 │ │ │ │ │ + 422 if (pp > pb) res = int_type(AdjustEOF(m_obj.cwrite(pb, pp-pb))); │ │ │ │ │ + 423 this->setp(m_p, m_p + m_bufsize); │ │ │ │ │ + 424 │ │ │ │ │ + 425 // Write that one more character, if it's there. │ │ │ │ │ + 426 if (ch != EoF()) │ │ │ │ │ + 427 { │ │ │ │ │ + 428 *this->pptr() = char(ch); │ │ │ │ │ + 429 this->pbump(1); │ │ │ │ │ + 430 } │ │ │ │ │ + 431 return res; │ │ │ │ │ + 432 } │ │ │ │ │ + 433 │ │ │ │ │ +434 virtual int_type underflow() override │ │ │ │ │ + 435 { │ │ │ │ │ + 436 if (this->gptr() == nullptr) return EoF(); │ │ │ │ │ + 437 char *const eb = this->eback(); │ │ │ │ │ + 438 const int_type res(static_cast( │ │ │ │ │ + 439 AdjustEOF(m_obj.cread(this->eback(), m_bufsize)))); │ │ │ │ │ + 440 this->setg(eb, eb, eb + ((res==EoF()) ? 0 : res)); │ │ │ │ │ + 441 return ((res == 0) or (res == EoF())) ? EoF() : *eb; │ │ │ │ │ + 442 } │ │ │ │ │ + 443 │ │ │ │ │ + 444private: │ │ │ │ │ + 446 static int_type EoF() { return traits_type::eof(); } │ │ │ │ │ + 447 │ │ │ │ │ + 449 template │ │ │ │ │ + 450 static std::streampos AdjustEOF(INTYPE pos) │ │ │ │ │ + 451 { return (pos==-1) ? std::streampos(EoF()) : std::streampos(pos); } │ │ │ │ │ + 452 │ │ │ │ │ + 453 void initialize(openmode mode) │ │ │ │ │ + 454 { │ │ │ │ │ + 455 if (mode & std::ios::in) │ │ │ │ │ + 456 { │ │ │ │ │ + 457 m_g = new char_type[unsigned(m_bufsize)]; │ │ │ │ │ + 458 this->setg(m_g, m_g, m_g); │ │ │ │ │ + 459 } │ │ │ │ │ + 460 if (mode & std::ios::out) │ │ │ │ │ + 461 { │ │ │ │ │ + 462 m_p = new char_type[unsigned(m_bufsize)]; │ │ │ │ │ + 463 this->setp(m_p, m_p + m_bufsize); │ │ │ │ │ + 464 } │ │ │ │ │ + 465 } │ │ │ │ │ + 466 │ │ │ │ │ + 467 const size_type m_bufsize; │ │ │ │ │ + 468 largeobjectaccess m_obj; │ │ │ │ │ + 469 │ │ │ │ │ + 471 char_type *m_g, *m_p; │ │ │ │ │ + 472}; │ │ │ │ │ + 473 │ │ │ │ │ + 474 │ │ │ │ │ + 476 │ │ │ │ │ + 484template> │ │ │ │ │ +485 class basic_ilostream : │ │ │ │ │ + 486 public std::basic_istream │ │ │ │ │ + 487{ │ │ │ │ │ + 488 using super = std::basic_istream; │ │ │ │ │ + 489 │ │ │ │ │ + 490public: │ │ │ │ │ +491 using char_type = CHAR; │ │ │ │ │ +492 using traits_type = TRAITS; │ │ │ │ │ +493 using int_type = typename traits_type::int_type; │ │ │ │ │ +494 using pos_type = typename traits_type::pos_type; │ │ │ │ │ +495 using off_type = typename traits_type::off_type; │ │ │ │ │ + 496 │ │ │ │ │ + 498 │ │ │ │ │ +503 basic_ilostream( //[t57] │ │ │ │ │ + 504 dbtransaction &T, │ │ │ │ │ + 505 largeobject O, │ │ │ │ │ + 506 largeobject::size_type BufSize=512) : │ │ │ │ │ + 507 super{nullptr}, │ │ │ │ │ + 508 m_buf{T, O, std::ios::in, BufSize} │ │ │ │ │ + 509 { super::init(&m_buf); } │ │ │ │ │ + 510 │ │ │ │ │ + 512 │ │ │ │ │ +517 basic_ilostream( //[t48] │ │ │ │ │ + 518 dbtransaction &T, │ │ │ │ │ + 519 oid O, │ │ │ │ │ + 520 largeobject::size_type BufSize=512) : │ │ │ │ │ + 521 super{nullptr}, │ │ │ │ │ + 522 m_buf{T, O, std::ios::in, BufSize} │ │ │ │ │ + 523 { super::init(&m_buf); } │ │ │ │ │ + 524 │ │ │ │ │ + 525private: │ │ │ │ │ + 526 largeobject_streambuf m_buf; │ │ │ │ │ + 527}; │ │ │ │ │ + 528 │ │ │ │ │ +529using ilostream = basic_ilostream; │ │ │ │ │ + 530 │ │ │ │ │ + 531 │ │ │ │ │ + 533 │ │ │ │ │ + 541template> │ │ │ │ │ +542 class basic_olostream : │ │ │ │ │ + 543 public std::basic_ostream │ │ │ │ │ + 544{ │ │ │ │ │ + 545 using super = std::basic_ostream; │ │ │ │ │ + 546public: │ │ │ │ │ +547 using char_type = CHAR; │ │ │ │ │ +548 using traits_type = TRAITS; │ │ │ │ │ +549 using int_type = typename traits_type::int_type; │ │ │ │ │ +550 using pos_type = typename traits_type::pos_type; │ │ │ │ │ +551 using off_type = typename traits_type::off_type; │ │ │ │ │ + 552 │ │ │ │ │ + 554 │ │ │ │ │ +559 basic_olostream( //[t48] │ │ │ │ │ + 560 dbtransaction &T, │ │ │ │ │ + 561 largeobject O, │ │ │ │ │ + 562 largeobject::size_type BufSize=512) : │ │ │ │ │ + 563 super{nullptr}, │ │ │ │ │ + 564 m_buf{T, O, std::ios::out, BufSize} │ │ │ │ │ + 565 { super::init(&m_buf); } │ │ │ │ │ + 566 │ │ │ │ │ + 568 │ │ │ │ │ +573 basic_olostream( //[t57] │ │ │ │ │ + 574 dbtransaction &T, │ │ │ │ │ + 575 oid O, │ │ │ │ │ + 576 largeobject::size_type BufSize=512) : │ │ │ │ │ + 577 super{nullptr}, │ │ │ │ │ + 578 m_buf{T, O, std::ios::out, BufSize} │ │ │ │ │ + 579 { super::init(&m_buf); } │ │ │ │ │ + 580 │ │ │ │ │ +581 ~basic_olostream() │ │ │ │ │ + 582 { │ │ │ │ │ + 583 try │ │ │ │ │ + 584 { │ │ │ │ │ + 585 m_buf.pubsync(); m_buf.pubsync(); │ │ │ │ │ + 586 } │ │ │ │ │ + 587 catch (const std::exception &e) │ │ │ │ │ + 588 { │ │ │ │ │ + 589 m_buf.process_notice(e.what()); │ │ │ │ │ + 590 } │ │ │ │ │ + 591 } │ │ │ │ │ + 592 │ │ │ │ │ + 593private: │ │ │ │ │ + 594 largeobject_streambuf m_buf; │ │ │ │ │ + 595}; │ │ │ │ │ + 596 │ │ │ │ │ +597using olostream = basic_olostream; │ │ │ │ │ + 598 │ │ │ │ │ + 599 │ │ │ │ │ + 601 │ │ │ │ │ + 609template> │ │ │ │ │ +610 class basic_lostream : │ │ │ │ │ + 611 public std::basic_iostream │ │ │ │ │ + 612{ │ │ │ │ │ + 613 using super = std::basic_iostream; │ │ │ │ │ + 614 │ │ │ │ │ + 615public: │ │ │ │ │ +616 using char_type = CHAR; │ │ │ │ │ +617 using traits_type = TRAITS; │ │ │ │ │ +618 using int_type = typename traits_type::int_type; │ │ │ │ │ +619 using pos_type = typename traits_type::pos_type; │ │ │ │ │ +620 using off_type = typename traits_type::off_type; │ │ │ │ │ + 621 │ │ │ │ │ + 623 │ │ │ │ │ +628 basic_lostream( //[t59] │ │ │ │ │ + 629 dbtransaction &T, │ │ │ │ │ + 630 largeobject O, │ │ │ │ │ + 631 largeobject::size_type BufSize=512) : │ │ │ │ │ + 632 super{nullptr}, │ │ │ │ │ + 633 m_buf{T, O, std::ios::in | std::ios::out, BufSize} │ │ │ │ │ + 634 { super::init(&m_buf); } │ │ │ │ │ + 635 │ │ │ │ │ + 637 │ │ │ │ │ +642 basic_lostream( //[t59] │ │ │ │ │ + 643 dbtransaction &T, │ │ │ │ │ + 644 oid O, │ │ │ │ │ + 645 largeobject::size_type BufSize=512) : │ │ │ │ │ + 646 super{nullptr}, │ │ │ │ │ + 647 m_buf{T, O, std::ios::in | std::ios::out, BufSize} │ │ │ │ │ + 648 { super::init(&m_buf); } │ │ │ │ │ + 649 │ │ │ │ │ +650 ~basic_lostream() │ │ │ │ │ + 651 { │ │ │ │ │ + 652 try │ │ │ │ │ + 653 { │ │ │ │ │ + 654 m_buf.pubsync(); m_buf.pubsync(); │ │ │ │ │ + 655 } │ │ │ │ │ + 656 catch (const std::exception &e) │ │ │ │ │ + 657 { │ │ │ │ │ + 658 m_buf.process_notice(e.what()); │ │ │ │ │ + 659 } │ │ │ │ │ + 660 } │ │ │ │ │ + 661 │ │ │ │ │ + 662private: │ │ │ │ │ + 663 largeobject_streambuf m_buf; │ │ │ │ │ + 664}; │ │ │ │ │ + 665 │ │ │ │ │ +666using lostream = basic_lostream; │ │ │ │ │ + 667 │ │ │ │ │ + 668} // namespace pqxx │ │ │ │ │ + 669 │ │ │ │ │ + 670#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 671 │ │ │ │ │ + 672#endif │ │ │ │ │ std │ │ │ │ │ STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::tablereader │ │ │ │ │ -Definition: tablereader.hxx:30 │ │ │ │ │ -pqxx::tablereader::tokenize │ │ │ │ │ -void tokenize(std::string, TUPLE &) const │ │ │ │ │ -Definition: tablereader.hxx:100 │ │ │ │ │ -pqxx::tablereader::tablereader │ │ │ │ │ -tablereader(transaction_base &, const std::string &Name, const std::string │ │ │ │ │ -&Null=std::string{}) │ │ │ │ │ -Definition: tablereader.cxx:21 │ │ │ │ │ -pqxx::tablereader::operator! │ │ │ │ │ -bool operator!() const noexcept │ │ │ │ │ -Definition: tablereader.hxx:52 │ │ │ │ │ -pqxx::tablereader::operator>> │ │ │ │ │ -tablereader & operator>>(TUPLE &) │ │ │ │ │ -Definition: tablereader.hxx:109 │ │ │ │ │ -pqxx::tablestream │ │ │ │ │ -Base class for obsolete tablereader/tablewriter classes. │ │ │ │ │ -Definition: tablestream.hxx:28 │ │ │ │ │ -pqxx::tablestream::columnlist │ │ │ │ │ -static std::string columnlist(ITER colbegin, ITER colend) │ │ │ │ │ -Definition: tablestream.hxx:52 │ │ │ │ │ -pqxx::transaction_base │ │ │ │ │ -Interface definition (and common code) for "transaction" classes. │ │ │ │ │ -Definition: transaction_base.hxx:138 │ │ │ │ │ +pqxx::large_object_size_type │ │ │ │ │ +long large_object_size_type │ │ │ │ │ +Number of bytes in a large object. (Unusual: it's signed.) │ │ │ │ │ +Definition: types.hxx:33 │ │ │ │ │ +pqxx::oid_none │ │ │ │ │ +constexpr oid oid_none │ │ │ │ │ +The "null" oid. │ │ │ │ │ +Definition: util.hxx:77 │ │ │ │ │ +pqxx::connection_base │ │ │ │ │ +connection_base abstract base class; represents a connection to a database. │ │ │ │ │ +Definition: connection_base.hxx:140 │ │ │ │ │ +pqxx::dbtransaction │ │ │ │ │ +Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ +Definition: dbtransaction.hxx:63 │ │ │ │ │ +pqxx::largeobject │ │ │ │ │ +Identity of a large object. │ │ │ │ │ +Definition: largeobject.hxx:35 │ │ │ │ │ +pqxx::largeobject::raw_connection │ │ │ │ │ +static PQXX_PURE internal::pq::PGconn * raw_connection(const dbtransaction &T) │ │ │ │ │ +Definition: largeobject.cxx:134 │ │ │ │ │ +pqxx::largeobject::size_type │ │ │ │ │ +large_object_size_type size_type │ │ │ │ │ +Definition: largeobject.hxx:37 │ │ │ │ │ +pqxx::largeobject::operator< │ │ │ │ │ +bool operator<(const largeobject &other) const │ │ │ │ │ +Compare object identities. │ │ │ │ │ +Definition: largeobject.hxx:101 │ │ │ │ │ +pqxx::largeobject::operator== │ │ │ │ │ +bool operator==(const largeobject &other) const │ │ │ │ │ +Compare object identities. │ │ │ │ │ +Definition: largeobject.hxx:85 │ │ │ │ │ +pqxx::largeobject::to_file │ │ │ │ │ +void to_file(dbtransaction &T, const std::string &File) const │ │ │ │ │ +Export large object's contents to a local file. │ │ │ │ │ +Definition: largeobject.cxx:106 │ │ │ │ │ +pqxx::largeobject::operator> │ │ │ │ │ +bool operator>(const largeobject &other) const │ │ │ │ │ +Compare object identities. │ │ │ │ │ +Definition: largeobject.hxx:105 │ │ │ │ │ +pqxx::largeobject::operator<= │ │ │ │ │ +bool operator<=(const largeobject &other) const │ │ │ │ │ +Compare object identities. │ │ │ │ │ +Definition: largeobject.hxx:93 │ │ │ │ │ +pqxx::largeobject::largeobject │ │ │ │ │ +largeobject() noexcept=default │ │ │ │ │ +Refer to a nonexistent large object (similar to what a null pointer does) │ │ │ │ │ +pqxx::largeobject::operator!= │ │ │ │ │ +bool operator!=(const largeobject &other) const │ │ │ │ │ +Compare object identities. │ │ │ │ │ +Definition: largeobject.hxx:89 │ │ │ │ │ +pqxx::largeobject::operator>= │ │ │ │ │ +bool operator>=(const largeobject &other) const │ │ │ │ │ +Compare object identities. │ │ │ │ │ +Definition: largeobject.hxx:97 │ │ │ │ │ +pqxx::largeobject::id │ │ │ │ │ +oid id() const noexcept │ │ │ │ │ +Object identifier. │ │ │ │ │ +Definition: largeobject.hxx:73 │ │ │ │ │ +pqxx::largeobjectaccess │ │ │ │ │ +Accessor for large object's contents. │ │ │ │ │ +Definition: largeobject.hxx:138 │ │ │ │ │ +pqxx::largeobjectaccess::pos_type │ │ │ │ │ +size_type pos_type │ │ │ │ │ +Definition: largeobject.hxx:142 │ │ │ │ │ +pqxx::largeobjectaccess::openmode │ │ │ │ │ +std::ios::openmode openmode │ │ │ │ │ +Open mode: in, out (can be combined with the "or" operator) │ │ │ │ │ +Definition: largeobject.hxx:149 │ │ │ │ │ +pqxx::largeobjectaccess::seekdir │ │ │ │ │ +std::ios::seekdir seekdir │ │ │ │ │ +Seek direction: beg, cur, end. │ │ │ │ │ +Definition: largeobject.hxx:156 │ │ │ │ │ +pqxx::largeobjectaccess::write │ │ │ │ │ +void write(const std::string &Buf) │ │ │ │ │ +Write string to large object. │ │ │ │ │ +Definition: largeobject.hxx:233 │ │ │ │ │ +pqxx::largeobjectaccess::off_type │ │ │ │ │ +long off_type │ │ │ │ │ +Definition: largeobject.hxx:141 │ │ │ │ │ +pqxx::largeobjectaccess::~largeobjectaccess │ │ │ │ │ +~largeobjectaccess() noexcept │ │ │ │ │ +Definition: largeobject.hxx:201 │ │ │ │ │ +pqxx::largeobjectaccess::to_file │ │ │ │ │ +void to_file(const std::string &File) const │ │ │ │ │ +Export large object's contents to a local file. │ │ │ │ │ +Definition: largeobject.hxx:213 │ │ │ │ │ +pqxx::largeobject_streambuf │ │ │ │ │ +Streambuf to use large objects in standard I/O streams. │ │ │ │ │ +Definition: largeobject.hxx:350 │ │ │ │ │ +pqxx::largeobject_streambuf::seekoff │ │ │ │ │ +virtual pos_type seekoff(off_type offset, seekdir dir, openmode) override │ │ │ │ │ +Definition: largeobject.hxx:398 │ │ │ │ │ +pqxx::largeobject_streambuf::traits_type │ │ │ │ │ +TRAITS traits_type │ │ │ │ │ +Definition: largeobject.hxx:354 │ │ │ │ │ +pqxx::largeobject_streambuf::int_type │ │ │ │ │ +typename traits_type::int_type int_type │ │ │ │ │ +Definition: largeobject.hxx:355 │ │ │ │ │ +pqxx::largeobject_streambuf::seekpos │ │ │ │ │ +virtual pos_type seekpos(pos_type pos, openmode) override │ │ │ │ │ +Definition: largeobject.hxx:407 │ │ │ │ │ +pqxx::largeobject_streambuf::process_notice │ │ │ │ │ +void process_notice(const std::string &s) │ │ │ │ │ +For use by large object stream classes. │ │ │ │ │ +Definition: largeobject.hxx:388 │ │ │ │ │ +pqxx::largeobject_streambuf::char_type │ │ │ │ │ +CHAR char_type │ │ │ │ │ +Definition: largeobject.hxx:353 │ │ │ │ │ +pqxx::largeobject_streambuf::off_type │ │ │ │ │ +typename traits_type::off_type off_type │ │ │ │ │ +Definition: largeobject.hxx:357 │ │ │ │ │ +pqxx::largeobject_streambuf::largeobject_streambuf │ │ │ │ │ +largeobject_streambuf(dbtransaction &T, largeobject O, openmode mode=std::ios:: │ │ │ │ │ +in|std::ios::out, size_type BufSize=512) │ │ │ │ │ +Definition: largeobject.hxx:361 │ │ │ │ │ +pqxx::largeobject_streambuf::largeobject_streambuf │ │ │ │ │ +largeobject_streambuf(dbtransaction &T, oid O, openmode mode=std::ios::in|std:: │ │ │ │ │ +ios::out, size_type BufSize=512) │ │ │ │ │ +Definition: largeobject.hxx:372 │ │ │ │ │ +pqxx::largeobject_streambuf::~largeobject_streambuf │ │ │ │ │ +virtual ~largeobject_streambuf() noexcept │ │ │ │ │ +Definition: largeobject.hxx:383 │ │ │ │ │ +pqxx::largeobject_streambuf::sync │ │ │ │ │ +virtual int sync() override │ │ │ │ │ +Definition: largeobject.hxx:391 │ │ │ │ │ +pqxx::largeobject_streambuf::seekdir │ │ │ │ │ +largeobjectaccess::seekdir seekdir │ │ │ │ │ +Definition: largeobject.hxx:359 │ │ │ │ │ +pqxx::largeobject_streambuf::underflow │ │ │ │ │ +virtual int_type underflow() override │ │ │ │ │ +Definition: largeobject.hxx:434 │ │ │ │ │ +pqxx::largeobject_streambuf::overflow │ │ │ │ │ +virtual int_type overflow(int_type ch=EoF()) override │ │ │ │ │ +Definition: largeobject.hxx:415 │ │ │ │ │ +pqxx::largeobject_streambuf::openmode │ │ │ │ │ +largeobjectaccess::openmode openmode │ │ │ │ │ +Definition: largeobject.hxx:358 │ │ │ │ │ +pqxx::largeobject_streambuf::pos_type │ │ │ │ │ +typename traits_type::pos_type pos_type │ │ │ │ │ +Definition: largeobject.hxx:356 │ │ │ │ │ +pqxx::basic_ilostream │ │ │ │ │ +Input stream that gets its data from a large object. │ │ │ │ │ +Definition: largeobject.hxx:487 │ │ │ │ │ +pqxx::basic_ilostream::char_type │ │ │ │ │ +CHAR char_type │ │ │ │ │ +Definition: largeobject.hxx:491 │ │ │ │ │ +pqxx::basic_ilostream::basic_ilostream │ │ │ │ │ +basic_ilostream(dbtransaction &T, largeobject O, largeobject::size_type │ │ │ │ │ +BufSize=512) │ │ │ │ │ +Create a basic_ilostream. │ │ │ │ │ +Definition: largeobject.hxx:503 │ │ │ │ │ +pqxx::basic_ilostream::int_type │ │ │ │ │ +typename traits_type::int_type int_type │ │ │ │ │ +Definition: largeobject.hxx:493 │ │ │ │ │ +pqxx::basic_ilostream::traits_type │ │ │ │ │ +TRAITS traits_type │ │ │ │ │ +Definition: largeobject.hxx:492 │ │ │ │ │ +pqxx::basic_ilostream::off_type │ │ │ │ │ +typename traits_type::off_type off_type │ │ │ │ │ +Definition: largeobject.hxx:495 │ │ │ │ │ +pqxx::basic_ilostream::pos_type │ │ │ │ │ +typename traits_type::pos_type pos_type │ │ │ │ │ +Definition: largeobject.hxx:494 │ │ │ │ │ +pqxx::basic_ilostream::basic_ilostream │ │ │ │ │ +basic_ilostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512) │ │ │ │ │ +Create a basic_ilostream. │ │ │ │ │ +Definition: largeobject.hxx:517 │ │ │ │ │ +pqxx::basic_olostream │ │ │ │ │ +Output stream that writes data back to a large object. │ │ │ │ │ +Definition: largeobject.hxx:544 │ │ │ │ │ +pqxx::basic_olostream::off_type │ │ │ │ │ +typename traits_type::off_type off_type │ │ │ │ │ +Definition: largeobject.hxx:551 │ │ │ │ │ +pqxx::basic_olostream::pos_type │ │ │ │ │ +typename traits_type::pos_type pos_type │ │ │ │ │ +Definition: largeobject.hxx:550 │ │ │ │ │ +pqxx::basic_olostream::int_type │ │ │ │ │ +typename traits_type::int_type int_type │ │ │ │ │ +Definition: largeobject.hxx:549 │ │ │ │ │ +pqxx::basic_olostream::~basic_olostream │ │ │ │ │ +~basic_olostream() │ │ │ │ │ +Definition: largeobject.hxx:581 │ │ │ │ │ +pqxx::basic_olostream::basic_olostream │ │ │ │ │ +basic_olostream(dbtransaction &T, largeobject O, largeobject::size_type │ │ │ │ │ +BufSize=512) │ │ │ │ │ +Create a basic_olostream. │ │ │ │ │ +Definition: largeobject.hxx:559 │ │ │ │ │ +pqxx::basic_olostream::char_type │ │ │ │ │ +CHAR char_type │ │ │ │ │ +Definition: largeobject.hxx:547 │ │ │ │ │ +pqxx::basic_olostream::traits_type │ │ │ │ │ +TRAITS traits_type │ │ │ │ │ +Definition: largeobject.hxx:548 │ │ │ │ │ +pqxx::basic_olostream::basic_olostream │ │ │ │ │ +basic_olostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512) │ │ │ │ │ +Create a basic_olostream. │ │ │ │ │ +Definition: largeobject.hxx:573 │ │ │ │ │ +pqxx::basic_lostream │ │ │ │ │ +Stream that reads and writes a large object. │ │ │ │ │ +Definition: largeobject.hxx:612 │ │ │ │ │ +pqxx::basic_lostream::pos_type │ │ │ │ │ +typename traits_type::pos_type pos_type │ │ │ │ │ +Definition: largeobject.hxx:619 │ │ │ │ │ +pqxx::basic_lostream::~basic_lostream │ │ │ │ │ +~basic_lostream() │ │ │ │ │ +Definition: largeobject.hxx:650 │ │ │ │ │ +pqxx::basic_lostream::basic_lostream │ │ │ │ │ +basic_lostream(dbtransaction &T, oid O, largeobject::size_type BufSize=512) │ │ │ │ │ +Create a basic_lostream. │ │ │ │ │ +Definition: largeobject.hxx:642 │ │ │ │ │ +pqxx::basic_lostream::int_type │ │ │ │ │ +typename traits_type::int_type int_type │ │ │ │ │ +Definition: largeobject.hxx:618 │ │ │ │ │ +pqxx::basic_lostream::basic_lostream │ │ │ │ │ +basic_lostream(dbtransaction &T, largeobject O, largeobject::size_type │ │ │ │ │ +BufSize=512) │ │ │ │ │ +Create a basic_lostream. │ │ │ │ │ +Definition: largeobject.hxx:628 │ │ │ │ │ +pqxx::basic_lostream::off_type │ │ │ │ │ +typename traits_type::off_type off_type │ │ │ │ │ +Definition: largeobject.hxx:620 │ │ │ │ │ +pqxx::basic_lostream::traits_type │ │ │ │ │ +TRAITS traits_type │ │ │ │ │ +Definition: largeobject.hxx:617 │ │ │ │ │ +pqxx::basic_lostream::char_type │ │ │ │ │ +CHAR char_type │ │ │ │ │ +Definition: largeobject.hxx:616 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * tablereader.hxx │ │ │ │ │ + * largeobject.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00116_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: except.hxx Source File │ │ │ │ +libpqxx: isolation.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,500 +55,73 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
except.hxx
│ │ │ │ +
isolation.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_EXCEPT
│ │ │ │ -
14#define PQXX_H_EXCEPT
│ │ │ │ +
13#ifndef PQXX_H_ISOLATION
│ │ │ │ +
14#define PQXX_H_ISOLATION
│ │ │ │
15
│ │ │ │
16#include "pqxx/compiler-public.hxx"
│ │ │ │
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │
18
│ │ │ │ -
19#include <stdexcept>
│ │ │ │ +
19#include "pqxx/util.hxx"
│ │ │ │
20
│ │ │ │ -
21#include "pqxx/util.hxx"
│ │ │ │ -
22
│ │ │ │ +
21namespace pqxx
│ │ │ │ +
22{
│ │ │ │
23
│ │ │ │ -
24namespace pqxx
│ │ │ │ -
25{
│ │ │ │ -
26
│ │ │ │ -
44
│ │ │ │ -
55class PQXX_LIBEXPORT PQXX_NOVTABLE pqxx_exception
│ │ │ │ -
56{
│ │ │ │ -
57public:
│ │ │ │ -
59 virtual ~pqxx_exception() noexcept =0;
│ │ │ │ -
60
│ │ │ │ -
62
│ │ │ │ -
84 PQXX_CONST virtual const std::exception &base() const noexcept =0; //[t00]
│ │ │ │ -
85};
│ │ │ │ -
86
│ │ │ │ -
87
│ │ │ │ -
89class PQXX_LIBEXPORT failure :
│ │ │ │ -
90 public pqxx_exception, public std::runtime_error
│ │ │ │ -
91{
│ │ │ │ -
92 virtual const std::exception &base() const noexcept override
│ │ │ │ -
93 { return *this; }
│ │ │ │ -
94public:
│ │ │ │ -
95 explicit failure(const std::string &);
│ │ │ │ -
96};
│ │ │ │ -
97
│ │ │ │ -
98
│ │ │ │ -
100
│ │ │ │ -
118class PQXX_LIBEXPORT broken_connection : public failure
│ │ │ │ -
119{
│ │ │ │ -
120public:
│ │ │ │ - │ │ │ │ -
122 explicit broken_connection(const std::string &);
│ │ │ │ -
123};
│ │ │ │ -
124
│ │ │ │ -
125
│ │ │ │ -
127
│ │ │ │ -
130class PQXX_LIBEXPORT sql_error : public failure
│ │ │ │ -
131{
│ │ │ │ -
133 const std::string m_query;
│ │ │ │ -
135 const std::string m_sqlstate;
│ │ │ │ -
136
│ │ │ │ -
137public:
│ │ │ │ -
138 explicit sql_error(
│ │ │ │ -
139 const std::string &msg="",
│ │ │ │ -
140 const std::string &Q="",
│ │ │ │ -
141 const char sqlstate[]=nullptr);
│ │ │ │ -
142 virtual ~sql_error() noexcept;
│ │ │ │ -
143
│ │ │ │ -
145 PQXX_PURE const std::string &query() const noexcept; //[t56]
│ │ │ │ -
146
│ │ │ │ -
148 PQXX_PURE const std::string &sqlstate() const noexcept;
│ │ │ │ -
149};
│ │ │ │ -
150
│ │ │ │ -
151
│ │ │ │ -
153
│ │ │ │ -
159class PQXX_LIBEXPORT in_doubt_error : public failure
│ │ │ │ -
160{
│ │ │ │ -
161public:
│ │ │ │ -
162 explicit in_doubt_error(const std::string &);
│ │ │ │ -
163};
│ │ │ │ -
164
│ │ │ │ -
165
│ │ │ │ -
167class PQXX_LIBEXPORT transaction_rollback : public failure
│ │ │ │ -
168{
│ │ │ │ -
169public:
│ │ │ │ -
170 explicit transaction_rollback(const std::string &);
│ │ │ │ -
171};
│ │ │ │ -
172
│ │ │ │ -
173
│ │ │ │ -
175
│ │ │ │ -
183class PQXX_LIBEXPORT serialization_failure : public transaction_rollback
│ │ │ │ -
184{
│ │ │ │ -
185public:
│ │ │ │ -
186 explicit serialization_failure(const std::string &);
│ │ │ │ -
187};
│ │ │ │ -
188
│ │ │ │ -
189
│ │ │ │ - │ │ │ │ -
192{
│ │ │ │ -
193public:
│ │ │ │ -
194 explicit statement_completion_unknown(const std::string &);
│ │ │ │ -
195};
│ │ │ │ -
196
│ │ │ │ -
197
│ │ │ │ -
199class PQXX_LIBEXPORT deadlock_detected : public transaction_rollback
│ │ │ │ -
200{
│ │ │ │ -
201public:
│ │ │ │ -
202 explicit deadlock_detected(const std::string &);
│ │ │ │ -
203};
│ │ │ │ -
204
│ │ │ │ -
205
│ │ │ │ -
207class PQXX_LIBEXPORT internal_error :
│ │ │ │ -
208 public pqxx_exception, public std::logic_error
│ │ │ │ -
209{
│ │ │ │ -
210 virtual const std::exception &base() const noexcept override
│ │ │ │ -
211 { return *this; }
│ │ │ │ -
212public:
│ │ │ │ -
213 explicit internal_error(const std::string &);
│ │ │ │ -
214};
│ │ │ │ -
215
│ │ │ │ -
216
│ │ │ │ -
218class PQXX_LIBEXPORT usage_error :
│ │ │ │ -
219 public pqxx_exception, public std::logic_error
│ │ │ │ -
220{
│ │ │ │ -
221 virtual const std::exception &base() const noexcept override
│ │ │ │ -
222 { return *this; }
│ │ │ │ -
223public:
│ │ │ │ -
224 explicit usage_error(const std::string &);
│ │ │ │ -
225};
│ │ │ │ -
226
│ │ │ │ -
227
│ │ │ │ -
229class PQXX_LIBEXPORT argument_error :
│ │ │ │ -
230 public pqxx_exception, public std::invalid_argument
│ │ │ │ -
231{
│ │ │ │ -
232 virtual const std::exception &base() const noexcept override
│ │ │ │ -
233 { return *this; }
│ │ │ │ -
234public:
│ │ │ │ -
235 explicit argument_error(const std::string &);
│ │ │ │ -
236};
│ │ │ │ -
237
│ │ │ │ -
238
│ │ │ │ -
240class PQXX_LIBEXPORT conversion_error :
│ │ │ │ -
241 public pqxx_exception, public std::domain_error
│ │ │ │ -
242{
│ │ │ │ -
243 virtual const std::exception &base() const noexcept override
│ │ │ │ -
244 { return *this; }
│ │ │ │ -
245public:
│ │ │ │ -
246 explicit conversion_error(const std::string &);
│ │ │ │ -
247};
│ │ │ │ -
248
│ │ │ │ -
249
│ │ │ │ -
251class PQXX_LIBEXPORT range_error :
│ │ │ │ -
252 public pqxx_exception, public std::out_of_range
│ │ │ │ -
253{
│ │ │ │ -
254 virtual const std::exception &base() const noexcept override
│ │ │ │ -
255 { return *this; }
│ │ │ │ -
256public:
│ │ │ │ -
257 explicit range_error(const std::string &);
│ │ │ │ -
258};
│ │ │ │ -
259
│ │ │ │ -
260
│ │ │ │ -
262class PQXX_LIBEXPORT unexpected_rows : public range_error
│ │ │ │ -
263{
│ │ │ │ -
264 virtual const std::exception &base() const noexcept override
│ │ │ │ -
265 { return *this; }
│ │ │ │ -
266public:
│ │ │ │ -
267 explicit unexpected_rows(const std::string &msg) : range_error{msg} {}
│ │ │ │ -
268};
│ │ │ │ -
269
│ │ │ │ -
270
│ │ │ │ -
272class PQXX_LIBEXPORT feature_not_supported : public sql_error
│ │ │ │ -
273{
│ │ │ │ -
274public:
│ │ │ │ - │ │ │ │ -
276 const std::string &err,
│ │ │ │ -
277 const std::string &Q="",
│ │ │ │ -
278 const char sqlstate[]=nullptr) :
│ │ │ │ -
279 sql_error{err, Q, sqlstate} {}
│ │ │ │ -
280};
│ │ │ │ -
281
│ │ │ │ -
283class PQXX_LIBEXPORT data_exception : public sql_error
│ │ │ │ -
284{
│ │ │ │ -
285public:
│ │ │ │ - │ │ │ │ -
287 const std::string &err,
│ │ │ │ -
288 const std::string &Q="",
│ │ │ │ -
289 const char sqlstate[]=nullptr) :
│ │ │ │ -
290 sql_error{err, Q, sqlstate} {}
│ │ │ │ -
291};
│ │ │ │ -
292
│ │ │ │ -
293class PQXX_LIBEXPORT integrity_constraint_violation : public sql_error
│ │ │ │ -
294{
│ │ │ │ -
295public:
│ │ │ │ - │ │ │ │ -
297 const std::string &err,
│ │ │ │ -
298 const std::string &Q="",
│ │ │ │ -
299 const char sqlstate[]=nullptr) :
│ │ │ │ -
300 sql_error{err, Q, sqlstate} {}
│ │ │ │ -
301};
│ │ │ │ -
302
│ │ │ │ -
303class PQXX_LIBEXPORT restrict_violation :
│ │ │ │ - │ │ │ │ -
305{
│ │ │ │ -
306public:
│ │ │ │ - │ │ │ │ -
308 const std::string &err,
│ │ │ │ -
309 const std::string &Q="",
│ │ │ │ -
310 const char sqlstate[]=nullptr) :
│ │ │ │ -
311 integrity_constraint_violation{err, Q, sqlstate} {}
│ │ │ │ -
312};
│ │ │ │ -
313
│ │ │ │ -
314class PQXX_LIBEXPORT not_null_violation :
│ │ │ │ - │ │ │ │ -
316{
│ │ │ │ -
317public:
│ │ │ │ - │ │ │ │ -
319 const std::string &err,
│ │ │ │ -
320 const std::string &Q="",
│ │ │ │ -
321 const char sqlstate[]=nullptr) :
│ │ │ │ -
322 integrity_constraint_violation{err, Q, sqlstate} {}
│ │ │ │ -
323};
│ │ │ │ -
324
│ │ │ │ -
325class PQXX_LIBEXPORT foreign_key_violation :
│ │ │ │ - │ │ │ │ -
327{
│ │ │ │ -
328public:
│ │ │ │ - │ │ │ │ -
330 const std::string &err,
│ │ │ │ -
331 const std::string &Q="",
│ │ │ │ -
332 const char sqlstate[]=nullptr) :
│ │ │ │ -
333 integrity_constraint_violation{err, Q, sqlstate} {}
│ │ │ │ -
334};
│ │ │ │ -
335
│ │ │ │ -
336class PQXX_LIBEXPORT unique_violation :
│ │ │ │ - │ │ │ │ -
338{
│ │ │ │ -
339public:
│ │ │ │ - │ │ │ │ -
341 const std::string &err,
│ │ │ │ -
342 const std::string &Q="",
│ │ │ │ -
343 const char sqlstate[]=nullptr) :
│ │ │ │ -
344 integrity_constraint_violation{err, Q, sqlstate} {}
│ │ │ │ -
345};
│ │ │ │ -
346
│ │ │ │ -
347class PQXX_LIBEXPORT check_violation :
│ │ │ │ - │ │ │ │ -
349{
│ │ │ │ -
350public:
│ │ │ │ - │ │ │ │ -
352 const std::string &err,
│ │ │ │ -
353 const std::string &Q="",
│ │ │ │ -
354 const char sqlstate[]=nullptr) :
│ │ │ │ -
355 integrity_constraint_violation{err, Q, sqlstate} {}
│ │ │ │ -
356};
│ │ │ │ -
357
│ │ │ │ -
358class PQXX_LIBEXPORT invalid_cursor_state : public sql_error
│ │ │ │ -
359{
│ │ │ │ -
360public:
│ │ │ │ - │ │ │ │ -
362 const std::string &err,
│ │ │ │ -
363 const std::string &Q="",
│ │ │ │ -
364 const char sqlstate[]=nullptr) :
│ │ │ │ -
365 sql_error{err, Q, sqlstate} {}
│ │ │ │ -
366};
│ │ │ │ -
367
│ │ │ │ -
368class PQXX_LIBEXPORT invalid_sql_statement_name : public sql_error
│ │ │ │ -
369{
│ │ │ │ -
370public:
│ │ │ │ - │ │ │ │ -
372 const std::string &err,
│ │ │ │ -
373 const std::string &Q="",
│ │ │ │ -
374 const char sqlstate[]=nullptr) :
│ │ │ │ -
375 sql_error{err, Q, sqlstate} {}
│ │ │ │ -
376};
│ │ │ │ -
377
│ │ │ │ -
378class PQXX_LIBEXPORT invalid_cursor_name : public sql_error
│ │ │ │ -
379{
│ │ │ │ -
380public:
│ │ │ │ - │ │ │ │ -
382 const std::string &err,
│ │ │ │ -
383 const std::string &Q="",
│ │ │ │ -
384 const char sqlstate[]=nullptr) :
│ │ │ │ -
385 sql_error{err, Q, sqlstate} {}
│ │ │ │ -
386};
│ │ │ │ -
387
│ │ │ │ -
388class PQXX_LIBEXPORT syntax_error : public sql_error
│ │ │ │ -
389{
│ │ │ │ -
390public:
│ │ │ │ -
392 const int error_position;
│ │ │ │ -
393
│ │ │ │ -
394 explicit syntax_error(
│ │ │ │ -
395 const std::string &err,
│ │ │ │ -
396 const std::string &Q="",
│ │ │ │ -
397 const char sqlstate[]=nullptr,
│ │ │ │ -
398 int pos=-1) :
│ │ │ │ -
399 sql_error{err, Q, sqlstate}, error_position{pos} {}
│ │ │ │ -
400};
│ │ │ │ -
401
│ │ │ │ -
402class PQXX_LIBEXPORT undefined_column : public syntax_error
│ │ │ │ -
403{
│ │ │ │ -
404public:
│ │ │ │ - │ │ │ │ -
406 const std::string &err,
│ │ │ │ -
407 const std::string &Q="",
│ │ │ │ -
408 const char sqlstate[]=nullptr) :
│ │ │ │ -
409 syntax_error{err, Q, sqlstate} {}
│ │ │ │ -
410};
│ │ │ │ -
411
│ │ │ │ -
412class PQXX_LIBEXPORT undefined_function : public syntax_error
│ │ │ │ -
413{
│ │ │ │ -
414public:
│ │ │ │ - │ │ │ │ -
416 const std::string &err,
│ │ │ │ -
417 const std::string &Q="",
│ │ │ │ -
418 const char sqlstate[]=nullptr) :
│ │ │ │ -
419 syntax_error{err, Q, sqlstate} {}
│ │ │ │ -
420};
│ │ │ │ -
421
│ │ │ │ -
422class PQXX_LIBEXPORT undefined_table : public syntax_error
│ │ │ │ -
423{
│ │ │ │ -
424public:
│ │ │ │ - │ │ │ │ -
426 const std::string &err,
│ │ │ │ -
427 const std::string &Q="",
│ │ │ │ -
428 const char sqlstate[]=nullptr) :
│ │ │ │ -
429 syntax_error{err, Q, sqlstate} {}
│ │ │ │ -
430};
│ │ │ │ -
431
│ │ │ │ -
432class PQXX_LIBEXPORT insufficient_privilege : public sql_error
│ │ │ │ -
433{
│ │ │ │ -
434public:
│ │ │ │ - │ │ │ │ -
436 const std::string &err,
│ │ │ │ -
437 const std::string &Q="",
│ │ │ │ -
438 const char sqlstate[]=nullptr) :
│ │ │ │ -
439 sql_error{err, Q, sqlstate} {}
│ │ │ │ -
440};
│ │ │ │ -
441
│ │ │ │ -
443class PQXX_LIBEXPORT insufficient_resources : public sql_error
│ │ │ │ -
444{
│ │ │ │ -
445public:
│ │ │ │ - │ │ │ │ -
447 const std::string &err,
│ │ │ │ -
448 const std::string &Q="",
│ │ │ │ -
449 const char sqlstate[]=nullptr) :
│ │ │ │ -
450 sql_error{err,Q, sqlstate} {}
│ │ │ │ -
451};
│ │ │ │ -
452
│ │ │ │ -
453class PQXX_LIBEXPORT disk_full : public insufficient_resources
│ │ │ │ -
454{
│ │ │ │ -
455public:
│ │ │ │ -
456 explicit disk_full(
│ │ │ │ -
457 const std::string &err,
│ │ │ │ -
458 const std::string &Q="",
│ │ │ │ -
459 const char sqlstate[]=nullptr) :
│ │ │ │ -
460 insufficient_resources{err, Q, sqlstate} {}
│ │ │ │ -
461};
│ │ │ │ -
462
│ │ │ │ -
463class PQXX_LIBEXPORT out_of_memory : public insufficient_resources
│ │ │ │ -
464{
│ │ │ │ -
465public:
│ │ │ │ - │ │ │ │ -
467 const std::string &err,
│ │ │ │ -
468 const std::string &Q="",
│ │ │ │ -
469 const char sqlstate[]=nullptr) :
│ │ │ │ -
470 insufficient_resources{err, Q, sqlstate} {}
│ │ │ │ -
471};
│ │ │ │ -
472
│ │ │ │ -
473class PQXX_LIBEXPORT too_many_connections : public broken_connection
│ │ │ │ -
474{
│ │ │ │ -
475public:
│ │ │ │ -
476 explicit too_many_connections(const std::string &err) :
│ │ │ │ -
477 broken_connection{err} {}
│ │ │ │ -
478};
│ │ │ │ -
479
│ │ │ │ -
481
│ │ │ │ -
483class PQXX_LIBEXPORT plpgsql_error : public sql_error
│ │ │ │ -
484{
│ │ │ │ -
485public:
│ │ │ │ - │ │ │ │ -
487 const std::string &err,
│ │ │ │ -
488 const std::string &Q="",
│ │ │ │ -
489 const char sqlstate[]=nullptr) :
│ │ │ │ -
490 sql_error{err, Q, sqlstate} {}
│ │ │ │ -
491};
│ │ │ │ -
492
│ │ │ │ -
494class PQXX_LIBEXPORT plpgsql_raise : public plpgsql_error
│ │ │ │ -
495{
│ │ │ │ -
496public:
│ │ │ │ - │ │ │ │ -
498 const std::string &err,
│ │ │ │ -
499 const std::string &Q="",
│ │ │ │ -
500 const char sqlstate[]=nullptr) :
│ │ │ │ -
501 plpgsql_error{err, Q, sqlstate} {}
│ │ │ │ -
502};
│ │ │ │ -
503
│ │ │ │ -
504class PQXX_LIBEXPORT plpgsql_no_data_found : public plpgsql_error
│ │ │ │ -
505{
│ │ │ │ -
506public:
│ │ │ │ - │ │ │ │ -
508 const std::string &err,
│ │ │ │ -
509 const std::string &Q="",
│ │ │ │ -
510 const char sqlstate[]=nullptr) :
│ │ │ │ -
511 plpgsql_error{err, Q, sqlstate} {}
│ │ │ │ -
512};
│ │ │ │ -
513
│ │ │ │ -
514class PQXX_LIBEXPORT plpgsql_too_many_rows : public plpgsql_error
│ │ │ │ -
515{
│ │ │ │ -
516public:
│ │ │ │ - │ │ │ │ -
518 const std::string &err,
│ │ │ │ -
519 const std::string &Q="",
│ │ │ │ -
520 const char sqlstate[]=nullptr) :
│ │ │ │ -
521 plpgsql_error{err, Q, sqlstate} {}
│ │ │ │ -
522};
│ │ │ │ -
523
│ │ │ │ -
528}
│ │ │ │ -
529
│ │ │ │ -
530#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
531
│ │ │ │ -
532#endif
│ │ │ │ -
STL namespace.
│ │ │ │ +
25
│ │ │ │ + │ │ │ │ +
57{
│ │ │ │ +
58 // read_uncommitted,
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
62};
│ │ │ │ +
63
│ │ │ │ +
65template<isolation_level LEVEL> struct isolation_traits
│ │ │ │ +
66{
│ │ │ │ +
67 static constexpr isolation_level level() noexcept { return LEVEL; }
│ │ │ │ +
68 static constexpr const char *name() noexcept;
│ │ │ │ +
69};
│ │ │ │ +
70
│ │ │ │ +
71
│ │ │ │ +
72template<>
│ │ │ │ +
73inline constexpr const char *isolation_traits<read_committed>::name() noexcept
│ │ │ │ +
74 { return "READ COMMITTED"; }
│ │ │ │ +
75
│ │ │ │ +
76template<>
│ │ │ │ +
77inline constexpr const char *isolation_traits<repeatable_read>::name() noexcept
│ │ │ │ +
78 { return "REPEATABLE READ"; }
│ │ │ │ +
79
│ │ │ │ +
80template<>
│ │ │ │ +
81inline constexpr const char *isolation_traits<serializable>::name() noexcept
│ │ │ │ +
82 { return "SERIALIZABLE"; }
│ │ │ │ +
83
│ │ │ │ +
84}
│ │ │ │ +
85
│ │ │ │ +
86#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
87#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
Mixin base class to identify libpqxx-specific exception types.
Definition: except.hxx:56
│ │ │ │ -
virtual PQXX_CONST const std::exception & base() const noexcept=0
Return std::exception base-class object.
│ │ │ │ -
Run-time failure encountered by libpqxx, similar to std::runtime_error.
Definition: except.hxx:91
│ │ │ │ -
Exception class for lost or failed backend connection.
Definition: except.hxx:119
│ │ │ │ -
Exception class for failed queries.
Definition: except.hxx:131
│ │ │ │ -
"Help, I don't know whether transaction was committed successfully!"
Definition: except.hxx:160
│ │ │ │ -
The backend saw itself forced to roll back the ongoing transaction.
Definition: except.hxx:168
│ │ │ │ -
Transaction failed to serialize. Please retry it.
Definition: except.hxx:184
│ │ │ │ -
We can't tell whether our last statement succeeded.
Definition: except.hxx:192
│ │ │ │ -
The ongoing transaction has deadlocked. Retrying it may help.
Definition: except.hxx:200
│ │ │ │ -
Internal error in libpqxx library.
Definition: except.hxx:209
│ │ │ │ -
Error in usage of libpqxx library, similar to std::logic_error.
Definition: except.hxx:220
│ │ │ │ -
Invalid argument passed to libpqxx, similar to std::invalid_argument.
Definition: except.hxx:231
│ │ │ │ -
Value conversion failed, e.g. when converting "Hello" to int.
Definition: except.hxx:242
│ │ │ │ -
Something is out of range, similar to std::out_of_range.
Definition: except.hxx:253
│ │ │ │ -
Query returned an unexpected number of rows.
Definition: except.hxx:263
│ │ │ │ -
unexpected_rows(const std::string &msg)
Definition: except.hxx:267
│ │ │ │ -
Database feature not supported in current setup.
Definition: except.hxx:273
│ │ │ │ -
feature_not_supported(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:275
│ │ │ │ -
Error in data provided to SQL statement.
Definition: except.hxx:284
│ │ │ │ -
data_exception(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:286
│ │ │ │ -
Definition: except.hxx:294
│ │ │ │ -
integrity_constraint_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:296
│ │ │ │ -
Definition: except.hxx:305
│ │ │ │ -
restrict_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:307
│ │ │ │ -
Definition: except.hxx:316
│ │ │ │ -
not_null_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:318
│ │ │ │ -
Definition: except.hxx:327
│ │ │ │ -
foreign_key_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:329
│ │ │ │ -
Definition: except.hxx:338
│ │ │ │ -
unique_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:340
│ │ │ │ -
Definition: except.hxx:349
│ │ │ │ -
check_violation(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:351
│ │ │ │ -
Definition: except.hxx:359
│ │ │ │ -
invalid_cursor_state(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:361
│ │ │ │ -
Definition: except.hxx:369
│ │ │ │ -
invalid_sql_statement_name(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:371
│ │ │ │ -
Definition: except.hxx:379
│ │ │ │ -
invalid_cursor_name(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:381
│ │ │ │ -
Definition: except.hxx:389
│ │ │ │ -
const int error_position
Approximate position in string where error occurred, or -1 if unknown.
Definition: except.hxx:392
│ │ │ │ -
syntax_error(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr, int pos=-1)
Definition: except.hxx:394
│ │ │ │ -
Definition: except.hxx:403
│ │ │ │ -
undefined_column(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:405
│ │ │ │ -
Definition: except.hxx:413
│ │ │ │ -
undefined_function(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:415
│ │ │ │ -
Definition: except.hxx:423
│ │ │ │ -
undefined_table(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:425
│ │ │ │ -
Definition: except.hxx:433
│ │ │ │ -
insufficient_privilege(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:435
│ │ │ │ -
Resource shortage on the server.
Definition: except.hxx:444
│ │ │ │ -
insufficient_resources(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:446
│ │ │ │ -
Definition: except.hxx:454
│ │ │ │ -
disk_full(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:456
│ │ │ │ -
Definition: except.hxx:464
│ │ │ │ -
out_of_memory(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:466
│ │ │ │ -
Definition: except.hxx:474
│ │ │ │ -
too_many_connections(const std::string &err)
Definition: except.hxx:476
│ │ │ │ -
PL/pgSQL error.
Definition: except.hxx:484
│ │ │ │ -
plpgsql_error(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:486
│ │ │ │ -
Exception raised in PL/pgSQL procedure.
Definition: except.hxx:495
│ │ │ │ -
plpgsql_raise(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:497
│ │ │ │ -
Definition: except.hxx:505
│ │ │ │ -
plpgsql_no_data_found(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:507
│ │ │ │ -
Definition: except.hxx:515
│ │ │ │ -
plpgsql_too_many_rows(const std::string &err, const std::string &Q="", const char sqlstate[]=nullptr)
Definition: except.hxx:517
│ │ │ │ +
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:57
│ │ │ │ +
@ serializable
Definition: isolation.hxx:61
│ │ │ │ +
@ read_committed
Definition: isolation.hxx:59
│ │ │ │ +
@ repeatable_read
Definition: isolation.hxx:60
│ │ │ │ +
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
│ │ │ │ +
static constexpr const char * name() noexcept
│ │ │ │ +
static constexpr isolation_level level() noexcept
Definition: isolation.hxx:67
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,632 +1,82 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -except.hxx │ │ │ │ │ +isolation.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_EXCEPT │ │ │ │ │ - 14#define PQXX_H_EXCEPT │ │ │ │ │ + 13#ifndef PQXX_H_ISOLATION │ │ │ │ │ + 14#define PQXX_H_ISOLATION │ │ │ │ │ 15 │ │ │ │ │ 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ 18 │ │ │ │ │ - 19#include │ │ │ │ │ + 19#include "pqxx/util.hxx" │ │ │ │ │ 20 │ │ │ │ │ - 21#include "pqxx/util.hxx" │ │ │ │ │ - 22 │ │ │ │ │ + 21namespace pqxx │ │ │ │ │ + 22{ │ │ │ │ │ 23 │ │ │ │ │ - 24namespace pqxx │ │ │ │ │ - 25{ │ │ │ │ │ - 26 │ │ │ │ │ - 44 │ │ │ │ │ -55class PQXX_LIBEXPORT PQXX_NOVTABLE pqxx_exception │ │ │ │ │ - 56{ │ │ │ │ │ - 57public: │ │ │ │ │ - 59 virtual ~pqxx_exception() noexcept =0; │ │ │ │ │ - 60 │ │ │ │ │ - 62 │ │ │ │ │ -84 PQXX_CONST virtual const std::exception &base() const noexcept =0; //[t00] │ │ │ │ │ - 85}; │ │ │ │ │ - 86 │ │ │ │ │ - 87 │ │ │ │ │ -89class PQXX_LIBEXPORT failure : │ │ │ │ │ - 90 public pqxx_exception, public std::runtime_error │ │ │ │ │ - 91{ │ │ │ │ │ - 92 virtual const std::exception &base() const noexcept override │ │ │ │ │ - 93 { return *this; } │ │ │ │ │ - 94public: │ │ │ │ │ - 95 explicit failure(const std::string &); │ │ │ │ │ - 96}; │ │ │ │ │ - 97 │ │ │ │ │ - 98 │ │ │ │ │ - 100 │ │ │ │ │ -118class PQXX_LIBEXPORT broken_connection : public failure │ │ │ │ │ - 119{ │ │ │ │ │ - 120public: │ │ │ │ │ - 121 broken_connection(); │ │ │ │ │ - 122 explicit broken_connection(const std::string &); │ │ │ │ │ - 123}; │ │ │ │ │ - 124 │ │ │ │ │ - 125 │ │ │ │ │ - 127 │ │ │ │ │ -130class PQXX_LIBEXPORT sql_error : public failure │ │ │ │ │ - 131{ │ │ │ │ │ - 133 const std::string m_query; │ │ │ │ │ - 135 const std::string m_sqlstate; │ │ │ │ │ - 136 │ │ │ │ │ - 137public: │ │ │ │ │ - 138 explicit sql_error( │ │ │ │ │ - 139 const std::string &msg="", │ │ │ │ │ - 140 const std::string &Q="", │ │ │ │ │ - 141 const char sqlstate[]=nullptr); │ │ │ │ │ - 142 virtual ~sql_error() noexcept; │ │ │ │ │ - 143 │ │ │ │ │ - 145 PQXX_PURE const std::string &query() const noexcept; //[t56] │ │ │ │ │ - 146 │ │ │ │ │ - 148 PQXX_PURE const std::string &sqlstate() const noexcept; │ │ │ │ │ - 149}; │ │ │ │ │ - 150 │ │ │ │ │ - 151 │ │ │ │ │ - 153 │ │ │ │ │ -159class PQXX_LIBEXPORT in_doubt_error : public failure │ │ │ │ │ - 160{ │ │ │ │ │ - 161public: │ │ │ │ │ - 162 explicit in_doubt_error(const std::string &); │ │ │ │ │ - 163}; │ │ │ │ │ - 164 │ │ │ │ │ - 165 │ │ │ │ │ -167class PQXX_LIBEXPORT transaction_rollback : public failure │ │ │ │ │ - 168{ │ │ │ │ │ - 169public: │ │ │ │ │ - 170 explicit transaction_rollback(const std::string &); │ │ │ │ │ - 171}; │ │ │ │ │ - 172 │ │ │ │ │ - 173 │ │ │ │ │ - 175 │ │ │ │ │ -183class PQXX_LIBEXPORT serialization_failure : public transaction_rollback │ │ │ │ │ - 184{ │ │ │ │ │ - 185public: │ │ │ │ │ - 186 explicit serialization_failure(const std::string &); │ │ │ │ │ - 187}; │ │ │ │ │ - 188 │ │ │ │ │ - 189 │ │ │ │ │ -191class PQXX_LIBEXPORT statement_completion_unknown : public │ │ │ │ │ -transaction_rollback │ │ │ │ │ - 192{ │ │ │ │ │ - 193public: │ │ │ │ │ - 194 explicit statement_completion_unknown(const std::string &); │ │ │ │ │ - 195}; │ │ │ │ │ - 196 │ │ │ │ │ - 197 │ │ │ │ │ -199class PQXX_LIBEXPORT deadlock_detected : public transaction_rollback │ │ │ │ │ - 200{ │ │ │ │ │ - 201public: │ │ │ │ │ - 202 explicit deadlock_detected(const std::string &); │ │ │ │ │ - 203}; │ │ │ │ │ - 204 │ │ │ │ │ - 205 │ │ │ │ │ -207class PQXX_LIBEXPORT internal_error : │ │ │ │ │ - 208 public pqxx_exception, public std::logic_error │ │ │ │ │ - 209{ │ │ │ │ │ - 210 virtual const std::exception &base() const noexcept override │ │ │ │ │ - 211 { return *this; } │ │ │ │ │ - 212public: │ │ │ │ │ - 213 explicit internal_error(const std::string &); │ │ │ │ │ - 214}; │ │ │ │ │ - 215 │ │ │ │ │ - 216 │ │ │ │ │ -218class PQXX_LIBEXPORT usage_error : │ │ │ │ │ - 219 public pqxx_exception, public std::logic_error │ │ │ │ │ - 220{ │ │ │ │ │ - 221 virtual const std::exception &base() const noexcept override │ │ │ │ │ - 222 { return *this; } │ │ │ │ │ - 223public: │ │ │ │ │ - 224 explicit usage_error(const std::string &); │ │ │ │ │ - 225}; │ │ │ │ │ - 226 │ │ │ │ │ - 227 │ │ │ │ │ -229class PQXX_LIBEXPORT argument_error : │ │ │ │ │ - 230 public pqxx_exception, public std::invalid_argument │ │ │ │ │ - 231{ │ │ │ │ │ - 232 virtual const std::exception &base() const noexcept override │ │ │ │ │ - 233 { return *this; } │ │ │ │ │ - 234public: │ │ │ │ │ - 235 explicit argument_error(const std::string &); │ │ │ │ │ - 236}; │ │ │ │ │ - 237 │ │ │ │ │ - 238 │ │ │ │ │ -240class PQXX_LIBEXPORT conversion_error : │ │ │ │ │ - 241 public pqxx_exception, public std::domain_error │ │ │ │ │ - 242{ │ │ │ │ │ - 243 virtual const std::exception &base() const noexcept override │ │ │ │ │ - 244 { return *this; } │ │ │ │ │ - 245public: │ │ │ │ │ - 246 explicit conversion_error(const std::string &); │ │ │ │ │ - 247}; │ │ │ │ │ - 248 │ │ │ │ │ - 249 │ │ │ │ │ -251class PQXX_LIBEXPORT range_error : │ │ │ │ │ - 252 public pqxx_exception, public std::out_of_range │ │ │ │ │ - 253{ │ │ │ │ │ - 254 virtual const std::exception &base() const noexcept override │ │ │ │ │ - 255 { return *this; } │ │ │ │ │ - 256public: │ │ │ │ │ - 257 explicit range_error(const std::string &); │ │ │ │ │ - 258}; │ │ │ │ │ - 259 │ │ │ │ │ - 260 │ │ │ │ │ -262class PQXX_LIBEXPORT unexpected_rows : public range_error │ │ │ │ │ - 263{ │ │ │ │ │ - 264 virtual const std::exception &base() const noexcept override │ │ │ │ │ - 265 { return *this; } │ │ │ │ │ - 266public: │ │ │ │ │ -267 explicit unexpected_rows(const std::string &msg) : range_error{msg} {} │ │ │ │ │ - 268}; │ │ │ │ │ - 269 │ │ │ │ │ - 270 │ │ │ │ │ -272class PQXX_LIBEXPORT feature_not_supported : public sql_error │ │ │ │ │ - 273{ │ │ │ │ │ - 274public: │ │ │ │ │ -275 explicit feature_not_supported( │ │ │ │ │ - 276 const std::string &err, │ │ │ │ │ - 277 const std::string &Q="", │ │ │ │ │ - 278 const char sqlstate[]=nullptr) : │ │ │ │ │ - 279 sql_error{err, Q, sqlstate} {} │ │ │ │ │ - 280}; │ │ │ │ │ - 281 │ │ │ │ │ -283class PQXX_LIBEXPORT data_exception : public sql_error │ │ │ │ │ - 284{ │ │ │ │ │ - 285public: │ │ │ │ │ -286 explicit data_exception( │ │ │ │ │ - 287 const std::string &err, │ │ │ │ │ - 288 const std::string &Q="", │ │ │ │ │ - 289 const char sqlstate[]=nullptr) : │ │ │ │ │ - 290 sql_error{err, Q, sqlstate} {} │ │ │ │ │ - 291}; │ │ │ │ │ - 292 │ │ │ │ │ -293class PQXX_LIBEXPORT integrity_constraint_violation : public sql_error │ │ │ │ │ - 294{ │ │ │ │ │ - 295public: │ │ │ │ │ -296 explicit integrity_constraint_violation( │ │ │ │ │ - 297 const std::string &err, │ │ │ │ │ - 298 const std::string &Q="", │ │ │ │ │ - 299 const char sqlstate[]=nullptr) : │ │ │ │ │ - 300 sql_error{err, Q, sqlstate} {} │ │ │ │ │ - 301}; │ │ │ │ │ - 302 │ │ │ │ │ -303class PQXX_LIBEXPORT restrict_violation : │ │ │ │ │ - 304 public integrity_constraint_violation │ │ │ │ │ - 305{ │ │ │ │ │ - 306public: │ │ │ │ │ -307 explicit restrict_violation( │ │ │ │ │ - 308 const std::string &err, │ │ │ │ │ - 309 const std::string &Q="", │ │ │ │ │ - 310 const char sqlstate[]=nullptr) : │ │ │ │ │ - 311 integrity_constraint_violation{err, Q, sqlstate} {} │ │ │ │ │ - 312}; │ │ │ │ │ - 313 │ │ │ │ │ -314class PQXX_LIBEXPORT not_null_violation : │ │ │ │ │ - 315 public integrity_constraint_violation │ │ │ │ │ - 316{ │ │ │ │ │ - 317public: │ │ │ │ │ -318 explicit not_null_violation( │ │ │ │ │ - 319 const std::string &err, │ │ │ │ │ - 320 const std::string &Q="", │ │ │ │ │ - 321 const char sqlstate[]=nullptr) : │ │ │ │ │ - 322 integrity_constraint_violation{err, Q, sqlstate} {} │ │ │ │ │ - 323}; │ │ │ │ │ - 324 │ │ │ │ │ -325class PQXX_LIBEXPORT foreign_key_violation : │ │ │ │ │ - 326 public integrity_constraint_violation │ │ │ │ │ - 327{ │ │ │ │ │ - 328public: │ │ │ │ │ -329 explicit foreign_key_violation( │ │ │ │ │ - 330 const std::string &err, │ │ │ │ │ - 331 const std::string &Q="", │ │ │ │ │ - 332 const char sqlstate[]=nullptr) : │ │ │ │ │ - 333 integrity_constraint_violation{err, Q, sqlstate} {} │ │ │ │ │ - 334}; │ │ │ │ │ - 335 │ │ │ │ │ -336class PQXX_LIBEXPORT unique_violation : │ │ │ │ │ - 337 public integrity_constraint_violation │ │ │ │ │ - 338{ │ │ │ │ │ - 339public: │ │ │ │ │ -340 explicit unique_violation( │ │ │ │ │ - 341 const std::string &err, │ │ │ │ │ - 342 const std::string &Q="", │ │ │ │ │ - 343 const char sqlstate[]=nullptr) : │ │ │ │ │ - 344 integrity_constraint_violation{err, Q, sqlstate} {} │ │ │ │ │ - 345}; │ │ │ │ │ - 346 │ │ │ │ │ -347class PQXX_LIBEXPORT check_violation : │ │ │ │ │ - 348 public integrity_constraint_violation │ │ │ │ │ - 349{ │ │ │ │ │ - 350public: │ │ │ │ │ -351 explicit check_violation( │ │ │ │ │ - 352 const std::string &err, │ │ │ │ │ - 353 const std::string &Q="", │ │ │ │ │ - 354 const char sqlstate[]=nullptr) : │ │ │ │ │ - 355 integrity_constraint_violation{err, Q, sqlstate} {} │ │ │ │ │ - 356}; │ │ │ │ │ - 357 │ │ │ │ │ -358class PQXX_LIBEXPORT invalid_cursor_state : public sql_error │ │ │ │ │ - 359{ │ │ │ │ │ - 360public: │ │ │ │ │ -361 explicit invalid_cursor_state( │ │ │ │ │ - 362 const std::string &err, │ │ │ │ │ - 363 const std::string &Q="", │ │ │ │ │ - 364 const char sqlstate[]=nullptr) : │ │ │ │ │ - 365 sql_error{err, Q, sqlstate} {} │ │ │ │ │ - 366}; │ │ │ │ │ - 367 │ │ │ │ │ -368class PQXX_LIBEXPORT invalid_sql_statement_name : public sql_error │ │ │ │ │ - 369{ │ │ │ │ │ - 370public: │ │ │ │ │ -371 explicit invalid_sql_statement_name( │ │ │ │ │ - 372 const std::string &err, │ │ │ │ │ - 373 const std::string &Q="", │ │ │ │ │ - 374 const char sqlstate[]=nullptr) : │ │ │ │ │ - 375 sql_error{err, Q, sqlstate} {} │ │ │ │ │ - 376}; │ │ │ │ │ - 377 │ │ │ │ │ -378class PQXX_LIBEXPORT invalid_cursor_name : public sql_error │ │ │ │ │ - 379{ │ │ │ │ │ - 380public: │ │ │ │ │ -381 explicit invalid_cursor_name( │ │ │ │ │ - 382 const std::string &err, │ │ │ │ │ - 383 const std::string &Q="", │ │ │ │ │ - 384 const char sqlstate[]=nullptr) : │ │ │ │ │ - 385 sql_error{err, Q, sqlstate} {} │ │ │ │ │ - 386}; │ │ │ │ │ - 387 │ │ │ │ │ -388class PQXX_LIBEXPORT syntax_error : public sql_error │ │ │ │ │ - 389{ │ │ │ │ │ - 390public: │ │ │ │ │ -392 const int error_position; │ │ │ │ │ - 393 │ │ │ │ │ -394 explicit syntax_error( │ │ │ │ │ - 395 const std::string &err, │ │ │ │ │ - 396 const std::string &Q="", │ │ │ │ │ - 397 const char sqlstate[]=nullptr, │ │ │ │ │ - 398 int pos=-1) : │ │ │ │ │ - 399 sql_error{err, Q, sqlstate}, error_position{pos} {} │ │ │ │ │ - 400}; │ │ │ │ │ - 401 │ │ │ │ │ -402class PQXX_LIBEXPORT undefined_column : public syntax_error │ │ │ │ │ - 403{ │ │ │ │ │ - 404public: │ │ │ │ │ -405 explicit undefined_column( │ │ │ │ │ - 406 const std::string &err, │ │ │ │ │ - 407 const std::string &Q="", │ │ │ │ │ - 408 const char sqlstate[]=nullptr) : │ │ │ │ │ - 409 syntax_error{err, Q, sqlstate} {} │ │ │ │ │ - 410}; │ │ │ │ │ - 411 │ │ │ │ │ -412class PQXX_LIBEXPORT undefined_function : public syntax_error │ │ │ │ │ - 413{ │ │ │ │ │ - 414public: │ │ │ │ │ -415 explicit undefined_function( │ │ │ │ │ - 416 const std::string &err, │ │ │ │ │ - 417 const std::string &Q="", │ │ │ │ │ - 418 const char sqlstate[]=nullptr) : │ │ │ │ │ - 419 syntax_error{err, Q, sqlstate} {} │ │ │ │ │ - 420}; │ │ │ │ │ - 421 │ │ │ │ │ -422class PQXX_LIBEXPORT undefined_table : public syntax_error │ │ │ │ │ - 423{ │ │ │ │ │ - 424public: │ │ │ │ │ -425 explicit undefined_table( │ │ │ │ │ - 426 const std::string &err, │ │ │ │ │ - 427 const std::string &Q="", │ │ │ │ │ - 428 const char sqlstate[]=nullptr) : │ │ │ │ │ - 429 syntax_error{err, Q, sqlstate} {} │ │ │ │ │ - 430}; │ │ │ │ │ - 431 │ │ │ │ │ -432class PQXX_LIBEXPORT insufficient_privilege : public sql_error │ │ │ │ │ - 433{ │ │ │ │ │ - 434public: │ │ │ │ │ -435 explicit insufficient_privilege( │ │ │ │ │ - 436 const std::string &err, │ │ │ │ │ - 437 const std::string &Q="", │ │ │ │ │ - 438 const char sqlstate[]=nullptr) : │ │ │ │ │ - 439 sql_error{err, Q, sqlstate} {} │ │ │ │ │ - 440}; │ │ │ │ │ - 441 │ │ │ │ │ -443class PQXX_LIBEXPORT insufficient_resources : public sql_error │ │ │ │ │ - 444{ │ │ │ │ │ - 445public: │ │ │ │ │ -446 explicit insufficient_resources( │ │ │ │ │ - 447 const std::string &err, │ │ │ │ │ - 448 const std::string &Q="", │ │ │ │ │ - 449 const char sqlstate[]=nullptr) : │ │ │ │ │ - 450 sql_error{err,Q, sqlstate} {} │ │ │ │ │ - 451}; │ │ │ │ │ - 452 │ │ │ │ │ -453class PQXX_LIBEXPORT disk_full : public insufficient_resources │ │ │ │ │ - 454{ │ │ │ │ │ - 455public: │ │ │ │ │ -456 explicit disk_full( │ │ │ │ │ - 457 const std::string &err, │ │ │ │ │ - 458 const std::string &Q="", │ │ │ │ │ - 459 const char sqlstate[]=nullptr) : │ │ │ │ │ - 460 insufficient_resources{err, Q, sqlstate} {} │ │ │ │ │ - 461}; │ │ │ │ │ - 462 │ │ │ │ │ -463class PQXX_LIBEXPORT out_of_memory : public insufficient_resources │ │ │ │ │ - 464{ │ │ │ │ │ - 465public: │ │ │ │ │ -466 explicit out_of_memory( │ │ │ │ │ - 467 const std::string &err, │ │ │ │ │ - 468 const std::string &Q="", │ │ │ │ │ - 469 const char sqlstate[]=nullptr) : │ │ │ │ │ - 470 insufficient_resources{err, Q, sqlstate} {} │ │ │ │ │ - 471}; │ │ │ │ │ - 472 │ │ │ │ │ -473class PQXX_LIBEXPORT too_many_connections : public broken_connection │ │ │ │ │ - 474{ │ │ │ │ │ - 475public: │ │ │ │ │ -476 explicit too_many_connections(const std::string &err) : │ │ │ │ │ - 477 broken_connection{err} {} │ │ │ │ │ - 478}; │ │ │ │ │ - 479 │ │ │ │ │ - 481 │ │ │ │ │ -483class PQXX_LIBEXPORT plpgsql_error : public sql_error │ │ │ │ │ - 484{ │ │ │ │ │ - 485public: │ │ │ │ │ -486 explicit plpgsql_error( │ │ │ │ │ - 487 const std::string &err, │ │ │ │ │ - 488 const std::string &Q="", │ │ │ │ │ - 489 const char sqlstate[]=nullptr) : │ │ │ │ │ - 490 sql_error{err, Q, sqlstate} {} │ │ │ │ │ - 491}; │ │ │ │ │ - 492 │ │ │ │ │ -494class PQXX_LIBEXPORT plpgsql_raise : public plpgsql_error │ │ │ │ │ - 495{ │ │ │ │ │ - 496public: │ │ │ │ │ -497 explicit plpgsql_raise( │ │ │ │ │ - 498 const std::string &err, │ │ │ │ │ - 499 const std::string &Q="", │ │ │ │ │ - 500 const char sqlstate[]=nullptr) : │ │ │ │ │ - 501 plpgsql_error{err, Q, sqlstate} {} │ │ │ │ │ - 502}; │ │ │ │ │ - 503 │ │ │ │ │ -504class PQXX_LIBEXPORT plpgsql_no_data_found : public plpgsql_error │ │ │ │ │ - 505{ │ │ │ │ │ - 506public: │ │ │ │ │ -507 explicit plpgsql_no_data_found( │ │ │ │ │ - 508 const std::string &err, │ │ │ │ │ - 509 const std::string &Q="", │ │ │ │ │ - 510 const char sqlstate[]=nullptr) : │ │ │ │ │ - 511 plpgsql_error{err, Q, sqlstate} {} │ │ │ │ │ - 512}; │ │ │ │ │ - 513 │ │ │ │ │ -514class PQXX_LIBEXPORT plpgsql_too_many_rows : public plpgsql_error │ │ │ │ │ - 515{ │ │ │ │ │ - 516public: │ │ │ │ │ -517 explicit plpgsql_too_many_rows( │ │ │ │ │ - 518 const std::string &err, │ │ │ │ │ - 519 const std::string &Q="", │ │ │ │ │ - 520 const char sqlstate[]=nullptr) : │ │ │ │ │ - 521 plpgsql_error{err, Q, sqlstate} {} │ │ │ │ │ - 522}; │ │ │ │ │ - 523 │ │ │ │ │ - 528} │ │ │ │ │ - 529 │ │ │ │ │ - 530#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 531 │ │ │ │ │ - 532#endif │ │ │ │ │ -std │ │ │ │ │ -STL namespace. │ │ │ │ │ + 25 │ │ │ │ │ +56enum isolation_level │ │ │ │ │ + 57{ │ │ │ │ │ + 58 // read_uncommitted, │ │ │ │ │ +59 read_committed, │ │ │ │ │ +60 repeatable_read, │ │ │ │ │ + 61 serializable │ │ │ │ │ +62}; │ │ │ │ │ + 63 │ │ │ │ │ +65template struct isolation_traits │ │ │ │ │ + 66{ │ │ │ │ │ +67 static constexpr isolation_level level() noexcept { return LEVEL; } │ │ │ │ │ +68 static constexpr const char *name() noexcept; │ │ │ │ │ + 69}; │ │ │ │ │ + 70 │ │ │ │ │ + 71 │ │ │ │ │ + 72template<> │ │ │ │ │ +73inline constexpr const char *isolation_traits::name() │ │ │ │ │ +noexcept │ │ │ │ │ + 74 { return "READ COMMITTED"; } │ │ │ │ │ + 75 │ │ │ │ │ + 76template<> │ │ │ │ │ +77inline constexpr const char *isolation_traits::name() │ │ │ │ │ +noexcept │ │ │ │ │ + 78 { return "REPEATABLE READ"; } │ │ │ │ │ + 79 │ │ │ │ │ + 80template<> │ │ │ │ │ +81inline constexpr const char *isolation_traits::name() noexcept │ │ │ │ │ + 82 { return "SERIALIZABLE"; } │ │ │ │ │ + 83 │ │ │ │ │ + 84} │ │ │ │ │ + 85 │ │ │ │ │ + 86#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 87#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::pqxx_exception │ │ │ │ │ -Mixin base class to identify libpqxx-specific exception types. │ │ │ │ │ -Definition: except.hxx:56 │ │ │ │ │ -pqxx::pqxx_exception::base │ │ │ │ │ -virtual PQXX_CONST const std::exception & base() const noexcept=0 │ │ │ │ │ -Return std::exception base-class object. │ │ │ │ │ -pqxx::failure │ │ │ │ │ -Run-time failure encountered by libpqxx, similar to std::runtime_error. │ │ │ │ │ -Definition: except.hxx:91 │ │ │ │ │ -pqxx::broken_connection │ │ │ │ │ -Exception class for lost or failed backend connection. │ │ │ │ │ -Definition: except.hxx:119 │ │ │ │ │ -pqxx::sql_error │ │ │ │ │ -Exception class for failed queries. │ │ │ │ │ -Definition: except.hxx:131 │ │ │ │ │ -pqxx::in_doubt_error │ │ │ │ │ -"Help, I don't know whether transaction was committed successfully!" │ │ │ │ │ -Definition: except.hxx:160 │ │ │ │ │ -pqxx::transaction_rollback │ │ │ │ │ -The backend saw itself forced to roll back the ongoing transaction. │ │ │ │ │ -Definition: except.hxx:168 │ │ │ │ │ -pqxx::serialization_failure │ │ │ │ │ -Transaction failed to serialize. Please retry it. │ │ │ │ │ -Definition: except.hxx:184 │ │ │ │ │ -pqxx::statement_completion_unknown │ │ │ │ │ -We can't tell whether our last statement succeeded. │ │ │ │ │ -Definition: except.hxx:192 │ │ │ │ │ -pqxx::deadlock_detected │ │ │ │ │ -The ongoing transaction has deadlocked. Retrying it may help. │ │ │ │ │ -Definition: except.hxx:200 │ │ │ │ │ -pqxx::internal_error │ │ │ │ │ -Internal error in libpqxx library. │ │ │ │ │ -Definition: except.hxx:209 │ │ │ │ │ -pqxx::usage_error │ │ │ │ │ -Error in usage of libpqxx library, similar to std::logic_error. │ │ │ │ │ -Definition: except.hxx:220 │ │ │ │ │ -pqxx::argument_error │ │ │ │ │ -Invalid argument passed to libpqxx, similar to std::invalid_argument. │ │ │ │ │ -Definition: except.hxx:231 │ │ │ │ │ -pqxx::conversion_error │ │ │ │ │ -Value conversion failed, e.g. when converting "Hello" to int. │ │ │ │ │ -Definition: except.hxx:242 │ │ │ │ │ -pqxx::range_error │ │ │ │ │ -Something is out of range, similar to std::out_of_range. │ │ │ │ │ -Definition: except.hxx:253 │ │ │ │ │ -pqxx::unexpected_rows │ │ │ │ │ -Query returned an unexpected number of rows. │ │ │ │ │ -Definition: except.hxx:263 │ │ │ │ │ -pqxx::unexpected_rows::unexpected_rows │ │ │ │ │ -unexpected_rows(const std::string &msg) │ │ │ │ │ -Definition: except.hxx:267 │ │ │ │ │ -pqxx::feature_not_supported │ │ │ │ │ -Database feature not supported in current setup. │ │ │ │ │ -Definition: except.hxx:273 │ │ │ │ │ -pqxx::feature_not_supported::feature_not_supported │ │ │ │ │ -feature_not_supported(const std::string &err, const std::string &Q="", const │ │ │ │ │ -char sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:275 │ │ │ │ │ -pqxx::data_exception │ │ │ │ │ -Error in data provided to SQL statement. │ │ │ │ │ -Definition: except.hxx:284 │ │ │ │ │ -pqxx::data_exception::data_exception │ │ │ │ │ -data_exception(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:286 │ │ │ │ │ -pqxx::integrity_constraint_violation │ │ │ │ │ -Definition: except.hxx:294 │ │ │ │ │ -pqxx::integrity_constraint_violation::integrity_constraint_violation │ │ │ │ │ -integrity_constraint_violation(const std::string &err, const std::string &Q="", │ │ │ │ │ -const char sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:296 │ │ │ │ │ -pqxx::restrict_violation │ │ │ │ │ -Definition: except.hxx:305 │ │ │ │ │ -pqxx::restrict_violation::restrict_violation │ │ │ │ │ -restrict_violation(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:307 │ │ │ │ │ -pqxx::not_null_violation │ │ │ │ │ -Definition: except.hxx:316 │ │ │ │ │ -pqxx::not_null_violation::not_null_violation │ │ │ │ │ -not_null_violation(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:318 │ │ │ │ │ -pqxx::foreign_key_violation │ │ │ │ │ -Definition: except.hxx:327 │ │ │ │ │ -pqxx::foreign_key_violation::foreign_key_violation │ │ │ │ │ -foreign_key_violation(const std::string &err, const std::string &Q="", const │ │ │ │ │ -char sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:329 │ │ │ │ │ -pqxx::unique_violation │ │ │ │ │ -Definition: except.hxx:338 │ │ │ │ │ -pqxx::unique_violation::unique_violation │ │ │ │ │ -unique_violation(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:340 │ │ │ │ │ -pqxx::check_violation │ │ │ │ │ -Definition: except.hxx:349 │ │ │ │ │ -pqxx::check_violation::check_violation │ │ │ │ │ -check_violation(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:351 │ │ │ │ │ -pqxx::invalid_cursor_state │ │ │ │ │ -Definition: except.hxx:359 │ │ │ │ │ -pqxx::invalid_cursor_state::invalid_cursor_state │ │ │ │ │ -invalid_cursor_state(const std::string &err, const std::string &Q="", const │ │ │ │ │ -char sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:361 │ │ │ │ │ -pqxx::invalid_sql_statement_name │ │ │ │ │ -Definition: except.hxx:369 │ │ │ │ │ -pqxx::invalid_sql_statement_name::invalid_sql_statement_name │ │ │ │ │ -invalid_sql_statement_name(const std::string &err, const std::string &Q="", │ │ │ │ │ -const char sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:371 │ │ │ │ │ -pqxx::invalid_cursor_name │ │ │ │ │ -Definition: except.hxx:379 │ │ │ │ │ -pqxx::invalid_cursor_name::invalid_cursor_name │ │ │ │ │ -invalid_cursor_name(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:381 │ │ │ │ │ -pqxx::syntax_error │ │ │ │ │ -Definition: except.hxx:389 │ │ │ │ │ -pqxx::syntax_error::error_position │ │ │ │ │ -const int error_position │ │ │ │ │ -Approximate position in string where error occurred, or -1 if unknown. │ │ │ │ │ -Definition: except.hxx:392 │ │ │ │ │ -pqxx::syntax_error::syntax_error │ │ │ │ │ -syntax_error(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr, int pos=-1) │ │ │ │ │ -Definition: except.hxx:394 │ │ │ │ │ -pqxx::undefined_column │ │ │ │ │ -Definition: except.hxx:403 │ │ │ │ │ -pqxx::undefined_column::undefined_column │ │ │ │ │ -undefined_column(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:405 │ │ │ │ │ -pqxx::undefined_function │ │ │ │ │ -Definition: except.hxx:413 │ │ │ │ │ -pqxx::undefined_function::undefined_function │ │ │ │ │ -undefined_function(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:415 │ │ │ │ │ -pqxx::undefined_table │ │ │ │ │ -Definition: except.hxx:423 │ │ │ │ │ -pqxx::undefined_table::undefined_table │ │ │ │ │ -undefined_table(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:425 │ │ │ │ │ -pqxx::insufficient_privilege │ │ │ │ │ -Definition: except.hxx:433 │ │ │ │ │ -pqxx::insufficient_privilege::insufficient_privilege │ │ │ │ │ -insufficient_privilege(const std::string &err, const std::string &Q="", const │ │ │ │ │ -char sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:435 │ │ │ │ │ -pqxx::insufficient_resources │ │ │ │ │ -Resource shortage on the server. │ │ │ │ │ -Definition: except.hxx:444 │ │ │ │ │ -pqxx::insufficient_resources::insufficient_resources │ │ │ │ │ -insufficient_resources(const std::string &err, const std::string &Q="", const │ │ │ │ │ -char sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:446 │ │ │ │ │ -pqxx::disk_full │ │ │ │ │ -Definition: except.hxx:454 │ │ │ │ │ -pqxx::disk_full::disk_full │ │ │ │ │ -disk_full(const std::string &err, const std::string &Q="", const char sqlstate │ │ │ │ │ -[]=nullptr) │ │ │ │ │ -Definition: except.hxx:456 │ │ │ │ │ -pqxx::out_of_memory │ │ │ │ │ -Definition: except.hxx:464 │ │ │ │ │ -pqxx::out_of_memory::out_of_memory │ │ │ │ │ -out_of_memory(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:466 │ │ │ │ │ -pqxx::too_many_connections │ │ │ │ │ -Definition: except.hxx:474 │ │ │ │ │ -pqxx::too_many_connections::too_many_connections │ │ │ │ │ -too_many_connections(const std::string &err) │ │ │ │ │ -Definition: except.hxx:476 │ │ │ │ │ -pqxx::plpgsql_error │ │ │ │ │ -PL/pgSQL error. │ │ │ │ │ -Definition: except.hxx:484 │ │ │ │ │ -pqxx::plpgsql_error::plpgsql_error │ │ │ │ │ -plpgsql_error(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:486 │ │ │ │ │ -pqxx::plpgsql_raise │ │ │ │ │ -Exception raised in PL/pgSQL procedure. │ │ │ │ │ -Definition: except.hxx:495 │ │ │ │ │ -pqxx::plpgsql_raise::plpgsql_raise │ │ │ │ │ -plpgsql_raise(const std::string &err, const std::string &Q="", const char │ │ │ │ │ -sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:497 │ │ │ │ │ -pqxx::plpgsql_no_data_found │ │ │ │ │ -Definition: except.hxx:505 │ │ │ │ │ -pqxx::plpgsql_no_data_found::plpgsql_no_data_found │ │ │ │ │ -plpgsql_no_data_found(const std::string &err, const std::string &Q="", const │ │ │ │ │ -char sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:507 │ │ │ │ │ -pqxx::plpgsql_too_many_rows │ │ │ │ │ -Definition: except.hxx:515 │ │ │ │ │ -pqxx::plpgsql_too_many_rows::plpgsql_too_many_rows │ │ │ │ │ -plpgsql_too_many_rows(const std::string &err, const std::string &Q="", const │ │ │ │ │ -char sqlstate[]=nullptr) │ │ │ │ │ -Definition: except.hxx:517 │ │ │ │ │ +pqxx::isolation_level │ │ │ │ │ +isolation_level │ │ │ │ │ +Transaction isolation levels. │ │ │ │ │ +Definition: isolation.hxx:57 │ │ │ │ │ +pqxx::serializable │ │ │ │ │ +@ serializable │ │ │ │ │ +Definition: isolation.hxx:61 │ │ │ │ │ +pqxx::read_committed │ │ │ │ │ +@ read_committed │ │ │ │ │ +Definition: isolation.hxx:59 │ │ │ │ │ +pqxx::repeatable_read │ │ │ │ │ +@ repeatable_read │ │ │ │ │ +Definition: isolation.hxx:60 │ │ │ │ │ +pqxx::isolation_traits │ │ │ │ │ +Traits class to describe an isolation level; primarly for libpqxx's own use. │ │ │ │ │ +Definition: isolation.hxx:66 │ │ │ │ │ +pqxx::isolation_traits::name │ │ │ │ │ +static constexpr const char * name() noexcept │ │ │ │ │ +pqxx::isolation_traits::level │ │ │ │ │ +static constexpr isolation_level level() noexcept │ │ │ │ │ +Definition: isolation.hxx:67 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * except.hxx │ │ │ │ │ + * isolation.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00119_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: errorhandler.hxx Source File │ │ │ │ +libpqxx: transaction.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,83 +55,105 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
errorhandler.hxx
│ │ │ │ +
transaction.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_ERRORHANDLER
│ │ │ │ -
14#define PQXX_H_ERRORHANDLER
│ │ │ │ -
15
│ │ │ │ -
16#include "pqxx/compiler-public.hxx"
│ │ │ │ -
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include "pqxx/types.hxx"
│ │ │ │ +
12#ifndef PQXX_H_TRANSACTION
│ │ │ │ +
13#define PQXX_H_TRANSACTION
│ │ │ │ +
14
│ │ │ │ +
15#include "pqxx/compiler-public.hxx"
│ │ │ │ +
16#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
17
│ │ │ │ +
18#include "pqxx/dbtransaction.hxx"
│ │ │ │ +
19
│ │ │ │
20
│ │ │ │ -
21
│ │ │ │ -
22namespace pqxx
│ │ │ │ -
23{
│ │ │ │ -
24namespace internal
│ │ │ │ -
25{
│ │ │ │ -
26namespace gate
│ │ │ │ -
27{
│ │ │ │ -
28class errorhandler_connection_base;
│ │ │ │ -
29}
│ │ │ │ -
30}
│ │ │ │ -
31
│ │ │ │ +
21/* Methods tested in eg. self-test program test1 are marked with "//[t01]"
│ │ │ │ +
22 */
│ │ │ │ +
23
│ │ │ │ +
24
│ │ │ │ +
25namespace pqxx
│ │ │ │ +
26{
│ │ │ │ +
27
│ │ │ │ +
28namespace internal
│ │ │ │ +
29{
│ │ │ │ +
31class PQXX_LIBEXPORT basic_transaction : public dbtransaction
│ │ │ │ +
32{
│ │ │ │ +
33protected:
│ │ │ │ +
34 basic_transaction( //[t01]
│ │ │ │ + │ │ │ │ +
36 const std::string &IsolationLevel,
│ │ │ │ + │ │ │ │
38
│ │ │ │ -
54class PQXX_LIBEXPORT errorhandler
│ │ │ │ -
55{
│ │ │ │ -
56public:
│ │ │ │ -
57 explicit errorhandler(connection_base &);
│ │ │ │ -
58 virtual ~errorhandler();
│ │ │ │ -
59
│ │ │ │ -
61
│ │ │ │ -
65 virtual bool operator()(const char msg[]) noexcept =0;
│ │ │ │ -
66
│ │ │ │ -
67private:
│ │ │ │ -
68 connection_base *m_home;
│ │ │ │ -
69
│ │ │ │ -
70 friend class internal::gate::errorhandler_connection_base;
│ │ │ │ -
71 void unregister() noexcept;
│ │ │ │ -
72
│ │ │ │ -
73 errorhandler() =delete;
│ │ │ │ -
74 errorhandler(const errorhandler &) =delete;
│ │ │ │ -
75 errorhandler &operator=(const errorhandler &) =delete;
│ │ │ │ -
76};
│ │ │ │ -
77
│ │ │ │ -
78
│ │ │ │ - │ │ │ │ -
81{
│ │ │ │ -
82public:
│ │ │ │ - │ │ │ │ -
84
│ │ │ │ -
85 virtual bool operator()(const char[]) noexcept override { return false; }
│ │ │ │ -
86};
│ │ │ │ -
87
│ │ │ │ -
92} // namespace pqxx
│ │ │ │ -
93
│ │ │ │ -
94#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
95
│ │ │ │ -
96#endif
│ │ │ │ +
39private:
│ │ │ │ +
40 virtual void do_commit() override; //[t01]
│ │ │ │ +
41};
│ │ │ │ +
42} // namespace internal
│ │ │ │ +
43
│ │ │ │ +
44
│ │ │ │ +
49
│ │ │ │ +
51
│ │ │ │ +
79template<
│ │ │ │ +
80 isolation_level ISOLATIONLEVEL=read_committed,
│ │ │ │ + │ │ │ │ + │ │ │ │ +
83{
│ │ │ │ +
84public:
│ │ │ │ + │ │ │ │ +
86
│ │ │ │ +
88
│ │ │ │ +
93 explicit transaction(connection_base &C, const std::string &TName): //[t01]
│ │ │ │ +
94 namedclass{fullname("transaction", isolation_tag::name()), TName},
│ │ │ │ +
95 internal::basic_transaction(C, isolation_tag::name(), READWRITE)
│ │ │ │ +
96 { Begin(); }
│ │ │ │ +
97
│ │ │ │ +
98 explicit transaction(connection_base &C) : //[t01]
│ │ │ │ +
99 transaction(C, "") {}
│ │ │ │ +
100
│ │ │ │ +
101 virtual ~transaction() noexcept
│ │ │ │ +
102 { End(); }
│ │ │ │ +
103};
│ │ │ │ +
104
│ │ │ │ +
105
│ │ │ │ + │ │ │ │ +
108
│ │ │ │ + │ │ │ │ +
111
│ │ │ │ +
113}
│ │ │ │ +
114
│ │ │ │ +
115#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
116#endif
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ +
readwrite_policy
Definition: dbtransaction.hxx:25
│ │ │ │ +
@ read_write
Definition: dbtransaction.hxx:27
│ │ │ │ +
isolation_level
Transaction isolation levels.
Definition: isolation.hxx:57
│ │ │ │ +
@ read_committed
Definition: isolation.hxx:59
│ │ │ │
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:140
│ │ │ │ -
Base class for error-handler callbacks.
Definition: errorhandler.hxx:55
│ │ │ │ -
virtual bool operator()(const char msg[]) noexcept=0
Define in subclass: receive an error or warning message from the database.
│ │ │ │ -
An error handler that suppresses any previously registered error handlers.
Definition: errorhandler.hxx:81
│ │ │ │ -
virtual bool operator()(const char[]) noexcept override
Define in subclass: receive an error or warning message from the database.
Definition: errorhandler.hxx:85
│ │ │ │ -
quiet_errorhandler(connection_base &conn)
Definition: errorhandler.hxx:83
│ │ │ │ +
Abstract base class responsible for bracketing a backend transaction.
Definition: dbtransaction.hxx:63
│ │ │ │ +
static std::string fullname(const std::string &ttype, const std::string &isolation)
Definition: dbtransaction.cxx:95
│ │ │ │ +
Traits class to describe an isolation level; primarly for libpqxx's own use.
Definition: isolation.hxx:66
│ │ │ │ +
Helper base class for the transaction class template.
Definition: transaction.hxx:32
│ │ │ │ +
basic_transaction(connection_base &C, const std::string &IsolationLevel, readwrite_policy)
Definition: transaction.cxx:20
│ │ │ │ +
Standard back-end transaction, templatized on isolation level.
Definition: transaction.hxx:83
│ │ │ │ +
transaction(connection_base &C, const std::string &TName)
Create a transaction.
Definition: transaction.hxx:93
│ │ │ │ +
transaction(connection_base &C)
Definition: transaction.hxx:98
│ │ │ │ +
virtual ~transaction() noexcept
Definition: transaction.hxx:101
│ │ │ │ +
void Begin()
Begin transaction (to be called by implementing class)
Definition: transaction_base.cxx:386
│ │ │ │ +
void End() noexcept
End transaction. To be called by implementing class' destructor.
Definition: transaction_base.cxx:408
│ │ │ │ +
namedclass(const std::string &Classname)
Definition: util.hxx:236
│ │ │ │ +
const std::string & name() const noexcept
Object name, or the empty string if no name was given.
Definition: util.hxx:249
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,89 +1,141 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -errorhandler.hxx │ │ │ │ │ +transaction.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_ERRORHANDLER │ │ │ │ │ - 14#define PQXX_H_ERRORHANDLER │ │ │ │ │ - 15 │ │ │ │ │ - 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ - 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include "pqxx/types.hxx" │ │ │ │ │ + 12#ifndef PQXX_H_TRANSACTION │ │ │ │ │ + 13#define PQXX_H_TRANSACTION │ │ │ │ │ + 14 │ │ │ │ │ + 15#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 16#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 17 │ │ │ │ │ + 18#include "pqxx/dbtransaction.hxx" │ │ │ │ │ + 19 │ │ │ │ │ 20 │ │ │ │ │ - 21 │ │ │ │ │ - 22namespace pqxx │ │ │ │ │ - 23{ │ │ │ │ │ - 24namespace internal │ │ │ │ │ - 25{ │ │ │ │ │ - 26namespace gate │ │ │ │ │ - 27{ │ │ │ │ │ - 28class errorhandler_connection_base; │ │ │ │ │ - 29} │ │ │ │ │ - 30} │ │ │ │ │ - 31 │ │ │ │ │ + 21/* Methods tested in eg. self-test program test1 are marked with "//[t01]" │ │ │ │ │ + 22 */ │ │ │ │ │ + 23 │ │ │ │ │ + 24 │ │ │ │ │ + 25namespace pqxx │ │ │ │ │ + 26{ │ │ │ │ │ + 27 │ │ │ │ │ + 28namespace internal │ │ │ │ │ + 29{ │ │ │ │ │ +31class PQXX_LIBEXPORT basic_transaction : public dbtransaction │ │ │ │ │ + 32{ │ │ │ │ │ + 33protected: │ │ │ │ │ + 34 basic_transaction( //[t01] │ │ │ │ │ + 35 connection_base &C, │ │ │ │ │ + 36 const std::string &IsolationLevel, │ │ │ │ │ + 37 readwrite_policy); │ │ │ │ │ 38 │ │ │ │ │ -54class PQXX_LIBEXPORT errorhandler │ │ │ │ │ - 55{ │ │ │ │ │ - 56public: │ │ │ │ │ - 57 explicit errorhandler(connection_base &); │ │ │ │ │ - 58 virtual ~errorhandler(); │ │ │ │ │ - 59 │ │ │ │ │ - 61 │ │ │ │ │ -65 virtual bool operator()(const char msg[]) noexcept =0; │ │ │ │ │ - 66 │ │ │ │ │ - 67private: │ │ │ │ │ - 68 connection_base *m_home; │ │ │ │ │ - 69 │ │ │ │ │ -70 friend class internal::gate::errorhandler_connection_base; │ │ │ │ │ - 71 void unregister() noexcept; │ │ │ │ │ - 72 │ │ │ │ │ - 73 errorhandler() =delete; │ │ │ │ │ - 74 errorhandler(const errorhandler &) =delete; │ │ │ │ │ - 75 errorhandler &operator=(const errorhandler &) =delete; │ │ │ │ │ - 76}; │ │ │ │ │ - 77 │ │ │ │ │ - 78 │ │ │ │ │ -80class quiet_errorhandler : public errorhandler │ │ │ │ │ - 81{ │ │ │ │ │ - 82public: │ │ │ │ │ -83 quiet_errorhandler(connection_base &conn) : errorhandler{conn} {} │ │ │ │ │ - 84 │ │ │ │ │ -85 virtual bool operator()(const char[]) noexcept override { return false; } │ │ │ │ │ - 86}; │ │ │ │ │ - 87 │ │ │ │ │ - 92} // namespace pqxx │ │ │ │ │ - 93 │ │ │ │ │ - 94#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 95 │ │ │ │ │ - 96#endif │ │ │ │ │ + 39private: │ │ │ │ │ + 40 virtual void do_commit() override; //[t01] │ │ │ │ │ + 41}; │ │ │ │ │ + 42} // namespace internal │ │ │ │ │ + 43 │ │ │ │ │ + 44 │ │ │ │ │ + 49 │ │ │ │ │ + 51 │ │ │ │ │ + 79template< │ │ │ │ │ + 80 isolation_level ISOLATIONLEVEL=read_committed, │ │ │ │ │ + 81 readwrite_policy READWRITE=read_write> │ │ │ │ │ +82class transaction : public internal::basic_transaction │ │ │ │ │ + 83{ │ │ │ │ │ + 84public: │ │ │ │ │ +85 using isolation_tag = isolation_traits; │ │ │ │ │ + 86 │ │ │ │ │ + 88 │ │ │ │ │ +93 explicit transaction(connection_base &C, const std::string &TName): //[t01] │ │ │ │ │ + 94 namedclass{fullname("transaction", isolation_tag::name()), TName}, │ │ │ │ │ + 95 internal::basic_transaction(C, isolation_tag::name(), READWRITE) │ │ │ │ │ + 96 { Begin(); } │ │ │ │ │ + 97 │ │ │ │ │ +98 explicit transaction(connection_base &C) : //[t01] │ │ │ │ │ + 99 transaction(C, "") {} │ │ │ │ │ + 100 │ │ │ │ │ +101 virtual ~transaction() noexcept │ │ │ │ │ + 102 { End(); } │ │ │ │ │ + 103}; │ │ │ │ │ + 104 │ │ │ │ │ + 105 │ │ │ │ │ +107using work = transaction<>; │ │ │ │ │ + 108 │ │ │ │ │ +110using read_transaction = transaction; │ │ │ │ │ + 111 │ │ │ │ │ + 113} │ │ │ │ │ + 114 │ │ │ │ │ + 115#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 116#endif │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ +pqxx::readwrite_policy │ │ │ │ │ +readwrite_policy │ │ │ │ │ +Definition: dbtransaction.hxx:25 │ │ │ │ │ +pqxx::read_write │ │ │ │ │ +@ read_write │ │ │ │ │ +Definition: dbtransaction.hxx:27 │ │ │ │ │ +pqxx::isolation_level │ │ │ │ │ +isolation_level │ │ │ │ │ +Transaction isolation levels. │ │ │ │ │ +Definition: isolation.hxx:57 │ │ │ │ │ +pqxx::read_committed │ │ │ │ │ +@ read_committed │ │ │ │ │ +Definition: isolation.hxx:59 │ │ │ │ │ pqxx::connection_base │ │ │ │ │ connection_base abstract base class; represents a connection to a database. │ │ │ │ │ Definition: connection_base.hxx:140 │ │ │ │ │ -pqxx::errorhandler │ │ │ │ │ -Base class for error-handler callbacks. │ │ │ │ │ -Definition: errorhandler.hxx:55 │ │ │ │ │ -pqxx::errorhandler::operator() │ │ │ │ │ -virtual bool operator()(const char msg[]) noexcept=0 │ │ │ │ │ -Define in subclass: receive an error or warning message from the database. │ │ │ │ │ -pqxx::quiet_errorhandler │ │ │ │ │ -An error handler that suppresses any previously registered error handlers. │ │ │ │ │ -Definition: errorhandler.hxx:81 │ │ │ │ │ -pqxx::quiet_errorhandler::operator() │ │ │ │ │ -virtual bool operator()(const char[]) noexcept override │ │ │ │ │ -Define in subclass: receive an error or warning message from the database. │ │ │ │ │ -Definition: errorhandler.hxx:85 │ │ │ │ │ -pqxx::quiet_errorhandler::quiet_errorhandler │ │ │ │ │ -quiet_errorhandler(connection_base &conn) │ │ │ │ │ -Definition: errorhandler.hxx:83 │ │ │ │ │ +pqxx::dbtransaction │ │ │ │ │ +Abstract base class responsible for bracketing a backend transaction. │ │ │ │ │ +Definition: dbtransaction.hxx:63 │ │ │ │ │ +pqxx::dbtransaction::fullname │ │ │ │ │ +static std::string fullname(const std::string &ttype, const std::string │ │ │ │ │ +&isolation) │ │ │ │ │ +Definition: dbtransaction.cxx:95 │ │ │ │ │ +pqxx::isolation_traits │ │ │ │ │ +Traits class to describe an isolation level; primarly for libpqxx's own use. │ │ │ │ │ +Definition: isolation.hxx:66 │ │ │ │ │ +pqxx::internal::basic_transaction │ │ │ │ │ +Helper base class for the transaction class template. │ │ │ │ │ +Definition: transaction.hxx:32 │ │ │ │ │ +pqxx::internal::basic_transaction::basic_transaction │ │ │ │ │ +basic_transaction(connection_base &C, const std::string &IsolationLevel, │ │ │ │ │ +readwrite_policy) │ │ │ │ │ +Definition: transaction.cxx:20 │ │ │ │ │ +pqxx::transaction │ │ │ │ │ +Standard back-end transaction, templatized on isolation level. │ │ │ │ │ +Definition: transaction.hxx:83 │ │ │ │ │ +pqxx::transaction::transaction │ │ │ │ │ +transaction(connection_base &C, const std::string &TName) │ │ │ │ │ +Create a transaction. │ │ │ │ │ +Definition: transaction.hxx:93 │ │ │ │ │ +pqxx::transaction::transaction │ │ │ │ │ +transaction(connection_base &C) │ │ │ │ │ +Definition: transaction.hxx:98 │ │ │ │ │ +pqxx::transaction::~transaction │ │ │ │ │ +virtual ~transaction() noexcept │ │ │ │ │ +Definition: transaction.hxx:101 │ │ │ │ │ +pqxx::transaction_base::Begin │ │ │ │ │ +void Begin() │ │ │ │ │ +Begin transaction (to be called by implementing class) │ │ │ │ │ +Definition: transaction_base.cxx:386 │ │ │ │ │ +pqxx::transaction_base::End │ │ │ │ │ +void End() noexcept │ │ │ │ │ +End transaction. To be called by implementing class' destructor. │ │ │ │ │ +Definition: transaction_base.cxx:408 │ │ │ │ │ +pqxx::internal::namedclass::namedclass │ │ │ │ │ +namedclass(const std::string &Classname) │ │ │ │ │ +Definition: util.hxx:236 │ │ │ │ │ +pqxx::internal::namedclass::name │ │ │ │ │ +const std::string & name() const noexcept │ │ │ │ │ +Object name, or the empty string if no name was given. │ │ │ │ │ +Definition: util.hxx:249 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * errorhandler.hxx │ │ │ │ │ + * transaction.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00122_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: result.hxx Source File │ │ │ │ +libpqxx: tablereader.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,224 +55,134 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
result.hxx
│ │ │ │ +
tablereader.hxx
│ │ │ │
│ │ │ │
│ │ │ │
1
│ │ │ │ -
13#ifndef PQXX_H_RESULT
│ │ │ │ -
14#define PQXX_H_RESULT
│ │ │ │ +
13#ifndef PQXX_H_TABLEREADER
│ │ │ │ +
14#define PQXX_H_TABLEREADER
│ │ │ │
15
│ │ │ │
16#include "pqxx/compiler-public.hxx"
│ │ │ │
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ -
18
│ │ │ │ -
19#include <ios>
│ │ │ │ -
20#include <memory>
│ │ │ │ -
21#include <stdexcept>
│ │ │ │ -
22
│ │ │ │ -
23#include "pqxx/except.hxx"
│ │ │ │ -
24#include "pqxx/types.hxx"
│ │ │ │ -
25#include "pqxx/util.hxx"
│ │ │ │ -
26
│ │ │ │ -
27#include "pqxx/internal/encodings.hxx"
│ │ │ │ -
28
│ │ │ │ -
29
│ │ │ │ -
30// Methods tested in eg. test module test01 are marked with "//[t01]".
│ │ │ │ -
31
│ │ │ │ -
32namespace pqxx
│ │ │ │ -
33{
│ │ │ │ -
34namespace internal
│ │ │ │ -
35{
│ │ │ │ -
36PQXX_LIBEXPORT void clear_result(const pq::PGresult *);
│ │ │ │ -
37
│ │ │ │ -
38namespace gate
│ │ │ │ -
39{
│ │ │ │ -
40class result_connection;
│ │ │ │ -
41class result_creation;
│ │ │ │ -
42class result_row;
│ │ │ │ -
43class result_sql_cursor;
│ │ │ │ -
44} // namespace internal::gate
│ │ │ │ -
45} // namespace internal
│ │ │ │ -
46
│ │ │ │ -
47
│ │ │ │ -
49
│ │ │ │ -
69class PQXX_LIBEXPORT result
│ │ │ │ -
70{
│ │ │ │ -
71public:
│ │ │ │ - │ │ │ │ - │ │ │ │ -
74 using reference = row;
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
80
│ │ │ │ -
81 result() noexcept : //[t03]
│ │ │ │ -
82 m_data(make_data_pointer()),
│ │ │ │ -
83 m_query(),
│ │ │ │ -
84 m_encoding(internal::encoding_group::MONOBYTE)
│ │ │ │ -
85 {}
│ │ │ │ -
86 result(const result &rhs) noexcept =default; //[t01]
│ │ │ │ -
87
│ │ │ │ -
88 result &operator=(const result &rhs) noexcept =default; //[t10]
│ │ │ │ -
89
│ │ │ │ -
94 bool operator==(const result &) const noexcept; //[t70]
│ │ │ │ -
95 bool operator!=(const result &rhs) const noexcept //[t70]
│ │ │ │ -
96 { return not operator==(rhs); }
│ │ │ │ +
18#include "pqxx/result.hxx"
│ │ │ │ +
19#include "pqxx/tablestream.hxx"
│ │ │ │ +
20
│ │ │ │ +
21
│ │ │ │ +
22namespace pqxx
│ │ │ │ +
23{
│ │ │ │ +
25
│ │ │ │ +
29class PQXX_LIBEXPORT tablereader : public tablestream
│ │ │ │ +
30{
│ │ │ │ +
31public:
│ │ │ │ +
32 PQXX_DEPRECATED tablereader(
│ │ │ │ + │ │ │ │ +
34 const std::string &Name,
│ │ │ │ +
35 const std::string &Null=std::string{});
│ │ │ │ +
36 template<typename ITER>
│ │ │ │ +
37 PQXX_DEPRECATED tablereader(
│ │ │ │ + │ │ │ │ +
39 const std::string &Name,
│ │ │ │ +
40 ITER begincolumns,
│ │ │ │ +
41 ITER endcolumns);
│ │ │ │ +
42 template<typename ITER>
│ │ │ │ +
43 PQXX_DEPRECATED tablereader(
│ │ │ │ + │ │ │ │ +
45 const std::string &Name,
│ │ │ │ +
46 ITER begincolumns,
│ │ │ │ +
47 ITER endcolumns,
│ │ │ │ +
48 const std::string &Null);
│ │ │ │ +
49 ~tablereader() noexcept;
│ │ │ │ +
50 template<typename TUPLE> tablereader &operator>>(TUPLE &);
│ │ │ │ +
51 operator bool() const noexcept { return not m_done; }
│ │ │ │ +
52 bool operator!() const noexcept { return m_done; }
│ │ │ │ +
53 bool get_raw_line(std::string &Line);
│ │ │ │ +
54 template<typename TUPLE>
│ │ │ │ +
55 void tokenize(std::string, TUPLE &) const;
│ │ │ │ +
56 virtual void complete() override;
│ │ │ │ +
57private:
│ │ │ │ +
58 void set_up(
│ │ │ │ + │ │ │ │ +
60 const std::string &RName,
│ │ │ │ +
61 const std::string &Columns=std::string{});
│ │ │ │ +
62 PQXX_PRIVATE void reader_close();
│ │ │ │ +
63 std::string extract_field(
│ │ │ │ +
64 const std::string &,
│ │ │ │ +
65 std::string::size_type &) const;
│ │ │ │ +
66 bool m_done;
│ │ │ │ +
67};
│ │ │ │ +
68
│ │ │ │ +
69
│ │ │ │ +
70template<typename ITER> inline
│ │ │ │ + │ │ │ │ + │ │ │ │ +
73 const std::string &Name,
│ │ │ │ +
74 ITER begincolumns,
│ │ │ │ +
75 ITER endcolumns) :
│ │ │ │ +
76 namedclass{Name, "tablereader"},
│ │ │ │ +
77 tablestream{T, std::string{}},
│ │ │ │ +
78 m_done{true}
│ │ │ │ +
79{
│ │ │ │ +
80 set_up(T, Name, columnlist(begincolumns, endcolumns));
│ │ │ │ +
81}
│ │ │ │ +
82
│ │ │ │ +
83
│ │ │ │ +
84template<typename ITER> inline
│ │ │ │ + │ │ │ │ + │ │ │ │ +
87 const std::string &Name,
│ │ │ │ +
88 ITER begincolumns,
│ │ │ │ +
89 ITER endcolumns,
│ │ │ │ +
90 const std::string &Null) :
│ │ │ │ +
91 namedclass{Name, "tablereader"},
│ │ │ │ +
92 tablestream{T, Null},
│ │ │ │ +
93 m_done{true}
│ │ │ │ +
94{
│ │ │ │ +
95 set_up(T, Name, columnlist(begincolumns, endcolumns));
│ │ │ │ +
96}
│ │ │ │ +
97
│ │ │ │
98
│ │ │ │ -
99 const_reverse_iterator rbegin() const; //[t75]
│ │ │ │ -
100 const_reverse_iterator crbegin() const;
│ │ │ │ -
101 const_reverse_iterator rend() const; //[t75]
│ │ │ │ -
102 const_reverse_iterator crend() const;
│ │ │ │ -
103
│ │ │ │ -
104 const_iterator begin() const noexcept; //[t01]
│ │ │ │ -
105 const_iterator cbegin() const noexcept;
│ │ │ │ -
106 inline const_iterator end() const noexcept; //[t01]
│ │ │ │ -
107 inline const_iterator cend() const noexcept;
│ │ │ │ -
108
│ │ │ │ -
109 reference front() const noexcept; //[t74]
│ │ │ │ -
110 reference back() const noexcept; //[t75]
│ │ │ │ -
111
│ │ │ │ -
112 PQXX_PURE size_type size() const noexcept; //[t02]
│ │ │ │ -
113 PQXX_PURE bool empty() const noexcept; //[t11]
│ │ │ │ -
114 size_type capacity() const noexcept { return size(); } //[t20]
│ │ │ │ -
115
│ │ │ │ -
116 void swap(result &) noexcept; //[t77]
│ │ │ │ -
117
│ │ │ │ -
118 const row operator[](size_type i) const noexcept; //[t02]
│ │ │ │ -
119 const row at(size_type) const; //[t10]
│ │ │ │ -
120
│ │ │ │ -
121 void clear() noexcept { m_data.reset(); m_query = nullptr; } //[t20]
│ │ │ │ -
122
│ │ │ │ -
128 PQXX_PURE row_size_type columns() const noexcept; //[t11]
│ │ │ │ -
129
│ │ │ │ -
131 row_size_type column_number(const char ColName[]) const; //[t11]
│ │ │ │ -
132
│ │ │ │ -
134 row_size_type column_number(const std::string &Name) const //[t11]
│ │ │ │ -
135 {return column_number(Name.c_str());}
│ │ │ │ -
136
│ │ │ │ -
138 const char *column_name(row_size_type Number) const; //[t11]
│ │ │ │ -
139
│ │ │ │ -
141 oid column_type(row_size_type ColNum) const; //[t07]
│ │ │ │ -
143 oid column_type(int ColNum) const //[t07]
│ │ │ │ -
144 { return column_type(row_size_type(ColNum)); }
│ │ │ │ -
145
│ │ │ │ -
147 oid column_type(const std::string &ColName) const //[t07]
│ │ │ │ -
148 { return column_type(column_number(ColName)); }
│ │ │ │ -
149
│ │ │ │ -
151 oid column_type(const char ColName[]) const //[t07]
│ │ │ │ -
152 { return column_type(column_number(ColName)); }
│ │ │ │ -
153
│ │ │ │ -
155 oid column_table(row_size_type ColNum) const; //[t02]
│ │ │ │ -
156
│ │ │ │ -
158 oid column_table(int ColNum) const //[t02]
│ │ │ │ -
159 { return column_table(row_size_type(ColNum)); }
│ │ │ │ -
160
│ │ │ │ -
162 oid column_table(const std::string &ColName) const //[t02]
│ │ │ │ -
163 { return column_table(column_number(ColName)); }
│ │ │ │ -
164
│ │ │ │ -
166 row_size_type table_column(row_size_type ColNum) const; //[t93]
│ │ │ │ -
167
│ │ │ │ -
169 row_size_type table_column(int ColNum) const //[t93]
│ │ │ │ -
170 { return table_column(row_size_type(ColNum)); }
│ │ │ │ -
171
│ │ │ │ -
173 row_size_type table_column(const std::string &ColName) const //[t93]
│ │ │ │ -
174 { return table_column(column_number(ColName)); }
│ │ │ │ -
176
│ │ │ │ -
178 PQXX_PURE const std::string &query() const noexcept; //[t70]
│ │ │ │ -
179
│ │ │ │ -
181
│ │ │ │ -
184 PQXX_PURE oid inserted_oid() const; //[t13]
│ │ │ │ -
185
│ │ │ │ -
187
│ │ │ │ -
190 PQXX_PURE size_type affected_rows() const; //[t07]
│ │ │ │ -
191
│ │ │ │ -
192
│ │ │ │ -
193private:
│ │ │ │ -
194 using data_pointer = std::shared_ptr<const internal::pq::PGresult>;
│ │ │ │ -
195
│ │ │ │ -
197 data_pointer m_data;
│ │ │ │ -
198
│ │ │ │ -
200 static data_pointer make_data_pointer(
│ │ │ │ -
201 const internal::pq::PGresult *res=nullptr)
│ │ │ │ -
202 { return data_pointer{res, internal::clear_result}; }
│ │ │ │ -
203
│ │ │ │ -
205 std::shared_ptr<std::string> m_query;
│ │ │ │ -
206
│ │ │ │ -
207 internal::encoding_group m_encoding;
│ │ │ │ -
208
│ │ │ │ -
209 static const std::string s_empty_string;
│ │ │ │ -
210
│ │ │ │ -
211 friend class pqxx::field;
│ │ │ │ -
212 PQXX_PURE const char *GetValue(size_type Row, row_size_type Col) const;
│ │ │ │ -
213 PQXX_PURE bool get_is_null(size_type Row, row_size_type Col) const;
│ │ │ │ -
214 PQXX_PURE field_size_type get_length(
│ │ │ │ -
215 size_type,
│ │ │ │ -
216 row_size_type) const noexcept;
│ │ │ │ -
217
│ │ │ │ -
218 friend class pqxx::internal::gate::result_creation;
│ │ │ │ -
219 result(
│ │ │ │ -
220 internal::pq::PGresult *rhs,
│ │ │ │ -
221 const std::string &Query,
│ │ │ │ -
222 internal::encoding_group enc);
│ │ │ │ -
223
│ │ │ │ -
224 PQXX_PRIVATE void check_status() const;
│ │ │ │ -
225
│ │ │ │ -
226 friend class pqxx::internal::gate::result_connection;
│ │ │ │ -
227 friend class pqxx::internal::gate::result_row;
│ │ │ │ -
228 bool operator!() const noexcept { return not m_data.get(); }
│ │ │ │ -
229 operator bool() const noexcept { return m_data.get() != nullptr; }
│ │ │ │ -
230
│ │ │ │ -
231 [[noreturn]] PQXX_PRIVATE void ThrowSQLError(
│ │ │ │ -
232 const std::string &Err,
│ │ │ │ -
233 const std::string &Query) const;
│ │ │ │ -
234 PQXX_PRIVATE PQXX_PURE int errorposition() const;
│ │ │ │ -
235 PQXX_PRIVATE std::string StatusError() const;
│ │ │ │ -
236
│ │ │ │ -
237 friend class pqxx::internal::gate::result_sql_cursor;
│ │ │ │ -
238 PQXX_PURE const char *cmd_status() const noexcept;
│ │ │ │ -
239};
│ │ │ │ -
240} // namespace pqxx
│ │ │ │ -
241#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ -
242#endif
│ │ │ │ +
99template<typename TUPLE>
│ │ │ │ +
100inline void tablereader::tokenize(std::string Line, TUPLE &T) const
│ │ │ │ +
101{
│ │ │ │ +
102 std::back_insert_iterator<TUPLE> ins = std::back_inserter(T);
│ │ │ │ +
103 std::string::size_type here = 0;
│ │ │ │ +
104 while (here < Line.size()) *ins++ = extract_field(Line, here);
│ │ │ │ +
105}
│ │ │ │ +
106
│ │ │ │ +
107
│ │ │ │ +
108template<typename TUPLE>
│ │ │ │ + │ │ │ │ +
110{
│ │ │ │ +
111 std::string Line;
│ │ │ │ +
112 if (get_raw_line(Line)) tokenize(Line, T);
│ │ │ │ +
113 return *this;
│ │ │ │ +
114}
│ │ │ │ +
115} // namespace pqxx
│ │ │ │ +
116
│ │ │ │ +
117#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
118#endif
│ │ │ │
STL namespace.
│ │ │ │
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ -
signed long result_difference_type
Difference between result sizes.
Definition: types.hxx:21
│ │ │ │ -
std::size_t field_size_type
Number of bytes in a field of database data.
Definition: types.hxx:30
│ │ │ │ -
unsigned long result_size_type
Number of rows in a result set.
Definition: types.hxx:18
│ │ │ │ -
unsigned int row_size_type
Number of fields in a row of database data.
Definition: types.hxx:24
│ │ │ │ -
void clear_result(const pq::PGresult *)
C++ wrapper for libpq's PQclear.
Definition: result.cxx:30
│ │ │ │ -
Reference to a field in a result set.
Definition: field.hxx:50
│ │ │ │ -
Result set containing data returned by a query or command.
Definition: result.hxx:70
│ │ │ │ -
oid column_type(const char ColName[]) const
Type of given column.
Definition: result.hxx:151
│ │ │ │ -
row_size_type table_column(int ColNum) const
What column in its table did this column come from?
Definition: result.hxx:169
│ │ │ │ -
result() noexcept
Definition: result.hxx:81
│ │ │ │ -
oid column_type(const std::string &ColName) const
Type of given column.
Definition: result.hxx:147
│ │ │ │ -
result_size_type size_type
Definition: result.hxx:72
│ │ │ │ -
oid column_type(int ColNum) const
Type of given column.
Definition: result.hxx:143
│ │ │ │ -
void clear() noexcept
Definition: result.hxx:121
│ │ │ │ -
oid column_table(int ColNum) const
What table did this column come from?
Definition: result.hxx:158
│ │ │ │ -
result & operator=(const result &rhs) noexcept=default
│ │ │ │ -
oid column_table(const std::string &ColName) const
What table did this column come from?
Definition: result.hxx:162
│ │ │ │ -
result_difference_type difference_type
Definition: result.hxx:73
│ │ │ │ -
result(const result &rhs) noexcept=default
│ │ │ │ -
row_size_type table_column(const std::string &ColName) const
What column in its table did this column come from?
Definition: result.hxx:173
│ │ │ │ -
bool operator!=(const result &rhs) const noexcept
Definition: result.hxx:95
│ │ │ │ -
Iterator for rows in a result. Use as result::const_iterator.
Definition: result_iterator.hxx:36
│ │ │ │ -
Reverse iterator for result. Use as result::const_reverse_iterator.
Definition: result_iterator.hxx:122
│ │ │ │ -
Reference to one row in a result.
Definition: row.hxx:41
│ │ │ │ +
Definition: tablereader.hxx:30
│ │ │ │ +
void tokenize(std::string, TUPLE &) const
Definition: tablereader.hxx:100
│ │ │ │ +
tablereader(transaction_base &, const std::string &Name, const std::string &Null=std::string{})
Definition: tablereader.cxx:21
│ │ │ │ +
bool operator!() const noexcept
Definition: tablereader.hxx:52
│ │ │ │ +
tablereader & operator>>(TUPLE &)
Definition: tablereader.hxx:109
│ │ │ │ +
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:28
│ │ │ │ +
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
│ │ │ │ +
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:138
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,276 +1,144 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -result.hxx │ │ │ │ │ +tablereader.hxx │ │ │ │ │ 1 │ │ │ │ │ - 13#ifndef PQXX_H_RESULT │ │ │ │ │ - 14#define PQXX_H_RESULT │ │ │ │ │ + 13#ifndef PQXX_H_TABLEREADER │ │ │ │ │ + 14#define PQXX_H_TABLEREADER │ │ │ │ │ 15 │ │ │ │ │ 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ - 18 │ │ │ │ │ - 19#include │ │ │ │ │ - 20#include │ │ │ │ │ - 21#include │ │ │ │ │ - 22 │ │ │ │ │ - 23#include "pqxx/except.hxx" │ │ │ │ │ - 24#include "pqxx/types.hxx" │ │ │ │ │ - 25#include "pqxx/util.hxx" │ │ │ │ │ - 26 │ │ │ │ │ - 27#include "pqxx/internal/encodings.hxx" │ │ │ │ │ - 28 │ │ │ │ │ - 29 │ │ │ │ │ - 30// Methods tested in eg. test module test01 are marked with "//[t01]". │ │ │ │ │ - 31 │ │ │ │ │ - 32namespace pqxx │ │ │ │ │ - 33{ │ │ │ │ │ - 34namespace internal │ │ │ │ │ - 35{ │ │ │ │ │ - 36PQXX_LIBEXPORT void clear_result(const pq::PGresult *); │ │ │ │ │ - 37 │ │ │ │ │ - 38namespace gate │ │ │ │ │ - 39{ │ │ │ │ │ - 40class result_connection; │ │ │ │ │ - 41class result_creation; │ │ │ │ │ - 42class result_row; │ │ │ │ │ - 43class result_sql_cursor; │ │ │ │ │ - 44} // namespace internal::gate │ │ │ │ │ - 45} // namespace internal │ │ │ │ │ - 46 │ │ │ │ │ - 47 │ │ │ │ │ - 49 │ │ │ │ │ -69class PQXX_LIBEXPORT result │ │ │ │ │ - 70{ │ │ │ │ │ - 71public: │ │ │ │ │ -72 using size_type = result_size_type; │ │ │ │ │ -73 using difference_type = result_difference_type; │ │ │ │ │ -74 using reference = row; │ │ │ │ │ -75 using const_iterator = const_result_iterator; │ │ │ │ │ -76 using pointer = const_iterator; │ │ │ │ │ -77 using iterator = const_iterator; │ │ │ │ │ -78 using const_reverse_iterator = const_reverse_result_iterator; │ │ │ │ │ -79 using reverse_iterator = const_reverse_iterator; │ │ │ │ │ - 80 │ │ │ │ │ -81 result() noexcept : //[t03] │ │ │ │ │ - 82 m_data(make_data_pointer()), │ │ │ │ │ - 83 m_query(), │ │ │ │ │ - 84 m_encoding(internal::encoding_group::MONOBYTE) │ │ │ │ │ - 85 {} │ │ │ │ │ -86 result(const result &rhs) noexcept =default; //[t01] │ │ │ │ │ - 87 │ │ │ │ │ -88 result &operator=(const result &rhs) noexcept =default; //[t10] │ │ │ │ │ - 89 │ │ │ │ │ - 94 bool operator==(const result &) const noexcept; //[t70] │ │ │ │ │ -95 bool operator!=(const result &rhs) const noexcept //[t70] │ │ │ │ │ - 96 { return not operator==(rhs); } │ │ │ │ │ + 18#include "pqxx/result.hxx" │ │ │ │ │ + 19#include "pqxx/tablestream.hxx" │ │ │ │ │ + 20 │ │ │ │ │ + 21 │ │ │ │ │ + 22namespace pqxx │ │ │ │ │ + 23{ │ │ │ │ │ + 25 │ │ │ │ │ +29class PQXX_LIBEXPORT tablereader : public tablestream │ │ │ │ │ + 30{ │ │ │ │ │ + 31public: │ │ │ │ │ + 32 PQXX_DEPRECATED tablereader( │ │ │ │ │ + 33 transaction_base &, │ │ │ │ │ + 34 const std::string &Name, │ │ │ │ │ + 35 const std::string &Null=std::string{}); │ │ │ │ │ + 36 template │ │ │ │ │ + 37 PQXX_DEPRECATED tablereader( │ │ │ │ │ + 38 transaction_base &, │ │ │ │ │ + 39 const std::string &Name, │ │ │ │ │ + 40 ITER begincolumns, │ │ │ │ │ + 41 ITER endcolumns); │ │ │ │ │ + 42 template │ │ │ │ │ + 43 PQXX_DEPRECATED tablereader( │ │ │ │ │ + 44 transaction_base &, │ │ │ │ │ + 45 const std::string &Name, │ │ │ │ │ + 46 ITER begincolumns, │ │ │ │ │ + 47 ITER endcolumns, │ │ │ │ │ + 48 const std::string &Null); │ │ │ │ │ + 49 ~tablereader() noexcept; │ │ │ │ │ + 50 template tablereader &operator>>(TUPLE &); │ │ │ │ │ +51 operator bool() const noexcept { return not m_done; } │ │ │ │ │ +52 bool operator!() const noexcept { return m_done; } │ │ │ │ │ + 53 bool get_raw_line(std::string &Line); │ │ │ │ │ + 54 template │ │ │ │ │ + 55 void tokenize(std::string, TUPLE &) const; │ │ │ │ │ + 56 virtual void complete() override; │ │ │ │ │ + 57private: │ │ │ │ │ + 58 void set_up( │ │ │ │ │ + 59 transaction_base &T, │ │ │ │ │ + 60 const std::string &RName, │ │ │ │ │ + 61 const std::string &Columns=std::string{}); │ │ │ │ │ + 62 PQXX_PRIVATE void reader_close(); │ │ │ │ │ + 63 std::string extract_field( │ │ │ │ │ + 64 const std::string &, │ │ │ │ │ + 65 std::string::size_type &) const; │ │ │ │ │ + 66 bool m_done; │ │ │ │ │ + 67}; │ │ │ │ │ + 68 │ │ │ │ │ + 69 │ │ │ │ │ + 70template inline │ │ │ │ │ +71tablereader::tablereader( │ │ │ │ │ + 72 transaction_base &T, │ │ │ │ │ + 73 const std::string &Name, │ │ │ │ │ + 74 ITER begincolumns, │ │ │ │ │ + 75 ITER endcolumns) : │ │ │ │ │ + 76 namedclass{Name, "tablereader"}, │ │ │ │ │ + 77 tablestream{T, std::string{}}, │ │ │ │ │ + 78 m_done{true} │ │ │ │ │ + 79{ │ │ │ │ │ + 80 set_up(T, Name, columnlist(begincolumns, endcolumns)); │ │ │ │ │ + 81} │ │ │ │ │ + 82 │ │ │ │ │ + 83 │ │ │ │ │ + 84template inline │ │ │ │ │ +85tablereader::tablereader( │ │ │ │ │ + 86 transaction_base &T, │ │ │ │ │ + 87 const std::string &Name, │ │ │ │ │ + 88 ITER begincolumns, │ │ │ │ │ + 89 ITER endcolumns, │ │ │ │ │ + 90 const std::string &Null) : │ │ │ │ │ + 91 namedclass{Name, "tablereader"}, │ │ │ │ │ + 92 tablestream{T, Null}, │ │ │ │ │ + 93 m_done{true} │ │ │ │ │ + 94{ │ │ │ │ │ + 95 set_up(T, Name, columnlist(begincolumns, endcolumns)); │ │ │ │ │ + 96} │ │ │ │ │ + 97 │ │ │ │ │ 98 │ │ │ │ │ - 99 const_reverse_iterator rbegin() const; //[t75] │ │ │ │ │ - 100 const_reverse_iterator crbegin() const; │ │ │ │ │ - 101 const_reverse_iterator rend() const; //[t75] │ │ │ │ │ - 102 const_reverse_iterator crend() const; │ │ │ │ │ - 103 │ │ │ │ │ - 104 const_iterator begin() const noexcept; //[t01] │ │ │ │ │ - 105 const_iterator cbegin() const noexcept; │ │ │ │ │ - 106 inline const_iterator end() const noexcept; //[t01] │ │ │ │ │ - 107 inline const_iterator cend() const noexcept; │ │ │ │ │ - 108 │ │ │ │ │ - 109 reference front() const noexcept; //[t74] │ │ │ │ │ - 110 reference back() const noexcept; //[t75] │ │ │ │ │ - 111 │ │ │ │ │ - 112 PQXX_PURE size_type size() const noexcept; //[t02] │ │ │ │ │ - 113 PQXX_PURE bool empty() const noexcept; //[t11] │ │ │ │ │ -114 size_type capacity() const noexcept { return size(); } //[t20] │ │ │ │ │ - 115 │ │ │ │ │ - 116 void swap(result &) noexcept; //[t77] │ │ │ │ │ - 117 │ │ │ │ │ - 118 const row operator[](size_type i) const noexcept; //[t02] │ │ │ │ │ - 119 const row at(size_type) const; //[t10] │ │ │ │ │ - 120 │ │ │ │ │ -121 void clear() noexcept { m_data.reset(); m_query = nullptr; } //[t20] │ │ │ │ │ - 122 │ │ │ │ │ - 128 PQXX_PURE row_size_type columns() const noexcept; //[t11] │ │ │ │ │ - 129 │ │ │ │ │ - 131 row_size_type column_number(const char ColName[]) const; //[t11] │ │ │ │ │ - 132 │ │ │ │ │ -134 row_size_type column_number(const std::string &Name) const //[t11] │ │ │ │ │ - 135 {return column_number(Name.c_str());} │ │ │ │ │ - 136 │ │ │ │ │ - 138 const char *column_name(row_size_type Number) const; //[t11] │ │ │ │ │ - 139 │ │ │ │ │ - 141 oid column_type(row_size_type ColNum) const; //[t07] │ │ │ │ │ -143 oid column_type(int ColNum) const //[t07] │ │ │ │ │ - 144 { return column_type(row_size_type(ColNum)); } │ │ │ │ │ - 145 │ │ │ │ │ -147 oid column_type(const std::string &ColName) const //[t07] │ │ │ │ │ - 148 { return column_type(column_number(ColName)); } │ │ │ │ │ - 149 │ │ │ │ │ -151 oid column_type(const char ColName[]) const //[t07] │ │ │ │ │ - 152 { return column_type(column_number(ColName)); } │ │ │ │ │ - 153 │ │ │ │ │ - 155 oid column_table(row_size_type ColNum) const; //[t02] │ │ │ │ │ - 156 │ │ │ │ │ -158 oid column_table(int ColNum) const //[t02] │ │ │ │ │ - 159 { return column_table(row_size_type(ColNum)); } │ │ │ │ │ - 160 │ │ │ │ │ -162 oid column_table(const std::string &ColName) const //[t02] │ │ │ │ │ - 163 { return column_table(column_number(ColName)); } │ │ │ │ │ - 164 │ │ │ │ │ - 166 row_size_type table_column(row_size_type ColNum) const; //[t93] │ │ │ │ │ - 167 │ │ │ │ │ -169 row_size_type table_column(int ColNum) const //[t93] │ │ │ │ │ - 170 { return table_column(row_size_type(ColNum)); } │ │ │ │ │ - 171 │ │ │ │ │ -173 row_size_type table_column(const std::string &ColName) const //[t93] │ │ │ │ │ - 174 { return table_column(column_number(ColName)); } │ │ │ │ │ - 176 │ │ │ │ │ - 178 PQXX_PURE const std::string &query() const noexcept; //[t70] │ │ │ │ │ - 179 │ │ │ │ │ - 181 │ │ │ │ │ - 184 PQXX_PURE oid inserted_oid() const; //[t13] │ │ │ │ │ - 185 │ │ │ │ │ - 187 │ │ │ │ │ - 190 PQXX_PURE size_type affected_rows() const; //[t07] │ │ │ │ │ - 191 │ │ │ │ │ - 192 │ │ │ │ │ - 193private: │ │ │ │ │ - 194 using data_pointer = std::shared_ptr; │ │ │ │ │ - 195 │ │ │ │ │ - 197 data_pointer m_data; │ │ │ │ │ - 198 │ │ │ │ │ - 200 static data_pointer make_data_pointer( │ │ │ │ │ - 201 const internal::pq::PGresult *res=nullptr) │ │ │ │ │ - 202 { return data_pointer{res, internal::clear_result}; } │ │ │ │ │ - 203 │ │ │ │ │ - 205 std::shared_ptr m_query; │ │ │ │ │ - 206 │ │ │ │ │ - 207 internal::encoding_group m_encoding; │ │ │ │ │ - 208 │ │ │ │ │ - 209 static const std::string s_empty_string; │ │ │ │ │ - 210 │ │ │ │ │ -211 friend class pqxx::field; │ │ │ │ │ - 212 PQXX_PURE const char *GetValue(size_type Row, row_size_type Col) const; │ │ │ │ │ - 213 PQXX_PURE bool get_is_null(size_type Row, row_size_type Col) const; │ │ │ │ │ - 214 PQXX_PURE field_size_type get_length( │ │ │ │ │ - 215 size_type, │ │ │ │ │ - 216 row_size_type) const noexcept; │ │ │ │ │ - 217 │ │ │ │ │ -218 friend class pqxx::internal::gate::result_creation; │ │ │ │ │ - 219 result( │ │ │ │ │ - 220 internal::pq::PGresult *rhs, │ │ │ │ │ - 221 const std::string &Query, │ │ │ │ │ - 222 internal::encoding_group enc); │ │ │ │ │ - 223 │ │ │ │ │ - 224 PQXX_PRIVATE void check_status() const; │ │ │ │ │ - 225 │ │ │ │ │ -226 friend class pqxx::internal::gate::result_connection; │ │ │ │ │ -227 friend class pqxx::internal::gate::result_row; │ │ │ │ │ - 228 bool operator!() const noexcept { return not m_data.get(); } │ │ │ │ │ - 229 operator bool() const noexcept { return m_data.get() != nullptr; } │ │ │ │ │ - 230 │ │ │ │ │ - 231 [[noreturn]] PQXX_PRIVATE void ThrowSQLError( │ │ │ │ │ - 232 const std::string &Err, │ │ │ │ │ - 233 const std::string &Query) const; │ │ │ │ │ - 234 PQXX_PRIVATE PQXX_PURE int errorposition() const; │ │ │ │ │ - 235 PQXX_PRIVATE std::string StatusError() const; │ │ │ │ │ - 236 │ │ │ │ │ -237 friend class pqxx::internal::gate::result_sql_cursor; │ │ │ │ │ - 238 PQXX_PURE const char *cmd_status() const noexcept; │ │ │ │ │ - 239}; │ │ │ │ │ - 240} // namespace pqxx │ │ │ │ │ - 241#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ - 242#endif │ │ │ │ │ + 99template │ │ │ │ │ +100inline void tablereader::tokenize(std::string Line, TUPLE &T) const │ │ │ │ │ + 101{ │ │ │ │ │ + 102 std::back_insert_iterator ins = std::back_inserter(T); │ │ │ │ │ + 103 std::string::size_type here = 0; │ │ │ │ │ + 104 while (here < Line.size()) *ins++ = extract_field(Line, here); │ │ │ │ │ + 105} │ │ │ │ │ + 106 │ │ │ │ │ + 107 │ │ │ │ │ + 108template │ │ │ │ │ +109inline tablereader &pqxx::tablereader::operator>>(TUPLE &T) │ │ │ │ │ + 110{ │ │ │ │ │ + 111 std::string Line; │ │ │ │ │ + 112 if (get_raw_line(Line)) tokenize(Line, T); │ │ │ │ │ + 113 return *this; │ │ │ │ │ + 114} │ │ │ │ │ + 115} // namespace pqxx │ │ │ │ │ + 116 │ │ │ │ │ + 117#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 118#endif │ │ │ │ │ std │ │ │ │ │ STL namespace. │ │ │ │ │ pqxx │ │ │ │ │ The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ Definition: array.hxx:26 │ │ │ │ │ -pqxx::result_difference_type │ │ │ │ │ -signed long result_difference_type │ │ │ │ │ -Difference between result sizes. │ │ │ │ │ -Definition: types.hxx:21 │ │ │ │ │ -pqxx::field_size_type │ │ │ │ │ -std::size_t field_size_type │ │ │ │ │ -Number of bytes in a field of database data. │ │ │ │ │ -Definition: types.hxx:30 │ │ │ │ │ -pqxx::result_size_type │ │ │ │ │ -unsigned long result_size_type │ │ │ │ │ -Number of rows in a result set. │ │ │ │ │ -Definition: types.hxx:18 │ │ │ │ │ -pqxx::row_size_type │ │ │ │ │ -unsigned int row_size_type │ │ │ │ │ -Number of fields in a row of database data. │ │ │ │ │ -Definition: types.hxx:24 │ │ │ │ │ -pqxx::internal::clear_result │ │ │ │ │ -void clear_result(const pq::PGresult *) │ │ │ │ │ -C++ wrapper for libpq's PQclear. │ │ │ │ │ -Definition: result.cxx:30 │ │ │ │ │ -pqxx::field │ │ │ │ │ -Reference to a field in a result set. │ │ │ │ │ -Definition: field.hxx:50 │ │ │ │ │ -pqxx::result │ │ │ │ │ -Result set containing data returned by a query or command. │ │ │ │ │ -Definition: result.hxx:70 │ │ │ │ │ -pqxx::result::column_type │ │ │ │ │ -oid column_type(const char ColName[]) const │ │ │ │ │ -Type of given column. │ │ │ │ │ -Definition: result.hxx:151 │ │ │ │ │ -pqxx::result::table_column │ │ │ │ │ -row_size_type table_column(int ColNum) const │ │ │ │ │ -What column in its table did this column come from? │ │ │ │ │ -Definition: result.hxx:169 │ │ │ │ │ -pqxx::result::result │ │ │ │ │ -result() noexcept │ │ │ │ │ -Definition: result.hxx:81 │ │ │ │ │ -pqxx::result::column_type │ │ │ │ │ -oid column_type(const std::string &ColName) const │ │ │ │ │ -Type of given column. │ │ │ │ │ -Definition: result.hxx:147 │ │ │ │ │ -pqxx::result::size_type │ │ │ │ │ -result_size_type size_type │ │ │ │ │ -Definition: result.hxx:72 │ │ │ │ │ -pqxx::result::column_type │ │ │ │ │ -oid column_type(int ColNum) const │ │ │ │ │ -Type of given column. │ │ │ │ │ -Definition: result.hxx:143 │ │ │ │ │ -pqxx::result::clear │ │ │ │ │ -void clear() noexcept │ │ │ │ │ -Definition: result.hxx:121 │ │ │ │ │ -pqxx::result::column_table │ │ │ │ │ -oid column_table(int ColNum) const │ │ │ │ │ -What table did this column come from? │ │ │ │ │ -Definition: result.hxx:158 │ │ │ │ │ -pqxx::result::operator= │ │ │ │ │ -result & operator=(const result &rhs) noexcept=default │ │ │ │ │ -pqxx::result::column_table │ │ │ │ │ -oid column_table(const std::string &ColName) const │ │ │ │ │ -What table did this column come from? │ │ │ │ │ -Definition: result.hxx:162 │ │ │ │ │ -pqxx::result::difference_type │ │ │ │ │ -result_difference_type difference_type │ │ │ │ │ -Definition: result.hxx:73 │ │ │ │ │ -pqxx::result::result │ │ │ │ │ -result(const result &rhs) noexcept=default │ │ │ │ │ -pqxx::result::table_column │ │ │ │ │ -row_size_type table_column(const std::string &ColName) const │ │ │ │ │ -What column in its table did this column come from? │ │ │ │ │ -Definition: result.hxx:173 │ │ │ │ │ -pqxx::result::operator!= │ │ │ │ │ -bool operator!=(const result &rhs) const noexcept │ │ │ │ │ -Definition: result.hxx:95 │ │ │ │ │ -pqxx::const_result_iterator │ │ │ │ │ -Iterator for rows in a result. Use as result::const_iterator. │ │ │ │ │ -Definition: result_iterator.hxx:36 │ │ │ │ │ -pqxx::const_reverse_result_iterator │ │ │ │ │ -Reverse iterator for result. Use as result::const_reverse_iterator. │ │ │ │ │ -Definition: result_iterator.hxx:122 │ │ │ │ │ -pqxx::row │ │ │ │ │ -Reference to one row in a result. │ │ │ │ │ -Definition: row.hxx:41 │ │ │ │ │ +pqxx::tablereader │ │ │ │ │ +Definition: tablereader.hxx:30 │ │ │ │ │ +pqxx::tablereader::tokenize │ │ │ │ │ +void tokenize(std::string, TUPLE &) const │ │ │ │ │ +Definition: tablereader.hxx:100 │ │ │ │ │ +pqxx::tablereader::tablereader │ │ │ │ │ +tablereader(transaction_base &, const std::string &Name, const std::string │ │ │ │ │ +&Null=std::string{}) │ │ │ │ │ +Definition: tablereader.cxx:21 │ │ │ │ │ +pqxx::tablereader::operator! │ │ │ │ │ +bool operator!() const noexcept │ │ │ │ │ +Definition: tablereader.hxx:52 │ │ │ │ │ +pqxx::tablereader::operator>> │ │ │ │ │ +tablereader & operator>>(TUPLE &) │ │ │ │ │ +Definition: tablereader.hxx:109 │ │ │ │ │ +pqxx::tablestream │ │ │ │ │ +Base class for obsolete tablereader/tablewriter classes. │ │ │ │ │ +Definition: tablestream.hxx:28 │ │ │ │ │ +pqxx::tablestream::columnlist │ │ │ │ │ +static std::string columnlist(ITER colbegin, ITER colend) │ │ │ │ │ +Definition: tablestream.hxx:52 │ │ │ │ │ +pqxx::transaction_base │ │ │ │ │ +Interface definition (and common code) for "transaction" classes. │ │ │ │ │ +Definition: transaction_base.hxx:138 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * result.hxx │ │ │ │ │ + * tablereader.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00125_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: compiler-public.hxx Source File │ │ │ │ +libpqxx: config-internal-compiler.h Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,133 +55,28 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
compiler-public.hxx
│ │ │ │ +
config-internal-compiler.h
│ │ │ │
│ │ │ │
│ │ │ │ -
1
│ │ │ │ -
9#ifndef PQXX_H_COMPILER_PUBLIC
│ │ │ │ -
10#define PQXX_H_COMPILER_PUBLIC
│ │ │ │ -
11
│ │ │ │ -
12// Workarounds & definitions that need to be included even in library's headers
│ │ │ │ -
13#include "pqxx/config-public-compiler.h"
│ │ │ │ -
14
│ │ │ │ -
15// Some compilers, Visual Studio in particular, don't seem to support the
│ │ │ │ -
16// standard's ISO-646 keywords out of the box.
│ │ │ │ -
17#include <ciso646>
│ │ │ │ -
18
│ │ │ │ -
19
│ │ │ │ -
20#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_CONST)
│ │ │ │ -
22#define PQXX_CONST __attribute__ ((const))
│ │ │ │ -
23#else
│ │ │ │ -
24#define PQXX_CONST
│ │ │ │ -
25#endif
│ │ │ │ -
26
│ │ │ │ -
27#if defined(PQXX_HAVE_DEPRECATED)
│ │ │ │ -
29#define PQXX_DEPRECATED [[deprecated]]
│ │ │ │ -
30#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_DEPRECATED)
│ │ │ │ -
31#define PQXX_DEPRECATED __attribute__ ((deprecated))
│ │ │ │ -
32#else
│ │ │ │ -
33#define PQXX_DEPRECATED
│ │ │ │ -
34#endif
│ │ │ │ -
35
│ │ │ │ -
36#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_PURE)
│ │ │ │ -
38#define PQXX_PURE __attribute__ ((pure))
│ │ │ │ -
39#else
│ │ │ │ -
40#define PQXX_PURE
│ │ │ │ -
41#endif
│ │ │ │ -
42
│ │ │ │ -
43
│ │ │ │ -
44// Workarounds for Windows
│ │ │ │ -
45#ifdef _WIN32
│ │ │ │ -
46
│ │ │ │ -
47/* For now, export DLL symbols if _DLL is defined. This is done automatically
│ │ │ │ -
48 * by the compiler when linking to the dynamic version of the runtime library,
│ │ │ │ -
49 * according to "gzh"
│ │ │ │ -
50 */
│ │ │ │ -
51#if !defined(PQXX_LIBEXPORT) && defined(PQXX_SHARED)
│ │ │ │ -
52#define PQXX_LIBEXPORT __declspec(dllimport)
│ │ │ │ -
53#endif // !PQXX_LIBEXPORT && PQXX_SHARED
│ │ │ │ -
54
│ │ │ │ -
55
│ │ │ │ -
56// Workarounds for Microsoft Visual C++
│ │ │ │ -
57#ifdef _MSC_VER
│ │ │ │ -
58
│ │ │ │ -
59// Suppress vtables on abstract classes.
│ │ │ │ -
60#define PQXX_NOVTABLE __declspec(novtable)
│ │ │ │ -
61
│ │ │ │ -
62// Automatically link with the appropriate libpq (static or dynamic, debug or
│ │ │ │ -
63// release). The default is to use the release DLL. Define PQXX_PQ_STATIC to
│ │ │ │ -
64// link to a static version of libpq, and _DEBUG to link to a debug version.
│ │ │ │ -
65// The two may be combined.
│ │ │ │ -
66#if defined(PQXX_AUTOLINK)
│ │ │ │ -
67#if defined(PQXX_PQ_STATIC)
│ │ │ │ -
68#ifdef _DEBUG
│ │ │ │ -
69#pragma comment(lib, "libpqd")
│ │ │ │ -
70#else
│ │ │ │ -
71#pragma comment(lib, "libpq")
│ │ │ │ -
72#endif
│ │ │ │ -
73#else
│ │ │ │ -
74#ifdef _DEBUG
│ │ │ │ -
75#pragma comment(lib, "libpqddll")
│ │ │ │ -
76#else
│ │ │ │ -
77#pragma comment(lib, "libpqdll")
│ │ │ │ -
78#endif
│ │ │ │ -
79#endif
│ │ │ │ -
80#endif
│ │ │ │ -
81
│ │ │ │ -
82// If we're not compiling libpqxx itself, automatically link with the
│ │ │ │ -
83// appropriate libpqxx library. To link with the libpqxx DLL, define
│ │ │ │ -
84// PQXX_SHARED; the default is to link with the static library. A static link
│ │ │ │ -
85// is the recommended practice.
│ │ │ │ -
86//
│ │ │ │ -
87// The preprocessor macro PQXX_INTERNAL is used to detect whether we
│ │ │ │ -
88// are compiling the libpqxx library itself. When you compile the library
│ │ │ │ -
89// yourself using your own project file, make sure to include this macro.
│ │ │ │ -
90#if defined(PQXX_AUTOLINK) && !defined(PQXX_INTERNAL)
│ │ │ │ -
91 #ifdef PQXX_SHARED
│ │ │ │ -
92 #ifdef _DEBUG
│ │ │ │ -
93 #pragma comment(lib, "libpqxxD")
│ │ │ │ -
94 #else
│ │ │ │ -
95 #pragma comment(lib, "libpqxx")
│ │ │ │ -
96 #endif
│ │ │ │ -
97 #else // !PQXX_SHARED
│ │ │ │ -
98 #ifdef _DEBUG
│ │ │ │ -
99 #pragma comment(lib, "libpqxx_staticD")
│ │ │ │ -
100 #else
│ │ │ │ -
101 #pragma comment(lib, "libpqxx_static")
│ │ │ │ -
102 #endif
│ │ │ │ -
103 #endif
│ │ │ │ -
104#endif
│ │ │ │ -
105
│ │ │ │ -
106#endif // _MSC_VER
│ │ │ │ -
107#endif // _WIN32
│ │ │ │ -
108
│ │ │ │ -
109
│ │ │ │ -
110#ifndef PQXX_LIBEXPORT
│ │ │ │ -
111#define PQXX_LIBEXPORT
│ │ │ │ -
112#endif
│ │ │ │ -
113
│ │ │ │ -
114#ifndef PQXX_PRIVATE
│ │ │ │ -
115#define PQXX_PRIVATE
│ │ │ │ -
116#endif
│ │ │ │ -
117
│ │ │ │ -
118#ifndef PQXX_NOVTABLE
│ │ │ │ -
119#define PQXX_NOVTABLE
│ │ │ │ -
120#endif
│ │ │ │ -
121
│ │ │ │ -
122#endif
│ │ │ │ +
1/* Automatically generated from config.h: internal/compiler config. */
│ │ │ │ +
2
│ │ │ │ +
3#define HAVE_POLL 1
│ │ │ │ +
4#define HAVE_SYS_TIME_H 1
│ │ │ │ +
5#define HAVE_SYS_TYPES_H 1
│ │ │ │ +
6#define HAVE_UNISTD_H 1
│ │ │ │ +
7#define PQXX_HAVE_GCC_VISIBILITY 1
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,129 +1,19 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -compiler-public.hxx │ │ │ │ │ - 1 │ │ │ │ │ - 9#ifndef PQXX_H_COMPILER_PUBLIC │ │ │ │ │ - 10#define PQXX_H_COMPILER_PUBLIC │ │ │ │ │ - 11 │ │ │ │ │ - 12// Workarounds & definitions that need to be included even in library's │ │ │ │ │ -headers │ │ │ │ │ - 13#include "pqxx/config-public-compiler.h" │ │ │ │ │ - 14 │ │ │ │ │ - 15// Some compilers, Visual Studio in particular, don't seem to support the │ │ │ │ │ - 16// standard's ISO-646 keywords out of the box. │ │ │ │ │ - 17#include │ │ │ │ │ - 18 │ │ │ │ │ - 19 │ │ │ │ │ - 20#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_CONST) │ │ │ │ │ - 22#define PQXX_CONST __attribute__ ((const)) │ │ │ │ │ - 23#else │ │ │ │ │ - 24#define PQXX_CONST │ │ │ │ │ - 25#endif │ │ │ │ │ - 26 │ │ │ │ │ - 27#if defined(PQXX_HAVE_DEPRECATED) │ │ │ │ │ - 29#define PQXX_DEPRECATED [[deprecated]] │ │ │ │ │ - 30#elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_DEPRECATED) │ │ │ │ │ - 31#define PQXX_DEPRECATED __attribute__ ((deprecated)) │ │ │ │ │ - 32#else │ │ │ │ │ - 33#define PQXX_DEPRECATED │ │ │ │ │ - 34#endif │ │ │ │ │ - 35 │ │ │ │ │ - 36#if defined(__GNUC__) && defined(PQXX_HAVE_GCC_PURE) │ │ │ │ │ - 38#define PQXX_PURE __attribute__ ((pure)) │ │ │ │ │ - 39#else │ │ │ │ │ - 40#define PQXX_PURE │ │ │ │ │ - 41#endif │ │ │ │ │ - 42 │ │ │ │ │ - 43 │ │ │ │ │ - 44// Workarounds for Windows │ │ │ │ │ - 45#ifdef _WIN32 │ │ │ │ │ - 46 │ │ │ │ │ - 47/* For now, export DLL symbols if _DLL is defined. This is done │ │ │ │ │ -automatically │ │ │ │ │ - 48 * by the compiler when linking to the dynamic version of the runtime │ │ │ │ │ -library, │ │ │ │ │ - 49 * according to "gzh" │ │ │ │ │ - 50 */ │ │ │ │ │ - 51#if !defined(PQXX_LIBEXPORT) && defined(PQXX_SHARED) │ │ │ │ │ - 52#define PQXX_LIBEXPORT __declspec(dllimport) │ │ │ │ │ - 53#endif // !PQXX_LIBEXPORT && PQXX_SHARED │ │ │ │ │ - 54 │ │ │ │ │ - 55 │ │ │ │ │ - 56// Workarounds for Microsoft Visual C++ │ │ │ │ │ - 57#ifdef _MSC_VER │ │ │ │ │ - 58 │ │ │ │ │ - 59// Suppress vtables on abstract classes. │ │ │ │ │ - 60#define PQXX_NOVTABLE __declspec(novtable) │ │ │ │ │ - 61 │ │ │ │ │ - 62// Automatically link with the appropriate libpq (static or dynamic, debug │ │ │ │ │ -or │ │ │ │ │ - 63// release). The default is to use the release DLL. Define PQXX_PQ_STATIC to │ │ │ │ │ - 64// link to a static version of libpq, and _DEBUG to link to a debug version. │ │ │ │ │ - 65// The two may be combined. │ │ │ │ │ - 66#if defined(PQXX_AUTOLINK) │ │ │ │ │ - 67#if defined(PQXX_PQ_STATIC) │ │ │ │ │ - 68#ifdef _DEBUG │ │ │ │ │ - 69#pragma comment(lib, "libpqd") │ │ │ │ │ - 70#else │ │ │ │ │ - 71#pragma comment(lib, "libpq") │ │ │ │ │ - 72#endif │ │ │ │ │ - 73#else │ │ │ │ │ - 74#ifdef _DEBUG │ │ │ │ │ - 75#pragma comment(lib, "libpqddll") │ │ │ │ │ - 76#else │ │ │ │ │ - 77#pragma comment(lib, "libpqdll") │ │ │ │ │ - 78#endif │ │ │ │ │ - 79#endif │ │ │ │ │ - 80#endif │ │ │ │ │ - 81 │ │ │ │ │ - 82// If we're not compiling libpqxx itself, automatically link with the │ │ │ │ │ - 83// appropriate libpqxx library. To link with the libpqxx DLL, define │ │ │ │ │ - 84// PQXX_SHARED; the default is to link with the static library. A static │ │ │ │ │ -link │ │ │ │ │ - 85// is the recommended practice. │ │ │ │ │ - 86// │ │ │ │ │ - 87// The preprocessor macro PQXX_INTERNAL is used to detect whether we │ │ │ │ │ - 88// are compiling the libpqxx library itself. When you compile the library │ │ │ │ │ - 89// yourself using your own project file, make sure to include this macro. │ │ │ │ │ - 90#if defined(PQXX_AUTOLINK) && !defined(PQXX_INTERNAL) │ │ │ │ │ - 91 #ifdef PQXX_SHARED │ │ │ │ │ - 92 #ifdef _DEBUG │ │ │ │ │ - 93 #pragma comment(lib, "libpqxxD") │ │ │ │ │ - 94 #else │ │ │ │ │ - 95 #pragma comment(lib, "libpqxx") │ │ │ │ │ - 96 #endif │ │ │ │ │ - 97 #else // !PQXX_SHARED │ │ │ │ │ - 98 #ifdef _DEBUG │ │ │ │ │ - 99 #pragma comment(lib, "libpqxx_staticD") │ │ │ │ │ - 100 #else │ │ │ │ │ - 101 #pragma comment(lib, "libpqxx_static") │ │ │ │ │ - 102 #endif │ │ │ │ │ - 103 #endif │ │ │ │ │ - 104#endif │ │ │ │ │ - 105 │ │ │ │ │ - 106#endif // _MSC_VER │ │ │ │ │ - 107#endif // _WIN32 │ │ │ │ │ - 108 │ │ │ │ │ - 109 │ │ │ │ │ - 110#ifndef PQXX_LIBEXPORT │ │ │ │ │ - 111#define PQXX_LIBEXPORT │ │ │ │ │ - 112#endif │ │ │ │ │ - 113 │ │ │ │ │ - 114#ifndef PQXX_PRIVATE │ │ │ │ │ - 115#define PQXX_PRIVATE │ │ │ │ │ - 116#endif │ │ │ │ │ - 117 │ │ │ │ │ - 118#ifndef PQXX_NOVTABLE │ │ │ │ │ - 119#define PQXX_NOVTABLE │ │ │ │ │ - 120#endif │ │ │ │ │ - 121 │ │ │ │ │ - 122#endif │ │ │ │ │ +config-internal-compiler.h │ │ │ │ │ + 1/* Automatically generated from config.h: internal/compiler config. */ │ │ │ │ │ + 2 │ │ │ │ │ + 3#define HAVE_POLL 1 │ │ │ │ │ + 4#define HAVE_SYS_TIME_H 1 │ │ │ │ │ + 5#define HAVE_SYS_TYPES_H 1 │ │ │ │ │ + 6#define HAVE_UNISTD_H 1 │ │ │ │ │ + 7#define PQXX_HAVE_GCC_VISIBILITY 1 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * compiler-public.hxx │ │ │ │ │ + * config-internal-compiler.h │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00128_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -libpqxx: config-public-compiler.h Source File │ │ │ │ +libpqxx: connection.hxx Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -55,27 +55,101 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
config-public-compiler.h
│ │ │ │ +
connection.hxx
│ │ │ │
│ │ │ │
│ │ │ │ -
1/* Automatically generated from config.h: public/compiler config. */
│ │ │ │ -
2
│ │ │ │ -
3#define PQXX_HAVE_DEPRECATED 1
│ │ │ │ -
4#define PQXX_HAVE_GCC_CONST 1
│ │ │ │ -
5#define PQXX_HAVE_GCC_DEPRECATED 1
│ │ │ │ -
6#define PQXX_HAVE_GCC_PURE 1
│ │ │ │ +
1
│ │ │ │ +
13#ifndef PQXX_H_CONNECTION
│ │ │ │ +
14#define PQXX_H_CONNECTION
│ │ │ │ +
15
│ │ │ │ +
16#include "pqxx/compiler-public.hxx"
│ │ │ │ +
17#include "pqxx/compiler-internal-pre.hxx"
│ │ │ │ +
18
│ │ │ │ +
19#include "pqxx/connectionpolicy.hxx"
│ │ │ │ +
20#include "pqxx/basic_connection.hxx"
│ │ │ │ +
21
│ │ │ │ +
22namespace pqxx
│ │ │ │ +
23{
│ │ │ │ +
24
│ │ │ │ +
77
│ │ │ │ +
87class PQXX_LIBEXPORT connect_direct : public connectionpolicy
│ │ │ │ +
88{
│ │ │ │ +
89public:
│ │ │ │ +
92 explicit connect_direct(const std::string &opts) : connectionpolicy{opts} {}
│ │ │ │ +
93 virtual handle do_startconnect(handle) override;
│ │ │ │ +
94};
│ │ │ │ +
95
│ │ │ │ + │ │ │ │ +
98
│ │ │ │ +
99
│ │ │ │ +
101
│ │ │ │ +
105class PQXX_LIBEXPORT connect_lazy : public connectionpolicy
│ │ │ │ +
106{
│ │ │ │ +
107public:
│ │ │ │ +
110 explicit connect_lazy(const std::string &opts) : connectionpolicy{opts} {}
│ │ │ │ +
111 virtual handle do_completeconnect(handle) override;
│ │ │ │ +
112};
│ │ │ │ +
113
│ │ │ │ +
114
│ │ │ │ + │ │ │ │ +
117
│ │ │ │ +
118
│ │ │ │ +
120
│ │ │ │ +
126class PQXX_LIBEXPORT connect_async : public connectionpolicy
│ │ │ │ +
127{
│ │ │ │ +
128public:
│ │ │ │ +
131 explicit connect_async(const std::string &opts);
│ │ │ │ +
132 virtual handle do_startconnect(handle) override;
│ │ │ │ +
133 virtual handle do_completeconnect(handle) override;
│ │ │ │ +
134 virtual handle do_dropconnect(handle) noexcept override;
│ │ │ │ +
135 virtual bool is_ready(handle) const noexcept override;
│ │ │ │ +
136
│ │ │ │ +
137private:
│ │ │ │ +
139 bool m_connecting;
│ │ │ │ +
140};
│ │ │ │ +
141
│ │ │ │ +
142
│ │ │ │ + │ │ │ │ +
145
│ │ │ │ +
146
│ │ │ │ +
148
│ │ │ │ +
152class PQXX_LIBEXPORT connect_null : public connectionpolicy
│ │ │ │ +
153{
│ │ │ │ +
154public:
│ │ │ │ +
155 explicit connect_null(const std::string &opts) : connectionpolicy{opts} {}
│ │ │ │ +
156};
│ │ │ │ +
157
│ │ │ │ +
158
│ │ │ │ + │ │ │ │ +
161
│ │ │ │ +
166}
│ │ │ │ +
167
│ │ │ │ +
168#include "pqxx/compiler-internal-post.hxx"
│ │ │ │ +
169
│ │ │ │ +
170#endif
│ │ │ │ +
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
│ │ │ │ +
Base-class template for all libpqxx connection types.
Definition: basic_connection.hxx:47
│ │ │ │ +
Connection policy; creates an immediate connection to a database.
Definition: connection.hxx:88
│ │ │ │ +
connect_direct(const std::string &opts)
Definition: connection.hxx:92
│ │ │ │ +
Lazy connection policy; causes connection to be deferred until first use.
Definition: connection.hxx:106
│ │ │ │ +
connect_lazy(const std::string &opts)
Definition: connection.hxx:110
│ │ │ │ +
Asynchronous connection policy; connects "in the background".
Definition: connection.hxx:127
│ │ │ │ +
Nonfunctional, always-down connection policy for testing/debugging purposes.
Definition: connection.hxx:153
│ │ │ │ +
connect_null(const std::string &opts)
Definition: connection.hxx:155
│ │ │ │ +
Definition: connectionpolicy.hxx:32
│ │ │ │ +
internal::pq::PGconn * handle
Definition: connectionpolicy.hxx:34
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,18 +1,113 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ libpqxx │ │ │ │ │ │ │ │ │ │ -config-public-compiler.h │ │ │ │ │ - 1/* Automatically generated from config.h: public/compiler config. */ │ │ │ │ │ - 2 │ │ │ │ │ - 3#define PQXX_HAVE_DEPRECATED 1 │ │ │ │ │ - 4#define PQXX_HAVE_GCC_CONST 1 │ │ │ │ │ - 5#define PQXX_HAVE_GCC_DEPRECATED 1 │ │ │ │ │ - 6#define PQXX_HAVE_GCC_PURE 1 │ │ │ │ │ +connection.hxx │ │ │ │ │ + 1 │ │ │ │ │ + 13#ifndef PQXX_H_CONNECTION │ │ │ │ │ + 14#define PQXX_H_CONNECTION │ │ │ │ │ + 15 │ │ │ │ │ + 16#include "pqxx/compiler-public.hxx" │ │ │ │ │ + 17#include "pqxx/compiler-internal-pre.hxx" │ │ │ │ │ + 18 │ │ │ │ │ + 19#include "pqxx/connectionpolicy.hxx" │ │ │ │ │ + 20#include "pqxx/basic_connection.hxx" │ │ │ │ │ + 21 │ │ │ │ │ + 22namespace pqxx │ │ │ │ │ + 23{ │ │ │ │ │ + 24 │ │ │ │ │ + 77 │ │ │ │ │ +87class PQXX_LIBEXPORT connect_direct : public connectionpolicy │ │ │ │ │ + 88{ │ │ │ │ │ + 89public: │ │ │ │ │ +92 explicit connect_direct(const std::string &opts) : connectionpolicy{opts} {} │ │ │ │ │ + 93 virtual handle do_startconnect(handle) override; │ │ │ │ │ + 94}; │ │ │ │ │ + 95 │ │ │ │ │ +97using connection = basic_connection_base; │ │ │ │ │ + 98 │ │ │ │ │ + 99 │ │ │ │ │ + 101 │ │ │ │ │ +105class PQXX_LIBEXPORT connect_lazy : public connectionpolicy │ │ │ │ │ + 106{ │ │ │ │ │ + 107public: │ │ │ │ │ +110 explicit connect_lazy(const std::string &opts) : connectionpolicy{opts} {} │ │ │ │ │ + 111 virtual handle do_completeconnect(handle) override; │ │ │ │ │ + 112}; │ │ │ │ │ + 113 │ │ │ │ │ + 114 │ │ │ │ │ +116using lazyconnection = basic_connection_base; │ │ │ │ │ + 117 │ │ │ │ │ + 118 │ │ │ │ │ + 120 │ │ │ │ │ +126class PQXX_LIBEXPORT connect_async : public connectionpolicy │ │ │ │ │ + 127{ │ │ │ │ │ + 128public: │ │ │ │ │ + 131 explicit connect_async(const std::string &opts); │ │ │ │ │ + 132 virtual handle do_startconnect(handle) override; │ │ │ │ │ + 133 virtual handle do_completeconnect(handle) override; │ │ │ │ │ + 134 virtual handle do_dropconnect(handle) noexcept override; │ │ │ │ │ + 135 virtual bool is_ready(handle) const noexcept override; │ │ │ │ │ + 136 │ │ │ │ │ + 137private: │ │ │ │ │ + 139 bool m_connecting; │ │ │ │ │ + 140}; │ │ │ │ │ + 141 │ │ │ │ │ + 142 │ │ │ │ │ +144using asyncconnection = basic_connection_base; │ │ │ │ │ + 145 │ │ │ │ │ + 146 │ │ │ │ │ + 148 │ │ │ │ │ +152class PQXX_LIBEXPORT connect_null : public connectionpolicy │ │ │ │ │ + 153{ │ │ │ │ │ + 154public: │ │ │ │ │ +155 explicit connect_null(const std::string &opts) : connectionpolicy{opts} {} │ │ │ │ │ + 156}; │ │ │ │ │ + 157 │ │ │ │ │ + 158 │ │ │ │ │ +160using nullconnection = basic_connection_base; │ │ │ │ │ + 161 │ │ │ │ │ + 166} │ │ │ │ │ + 167 │ │ │ │ │ + 168#include "pqxx/compiler-internal-post.hxx" │ │ │ │ │ + 169 │ │ │ │ │ + 170#endif │ │ │ │ │ +pqxx │ │ │ │ │ +The home of all libpqxx classes, functions, templates, etc. │ │ │ │ │ +Definition: array.hxx:26 │ │ │ │ │ +pqxx::basic_connection_base │ │ │ │ │ +Base-class template for all libpqxx connection types. │ │ │ │ │ +Definition: basic_connection.hxx:47 │ │ │ │ │ +pqxx::connect_direct │ │ │ │ │ +Connection policy; creates an immediate connection to a database. │ │ │ │ │ +Definition: connection.hxx:88 │ │ │ │ │ +pqxx::connect_direct::connect_direct │ │ │ │ │ +connect_direct(const std::string &opts) │ │ │ │ │ +Definition: connection.hxx:92 │ │ │ │ │ +pqxx::connect_lazy │ │ │ │ │ +Lazy connection policy; causes connection to be deferred until first use. │ │ │ │ │ +Definition: connection.hxx:106 │ │ │ │ │ +pqxx::connect_lazy::connect_lazy │ │ │ │ │ +connect_lazy(const std::string &opts) │ │ │ │ │ +Definition: connection.hxx:110 │ │ │ │ │ +pqxx::connect_async │ │ │ │ │ +Asynchronous connection policy; connects "in the background". │ │ │ │ │ +Definition: connection.hxx:127 │ │ │ │ │ +pqxx::connect_null │ │ │ │ │ +Nonfunctional, always-down connection policy for testing/debugging purposes. │ │ │ │ │ +Definition: connection.hxx:153 │ │ │ │ │ +pqxx::connect_null::connect_null │ │ │ │ │ +connect_null(const std::string &opts) │ │ │ │ │ +Definition: connection.hxx:155 │ │ │ │ │ +pqxx::connectionpolicy │ │ │ │ │ +Definition: connectionpolicy.hxx:32 │ │ │ │ │ +pqxx::connectionpolicy::handle │ │ │ │ │ +internal::pq::PGconn * handle │ │ │ │ │ +Definition: connectionpolicy.hxx:34 │ │ │ │ │ * include │ │ │ │ │ * pqxx │ │ │ │ │ - * config-public-compiler.h │ │ │ │ │ + * connection.hxx │ │ │ │ │ * Generated by [doxygen] 1.9.4 │ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a00265.html │ │ │ │ @@ -597,15 +597,15 @@ │ │ │ │

Definition of the pqxx::stream_from class.

│ │ │ │

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

│ │ │ │

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

│ │ │ │

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

│ │ │ │

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.

│ │ │ │

Definition of the pqxx::stream_to class.

│ │ │ │

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

│ │ │ │ -

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

│ │ │ │ +

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

│ │ │ │

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

│ │ │ │

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.

│ │ │ │

Definition of the pqxx::subtransaction class.

│ │ │ │

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

│ │ │ │

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

│ │ │ │

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

│ │ │ │

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.

│ │ │ │ @@ -617,15 +617,15 @@ │ │ │ │

Definition of the pqxx::tablestream class.

│ │ │ │

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

│ │ │ │

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

│ │ │ │

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

│ │ │ │

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.

│ │ │ │

Definition of the pqxx::tablewriter class.

│ │ │ │

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

│ │ │ │ -

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

│ │ │ │ +

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

│ │ │ │

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

│ │ │ │

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.

│ │ │ │

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

│ │ │ │

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

│ │ │ │

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

│ │ │ │

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.

│ │ │ │

Common code and definitions for the transaction classes.

│ │ │ ├── ./usr/share/doc/libpqxx-doc/html/Reference/a01099.html │ │ │ │ @@ -66,15 +66,15 @@ │ │ │ │
pqxx::array_parser Class Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │

Low-level array parser. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <array.hxx>

│ │ │ │ +

#include <array.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

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

Parse the next step in the array.

│ │ │ │

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

│ │ │ │

Call this until the juncture it returns is done.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • array.hxx
  • │ │ │ │ +
  • array.hxx
  • │ │ │ │
  • array.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Base-class template for all libpqxx connection types. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <basic_connection.hxx>

│ │ │ │ +

#include <basic_connection.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::basic_connection_base< CONNECTPOLICY >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -440,15 +440,15 @@ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Concrete connection type template. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <basic_connection.hxx>

│ │ │ │ +

#include <basic_connection.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::basic_connection< CONNECTPOLICY >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -391,15 +391,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <binarystring.hxx>

│ │ │ │ +

#include <binarystring.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -909,15 +909,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Swap contents with other binarystring.

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <connection.hxx>

│ │ │ │ +

#include <connection.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::connect_direct:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -171,15 +171,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Reimplemented from pqxx::connectionpolicy.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <connection.hxx>

│ │ │ │ +

#include <connection.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::connect_lazy:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -170,15 +170,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Reimplemented from pqxx::connectionpolicy.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Asynchronous connection policy; connects "in the background". │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <connection.hxx>

│ │ │ │ +

#include <connection.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::connect_async:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -263,15 +263,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Reimplemented from pqxx::connectionpolicy.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <connection.hxx>

│ │ │ │ +

#include <connection.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::connect_null:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -138,15 +138,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using char_type = unsigned char
 
using value_type = std::char_traits< char_type >::char_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
pqxx::connectionpolicy Class Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <connectionpolicy.hxx>

│ │ │ │ +

#include <connectionpolicy.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::connectionpolicy:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -373,15 +373,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Common definitions for cursor types. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <cursor.hxx>

│ │ │ │ +

#include <cursor.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -515,15 +515,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

enum  accesspolicy { forward_only │ │ │ │ , random_access │ │ │ │ }
 Cursor access-pattern policy. More...
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • cursor.hxx
  • │ │ │ │ +
  • cursor.hxx
  • │ │ │ │
  • cursor.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <cursor.hxx>

│ │ │ │ +

#include <cursor.hxx>

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

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

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <cursor.hxx>

│ │ │ │ +

#include <cursor.hxx>

│ │ │ │

│ │ │ │ Public Types

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

│ │ │ │ Public Types

using size_type = cursor_base::size_type
 
using difference_type = cursor_base::difference_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • cursor.hxx
  • │ │ │ │ +
  • cursor.hxx
  • │ │ │ │
  • cursor.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Approximate istream_iterator for icursorstream. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <cursor.hxx>

│ │ │ │ +

#include <cursor.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -592,15 +592,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using iterator_category = std::input_iterator_tag
 
using value_type = result
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • cursor.hxx
  • │ │ │ │ +
  • cursor.hxx
  • │ │ │ │
  • cursor.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Abstract base class responsible for bracketing a backend transaction. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <dbtransaction.hxx>

│ │ │ │ +

#include <dbtransaction.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::dbtransaction:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -577,15 +577,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Base class for error-handler callbacks. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <errorhandler.hxx>

│ │ │ │ +

#include <errorhandler.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::errorhandler:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -209,15 +209,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

An error handler that suppresses any previously registered error handlers. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <errorhandler.hxx>

│ │ │ │ +

#include <errorhandler.hxx>

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

Implements pqxx::errorhandler.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::pqxx_exception:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -203,15 +203,15 @@ │ │ │ │
virtual PQXX_CONST const std::exception & base() const noexcept=0
Return std::exception base-class object.
│ │ │ │
Exception class for failed queries.
Definition: except.hxx:131
│ │ │ │
PQXX_PURE const std::string & query() const noexcept
The query whose execution triggered the exception.
Definition: except.cxx:53
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::failure:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -151,15 +151,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Exception class for lost or failed backend connection. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::broken_connection:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -152,15 +152,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Exception class for failed queries. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::sql_error:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -252,15 +252,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

SQLSTATE error code if known, or empty string otherwise.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::in_doubt_error:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -125,15 +125,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::transaction_rollback:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -127,15 +127,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Transaction failed to serialize. Please retry it. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::serialization_failure:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -130,15 +130,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::statement_completion_unknown:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -128,15 +128,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

The ongoing transaction has deadlocked. Retrying it may help. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::deadlock_detected:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -128,15 +128,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Internal error in libpqxx library. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::internal_error:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -120,15 +120,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::usage_error:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -120,15 +120,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::argument_error:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -121,15 +121,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::conversion_error:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -121,15 +121,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::range_error:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -122,15 +122,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • except.hxx
  • │ │ │ │ +
  • except.hxx
  • │ │ │ │
  • except.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Query returned an unexpected number of rows. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::unexpected_rows:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -125,15 +125,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Database feature not supported in current setup. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::feature_not_supported:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -152,15 +152,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Error in data provided to SQL statement. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::syntax_error:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -180,15 +180,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

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

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::insufficient_privilege:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -147,15 +147,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Resource shortage on the server. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::too_many_connections:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -125,15 +125,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

PL/pgSQL error. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::plpgsql_error:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -156,15 +156,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Exception raised in PL/pgSQL procedure. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

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

#include <except.hxx>

│ │ │ │ +

#include <except.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::plpgsql_too_many_rows:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -151,15 +151,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Reference to a field in a result set. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <field.hxx>

│ │ │ │ +

#include <field.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::field:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -762,15 +762,15 @@ │ │ │ │ │ │ │ │
│ │ │ │

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.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • field.hxx
  • │ │ │ │ +
  • field.hxx
  • │ │ │ │
  • field.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
pqxx::field_streambuf< CHAR, TRAITS > Class Template Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <field.hxx>

│ │ │ │ +

#include <field.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::field_streambuf< CHAR, TRAITS >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -419,15 +419,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <field.hxx>

│ │ │ │ +

#include <field.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::basic_fieldstream< CHAR, TRAITS >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -205,15 +205,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <isolation.hxx>

│ │ │ │ +

#include <isolation.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -218,15 +218,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

constexpr const char * name () noexcept
 
constexpr const char * name () noexcept
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Identity of a large object. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <largeobject.hxx>

│ │ │ │ +

#include <largeobject.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::largeobject:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -618,15 +618,15 @@ │ │ │ │ │ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Accessor for large object's contents. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <largeobject.hxx>

│ │ │ │ +

#include <largeobject.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::largeobjectaccess:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1066,15 +1066,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <largeobject.hxx>

│ │ │ │ +

#include <largeobject.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::largeobject_streambuf< CHAR, TRAITS >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -539,15 +539,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <largeobject.hxx>

│ │ │ │ +

#include <largeobject.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::basic_ilostream< CHAR, TRAITS >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -281,15 +281,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <largeobject.hxx>

│ │ │ │ +

#include <largeobject.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::basic_olostream< CHAR, TRAITS >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -302,15 +302,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Stream that reads and writes a large object. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <largeobject.hxx>

│ │ │ │ +

#include <largeobject.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::basic_lostream< CHAR, TRAITS >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -304,15 +304,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Simple "transaction" class offering no transactional integrity. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <nontransaction.hxx>

│ │ │ │ +

#include <nontransaction.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::nontransaction:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -326,15 +326,15 @@ │ │ │ │

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.

│ │ │ │ │ │ │ │

References pqxx::transaction_base::End().

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

#include <notification.hxx>

│ │ │ │ +

#include <notification.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -294,15 +294,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ 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
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <pipeline.hxx>

│ │ │ │ +

#include <pipeline.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::pipeline:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -519,15 +519,15 @@ │ │ │ │ │ │ │ │

Retrieve result for given query.

│ │ │ │

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.
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <prepared_statement.hxx>

│ │ │ │ +

#include <prepared_statement.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::prepare::invocation:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -431,15 +431,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Internal representation of a prepared statement definition. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <prepared_statement.hxx>

│ │ │ │ +

#include <prepared_statement.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -172,15 +172,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Has this prepared statement been prepared in the current session?

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <result.hxx>

│ │ │ │ +

#include <result.hxx>

│ │ │ │

│ │ │ │ Public Member Functions

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

│ │ │ │ Public Types

using size_type = result_size_type
 
using difference_type = result_difference_type
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <result_iterator.hxx>

│ │ │ │ +

#include <result_iterator.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::const_result_iterator:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -783,15 +783,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Reverse iterator for result. Use as result::const_reverse_iterator. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <result_iterator.hxx>

│ │ │ │ +

#include <result_iterator.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::const_reverse_result_iterator:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -676,15 +676,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper base class for the robusttransaction class template. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <robusttransaction.hxx>

│ │ │ │ +

#include <robusttransaction.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::internal::basic_robusttransaction:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -367,15 +367,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Slightly slower, better-fortified version of transaction. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <robusttransaction.hxx>

│ │ │ │ +

#include <robusttransaction.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::robusttransaction< ISOLATIONLEVEL >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -398,15 +398,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Reference to one row in a result. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <row.hxx>

│ │ │ │ +

#include <row.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::row:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1394,15 +1394,15 @@ │ │ │ │

Result set of which this is one row.

│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • row.hxx
  • │ │ │ │ +
  • row.hxx
  • │ │ │ │
  • row.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <row.hxx>

│ │ │ │ +

#include <row.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::const_row_iterator:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -714,15 +714,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • row.hxx
  • │ │ │ │ +
  • row.hxx
  • │ │ │ │
  • row.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Reverse iterator for a row. Use as row::const_reverse_iterator. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <row.hxx>

│ │ │ │ +

#include <row.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::const_reverse_row_iterator:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -674,15 +674,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • row.hxx
  • │ │ │ │ +
  • row.hxx
  • │ │ │ │
  • row.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <strconv.hxx>

│ │ │ │ +

#include <strconv.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Attributes

static constexpr const char * value = "char[]"
 
│ │ │ │

Member Data Documentation

│ │ │ │ @@ -95,15 +95,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <strconv.hxx>

│ │ │ │ +

#include <strconv.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -870,15 +870,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

void from_string (const char Str[], short &Obj)
 
std::string to_string (short Obj)
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper class for defining enum conversions. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <strconv.hxx>

│ │ │ │ +

#include <strconv.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -249,15 +249,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using underlying_type = typename std::underlying_type< ENUM >::type
 
using underlying_traits = string_traits< underlying_type >
 
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <strconv.hxx>

│ │ │ │ +

#include <strconv.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -249,15 +249,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

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

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

│ │ │ │ │ │ │ │ -

#include <strconv.hxx>

│ │ │ │ +

#include <strconv.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -211,15 +211,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

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

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

│ │ │ │ │ │ │ │ -

#include <strconv.hxx>

│ │ │ │ +

#include <strconv.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -222,15 +222,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

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

#include <strconv.hxx>

│ │ │ │ +

#include <strconv.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -246,15 +246,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

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

#include <strconv.hxx>

│ │ │ │ +

#include <strconv.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -208,15 +208,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

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

#include <strconv.hxx>

│ │ │ │ +

#include <strconv.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -246,15 +246,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Static Public Member Functions

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

#include <stream_base.hxx>

│ │ │ │ +

#include <stream_base.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::stream_base:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -403,15 +403,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Efficiently pull data directly out of a table. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <stream_from.hxx>

│ │ │ │ +

#include <stream_from.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::stream_from:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -366,15 +366,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

References get_raw_line().

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Efficiently write data directly to a database table. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <stream_to.hxx>

│ │ │ │ +

#include <stream_to.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::stream_to:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -401,15 +401,15 @@ │ │ │ │

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.

│ │ │ │ │ │ │ │

References pqxx::stream_from::get_raw_line().

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <stream_to.hxx>

│ │ │ │ +

#include <stream_to.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -117,15 +117,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

"Transaction" nested within another transaction │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <subtransaction.hxx>

│ │ │ │ +

#include <subtransaction.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::subtransaction:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -436,15 +436,15 @@ │ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

template<typename T >
std::string operator() (const T *t) const
 
template<>
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <tablereader.hxx>

│ │ │ │ +

#include <tablereader.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::tablereader:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -464,15 +464,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Base class for obsolete tablereader/tablewriter classes. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <tablestream.hxx>

│ │ │ │ +

#include <tablestream.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::tablestream:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -364,15 +364,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

#include <tablewriter.hxx>

│ │ │ │ +

#include <tablewriter.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::tablewriter:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -608,15 +608,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

Referenced by insert().

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

#include <tablewriter.hxx>

│ │ │ │ +

#include <tablewriter.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using iterator_category = output_iterator_tag
 
│ │ │ │ │ │ │ │

│ │ │ │ @@ -228,15 +228,15 @@ │ │ │ │

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

#include <tablewriter.hxx>

│ │ │ │ +

#include <tablewriter.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -124,15 +124,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

References pqxx::internal::escape_any().

│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper base class for the transaction class template. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <transaction.hxx>

│ │ │ │ +

#include <transaction.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::internal::basic_transaction:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -316,15 +316,15 @@ │ │ │ │

pqxx::transaction represents a regular database transaction.

│ │ │ │

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

│ │ │ │

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.

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <transaction.hxx>

│ │ │ │ +

#include <transaction.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::transaction< ISOLATIONLEVEL, READWRITE >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -284,15 +284,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

│ │ │ │ Public Member Functions

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

Detailed Description

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

Standard back-end transaction, templatized on isolation level.

│ │ │ │

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

│ │ │ │ -

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
│ │ │ │ +

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
│ │ │ │

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

│ │ │ │

Usage example: double all wages

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

References pqxx::transaction_base::End().

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

#include <transaction_base.hxx>

│ │ │ │ +

#include <transaction_base.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::internal::transactionfocus:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -354,15 +354,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <transaction_base.hxx>

│ │ │ │ +

#include <transaction_base.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::internal::parameterized_invocation:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -259,15 +259,15 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

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

│ │ │ │ │ │ │ │ -

#include <transaction_base.hxx>

│ │ │ │ +

#include <transaction_base.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::transaction_base:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -1839,15 +1839,15 @@ │ │ │ │ │ │ │ │

Resources allocated in this transaction that make reactivation impossible.

│ │ │ │

This number may be negative!

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

#include <transactor.hxx>

│ │ │ │ +

#include <transactor.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Public Types

using argument_type = TRANSACTION
 
│ │ │ │

│ │ │ │ @@ -279,15 +279,15 @@ │ │ │ │

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Descriptor of library's thread-safety model. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <util.hxx>

│ │ │ │ +

#include <util.hxx>

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -191,15 +191,15 @@ │ │ │ │

│ │ │ │ Public Attributes

bool have_safe_strerror = true
 
bool safe_libpq
 Is the underlying libpq build thread-safe? More...
│ │ │ │
│ │ │ │
Deprecated:
Always thread-safe to copy a 'result' or 'binarystring' now.
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
The documentation for this struct was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Helper base class: object descriptions for error messages and such. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <util.hxx>

│ │ │ │ +

#include <util.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::internal::namedclass:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -250,15 +250,15 @@ │ │ │ │

Object name, or the empty string if no name was given.

│ │ │ │ │ │ │ │

Referenced by description().

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following files:
    │ │ │ │ -
  • util.hxx
  • │ │ │ │ +
  • util.hxx
  • │ │ │ │
  • util.cxx
  • │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │

Ensure proper opening/closing of GUEST objects related to a "host" object. │ │ │ │ More...

│ │ │ │ │ │ │ │ -

#include <util.hxx>

│ │ │ │ +

#include <util.hxx>

│ │ │ │
│ │ │ │ Inheritance diagram for pqxx::internal::unique< GUEST >:
│ │ │ │
│ │ │ │
Inheritance graph
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -253,15 +253,15 @@ │ │ │ │
│ │ │ │ │ │ │ │

References pqxx::internal::CheckUniqueUnregistration().

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
The documentation for this class was generated from the following file: │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │