List:MySQL++« Previous MessageNext Message »
From:Dan Cook (dancook) Date:April 15 2011 10:01pm
Subject:RE: Crash in DBDriver::fetch_row on a heavily loaded system...
View as plain text  
[snip]

>On 4/14/2011 5:33 PM, Dan Cook (dancook) wrote:
>>
>> Thanks again for the patch.  I have applied the patch and rebuilt the
>> library.
>
>I didn't make it clear, but you also have to change your code.  With
the 
>patch installed, MySQL++ will throw an exception (or if exceptions are 
>disabled, make the Query object false) when the MySQL C API library
does 
>this.  It doesn't prevent the C API library from barfing, and it
doesn't 
>magically create error-handling code in your program.
>
>Not ideal, but greatly preferable to crashing, I hope.

Warren, 

Thank you for the clarification.  We let the mysqlpp code throw
exceptions and all of our database query code is "surrounded" by
try/catch blocks straight from the sample code.  The UseQueryError
should be caught in the catch all mysqpp::Exception ... I hope.   So in
theory we should see a highly intuitive "Bogus empty result" returned to
our upper layers as the error message.  ;)    Of course we will probably
have to do more changes, but if it does crash in the upper layers, it's
because they didn't handle the error condition not because we barfed.


std::string emsg;
  ...
try { 
  ...
} catch (const mysqlpp::BadQuery& er) {
     emsg.assign(er.what());
} catch (const mysqlpp::BadConversion& er) {
     std::ostringstream sstream;
     sstream << "Conversion error: " << er.what() <<
                " retrieved data size: " << er.retrieved <<
                ", actual size: " << er.actual_size;
        emsg.assign(sstream.str());
} catch (const mysqlpp::Exception& er) {
     emsg.assign(er.what());
}

Dan Cook
Thread
Crash in DBDriver::fetch_row on a heavily loaded system...dancook)12 Apr
  • Re: Crash in DBDriver::fetch_row on a heavily loaded system...Adrian Cornish12 Apr
    • RE: Crash in DBDriver::fetch_row on a heavily loaded system...dancook)12 Apr
    • RE: Crash in DBDriver::fetch_row on a heavily loaded system...dancook)13 Apr
      • Re: Crash in DBDriver::fetch_row on a heavily loaded system...Warren Young13 Apr
        • Re: Crash in DBDriver::fetch_row on a heavily loaded system...Adrian Cornish13 Apr
          • Re: Crash in DBDriver::fetch_row on a heavily loaded system...Warren Young13 Apr
        • RE: Crash in DBDriver::fetch_row on a heavily loaded system...dancook)15 Apr
          • Re: Crash in DBDriver::fetch_row on a heavily loaded system...Warren Young15 Apr
            • Re: Crash in DBDriver::fetch_row on a heavily loaded system...Warren Young15 Apr
            • RE: Crash in DBDriver::fetch_row on a heavily loaded system...dancook)16 Apr
              • Re: Crash in DBDriver::fetch_row on a heavily loaded system...Warren Young16 Apr
          • SSQLS: Number of colomns in a tabledancook)19 May
            • Re: SSQLS: Number of colomns in a tableAdrian Cornish19 May
            • Re: SSQLS: Number of colomns in a tableAdrian Cornish19 May
              • Re: SSQLS: Number of colomns in a tableWarren Young19 May
                • Re: SSQLS: Number of colomns in a tableAdrian Cornish19 May
                  • RE: SSQLS: Number of colomns in a tabledancook)19 May
                  • Re: SSQLS: Number of colomns in a tableWarren Young19 May
                    • Re: SSQLS: Number of colomns in a tableWarren Young20 May
      • Re: Crash in DBDriver::fetch_row on a heavily loaded system...Adrian Cornish13 Apr
        • Re: Crash in DBDriver::fetch_row on a heavily loaded system...Warren Young13 Apr