Skip to content

Commit

Permalink
Fix incorrect query & SQLSTATE params in exceptions.
Browse files Browse the repository at this point in the history
Fixes #378.

Some exception types were being constructed wrong, so instead of the query text they received their SQLSTATE string (and no actual SQLSTATE string).
  • Loading branch information
jtv committed Oct 24, 2020
1 parent 45988b0 commit e63674f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Internal rework of `field::to()` and `field::as()` functions.
- Some more warning options in maintainer mode.
- Removed the old, DocBook-based tutorial.
- Fixed wrong `query` and SQLSTATE params to some exceptions. (#378)
7.2.0
- You can now implicitly convert a `const std::string &` to `zview`.
- Replaced some overloads for C strings and C++ strings with `zview`.
Expand Down
2 changes: 1 addition & 1 deletion config/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ am__can_run_installinfo = \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in compile config.guess \
config.sub install-sh ltmain.sh missing mkinstalldirs
config.sub depcomp install-sh ltmain.sh missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
Expand Down
6 changes: 3 additions & 3 deletions src/result.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ void pqxx::result::ThrowSQLError(
if (equal(code, "40000"))
throw transaction_rollback{Err, Query, code};
if (equal(code, "40001"))
throw serialization_failure{Err, code};
throw serialization_failure{Err, Query, code};
if (equal(code, "40003"))
throw statement_completion_unknown{Err, code};
throw statement_completion_unknown{Err, Query, code};
if (equal(code, "40P01"))
throw deadlock_detected{Err, code};
throw deadlock_detected{Err, Query, code};
break;
case '2':
if (equal(code, "42501"))
Expand Down

0 comments on commit e63674f

Please sign in to comment.