MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / API_ROUTINE isc_get_segment

Function API_ROUTINE isc_get_segment

src/yvalve/why.cpp:3030–3062  ·  view source on GitHub ↗

Get a segment from a blob opened for reading.

Source from the content-addressed store, hash-verified

3028
3029// Get a segment from a blob opened for reading.
3030ISC_STATUS API_ROUTINE isc_get_segment(ISC_STATUS* userStatus, isc_blob_handle* blobHandle,
3031 USHORT* returnLength, USHORT bufferLength, SCHAR* buffer)
3032{
3033 StatusVector status(userStatus);
3034 CheckStatusWrapper statusWrapper(&status);
3035
3036 try
3037 {
3038 RefPtr<YBlob> blob(translateHandle(blobs, blobHandle));
3039 unsigned int length;
3040 int cc = blob->getSegment(&statusWrapper, bufferLength, reinterpret_cast<UCHAR*>(buffer), &length);
3041
3042 if (!(status.getState() & IStatus::STATE_ERRORS))
3043 *returnLength = length;
3044
3045 // Raise pseudo errors
3046 switch (cc)
3047 {
3048 case IStatus::RESULT_NO_DATA:
3049 Arg::Gds(isc_segstr_eof).raise();
3050 break;
3051 case IStatus::RESULT_SEGMENT:
3052 Arg::Gds(isc_segment).raise();
3053 break;
3054 }
3055 }
3056 catch (const Exception& e)
3057 {
3058 e.stuffException(&statusWrapper);
3059 }
3060
3061 return status[1];
3062}
3063
3064
3065// Snatch a slice of an array.

Callers

nothing calls this directly

Calls 6

translateHandleFunction · 0.85
GdsClass · 0.85
getSegmentMethod · 0.45
getStateMethod · 0.45
raiseMethod · 0.45
stuffExceptionMethod · 0.45

Tested by

no test coverage detected