| 1252 | |
| 1253 | |
| 1254 | void IDX_modify(thread_db* tdbb, |
| 1255 | record_param* org_rpb, |
| 1256 | record_param* new_rpb, |
| 1257 | jrd_tra* transaction) |
| 1258 | { |
| 1259 | /************************************** |
| 1260 | * |
| 1261 | * I D X _ m o d i f y |
| 1262 | * |
| 1263 | ************************************** |
| 1264 | * |
| 1265 | * Functional description |
| 1266 | * Update the various indices after a MODIFY operation. If a duplicate |
| 1267 | * index is violated, return the index number. If successful, return |
| 1268 | * -1. |
| 1269 | * |
| 1270 | **************************************/ |
| 1271 | SET_TDBB(tdbb); |
| 1272 | |
| 1273 | index_desc idx; |
| 1274 | idx.idx_id = idx_invalid; |
| 1275 | |
| 1276 | index_insertion insertion; |
| 1277 | insertion.iib_relation = org_rpb->rpb_relation; |
| 1278 | insertion.iib_number = org_rpb->rpb_number; |
| 1279 | insertion.iib_descriptor = &idx; |
| 1280 | insertion.iib_transaction = transaction; |
| 1281 | insertion.iib_btr_level = 0; |
| 1282 | |
| 1283 | RelationPages* relPages = org_rpb->rpb_relation->getPages(tdbb); |
| 1284 | WIN window(relPages->rel_pg_space_id, -1); |
| 1285 | |
| 1286 | new_rpb->rpb_runtime_flags &= ~RPB_uk_updated; |
| 1287 | |
| 1288 | while (BTR_next_index(tdbb, org_rpb->rpb_relation, transaction, &idx, &window)) |
| 1289 | { |
| 1290 | IndexErrorContext context(new_rpb->rpb_relation, &idx); |
| 1291 | idx_e error_code = idx_e_ok; |
| 1292 | |
| 1293 | { |
| 1294 | IndexCondition condition(tdbb, &idx); |
| 1295 | const auto checkResult = condition.check(new_rpb->rpb_record, &error_code); |
| 1296 | |
| 1297 | if (error_code) |
| 1298 | { |
| 1299 | CCH_RELEASE(tdbb, &window); |
| 1300 | context.raise(tdbb, error_code, new_rpb->rpb_record); |
| 1301 | } |
| 1302 | |
| 1303 | fb_assert(checkResult.isAssigned()); |
| 1304 | if (!checkResult.value) |
| 1305 | continue; |
| 1306 | } |
| 1307 | |
| 1308 | AutoIndexExpression expression; |
| 1309 | IndexKey newKey(tdbb, new_rpb->rpb_relation, &idx, expression), orgKey(newKey); |
| 1310 | |
| 1311 | if ( (error_code = newKey.compose(new_rpb->rpb_record)) ) |
no test coverage detected