I am having some trouble understanding why certain 'bad syntax' errors
are not being caught. Rather, they are not being caught as
mysqlpp-derived exceptions. A catch statement for a std::exception
type seems to catch the exception.
I modified line 50 of the tquery1 example so that the syntax of the
query was invalid. I would then expect a mysqlpp::BadQuery error to be
thrown, and caught by the catch statements starting at line 73 (or at
least the generic one at line 85). However, this happens:
terminate called after throwing an instance of 'mysqlpp::BadQuery'
what(): You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right
syntax to use near 'xxxxxxxxxselect * from stock where item =
'Nürnberger Brats'' at line 1
When I add a catch statement for std::exception objects, that will
catch the exception.
Oddly, when I revert the change but let the code throw a BadQuery
exception for missing rows:
throw mysqlpp::BadQuery("UTF-8 bratwurst item not found in "
"table, run resetdb");
It is caught as expected:
Query error: UTF-8 bratwurst item not found in table, run resetdb
I'm not sure what is going on, does anyone have any suggestions?
Mac OS X 10.3.9