Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions dbdimp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4026,9 +4026,16 @@ dbd_st_FETCH_internal(
I32 keylen;
for (n= 0; n < DBIc_NUM_PARAMS(imp_sth); n++)
{
keylen= sprintf(key, "%d", n);
(void)hv_store(pvhv, key,
keylen, newSVsv(imp_sth->params[n].value), 0);
// https://metacpan.org/pod/DBI#ParamValues says keys
// are typically integers starting at 1
// values should be undef if not yet bound
keylen= sprintf(key, "%d", n+1);
if (imp_sth->params[n].value) {
(void)hv_store(pvhv, key,
keylen, newSVsv(imp_sth->params[n].value), 0);
} else {
(void)hv_store(pvhv, key, keylen, &PL_sv_undef, 0);
}
}
}
retsv= sv_2mortal(newRV_noinc((SV*)pvhv));
Copy link
Contributor

@myrrhlin myrrhlin Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read this correctly, the return value here is always a hashref. When there are no params saved yet, the return should simply be undef -- if I understand the DBI docs correctly 😛

Expand Down