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

Method substring

src/common/CharSet.cpp:143–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141
142
143ULONG FixedWidthCharSet::substring(const ULONG srcLen, const UCHAR* src, const ULONG dstLen, UCHAR* dst,
144 const ULONG startPos, const ULONG len) const
145{
146 ULONG result;
147
148 if (getStruct()->charset_fn_substring)
149 result = getStruct()->charset_fn_substring(getStruct(), srcLen, src, dstLen, dst, startPos, len);
150 else
151 {
152 fb_assert(src != NULL && dst != NULL);
153
154 result = MIN(srcLen / minBytesPerChar() - startPos, len) * minBytesPerChar();
155
156 if (dstLen < result)
157 result = INTL_BAD_STR_LENGTH;
158 else if (startPos * minBytesPerChar() > srcLen)
159 result = 0;
160 else
161 memcpy(dst, src + startPos * minBytesPerChar(), result);
162 }
163
164 if (result == INTL_BAD_STR_LENGTH)
165 status_exception::raise(Arg::Gds(isc_arith_except) << Arg::Gds(isc_string_truncation) <<
166 Arg::Gds(isc_trunc_limits) << Arg::Num(dstLen) << Arg::Num(len));
167
168 return result;
169}
170
171
172//-------------

Callers 10

performMethod · 0.80
executeMethod · 0.80
evlAsciiValFunction · 0.80
evlOverlayFunction · 0.80
evlPadFunction · 0.80
evlReplaceFunction · 0.80
validateLengthMethod · 0.80
optimizeLikeSimilarMethod · 0.80
readOneCharMethod · 0.80

Calls 7

raiseFunction · 0.85
GdsClass · 0.85
NumClass · 0.85
convertLengthMethod · 0.45
convertMethod · 0.45
getBufferMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected