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 = querya.store();
> cout << res["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.data(),qstring.length)
> where 'mysqlpp::String qstring = //some String variable. */
Also, the conversion can be written like this:
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 Sepich||3 Jan|
| • Re: String question.||Chris Morgan||3 Jan|