[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-plusplus
Subject:    Re: Escaping a string
From:       "Samuel Borgman" <samuel.borgman () newsmachine ! com>
Date:       2006-03-31 16:00:22
Message-ID: 64209.213.89.143.53.1143820822.squirrel () 213 ! 89 ! 143 ! 53
[Download RAW message or body]

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=googlesam@newsmachine.com
>



-- 
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=mysql-plusplus@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic