List:MySQL++« Previous MessageNext Message »
From:Martin Gallwey Date:December 4 2009 2:31pm
Subject:Re: Template query change from v2 to v3
View as plain text  
Whoops, sorry, I hadn't read this mail:

http://lists.mysql.com/plusplus/6423

So my additional test cases weren't accurate as they contained the all 
important 'q' after the templated parameter.

>> You're welcome to continue working on this, but you'll have to take care of 
>> the single-string-parameter case to have the patch accepted.
>
> I'm pretty sure it works - the patch does more than just revert 1446 - it 
> also protects the execute/use/store cases where the user supplies a full 
> query with it's length by checking to see if it needs to do template 
> substitution first.
>
> If there is a test case I've missed, I'd be interested to know what it is.

There is a test case I had missed, which is the same as the previous ones 
but without the 'q', ie:

   mysqlpp::Query query = con.query ();
   query << "update stock set num = 587 where item = %0:ap_serial";
   query.parse();
   query.template_defaults["ap_serial"] = "'Good Irish Cabbage'";
   mysqlpp::SimpleResult result = query.execute();
   assert ( result.rows() == 0 );

I've modified my patch to revert the fix applied in revision 1446 and 
changed the fix so that the zero argument versions of execute/store/use 
(previously unchanged in this patch) were also protected by the 
'processing_' flag. This protects us from the double substitution 
described in the mail referenced above.

Cheers,

Martin
Attachment: [text/x-diff]  latest.patch
Thread
Template query change from v2 to v3Martin Gallwey3 Dec
  • Re: Template query change from v2 to v3Warren Young4 Dec
    • Re: Template query change from v2 to v3Martin Gallwey4 Dec
      • Re: Template query change from v2 to v3Martin Gallwey4 Dec
        • Re: Template query change from v2 to v3Warren Young4 Dec
          • Re: Template query change from v2 to v3Martin Gallwey4 Dec
            • Re: Template query change from v2 to v3Warren Young4 Dec