diff options
| author | Adrian Grucza | 2021-05-26 05:14:16 +0000 |
|---|---|---|
| committer | Hiroshi Inoue | 2021-05-26 12:44:51 +0000 |
| commit | 0baeeb567109ad23ce5c6656d83979955614cdbd (patch) | |
| tree | a4914b199eeb77bc9363646dd6cd21cbbb2be619 /statement.c | |
| parent | a2a416d7d0901dc83df4def478203015b2cc8287 (diff) | |
Named parameter binding support
Diffstat (limited to 'statement.c')
| -rw-r--r-- | statement.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/statement.c b/statement.c index a42f7ca..e7f816f 100644 --- a/statement.c +++ b/statement.c @@ -2268,12 +2268,22 @@ MYLOG(DETAIL_LOG_LEVEL, "!!SC_fetch return =%d\n", ret); num_p = ipdopts->allocated; for (i = 0, gidx = 0; i < num_p; i++) { + int icol = gidx; ipara = ipdopts->parameters + i; if (ipara->paramType == SQL_PARAM_OUTPUT || ipara->paramType == SQL_PARAM_INPUT_OUTPUT) { + if (NAME_IS_VALID(ipara->paramName)) + { + icol = QR_search_by_fieldname(rhold.first, GET_NAME(ipara->paramName)); + if (icol < 0) + { + SC_set_error(self, STMT_EXEC_ERROR, "Named output parameter does not exist.", func); + break; + } + } apara = apdopts->parameters + i; - ret = PGAPI_GetData(hstmt, gidx + 1, apara->CType, apara->buffer + offset, apara->buflen, apara->used ? LENADDR_SHIFT(apara->used, offset) : NULL); + ret = PGAPI_GetData(hstmt, icol + 1, apara->CType, apara->buffer + offset, apara->buflen, apara->used ? LENADDR_SHIFT(apara->used, offset) : NULL); if (!SQL_SUCCEEDED(ret)) { SC_set_error(self, STMT_EXEC_ERROR, "GetData to Procedure return failed.", func); |
