| 4909 | |
| 4910 | |
| 4911 | static void delete_record(thread_db* tdbb, record_param* rpb, ULONG prior_page, MemoryPool* pool) |
| 4912 | { |
| 4913 | /************************************** |
| 4914 | * |
| 4915 | * d e l e t e _ r e c o r d |
| 4916 | * |
| 4917 | ************************************** |
| 4918 | * |
| 4919 | * Functional description |
| 4920 | * Delete a record an all of its fragments. This assumes the |
| 4921 | * record has already been fetched for write. If a pool is given, |
| 4922 | * the caller has requested that data be fetched as the record is |
| 4923 | * deleted. |
| 4924 | * |
| 4925 | **************************************/ |
| 4926 | SET_TDBB(tdbb); |
| 4927 | |
| 4928 | #ifdef VIO_DEBUG |
| 4929 | jrd_rel* relation = rpb->rpb_relation; |
| 4930 | VIO_trace(DEBUG_WRITES, |
| 4931 | "delete_record (rel_id %u, record_param %" QUADFORMAT"d, prior_page %" SLONGFORMAT", pool %p)\n", |
| 4932 | relation->rel_id, rpb->rpb_number.getValue(), prior_page, (void*)pool); |
| 4933 | |
| 4934 | VIO_trace(DEBUG_WRITES_INFO, |
| 4935 | " delete_record record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT |
| 4936 | ", flags %d, back %" SLONGFORMAT":%d, fragment %" SLONGFORMAT":%d\n", |
| 4937 | rpb->rpb_page, rpb->rpb_line, rpb->rpb_transaction_nr, |
| 4938 | rpb->rpb_flags, rpb->rpb_b_page, rpb->rpb_b_line, |
| 4939 | rpb->rpb_f_page, rpb->rpb_f_line); |
| 4940 | #endif |
| 4941 | UCHAR* tail = nullptr; |
| 4942 | const UCHAR* tail_end = nullptr; |
| 4943 | |
| 4944 | Difference difference; |
| 4945 | |
| 4946 | Record* record = nullptr; |
| 4947 | const Record* prior = nullptr; |
| 4948 | |
| 4949 | if (pool && !(rpb->rpb_flags & rpb_deleted)) |
| 4950 | { |
| 4951 | record = VIO_record(tdbb, rpb, NULL, pool); |
| 4952 | prior = rpb->rpb_prior; |
| 4953 | |
| 4954 | if (prior) |
| 4955 | { |
| 4956 | tail = difference.getData(); |
| 4957 | tail_end = tail + difference.getCapacity(); |
| 4958 | |
| 4959 | if (prior != record) |
| 4960 | record->copyDataFrom(prior); |
| 4961 | } |
| 4962 | else |
| 4963 | { |
| 4964 | tail = record->getData(); |
| 4965 | tail_end = tail + record->getLength(); |
| 4966 | } |
| 4967 | |
| 4968 | tail = unpack(rpb, tail_end - tail, tail); |
no test coverage detected