List:MySQL++« Previous MessageNext Message »
From:Bill Buch Date:June 25 2009 12:06pm
Subject:Re: Mysql++ User Exceptions
View as plain text  
Below is an example call.  The AddCarrierToken will return an error should
the carrier name (first argument) not exist.

#include <mysql++/mysql++.h>
#include <iostream>

int main(int argc, char* argv[])
  mysqlpp::Connection mysql;

  mysql.set_option(new mysqlpp::MultiStatementsOption(true));
  if (mysql.connect("Global_Registry","","mysql","mysql"))
      mysqlpp::Query query = mysql.query("CALL AddCarrierToken(2, '1234')");
      std::cout << "Execute happened anyway?" << std::endl;
      std::cout << mysql.errnum() << std::endl;          // 0 no matter what
      std::cout << mysql.error() << std::endl;           // blank
    catch (...)
      std::cout << "Exception caught." << std::endl;

  return 0;

On 6/25/09 1:52 AM, "Warren Young" <mysqlpp@stripped> wrote:

> On Jun 24, 2009, at 2:55 PM, Buch, Bill wrote:
>> I have developed a UDF to return an exception should certain
>> criteria happen from a stored procedure.  In testing with mysql++
>> 3.0.9, I am unable to capture that exception, and the API thinks
>> that the SQL call was successful.  Additional attempts through PERL
>> and Mysql C API yields the correct behavior and error string being
>> returned.
> You should post a simple example -- or patch to one of the provided
> examples -- to show this bug.  examples/multiquery.cpp deals with
> stored procedures, for one.  Your demonstration could thus be just a
> few lines of change to it, perhaps?

Mysql++ User ExceptionsBill Buch24 Jun
  • Re: Mysql++ User ExceptionsWarren Young25 Jun
    • Re: Mysql++ User ExceptionsBill Buch25 Jun
      • Re: Mysql++ User ExceptionsWarren Young25 Jun