Samuel Borgman wrote:
>
> I though of a char * which is
> obviously taken care of(by manip.cpp:99-114 I'd imagine).
I looked into this, and it's going to be a mess to fix.
The reason the function you're referring to uses such a tortured
declaration ("const char* const& in" ... yuck!) is because it is
specializing a template which expects a const reference to something.
So, this is trying to talk about a const reference to a const char*.
Unfortunately, the compiler isn't playing along -- it doesn't consider a
const char* to be close enough for it to call that specialization.
Instead, it calls the non-specialized version, which doesn't do quoting.
This may be one of those things that once worked, but which was
"fixed" in a newer compiler version.
If the templates in question are changed to accept any type (i.e. just a
plain T instead of a const T&), and "const&" is removed from all of the
char* specializations, string literals get quoted as you'd expect.
Presumably this will fix Bjoern's problem, as it's probably related to
the one I illustrated in my program above. But, this simple change a)
breaks the ABI; and b) breaks other things, like quoting std::string.
I've added a Wishlist item to the v3.0 section. In the meantime, I
suggest wrapping all problem strings in std::string. It'll create some
extra temporaries, but what with all the delays imposed by SQL
databases, I'll bet it won't change your benchmark results meaningfully.