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

Function getBlobSize

src/common/classes/UserBlob.cpp:240–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238
239
240bool getBlobSize( const UserBlob& b,
241 SLONG* size,
242 SLONG* seg_count,
243 SLONG* max_seg)
244{
245/**************************************
246 *
247 * g e t B l o b S i z e
248 *
249 **************************************
250 *
251 * Functional description
252 * Get the size, number of segments, and max
253 * segment length of a blob. Return true
254 * if it happens to succeed.
255 * This is a clone of gds__blob_size.
256 *
257 **************************************/
258 static const UCHAR blob_items[] =
259 {
260 isc_info_blob_max_segment,
261 isc_info_blob_num_segments,
262 isc_info_blob_total_length
263 };
264
265 UCHAR buffer[64];
266
267 if (!b.getInfo(sizeof(blob_items), blob_items, sizeof(buffer), buffer))
268 return false;
269
270 const UCHAR* p = buffer;
271 const UCHAR* const end = buffer + sizeof(buffer);
272 for (UCHAR item = *p++; item != isc_info_end && p < end; item = *p++)
273 {
274 const USHORT l = gds__vax_integer(p, 2);
275 p += 2;
276 const SLONG n = gds__vax_integer(p, l);
277 p += l;
278 switch (item)
279 {
280 case isc_info_blob_max_segment:
281 if (max_seg)
282 *max_seg = n;
283 break;
284
285 case isc_info_blob_num_segments:
286 if (seg_count)
287 *seg_count = n;
288 break;
289
290 case isc_info_blob_total_length:
291 if (size)
292 *size = n;
293 break;
294
295 default:
296 return false;
297 }

Callers

nothing calls this directly

Calls 1

getInfoMethod · 0.45

Tested by

no test coverage detected