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

Function cmp_numeric_string

src/jrd/cvt2.cpp:206–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204
205
206static int cmp_numeric_string(const dsc* arg1, const dsc* arg2, Firebird::DecimalStatus decSt)
207{
208/**************************************
209 *
210 * c m p _ n u m e r i c _ s t r i n g
211 *
212 **************************************
213 *
214 * Functional description
215 * Compare any numeric value with string. Return (-1, 0, 1) if a<b, a=b, or a>b.
216 *
217 **************************************/
218 fb_assert(arg1->isNumeric());
219 fb_assert(arg2->isText());
220
221 Decimal128 buffer; // enough to fit any required data
222 SSHORT scale = 0;
223 UCHAR* text;
224 USHORT ttype;
225 USHORT textLen = CVT_get_string_ptr(arg2, &ttype, &text, nullptr, 0, 0);
226
227 dsc num2;
228 num2.dsc_dtype = CVT_get_numeric(text, textLen, &scale, &buffer);
229 num2.dsc_address = (UCHAR*)&buffer;
230 num2.dsc_scale = scale;
231 num2.dsc_length = type_lengths[num2.dsc_dtype];
232 num2.dsc_sub_type = 0;
233 num2.dsc_flags = 0;
234
235 return CVT2_compare(arg1, &num2, decSt);
236}
237
238
239int CVT2_compare(const dsc* arg1, const dsc* arg2, Firebird::DecimalStatus decSt)

Callers 1

CVT2_compareFunction · 0.85

Calls 5

CVT_get_numericFunction · 0.85
CVT2_compareFunction · 0.85
isNumericMethod · 0.80
isTextMethod · 0.80
CVT_get_string_ptrFunction · 0.70

Tested by

no test coverage detected