https://bugs.documentfoundation.org/show_bug.cgi?id=112423

--- Comment #22 from Lionel Elie Mamane <lio...@mamane.lu> ---
(In reply to Julien Nabet from comment #21)
> Lionel: just an hypothesis, since Robert uses the old extension perhaps this
> part doesn't work for him:

Yes, that seems probable.

> --- a/mysqlc/source/mysqlc_statement.cxx
> +++ b/mysqlc/source/mysqlc_statement.cxx

> Of course, these methods are called from a try/catch but are the catches
> sufficient to deal with the lack of one (or both) of these methods in the
> extension?

No, the try/catch deals with exceptions but here no exception is thrown by the
buggy version.

The bug really was that the MySQL extension was _lying_. It said "yes, I
support multiple results from one query (interface XMultipleResults)", but then
it returned garbage data when one tried to use it. It should have either
cleanly _not_ proposed the XMultipleResults interface *or* implement it
correctly (which was very easy since MySQL Connector C++ implements it... maybe
it didn't at the time this code was written. <shrug>).

The garbage data comes from a misunderstanding of the XMultipleResults
interface. The person that wrote that probably thought that:

 - getMoreResults() returning false means "no next result available".
   That is wrong. It means "there is a next result, and the next result
   is an update count, not a resultset". A resultset = a sequence of rows of
   columns (like what a SELECT query returns).
 - getUpdateCount() returning zero is ... I don't know what he/she though.
   It means "the current result is an update count, and that count is zero,
   i.e. the UPDATE/DELETE/... changed zero rows, but otherwise was successfully
   executed". For a "shim" implementation it should have returned "-1", which
   means "the current result is not an update count.

So essentially, the old MySQL extension was causing an infinite loop in any
caller that expected a correct XMultipleResults, since it was always saying
"there is a next result giving an update count" and giving a valid value (zero)
for the update count. While if it getMoreResults() returns false getUpdateCount
returns -1, that is the signal for "there is no further result".

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to