On Wed, Jan 27, 2021 at 3:35 PM Christian Schneider <cschn...@cschneid.com>
wrote:

> Am 27.01.2021 um 14:34 schrieb Nikita Popov <nikita....@gmail.com>:
> > I think if you wanted to introduce an additional diagnostic step, the
> way to go about it would be to issue a deprecation warning when creating a
> connection without mysqli_report() having been explicitly called beforehand.
>
> Wouldn't this mean everybody would add mysqli_report() to their code?
> And wouldn't this render the default of mysqli_report() entirely useless?
> Or is your idea that at a later stage you then want to create a warning
> for manual mysqli_report() calls?
>

Yes, that would render a call to mysqli_report() required until the version
where the default was switched, and the requirement went away. A call to
mysqli_report() is already required if you use exception-based error
handling. The deprecation would force those people who use manual error
handling by default to make an explicit choice.


> > As others have said, the warning mode is pretty much entirely useless,
> and what you really want (presumably) is to know about the places where you
> need to explicitly call mysqli_report() to preserve the old behavior (or
> explicitly switch to the new one).
>
> No, I want to know if I have any code which needs fixing so I can see how
> I want to change those places e.g. a duplicate key from INSERT to REPLACE
> or whatever the correct fix is. Without the code aborting.
>

Okay, I think I now get what you want. My line of thinking was that people
who use manual error handling likely just want to keep doing that, and
should opt-in to it once the default changes. You apparently want them to
switch to use exceptions, in which case the warning mode might indeed be
useful to identify cases where "expected" errors occur.

However, I don't think this has much to do with the proposal at hand. If
someone wants to migrate their code to use exceptions, that's of course
great, but they could do that any time, regardless of what the default is.
They could have done that ten years ago, and they could do it in ten years.

This proposal is only about switching the default, which is why I mentioned
the possibility of diagnosing cases where it may be observable. That said,
I don't think doing so would actually be particularly useful in practice.
And it wouldn't even address your particular concern. As such, I think the
RFC should stick with the original proposal of simply flipping the default
directly.

Regards,
Nikita

Reply via email to