| 3274 | } |
| 3275 | |
| 3276 | bool VIO_modify(thread_db* tdbb, record_param* org_rpb, record_param* new_rpb, jrd_tra* transaction) |
| 3277 | { |
| 3278 | /************************************** |
| 3279 | * |
| 3280 | * V I O _ m o d i f y |
| 3281 | * |
| 3282 | ************************************** |
| 3283 | * |
| 3284 | * Functional description |
| 3285 | * Modify an existing record. |
| 3286 | * |
| 3287 | **************************************/ |
| 3288 | SET_TDBB(tdbb); |
| 3289 | |
| 3290 | MetaName object_name, package_name; |
| 3291 | jrd_rel* relation = org_rpb->rpb_relation; |
| 3292 | |
| 3293 | #ifdef VIO_DEBUG |
| 3294 | VIO_trace(DEBUG_WRITES, |
| 3295 | "VIO_modify (rel_id %u, org_rpb %" QUADFORMAT"d, new_rpb %" QUADFORMAT"d, " |
| 3296 | "transaction %" SQUADFORMAT")\n", |
| 3297 | relation->rel_id, org_rpb->rpb_number.getValue(), new_rpb->rpb_number.getValue(), |
| 3298 | transaction ? transaction->tra_number : 0); |
| 3299 | |
| 3300 | VIO_trace(DEBUG_WRITES_INFO, |
| 3301 | " old record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT |
| 3302 | ", flags %d, back %" SLONGFORMAT":%d, fragment %" SLONGFORMAT":%d\n", |
| 3303 | org_rpb->rpb_page, org_rpb->rpb_line, org_rpb->rpb_transaction_nr, |
| 3304 | org_rpb->rpb_flags, org_rpb->rpb_b_page, org_rpb->rpb_b_line, |
| 3305 | org_rpb->rpb_f_page, org_rpb->rpb_f_line); |
| 3306 | #endif |
| 3307 | |
| 3308 | transaction->tra_flags |= TRA_write; |
| 3309 | new_rpb->rpb_transaction_nr = transaction->tra_number; |
| 3310 | new_rpb->rpb_flags = 0; |
| 3311 | new_rpb->getWindow(tdbb).win_flags = WIN_secondary; |
| 3312 | |
| 3313 | // If the stream was sorted, the various fields in the rpb are |
| 3314 | // probably junk. Just to make sure that everything is cool, |
| 3315 | // refetch and release the record. |
| 3316 | |
| 3317 | if (org_rpb->rpb_runtime_flags & (RPB_refetch | RPB_undo_read)) |
| 3318 | { |
| 3319 | const bool undo_read = (org_rpb->rpb_runtime_flags & RPB_undo_read); |
| 3320 | AutoTempRecord old_record; |
| 3321 | if (undo_read) |
| 3322 | { |
| 3323 | old_record = VIO_gc_record(tdbb, relation); |
| 3324 | old_record->copyFrom(org_rpb->rpb_record); |
| 3325 | } |
| 3326 | |
| 3327 | VIO_refetch_record(tdbb, org_rpb, transaction, false, true); |
| 3328 | org_rpb->rpb_runtime_flags &= ~RPB_refetch; |
| 3329 | fb_assert(!(org_rpb->rpb_runtime_flags & RPB_undo_read)); |
| 3330 | |
| 3331 | if (undo_read) |
| 3332 | refresh_changed_fields(tdbb, old_record, org_rpb, new_rpb); |
| 3333 | } |
no test coverage detected