MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / IDX_modify

Function IDX_modify

src/jrd/idx.cpp:1254–1355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1252
1253
1254void 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)) )

Callers 2

modifyMethod · 0.85
doUpdateMethod · 0.85

Calls 10

SET_TDBBFunction · 0.85
BTR_next_indexFunction · 0.85
CCH_RELEASEFunction · 0.85
insert_keyFunction · 0.85
isAssignedMethod · 0.80
getPagesMethod · 0.45
checkMethod · 0.45
raiseMethod · 0.45
composeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected