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

Function MOV_make_string2

src/jrd/mov.cpp:360–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358
359
360ULONG MOV_make_string2(Jrd::thread_db* tdbb,
361 const dsc* desc,
362 USHORT ttype,
363 UCHAR** address,
364 Jrd::MoveBuffer& buffer,
365 bool limit)
366{
367/**************************************
368 *
369 * M O V _ m a k e _ s t r i n g 2
370 *
371 **************************************
372 *
373 * Functional description
374 * Make a string, in a specified text type, out of a descriptor.
375 * The address of the resultant string is returned by reference.
376 * MOV_make_string2 returns the length of the string in bytes.
377 *
378 **************************************/
379
380 if (desc->isBlob())
381 {
382 // fake descriptor
383 dsc temp;
384 temp.dsc_dtype = dtype_text;
385 temp.setTextType(ttype);
386
387 Firebird::UCharBuffer bpb;
388 BLB_gen_bpb_from_descs(desc, &temp, bpb);
389
390 Jrd::blb* blob = Jrd::blb::open2(tdbb, tdbb->getRequest()->req_transaction,
391 reinterpret_cast<Jrd::bid*>(desc->dsc_address), bpb.getCount(), bpb.begin());
392
393 ULONG size;
394
395 if (temp.getCharSet() == desc->getCharSet())
396 {
397 size = blob->blb_length;
398 }
399 else
400 {
401 size = (blob->blb_length / INTL_charset_lookup(tdbb, desc->getCharSet())->minBytesPerChar()) *
402 INTL_charset_lookup(tdbb, temp.getCharSet())->maxBytesPerChar();
403 }
404
405 *address = buffer.getBuffer(size);
406
407 size = blob->BLB_get_data(tdbb, *address, size, true);
408
409 if (limit && size > MAX_COLUMN_SIZE)
410 {
411 ERR_post(Arg::Gds(isc_arith_except) <<
412 Arg::Gds(isc_blob_truncation));
413 }
414
415 return size;
416 }
417

Callers 15

executeMethod · 0.85
aggPassMethod · 0.85
stringBooleanMethod · 0.85
sleuthMethod · 0.85
getStringMethod · 0.85
setErrorMethod · 0.85
evlAsciiValFunction · 0.85
evlBlobAppendFunction · 0.85
evlGetContextFunction · 0.85
evlSetContextFunction · 0.85
evlResetContextFunction · 0.85
evlHashFunction · 0.85

Calls 15

BLB_gen_bpb_from_descsFunction · 0.85
INTL_charset_lookupFunction · 0.85
GdsClass · 0.85
CVT2_make_string2Function · 0.85
isBlobMethod · 0.80
setTextTypeMethod · 0.80
minBytesPerCharMethod · 0.80
BLB_get_dataMethod · 0.80
ERR_postFunction · 0.70
getRequestMethod · 0.45
getCountMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected