List:MySQL++« Previous MessageNext Message »
From:Earl Miles Date:March 14 2005 8:48pm
Subject:Re: Data types - especially strings
View as plain text  
Chris Frey wrote:
> On Mon, Mar 14, 2005 at 08:11:09PM +0100, Joachim Person wrote:
> 
>>Having the following code
>>
>> 
>>
>>            std::vector<CString> retV;
>>
>>            Result::iterator iter;
>>
>>            Row row;
>>
>>            for (iter = result.begin(); iter != result.end(); ++iter) {
>>
>>                         row = *iter;
>>
>> 
>>retV.push_back(CString(row[TABLE_NAME_SERVICE_COL_NAME_NAME]));
>>
>>            }
> 
> 
> Oops, my dumb mistake, it is set to something.  I should wake up completely
> before I post advice. :-)
> 
> My first thought would be to check what type the inner
> "row[TABLE_NAME...]" is returning.  If it is not returning what you think
> it is, you may need to force it with a cast.

Having run into issues like this, it's almost certainly the problem. Try casting it to
const char* which CString will more likely interpret as a string; it's probably somehow
coming out as just a char (though the compiler *should* complain because it shouldn't be
able to figure out which CString constructor to use in that situation since row has a lot
of different operators).
Thread
Data types - especially stringsJoachim Person14 Mar
  • Re: Data types - especially stringsChris Frey14 Mar
  • Re: Data types - especially stringsChris Frey14 Mar
    • Re: Data types - especially stringsEarl Miles14 Mar