List:MySQL++« Previous MessageNext Message »
From:Robert Simmons Date:January 28 2009 11:44pm
Subject:Re: Convert mysqlpp::String to std::string
View as plain text  
Yes, passing in the result to the variable using the .data and .length  
functions does work.

Thanks guys!

On 28 Jan 2009, at 23:09, Jeremy Rottman wrote:

> You should be able to do something as simple as this.
>
> mysqlpp::String s = result[i][0];
>
> std::string myString = std::string(s.data(),s.length());
>
> -----Original Message-----
> From: Warren Young [mailto:mysqlpp@stripped]
> Sent: Wednesday, January 28, 2009 3:24 PM
> To: plusplus@stripped
> Subject: Re: Convert mysqlpp::String to std::string
>
> On Jan 28, 2009, at 3:15 PM, Robert Simmons wrote:
>
>> "String" isnt defined within <string> or <string.h>
>
> I assumed when I wrote that that you would realize it needed either
> "using namespace mysqlpp" or a "mysqlpp::" qualifier.
>
>> Instead of returning "1;2;3;4;5" as it should in this case, the
>> string only contains "1 - note the missing quote.
>
> Given the data, I suspect the actual problem is that you didn't do the
> quoting or escaping correctly when inserting it into the DB.  Quotes
> and semicolons are special characters in SQL.  If you use something
> like MySQL Query Browser to examine the table, I think you'll find
> that it's truncated in the DB.
>
> See http://tangentsoft.net/mysql++/doc/html/userman/tutorial.html#qescape
>
> -- 
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:    http://lists.mysql.com/plusplus?unsub=1
>
>
> -- 
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:    http://lists.mysql.com/plusplus?unsub=1
>

Thread
Convert mysqlpp::String to std::stringRobert Simmons28 Jan
  • Re: Convert mysqlpp::String to std::stringWarren Young28 Jan
    • Re: Convert mysqlpp::String to std::stringRobert Simmons28 Jan
      • Re: Convert mysqlpp::String to std::stringWarren Young28 Jan
        • RE: Convert mysqlpp::String to std::stringJeremy Rottman29 Jan
          • Re: Convert mysqlpp::String to std::stringRobert Simmons29 Jan