List:MySQL++« Previous MessageNext Message »
From:Chris Morgan Date:January 3 2011 10:08pm
Subject:Re: String question.
View as plain text  
On Mon, Jan 3, 2011 at 13:49, Eric Sepich <sepich.eric@stripped> wrote:
> In regards to
> Query querya = conn.query("select * from program_categories");
> StoreQueryResult res =;
> cout << res[0]["name"] << endl;
> /* I notice that sometimes I can do this and it compiles and other times I
> try somthing very much like the 'cout' line above and I am forced to convert
> from a 'mysqlpp::String' type to a 'string' type in I guess what is the
> generally accepted way string temp = string(,qstring.length)
> where 'mysqlpp::String qstring = //some String variable. */

Also, the conversion can be written like this:

mysqlpp::String qstring;
std::string temp = std::string(qstring);

> /* I am trying to determine specifically why in some cases the conversion is
> necessary and in some cases it doesn't seem to be. */

The conversion is required when the compiler can't do it implicitly.
Are you trying to put SQL integers into std::strings or something?

You can find a list of conversion operators here:

Separately, it's really hard for us to answer your questions
completely when we don't have a compilable example of code.  The best
way to ask a question (as noted on the MySQL++ site) is to modify one
of the examples to reproduce whatever behavior you're asking about.
That way, everyone is working from the same schema and code base.

String question.Eric Sepich3 Jan
  • Re: String question.Chris Morgan3 Jan