DSQL_free_statement @brief Release request for a dsql statement @param user_status @param req_handle @param option **/
| 197 | |
| 198 | **/ |
| 199 | void DSQL_free_statement(thread_db* tdbb, DsqlRequest* dsqlRequest, USHORT option) |
| 200 | { |
| 201 | SET_TDBB(tdbb); |
| 202 | |
| 203 | Jrd::ContextPoolHolder context(tdbb, &dsqlRequest->getPool()); |
| 204 | |
| 205 | const auto dsqlStatement = dsqlRequest->getDsqlStatement(); |
| 206 | |
| 207 | fb_assert(!(option & DSQL_unprepare)); // handled in y-valve |
| 208 | |
| 209 | if (option & DSQL_drop) |
| 210 | { |
| 211 | // Release everything associated with the request |
| 212 | DsqlRequest::destroy(tdbb, dsqlRequest); |
| 213 | } |
| 214 | else if (option & DSQL_close) |
| 215 | { |
| 216 | // Just close the cursor associated with the request |
| 217 | if (dsqlStatement->isCursorBased()) |
| 218 | { |
| 219 | if (!dsqlRequest->req_cursor) |
| 220 | { |
| 221 | ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-501) << |
| 222 | Arg::Gds(isc_dsql_cursor_close_err)); |
| 223 | } |
| 224 | |
| 225 | DsqlCursor::close(tdbb, dsqlRequest->req_cursor); |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | |
| 231 | /** |
no test coverage detected