List:MySQL++« Previous MessageNext Message »
From:Drew M. Date:January 27 2007 7:47am
Subject:Re: troubles with 2.2.0
View as plain text  
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,
although ymmv.


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)
> and
> at least for simple queries.
>
> --
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:
> http://lists.mysql.com/plusplus?unsub=ghasatta@stripped
>
>
Attachment: [text/html]
Attachment: [text/html]
Attachment: [text/x-c++src] mysql-string-test.cpp
Thread
troubles with 2.2.0Королев Илья24 Jan
  • Re: troubles with 2.2.0Robert Mecklenburg24 Jan
    • Re: troubles with 2.2.0Warren Young24 Jan
      • Re: troubles with 2.2.0Robert Mecklenburg25 Jan
    • Re: troubles with 2.2.0Королев Илья25 Jan
      • Re: troubles with 2.2.0Drew M.27 Jan
  • Re: troubles with 2.2.0Warren Young24 Jan
    • Re: troubles with 2.2.0Королев Илья25 Jan
    • Re: troubles with 2.2.0Королев Илья1 Feb