List:MySQL++« Previous MessageNext Message »
From:Samuel Borgman Date:March 31 2006 4:00pm
Subject:Re: Escaping a string
View as plain text  
You're right that code doesn't compute the string but it's not the same as
the code below which uses a char * which was discussed.

#include <mysql++.h>
#include <iostream>

int main()
{
         mysqlpp::Connection c;
         mysqlpp::Query q(&c);
         char *str = strdup("quote me, please");
         q << mysqlpp::quote << str;
         std::cout << q.preview() << std::endl;
         return 0;
}

Which does quote the string.

However if Bjoern's code defines str as char [] your code applies.
Which is, my misstake, a char array. I though of a char * which is
obviously taken care of(by manip.cpp:99-114 I'd imagine).

/Samuel

> Samuel Borgman wrote:
>>
>> What does manip.cpp:99-114(in 2.0.7) do
>
> Not what you think it does.  Build and run this:
>
> #include <mysql++.h>
> #include <iostream>
>
> int main()
> {
>          mysqlpp::Connection c;
>          mysqlpp::Query q(&c);
>          q << mysqlpp::quote << "quote me, please";
>          std::cout << q.preview() << std::endl;
>          return 0;
> }
>
> Betcha it doesn't quote the given string.
>
> Patches thoughtfully considered.
>
> --
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:
> http://lists.mysql.com/plusplus?unsub=1
>


Thread
Escaping a stringBjoern Rasmussen31 Mar
Re: Escaping a stringBjoern Rasmussen31 Mar
  • Re: Escaping a stringWarren Young31 Mar
    • Re: Escaping a stringSamuel Borgman31 Mar
      • Re: Escaping a stringWarren Young31 Mar
        • Re: Escaping a stringSamuel Borgman31 Mar
          • Re: Escaping a stringWarren Young5 Apr