Skip to content

Commit 0bbd203

Browse files
committed
Make PramValues follow expectations
1. The keys are expected (not guaranteed) to be integers starting at 1. They previously started at 0. 2. The values should be undef if not yet bound
1 parent 0c8c2d3 commit 0bbd203

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

dbdimp.c

+11-3
Original file line numberDiff line numberDiff line change
@@ -4026,9 +4026,17 @@ dbd_st_FETCH_internal(
40264026
I32 keylen;
40274027
for (n= 0; n < DBIc_NUM_PARAMS(imp_sth); n++)
40284028
{
4029-
keylen= sprintf(key, "%d", n);
4030-
(void)hv_store(pvhv, key,
4031-
keylen, newSVsv(imp_sth->params[n].value), 0);
4029+
// https://metacpan.org/pod/DBI#ParamValues says keys
4030+
// are typically integers starting at 1
4031+
// values should be undef if not yet bound
4032+
keylen= sprintf(key, "%d", n+1);
4033+
if (imp_sth->params[n].value) {
4034+
(void)hv_store(pvhv, key,
4035+
keylen, newSVsv(imp_sth->params[n].value), 0);
4036+
} else {
4037+
(void)hv_store(pvhv, key,
4038+
keylen, &PL_sv_undef, 0);
4039+
}
40324040
}
40334041
}
40344042
retsv= sv_2mortal(newRV_noinc((SV*)pvhv));

0 commit comments

Comments
 (0)