List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:February 25 2009 6:14pm
Subject:Re: Newbie Row question
View as plain text  
Sebastián Salazar Molina. wrote:
> but when I change out to int, it compile fine, when I 
> use string, i can't compile:

That's because Row::operator[] returns mysqlpp::String, which knows how 
to convert itself to an int, but not to std::string.  Without a direct 
conversion, your compiler is having to choose among the const char* and 
char conversions, and doesn't understand that the first is clearly the 
right one.

One way to fix it:

	String field = actual[f];
	return string(field.data());

Another way would be to add a std::string conversion operator to 
lib/mystring.h, try it, and report back.  If it works and doesn't cause 
problems, I'll add it to the next version of MySQL++.
Thread
Newbie Row questionSebasti├ín Salazar Molina.25 Feb
  • Re: Newbie Row questionWarren Young25 Feb
    • Re: Newbie Row questionSebasti├ín Salazar Molina.25 Feb
    • Re: Newbie Row questionRobert Simmons25 Feb
      • Re: Newbie Row questionWarren Young25 Feb