diff options
| author | Heikki Linnakangas | 2014-04-11 12:14:26 +0000 |
|---|---|---|
| committer | Heikki Linnakangas | 2014-04-11 12:16:16 +0000 |
| commit | b5c9a65eedc5f16031b7d44421bc161b9758d9fc (patch) | |
| tree | 5cb70b0c18108112d2b031bd11ab9430d4a1083f /statement.c | |
| parent | c38504ae9064a766d41316b28144d5a05c9cd9f0 (diff) | |
Fix two UseDeclareFetch bugs.
1. NOTICE messages were not delivered to the application, if they arrived
as response to the DECLARE CURSOR statement.
2. Array-bound parameters on SELECT-queries caused a "cursor already open"
error.
These bugs were found by running the regression suite with
UseDeclareFetch=1. It's now clean.
Diffstat (limited to 'statement.c')
| -rw-r--r-- | statement.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/statement.c b/statement.c index 19510bf..0d23ffe 100644 --- a/statement.c +++ b/statement.c @@ -2048,6 +2048,12 @@ inolog("get_Result=%p %p %d\n", res, SC_get_Result(self), self->curr_param_resul res = CC_send_query_append(conn, self->stmt_with_params, qryi, qflag, SC_get_ancestor(self), appendq); if (useCursor && QR_command_maybe_successful(res)) { + /* + * If we sent a DECLARE CURSOR + FETCH, throw away the result of + * the DECLARE CURSOR statement, and only return the result of the + * FETCH to the caller. However, if we received any NOTICEs as + * part of the DECLARE CURSOR, carry those over. + */ if (appendq) { QResultClass *qres, *nres; @@ -2060,6 +2066,15 @@ inolog("get_Result=%p %p %d\n", res, SC_get_Result(self), self->curr_param_resul break; } nres = qres->next; + if (nres && QR_get_notice(qres) != NULL) + { + if (QR_command_successful(nres) && + QR_command_nonfatal(qres)) + { + QR_set_rstatus(nres, PORES_NONFATAL_ERROR); + } + QR_add_notice(nres, QR_get_notice(qres)); + } qres->next = NULL; QR_Destructor(qres); qres = nres; |
