8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 06:43:04 +01:00

Fixed some usage patterns of dec_fixed values - thanks to Adriano

This commit is contained in:
AlexPeshkoff 2018-05-14 18:09:50 +03:00
parent 21f0705175
commit 3acc93f51b
3 changed files with 12 additions and 23 deletions

View File

@ -173,7 +173,7 @@ typedef struct dsc
bool isDecOrInt() const
{
return isDecFloat() || isExact();
return isDecFloat() || isDecFixed() || isExact();
}
bool isApprox() const

View File

@ -1397,18 +1397,6 @@ void ArithmeticNode::getDescDialect1(thread_db* /*tdbb*/, dsc* desc, dsc& desc1,
break;
case blr_divide:
/***
if (desc1.isDecOrInt() && desc2.isDecOrInt())
{
desc->dsc_dtype = dtype_dec128;
desc->dsc_length = sizeof(Decimal128);
desc->dsc_scale = 0;
desc->dsc_sub_type = 0;
desc->dsc_flags = 0;
return;
}
***/
// for compatibility with older versions of the product, we accept
// text types for division in blr_version4 (dialect <= 1) only
if (!(DTYPE_IS_NUMERIC(desc1.dsc_dtype) || DTYPE_IS_TEXT(desc1.dsc_dtype)))

View File

@ -80,19 +80,20 @@ const BYTE CVT2_compare_priority[] =
dtype_short,
dtype_long,
dtype_quad + 1, // Move quad up by one to make room for int64 at its proper place in the table.
dtype_real + 3, // Also leave space for dec64 and dec 128.
dtype_double + 3,
dtype_d_float + 3,
dtype_sql_date + 3,
dtype_sql_time + 3,
dtype_timestamp + 3,
dtype_blob + 3,
dtype_array + 3,
dtype_real + 4, // Also leave space for dec_fixed, dec64 and dec128.
dtype_double + 4,
dtype_d_float + 4,
dtype_sql_date + 4,
dtype_sql_time + 4,
dtype_timestamp + 4,
dtype_blob + 4,
dtype_array + 4,
dtype_long + 1, // int64 goes right after long
dtype_dbkey, // compares with nothing except itself
dtype_boolean, // compares with nothing except itself
dtype_quad + 2, // dec64 and dec128 go after quad before real
dtype_quad + 3
dtype_quad + 3, // dec64 and dec128 go after dec64 before real
dtype_quad + 4,
dtype_quad + 2 // dec_fixed goes after quad before dec64
};
static inline int QUAD_COMPARE(const SQUAD* arg1, const SQUAD* arg2)