Gaus, Gregory R (Gregory) wrote:
> I have observed a problem when using a single argument template query
> with the 'storein' family of queries.
Sorry for taking so long to get back to you on this. I've had it
flagged for investigation, and kept putting it off because I thought it
represented an internal library problem that would be difficult to fix.
> testQuery.storein(someContainer, "1");
> // Works as expected
>
> testQuery.storein(someContainer, 1);
> // Fails - Sends the query "SELECT * FROM a WHERE b = 1 AND c = 2 AND c
> = 2"
I didn't realize until just now that the problem isn't that this code is
supposed to work and doesn't. The problem is that the second line is a
library usage bug, nothing more.
Template queries always require string arguments. That's just how
they're supposed to work. The fact that there is a storein() overload
that will take an integer as its second parameter is irrelevant; that
overload isn't meant to provide tquery service. The correct form for
the second line is:
testQuery.storein(someContainer, SQLString(1));
That'll ensure that your code uses the correct overload.
Now, none of this is to say that the problem's all yours. The fix to
the MySQL++ interface to prevent this confusion in the first place is
already on the Wishlist, but it can't be done until v3. I'll also try
to make the tquery chapter clearer on the argument requirement issue.
Sorry again for leaving you hanging on this.