Open or create an existing blob (extended edition).
| 1491 | |
| 1492 | // Open or create an existing blob (extended edition). |
| 1493 | static ISC_STATUS openOrCreateBlob(ISC_STATUS* userStatus, isc_db_handle* dbHandle, |
| 1494 | isc_tr_handle* traHandle, isc_blob_handle* blobHandle, ISC_QUAD* blobId, |
| 1495 | USHORT bpbLength, const UCHAR* bpb, bool createFlag) |
| 1496 | { |
| 1497 | StatusVector status(userStatus); |
| 1498 | CheckStatusWrapper statusWrapper(&status); |
| 1499 | |
| 1500 | try |
| 1501 | { |
| 1502 | nullCheck(blobHandle, isc_bad_segstr_handle); |
| 1503 | |
| 1504 | RefPtr<YAttachment> attachment(translateHandle(attachments, dbHandle)); |
| 1505 | RefPtr<YTransaction> transaction(translateHandle(transactions, traHandle)); |
| 1506 | |
| 1507 | YBlob* blob = createFlag ? |
| 1508 | attachment->createBlob(&statusWrapper, transaction, blobId, bpbLength, bpb) : |
| 1509 | attachment->openBlob(&statusWrapper, transaction, blobId, bpbLength, bpb); |
| 1510 | |
| 1511 | if (status.getState() & IStatus::STATE_ERRORS) |
| 1512 | return status[1]; |
| 1513 | |
| 1514 | *blobHandle = blob->getHandle(); |
| 1515 | } |
| 1516 | catch (const Exception& e) |
| 1517 | { |
| 1518 | e.stuffException(&statusWrapper); |
| 1519 | } |
| 1520 | |
| 1521 | return status[1]; |
| 1522 | } |
| 1523 | |
| 1524 | |
| 1525 | //------------------------------------- |
no test coverage detected