Skip to content

#475: Improve error message for unsupported named parameters #476

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 17 additions & 0 deletions dbdimp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4209,6 +4209,23 @@ int dbd_bind_ph(SV *sth, imp_sth_t *imp_sth, SV *param, SV *value,

if (param_num <= 0 || param_num > DBIc_NUM_PARAMS(imp_sth))
{
if (!looks_like_number(param))
{
STRLEN len;
char *paramstring;
paramstring = SvPV(param, len);
if(paramstring[len] == 0 && strlen(paramstring) == len)
{
do_error(sth, JW_ERR_ILLEGAL_PARAM_NUM, form("named parameters are unsupported: %s", paramstring), NULL);
return FALSE;
}
else
{
do_error(sth, JW_ERR_ILLEGAL_PARAM_NUM, "<param> could not be coerced to a C string", NULL);
return FALSE;
}
}

do_error(sth, JW_ERR_ILLEGAL_PARAM_NUM, "Illegal parameter number", NULL);
return FALSE;
}
Expand Down