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

Function DSC_string_length

src/common/dsc.cpp:1536–1569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1534
1535
1536int DSC_string_length(const dsc* desc)
1537{
1538/**************************************
1539 *
1540 * D S C _ s t r i n g _ l e n g t h
1541 *
1542 **************************************
1543 *
1544 * Functional description
1545 * Estimate length of string (in bytes) based on descriptor.
1546 * Estimated length assumes representing string in
1547 * narrow-char ASCII format.
1548 *
1549 * Note that this strips off the short at the
1550 * start of dtype_varying, and the NULL for dtype_cstring.
1551 *
1552 **************************************/
1553
1554 switch (desc->dsc_dtype)
1555 {
1556 case dtype_text:
1557 return desc->dsc_length;
1558 case dtype_cstring:
1559 return desc->dsc_length - 1;
1560 case dtype_varying:
1561 return desc->dsc_length - sizeof(USHORT);
1562 default:
1563 if (!DTYPE_IS_EXACT(desc->dsc_dtype) || desc->dsc_scale == 0)
1564 return (int) _DSC_convert_to_text_length[desc->dsc_dtype];
1565 if (desc->dsc_scale < 0)
1566 return (int) _DSC_convert_to_text_length[desc->dsc_dtype] + 1;
1567 return (int) _DSC_convert_to_text_length[desc->dsc_dtype] + desc->dsc_scale;
1568 }
1569}
1570
1571
1572const TEXT *DSC_dtype_tostring(UCHAR dtype)

Callers 7

getDescMethod · 0.85
executeMethod · 0.85
makeMethod · 0.85
get_string_lenFunction · 0.85
processMapFunction · 0.85
getStringLengthMethod · 0.85
float_to_textFunction · 0.85

Calls 1

DTYPE_IS_EXACTFunction · 0.85

Tested by

no test coverage detected