8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 12:43:03 +01:00
This commit is contained in:
Adriano dos Santos Fernandes 2017-05-04 23:08:45 -03:00
parent d02b6714f8
commit e31eefb8d9
7 changed files with 30 additions and 28 deletions

View File

@ -173,6 +173,7 @@ typedef int (*FB_SHUTDOWN_CALLBACK)(const int reason, const int mask, void* arg)
struct FB_DEC16_t { struct FB_DEC16_t {
ISC_UINT64 fb_data[1]; ISC_UINT64 fb_data[1];
}; };
struct FB_DEC34_t { struct FB_DEC34_t {
ISC_UINT64 fb_data[2]; ISC_UINT64 fb_data[2];
}; };

View File

@ -316,6 +316,7 @@ template <typename DSC>
bool areParamsDouble(int argsCount, DSC** args) bool areParamsDouble(int argsCount, DSC** args)
{ {
bool decSeen = false; bool decSeen = false;
for (int i = 0; i < argsCount; ++i) for (int i = 0; i < argsCount; ++i)
{ {
if (args[i]->isApprox()) if (args[i]->isApprox())
@ -323,6 +324,7 @@ bool areParamsDouble(int argsCount, DSC** args)
if (args[i]->isDecFloat()) if (args[i]->isDecFloat())
decSeen = true; decSeen = true;
} }
return !decSeen; return !decSeen;
} }
@ -2885,7 +2887,8 @@ dsc* evlQuantize(thread_db* tdbb, const SysFunction* function, const NestValueAr
impure->vlu_misc.vlu_dec64 = v1.quantize(decSt, v2); impure->vlu_misc.vlu_dec64 = v1.quantize(decSt, v2);
impure->vlu_desc.makeDecimal64(&impure->vlu_misc.vlu_dec64); impure->vlu_desc.makeDecimal64(&impure->vlu_misc.vlu_dec64);
} }
else { else
{
Decimal128 v1 = MOV_get_dec128(tdbb, value[0]); Decimal128 v1 = MOV_get_dec128(tdbb, value[0]);
Decimal128 v2 = MOV_get_dec128(tdbb, value[1]); Decimal128 v2 = MOV_get_dec128(tdbb, value[1]);
@ -2930,7 +2933,8 @@ dsc* evlCompare(thread_db* tdbb, const SysFunction* function, const NestValueArr
fb_assert(false); fb_assert(false);
} }
} }
else { else
{
Decimal128 v1 = MOV_get_dec128(tdbb, value[0]); Decimal128 v1 = MOV_get_dec128(tdbb, value[0]);
Decimal128 v2 = MOV_get_dec128(tdbb, value[1]); Decimal128 v2 = MOV_get_dec128(tdbb, value[1]);
@ -2973,7 +2977,8 @@ dsc* evlNormDec(thread_db* tdbb, const SysFunction* function, const NestValueArr
impure->vlu_misc.vlu_dec64 = v.normalize(decSt); impure->vlu_misc.vlu_dec64 = v.normalize(decSt);
impure->vlu_desc.makeDecimal64(&impure->vlu_misc.vlu_dec64); impure->vlu_desc.makeDecimal64(&impure->vlu_misc.vlu_dec64);
} }
else { else
{
Decimal128 v = MOV_get_dec128(tdbb, value); Decimal128 v = MOV_get_dec128(tdbb, value);
impure->vlu_misc.vlu_dec128 = v.normalize(decSt); impure->vlu_misc.vlu_dec128 = v.normalize(decSt);

View File

@ -265,7 +265,7 @@ UCHAR CVT_get_numeric(const UCHAR* string, const USHORT length, SSHORT* scale, v
((value < 0) && (sign != -1)))) // MAX_SINT64+1 wrapped around ((value < 0) && (sign != -1)))) // MAX_SINT64+1 wrapped around
{ {
// convert to double // convert to double
*(double *) ptr = CVT_get_double(&desc, 0, ERR_post, &over); *(double*) ptr = CVT_get_double(&desc, 0, ERR_post, &over);
if (!over) if (!over)
return dtype_double; return dtype_double;
} }
@ -273,7 +273,7 @@ UCHAR CVT_get_numeric(const UCHAR* string, const USHORT length, SSHORT* scale, v
if (over) if (over)
{ {
thread_db* tdbb = JRD_get_thread_data(); thread_db* tdbb = JRD_get_thread_data();
*(Decimal128 *) ptr = CVT_get_dec128(&desc, tdbb->getAttachment()->att_dec_status, ERR_post); *(Decimal128*) ptr = CVT_get_dec128(&desc, tdbb->getAttachment()->att_dec_status, ERR_post);
return dtype_dec128; return dtype_dec128;
} }

View File

@ -772,7 +772,7 @@ void FUN_evaluate(thread_db* tdbb, const Function* function, const NestValueArra
} }
else else
{ {
switch(value->vlu_desc.dsc_dtype) switch (value->vlu_desc.dsc_dtype)
{ {
case dtype_double: case dtype_double:
if (isinf(value->vlu_misc.vlu_double)) if (isinf(value->vlu_misc.vlu_double))
@ -819,13 +819,13 @@ void FUN_evaluate(thread_db* tdbb, const Function* function, const NestValueArra
} }
break; break;
} }
request->req_flags &= ~req_null; request->req_flags &= ~req_null;
} }
while (array_stack.hasData()) while (array_stack.hasData())
{
delete[] array_stack.pop(); delete[] array_stack.pop();
}
blob_stack.close(); blob_stack.close();
} // try } // try

View File

@ -420,12 +420,7 @@ Decimal64 MOV_get_dec64(Jrd::thread_db* tdbb, const dsc* desc)
{ {
/************************************** /**************************************
* *
* M O V _ g e t _ d o u b l e * M O V _ g e t _ d e c 6 4
*
**************************************
*
* Functional description
* Convert something arbitrary to a double precision number
* *
**************************************/ **************************************/
@ -437,12 +432,7 @@ Decimal128 MOV_get_dec128(Jrd::thread_db* tdbb, const dsc* desc)
{ {
/************************************** /**************************************
* *
* M O V _ g e t _ d o u b l e * M O V _ g e t _ d e c 1 2 8
*
**************************************
*
* Functional description
* Convert something arbitrary to a double precision number
* *
**************************************/ **************************************/

View File

@ -809,7 +809,7 @@ void Sort::diddleKey(UCHAR* record, bool direction)
case SKD_dec64: case SKD_dec64:
if (direction) if (direction)
{ {
((Decimal64*)p)->makeKey(lwp); ((Decimal64*) p)->makeKey(lwp);
*p ^= 1 << 7; *p ^= 1 << 7;
} }
else else
@ -821,8 +821,9 @@ void Sort::diddleKey(UCHAR* record, bool direction)
*pp++ ^= -1; *pp++ ^= -1;
} while (--n); } while (--n);
} }
*p ^= 1 << 7; *p ^= 1 << 7;
((Decimal64*)p)->grabKey(lwp); ((Decimal64*) p)->grabKey(lwp);
} }
break; break;
@ -830,7 +831,7 @@ void Sort::diddleKey(UCHAR* record, bool direction)
fb_assert(false); // diddleKey for Dec64/128 not tested on bigendians! fb_assert(false); // diddleKey for Dec64/128 not tested on bigendians!
if (direction) if (direction)
{ {
((Decimal128*)p)->makeKey(lwp); ((Decimal128*) p)->makeKey(lwp);
*p ^= 1 << 7; *p ^= 1 << 7;
} }
else else
@ -842,8 +843,9 @@ void Sort::diddleKey(UCHAR* record, bool direction)
*pp++ ^= -1; *pp++ ^= -1;
} while (--n); } while (--n);
} }
*p ^= 1 << 7; *p ^= 1 << 7;
((Decimal128*)p)->grabKey(lwp); ((Decimal128*) p)->grabKey(lwp);
} }
break; break;
@ -1083,7 +1085,7 @@ void Sort::diddleKey(UCHAR* record, bool direction)
case SKD_dec64: case SKD_dec64:
if (direction) if (direction)
{ {
((Decimal64*)p)->makeKey(lwp); ((Decimal64*) p)->makeKey(lwp);
p[3] ^= 1 << 7; p[3] ^= 1 << 7;
} }
else else
@ -1095,15 +1097,16 @@ void Sort::diddleKey(UCHAR* record, bool direction)
*pp++ ^= -1; *pp++ ^= -1;
} while (--n); } while (--n);
} }
p[3] ^= 1 << 7; p[3] ^= 1 << 7;
((Decimal64*)p)->grabKey(lwp); ((Decimal64*) p)->grabKey(lwp);
} }
break; break;
case SKD_dec128: case SKD_dec128:
if (direction) if (direction)
{ {
((Decimal128*)p)->makeKey(lwp); ((Decimal128*) p)->makeKey(lwp);
p[3] ^= 1 << 7; p[3] ^= 1 << 7;
} }
else else
@ -1115,8 +1118,9 @@ void Sort::diddleKey(UCHAR* record, bool direction)
*pp++ ^= -1; *pp++ ^= -1;
} while (--n); } while (--n);
} }
p[3] ^= 1 << 7; p[3] ^= 1 << 7;
((Decimal128*)p)->grabKey(lwp); ((Decimal128*) p)->grabKey(lwp);
} }
break; break;

View File

@ -164,6 +164,7 @@ public:
ULONG skd_vary_offset; // Offset to varying/cstring length ULONG skd_vary_offset; // Offset to varying/cstring length
USHORT getSkdLength() const { return skd_length; } USHORT getSkdLength() const { return skd_length; }
void setSkdLength(UCHAR dtype, USHORT v) void setSkdLength(UCHAR dtype, USHORT v)
{ {
skd_dtype = dtype; skd_dtype = dtype;
@ -178,6 +179,7 @@ public:
} }
ULONG getSkdOffset() const { return skd_offset; } ULONG getSkdOffset() const { return skd_offset; }
void setSkdOffset(const sort_key_def* prev = nullptr, dsc* desc = nullptr) void setSkdOffset(const sort_key_def* prev = nullptr, dsc* desc = nullptr)
{ {
skd_offset = 0; skd_offset = 0;