List:MySQL++« Previous MessageNext Message »
From:Chris Morgan Date:December 22 2010 4:38am
Subject:Re: Exception Handling.
View as plain text  
On Tue, Dec 21, 2010 at 18:29, Eric Sepich <sepich.eric@stripped> wrote:

> First off I saw an example outlining how to use:
>        #include <mysql++.h>
>        mysqlpp::Connection conn(use_exceptions);
> For me it does not work. My compiler tells me there is no definition for
> use_exceptions. Also I need to add error handling to the following query as
> it exists in my code:

Hi Eric,

I'm guessing you saw the (uncompilable) example on this page: (section 4.4.2).  Since the
author of that page never defined the use_exceptions variable, the compiler
will complain that it is undefined.  The mysqlpp::Connection constructor
takes a bool that enables or disables exceptions, which is defaulted to use

mysqlpp::Query fquery = pconn->query(squery);
> mysqlpp::StoreQueryResult fres =;
> From what I have read in the reference manual there is a BadQuery class.
> Also there is some StdErr class. There really is no good example I can find
> describing the how of exception handling in mysql++.
> If you look at tquery1.cpp (which comes with the mysql++ source in
examples/ and is available via SVN here:
can find a straightforward example of using try/catch blocks with
"common" mysql++ exceptions.

I'm not sure what you mean by StdErr.  mysqlpp::Exception derives from



Exception Handling.Eric Sepich22 Dec
  • Re: Exception Handling.Chris Morgan22 Dec
  • Re: Exception Handling.Warren Young22 Dec