| 47 | |
| 48 | |
| 49 | void VirtualTable::erase(thread_db* tdbb, record_param* rpb) |
| 50 | { |
| 51 | SET_TDBB(tdbb); |
| 52 | |
| 53 | Database* dbb = tdbb->getDatabase(); |
| 54 | fb_assert(dbb); |
| 55 | |
| 56 | jrd_rel* relation = rpb->rpb_relation; |
| 57 | fb_assert(relation); |
| 58 | |
| 59 | dsc desc; |
| 60 | lck_t lock_type; |
| 61 | |
| 62 | if (relation->rel_id == rel_mon_attachments) |
| 63 | { |
| 64 | // Get attachment id |
| 65 | if (!EVL_field(relation, rpb->rpb_record, f_mon_att_id, &desc)) |
| 66 | return; |
| 67 | |
| 68 | // Ignore attempt to stop system attachment |
| 69 | dsc sysFlag; |
| 70 | if (EVL_field(relation, rpb->rpb_record, f_mon_att_sys_flag, &sysFlag) && |
| 71 | MOV_get_long(tdbb, &sysFlag, 0) != 0) |
| 72 | { |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | lock_type = LCK_attachment; |
| 77 | } |
| 78 | else if (relation->rel_id == rel_mon_statements) |
| 79 | { |
| 80 | // Get attachment id |
| 81 | if (!EVL_field(relation, rpb->rpb_record, f_mon_stmt_att_id, &desc)) |
| 82 | return; |
| 83 | lock_type = LCK_cancel; |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | ERR_post(Arg::Gds(isc_read_only)); |
| 88 | return; |
| 89 | } |
| 90 | |
| 91 | const SINT64 id = MOV_get_int64(tdbb, &desc, 0); |
| 92 | |
| 93 | // Post a blocking request |
| 94 | Lock temp_lock(tdbb, sizeof(SINT64), lock_type); |
| 95 | temp_lock.setKey(id); |
| 96 | |
| 97 | ThreadStatusGuard temp_status(tdbb); |
| 98 | |
| 99 | if (LCK_lock(tdbb, &temp_lock, LCK_EX, -1)) |
| 100 | LCK_release(tdbb, &temp_lock); |
| 101 | } |
| 102 | |
| 103 | |
| 104 | void VirtualTable::modify(thread_db* /*tdbb*/, record_param* /*org_rpb*/, record_param* /*new_rpb*/) |
no test coverage detected