| 1214 | } |
| 1215 | |
| 1216 | void Applier::doInsert(thread_db* tdbb, record_param* rpb, jrd_tra* transaction) |
| 1217 | { |
| 1218 | fb_assert(!(transaction->tra_flags & TRA_system)); |
| 1219 | |
| 1220 | const auto record = rpb->rpb_record; |
| 1221 | const auto format = record->getFormat(); |
| 1222 | const auto relation = rpb->rpb_relation; |
| 1223 | |
| 1224 | RLCK_reserve_relation(tdbb, transaction, relation, true); |
| 1225 | |
| 1226 | for (USHORT id = 0; id < format->fmt_count; id++) |
| 1227 | { |
| 1228 | dsc desc; |
| 1229 | if (DTYPE_IS_BLOB(format->fmt_desc[id].dsc_dtype) && |
| 1230 | EVL_field(NULL, record, id, &desc)) |
| 1231 | { |
| 1232 | const auto blobId = (bid*) desc.dsc_address; |
| 1233 | |
| 1234 | if (!blobId->isEmpty()) |
| 1235 | { |
| 1236 | ULONG tempBlobId; |
| 1237 | bool found = false; |
| 1238 | |
| 1239 | const auto numericId = blobId->get_permanent_number().getValue(); |
| 1240 | |
| 1241 | if (transaction->tra_repl_blobs.get(numericId, tempBlobId) && |
| 1242 | transaction->tra_blobs->locate(tempBlobId)) |
| 1243 | { |
| 1244 | const auto current = &transaction->tra_blobs->current(); |
| 1245 | |
| 1246 | if (!current->bli_materialized) |
| 1247 | { |
| 1248 | const auto blob = current->bli_blob_object; |
| 1249 | fb_assert(blob); |
| 1250 | blob->blb_relation = relation; |
| 1251 | blob->blb_sub_type = desc.getBlobSubType(); |
| 1252 | blob->blb_charset = desc.getCharSet(); |
| 1253 | blobId->set_permanent(relation->rel_id, DPM_store_blob(tdbb, blob, record)); |
| 1254 | current->bli_materialized = true; |
| 1255 | current->bli_blob_id = *blobId; |
| 1256 | transaction->tra_blobs->fastRemove(); |
| 1257 | found = true; |
| 1258 | } |
| 1259 | } |
| 1260 | |
| 1261 | if (!found) |
| 1262 | { |
| 1263 | const ULONG num1 = blobId->bid_quad.bid_quad_high; |
| 1264 | const ULONG num2 = blobId->bid_quad.bid_quad_low; |
| 1265 | raiseError("Blob %u.%u is not found for table %s", |
| 1266 | num1, num2, relation->rel_name.c_str()); |
| 1267 | } |
| 1268 | } |
| 1269 | } |
| 1270 | } |
| 1271 | |
| 1272 | // Cleanup temporary blobs stored for this command beforehand but not materialized |
| 1273 |
nothing calls this directly
no test coverage detected