I put together a quick test comparing identical queries where one Query
object has a preview() call prior to execute() and the other does not. The
result was that the Query that did not have the preview() call executed
fine, but the Query that did preview() caused a syntax error. Please see the
attached source file.
So, it appears to me that any code that calls preview() prior to executing a
query is affected.
However, the fix that Королев Илья mentioned (commenting out the appending
of std::ends to the string) seems to resolve the issue. It's not clear to me
why one would append that to the end of a std::string in the first place,
On 1/25/07, Королев Илья <breeze@stripped> wrote:
> > The bug is that preview is inserting a null byte into the query string
> > on every call. Two calls, two null bytes; three calls, three null
> > bytes. One ever responded to by bug report. Changes in the new
> > release were made to allow null bytes in query strings, so possibly
> > the old code masked the error and the new code reveals it.
> Hm... What for null byte is inserting? IMHO result of function
> std::string.c_str() everywhere is a zero terminated string.
> I comment line
> *this << std::ends;
> in Query::str(...), and it's working. At least for me (Linux, gcc 4.1.1)
> at least for simple queries.
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:
Attachment: [text/x-c++src] mysql-string-test.cpp