Perform erase operation.
| 2658 | |
| 2659 | // Perform erase operation. |
| 2660 | const StmtNode* EraseNode::erase(thread_db* tdbb, Request* request, WhichTrigger whichTrig) const |
| 2661 | { |
| 2662 | impure_state* impure = request->getImpure<impure_state>(impureOffset); |
| 2663 | |
| 2664 | jrd_tra* transaction = request->req_transaction; |
| 2665 | record_param* rpb = &request->req_rpb[stream]; |
| 2666 | jrd_rel* relation = rpb->rpb_relation; |
| 2667 | |
| 2668 | switch (request->req_operation) |
| 2669 | { |
| 2670 | case Request::req_evaluate: |
| 2671 | { |
| 2672 | impure->sta_state = 0; |
| 2673 | |
| 2674 | if (!(marks & MARK_AVOID_COUNTERS)) |
| 2675 | request->req_records_affected.bumpModified(false); |
| 2676 | |
| 2677 | if (!statement) |
| 2678 | break; |
| 2679 | |
| 2680 | const Format* format = MET_current(tdbb, rpb->rpb_relation); |
| 2681 | Record* record = VIO_record(tdbb, rpb, format, tdbb->getDefaultPool()); |
| 2682 | |
| 2683 | rpb->rpb_address = record->getData(); |
| 2684 | rpb->rpb_length = format->fmt_length; |
| 2685 | rpb->rpb_format_number = format->fmt_version; |
| 2686 | |
| 2687 | return statement; |
| 2688 | } |
| 2689 | |
| 2690 | case Request::req_return: |
| 2691 | if (impure->sta_state == 1) |
| 2692 | { |
| 2693 | impure->sta_state = 0; |
| 2694 | rpb->rpb_number.setValid(false); |
| 2695 | return parentStmt; |
| 2696 | } |
| 2697 | break; |
| 2698 | |
| 2699 | default: |
| 2700 | return parentStmt; |
| 2701 | } |
| 2702 | |
| 2703 | request->req_operation = Request::req_return; |
| 2704 | RLCK_reserve_relation(tdbb, transaction, relation, true); |
| 2705 | |
| 2706 | if (rpb->rpb_runtime_flags & RPB_just_deleted) |
| 2707 | return parentStmt; |
| 2708 | |
| 2709 | if (rpb->rpb_number.isBof() || (!relation->rel_view_rse && !rpb->rpb_number.isValid())) |
| 2710 | ERR_post(Arg::Gds(isc_no_cur_rec)); |
| 2711 | |
| 2712 | if (forNode && forNode->isWriteLockMode(request)) |
| 2713 | { |
| 2714 | forceWriteLock(tdbb, rpb, transaction); |
| 2715 | return parentStmt; |
| 2716 | } |
| 2717 |
no test coverage detected