1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-06-13 16:01:32 +03:00

MCOL-4387 Convert dataconvert::decimalToString() into VDecimal and TSInt128 methods

This commit is contained in:
Roman Nozdrin
2020-11-10 17:27:16 +00:00
parent 007b8a5082
commit 58495d0d2f
29 changed files with 793 additions and 878 deletions

View File

@ -2994,16 +2994,11 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
{
if (fetchColColwidths[fetchColPos] == datatypes::MAXDECIMALWIDTH)
{
int128_t* dec;
char buf[datatypes::Decimal::MAXLENGTH16BYTES];
dec = row.getBinaryField<int128_t>(fetchColPos);
dataconvert::DataConvert::decimalToString(dec,
(unsigned)fetchColScales[fetchColPos], buf,
(uint8_t) sizeof(buf), fetchColTypes[fetchColPos]);
value.assign(buf);
datatypes::VDecimal dec(0,
fetchColScales[fetchColPos],
rowGroups[txnId]->getPrecision()[fetchColPos],
row.getBinaryField<int128_t>(fetchColPos));
value = dec.toString(true);
break;
}
}
@ -3042,12 +3037,10 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
}
else
{
const int ctmp_size = 65 + 1 + 1 + 1;
char ctmp[ctmp_size] = {0};
DataConvert::decimalToString(
intColVal, fetchColScales[fetchColPos],
ctmp, ctmp_size, fetchColTypes[fetchColPos]);
value = ctmp; // null termination by decimalToString
datatypes::VDecimal dec(intColVal,
fetchColScales[fetchColPos],
rowGroups[txnId]->getPrecision()[fetchColPos]);
value = dec.toString();
}
}
break;
@ -3356,16 +3349,11 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
{
if (fetchColColwidths[fetchColPos] == datatypes::MAXDECIMALWIDTH)
{
int128_t* dec;
char buf[datatypes::Decimal::MAXLENGTH16BYTES];
dec = row.getBinaryField<int128_t>(fetchColPos);
dataconvert::DataConvert::decimalToString(dec,
(unsigned)fetchColScales[fetchColPos], buf,
(uint8_t) sizeof(buf), fetchColTypes[fetchColPos]);
value = buf;
datatypes::VDecimal dec(0,
fetchColScales[fetchColPos],
rowGroups[txnId]->getPrecision()[fetchColPos],
row.getBinaryField<int128_t>(fetchColPos));
value = dec.toString(true);
break;
}
}
@ -3405,12 +3393,10 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
}
else
{
const int ctmp_size = 65 + 1 + 1 + 1;
char ctmp[ctmp_size] = {0};
DataConvert::decimalToString(
intColVal, fetchColScales[fetchColPos],
ctmp, ctmp_size, fetchColTypes[fetchColPos]);
value = ctmp; // null termination by decimalToString
datatypes::VDecimal dec(intColVal,
fetchColScales[fetchColPos],
rowGroups[txnId]->getPrecision()[fetchColPos]);
value = dec.toString();
}
}
break;