List:MySQL++« Previous MessageNext Message »
From:Martin Gallwey Date:December 4 2009 2:09pm
Subject:Re: Template query change from v2 to v3
View as plain text  
Hi Warren,

>> 1) Revision 1446 changed the detection of a templated query to search for 
>> the magic size of '2' for parse_elems_. 
>
> There's no "magic" here.  The problem is how do you distinguish a lone string 
> parameter for a template query containing only %0 from a raw query string?

Because in the first case, parse_elems_ will not be empty, and in the 
second case it will?

> The core problem is the number of overloads for execute() and such, and 
> maintaining unambiguity through call chains that may pass through several of 
> these overloads.
>
> I haven't tried your patch, but I'd be surprised -- since it just reverts a 
> patch -- if it doesn't break this again.

Which test case from 'dtest' would you expect to fail if this case had 
been broken? I looked back at the list to see which case was failing to 
prompt the changes made in revision 1446, and added a test case based on 
that, then on a variety of other variations on the theme to tquery1.cpp 
and they all work. I've attached the patch with these additional tests 
added.

> 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.

Thanks,

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