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

Function makePad

src/jrd/SysFunction.cpp:1720–1764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1718
1719
1720void makePad(DataTypeUtilBase* dataTypeUtil, const SysFunction* function, dsc* result,
1721 int argsCount, const dsc** args)
1722{
1723 fb_assert(argsCount >= function->minArgCount);
1724
1725 result->makeNullString();
1726
1727 bool isNullable;
1728 if (initResult(result, argsCount, args, &isNullable))
1729 return;
1730
1731 const dsc* value1 = args[0];
1732 const dsc* length = args[1];
1733 const dsc* value2 = (argsCount >= 3 ? args[2] : NULL);
1734
1735 if (value1->isBlob())
1736 *result = *value1;
1737 else if (value2 && value2->isBlob())
1738 *result = *value2;
1739 else
1740 {
1741 result->clear();
1742 result->dsc_dtype = dtype_varying;
1743 }
1744
1745 result->setBlobSubType(value1->getBlobSubType());
1746 result->setTextType(value1->getTextType());
1747
1748 if (!result->isBlob())
1749 {
1750 if (length->dsc_address) // constant
1751 {
1752 result->dsc_length = static_cast<USHORT>(sizeof(USHORT)) + dataTypeUtil->fixLength(result,
1753 CVT_get_long(length, 0, JRD_get_thread_data()->getAttachment()->att_dec_status, ERR_post) *
1754 dataTypeUtil->maxBytesPerChar(result->getCharSet()));
1755 }
1756 else
1757 {
1758 result->dsc_length = static_cast<USHORT>(sizeof(USHORT)) +
1759 dataTypeUtil->fixLength(result, MAX_STR_SIZE);
1760 }
1761 }
1762
1763 result->setNullable(isNullable);
1764}
1765
1766
1767void makeReplace(DataTypeUtilBase* dataTypeUtil, const SysFunction* function, dsc* result,

Callers

nothing calls this directly

Calls 15

initResultFunction · 0.85
CVT_get_longFunction · 0.85
JRD_get_thread_dataFunction · 0.85
makeNullStringMethod · 0.80
isBlobMethod · 0.80
setBlobSubTypeMethod · 0.80
getBlobSubTypeMethod · 0.80
setTextTypeMethod · 0.80
getTextTypeMethod · 0.80
fixLengthMethod · 0.80
setNullableMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected