Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unreliable use of ParamValues attribute #23

Open
myrrhlin opened this issue Oct 20, 2024 · 0 comments
Open

unreliable use of ParamValues attribute #23

myrrhlin opened this issue Oct 20, 2024 · 0 comments

Comments

@myrrhlin
Copy link

myrrhlin commented Oct 20, 2024

I experienced a segfault using DBI::Log with mysql, and reported it to DBD::mysql.

The segfault comes from the dereferencing of $sth->{ParamValues}, to copy its data for populating the placeholders, as the attribute is expected to return a hashref, where

keys of the hash are the 'names' of the placeholders, typically integers starting at 1. Returns undef if not supported by the driver

The segfault is obviously not the fault of DBI::Log.

However, DBI::Log should probably not be looking at the ParamValues attribute prior to execution, as some (many?) drivers won't support this:

Some drivers cannot provide valid values for some or all of these attributes until after $sth->execute has been successfully called. Typically the attribute will be undef in these situations

It might be a good idea to move the actual logging (in all cases, not just json) to the post_query function, since ParamValues is more likely to contain bound parameter values at that time. If this is acceptable, I will make a pull request.

(Working around the problematic behavior of the DBD::mysql driver that I reported, however, would require something further. I can also take a stab at that, if you're open to that.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant