Just wanted to also mention that this seems to work fine on CentOS
with gcc 3.4.6. It's either my older version of mac os x or the gcc
Does anyone else with os x 10.3.9 see this problem?
On 7/10/08, Drew M. <ghasatta@stripped> wrote:
> 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
> g++ 4.0.2