| 204 | |
| 205 | |
| 206 | static 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 | |
| 239 | int CVT2_compare(const dsc* arg1, const dsc* arg2, Firebird::DecimalStatus decSt) |
no test coverage detected