Open a dynamic SQL cursor.
| 518 | |
| 519 | // Open a dynamic SQL cursor. |
| 520 | DsqlCursor* DsqlDmlRequest::openCursor(thread_db* tdbb, jrd_tra** traHandle, |
| 521 | IMessageMetadata* inMeta, const UCHAR* inMsg, IMessageMetadata* outMeta, ULONG flags) |
| 522 | { |
| 523 | SET_TDBB(tdbb); |
| 524 | |
| 525 | Jrd::ContextPoolHolder context(tdbb, &getPool()); |
| 526 | |
| 527 | if (dsqlStatement->getFlags() & DsqlStatement::FLAG_ORPHAN) |
| 528 | { |
| 529 | ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) << |
| 530 | Arg::Gds(isc_bad_req_handle)); |
| 531 | } |
| 532 | |
| 533 | // Validate transaction handle |
| 534 | |
| 535 | if (!*traHandle) |
| 536 | { |
| 537 | ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) << |
| 538 | Arg::Gds(isc_bad_trans_handle)); |
| 539 | } |
| 540 | |
| 541 | // Validate statement type |
| 542 | |
| 543 | if (!dsqlStatement->isCursorBased()) |
| 544 | Arg::Gds(isc_no_cursor).raise(); |
| 545 | |
| 546 | // Validate cursor or batch being not already open |
| 547 | |
| 548 | if (req_cursor) |
| 549 | { |
| 550 | ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-502) << |
| 551 | Arg::Gds(isc_dsql_cursor_open_err)); |
| 552 | } |
| 553 | |
| 554 | if (req_batch) |
| 555 | { |
| 556 | ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-502) << |
| 557 | Arg::Gds(isc_batch_open)); |
| 558 | } |
| 559 | |
| 560 | req_transaction = *traHandle; |
| 561 | execute(tdbb, traHandle, inMeta, inMsg, outMeta, NULL, false); |
| 562 | |
| 563 | req_cursor = FB_NEW_POOL(getPool()) DsqlCursor(this, flags); |
| 564 | |
| 565 | return req_cursor; |
| 566 | } |
| 567 | |
| 568 | bool DsqlDmlRequest::needRestarts() |
| 569 | { |
nothing calls this directly
no test coverage detected