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

Method open2

src/jrd/blb.cpp:1326–1556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1324
1325
1326blb* blb::open2(thread_db* tdbb,
1327 jrd_tra* transaction, const bid* blob_id,
1328 USHORT bpb_length, const UCHAR* bpb,
1329 bool external_call)
1330{
1331/**************************************
1332 *
1333 * b l b : : o p e n 2
1334 *
1335 **************************************
1336 *
1337 * Functional description
1338 * Open an existing blob.
1339 * Basically blb::open() with BPB structure.
1340 *
1341 **************************************/
1342 transaction = transaction->getOuter();
1343
1344 SET_TDBB(tdbb);
1345 Database* dbb = tdbb->getDatabase();
1346
1347 // Use local copy of input blob id to not change contents of *blob_id in a
1348 // case when it points to materialized temporary blob.
1349 bid blobId = *blob_id;
1350
1351 // Handle filter case
1352 SSHORT from, to;
1353 SSHORT from_charset, to_charset;
1354 bool from_type_specified;
1355 bool from_charset_specified;
1356 bool to_type_specified;
1357 bool to_charset_specified;
1358
1359 gds__parse_bpb2(bpb_length,
1360 bpb,
1361 &from,
1362 &to,
1363 reinterpret_cast<USHORT*>(&from_charset), // safe - alignment not changed
1364 reinterpret_cast<USHORT*>(&to_charset), // safe - alignment not changed
1365 &from_type_specified, &from_charset_specified,
1366 &to_type_specified, &to_charset_specified);
1367
1368 blb* const blob = allocate_blob(tdbb, transaction);
1369
1370 bool try_relations = false;
1371 BlobIndex* current = NULL;
1372
1373 if (!blobId.bid_internal.bid_relation_id)
1374 {
1375 if (blobId.isEmpty())
1376 blob->blb_flags |= BLB_eof;
1377 else
1378 {
1379 /* Note: Prior to 1991, we would immediately report bad_segstr_id here,
1380 * but then we decided to allow a newly created blob to be opened,
1381 * leaving the possibility of receiving a garbage blob ID from
1382 * the application.
1383 * The following does some checks to try and protect ourselves

Callers

nothing calls this directly

Calls 15

SET_TDBBFunction · 0.85
GdsClass · 0.85
BLB_gen_bpbFunction · 0.85
find_filterFunction · 0.85
BLF_open_blobFunction · 0.85
getOuterMethod · 0.80
getDatabaseMethod · 0.80
BLB_closeMethod · 0.80
getBlobSpaceMethod · 0.80
get_permanent_numberMethod · 0.80
checkBlobMethod · 0.80
ERR_postFunction · 0.70

Tested by

no test coverage detected