List:MySQL++« Previous MessageNext Message »
From:Chris Frey Date:December 19 2005 8:10pm
Subject:Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "d
View as plain text  
On Thu, Dec 15, 2005 at 08:21:51PM -0600, Drew Vogel wrote:
> After running into this same memory corruption again, I did a bit more 
> debugging. Through trial and error, I've determined that it only happens 
> when I declare a row object and then initialize it later:
> 
>    mysqlpp::Row row;
>    while (row = res.fetch_row()) {
>        ...
>    }
> 
> The memory corruption does not appear if I declare the row object inside 
> the loop condition:
> 
>    while (mysqlpp::Row row = res.fetch_row()) {
>       ...
>    }

I don't see how that can make a difference.  The examples use similar
logic to your first example, and they work.

The Row object is a rather simple container of data, and does its copying with
default copy constructor and default operator=().

Note that Row objects contain a pointer to the result object, so they must
not outlive the result.

- Chris

Thread
BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel11 Dec
  • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel11 Dec
  • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dWarren Young12 Dec
    • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel12 Dec
      • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dWarren Young12 Dec
        • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel12 Dec
          • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dWarren Young12 Dec
            • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel12 Dec
          • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dDrew Vogel16 Dec
            • Re: BadConverion::what()=Tried to convert "0.00P\uffffI" to a "dChris Frey19 Dec