mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:43:02 +01:00
Fixed #8006: Int128 datatype not supported in UDR
This commit is contained in:
parent
9870f350a0
commit
54a7a196e7
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
static IMaster* master = fb_get_master_interface();
|
static IMaster* master = fb_get_master_interface();
|
||||||
static IDecFloat16* idf16 = NULL;
|
static IDecFloat16* idf16 = NULL;
|
||||||
|
static IInt128* ii128 = NULL;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@ -56,6 +57,7 @@ int main()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
idf16 = master->getUtilInterface()->getDecFloat16(&status);
|
idf16 = master->getUtilInterface()->getDecFloat16(&status);
|
||||||
|
ii128 = master->getUtilInterface()->getInt128(&status);
|
||||||
|
|
||||||
att = prov->attachDatabase(&status, dbName, 0, NULL);
|
att = prov->attachDatabase(&status, dbName, 0, NULL);
|
||||||
tra = att->startTransaction(&status, 0, NULL);
|
tra = att->startTransaction(&status, 0, NULL);
|
||||||
@ -79,6 +81,7 @@ int main()
|
|||||||
(FB_VARCHAR(31), relationName)
|
(FB_VARCHAR(31), relationName)
|
||||||
(FB_VARCHAR(100), description)
|
(FB_VARCHAR(100), description)
|
||||||
(FB_DECFLOAT16, df16)
|
(FB_DECFLOAT16, df16)
|
||||||
|
(FB_INT128, iHuge)
|
||||||
) output(&status, master);
|
) output(&status, master);
|
||||||
|
|
||||||
input.clear();
|
input.clear();
|
||||||
@ -86,25 +89,28 @@ int main()
|
|||||||
|
|
||||||
rs = att->openCursor(&status, tra, 0,
|
rs = att->openCursor(&status, tra, 0,
|
||||||
"select rdb$relation_id, rdb$relation_name, rdb$description,"
|
"select rdb$relation_id, rdb$relation_name, rdb$description,"
|
||||||
" cast (rdb$relation_id as decfloat(16)) * 0.05 as df16"
|
" cast (rdb$relation_id as decfloat(16)) * 0.05 as df16,"
|
||||||
|
" cast (rdb$relation_id as int128) * 212778764464767 as iHuge"
|
||||||
" from rdb$relations"
|
" from rdb$relations"
|
||||||
" where rdb$system_flag = ?"
|
" where rdb$system_flag = ?"
|
||||||
" order by rdb$relation_id",
|
" order by rdb$relation_id",
|
||||||
SAMPLES_DIALECT, input.getMetadata(), input.getData(), output.getMetadata(), NULL, 0);
|
SAMPLES_DIALECT, input.getMetadata(), input.getData(), output.getMetadata(), NULL, 0);
|
||||||
|
|
||||||
printf(" ID Name/comment\n");
|
printf(" ID Name datatype-tests (perform some arithmetics) /comment\n");
|
||||||
while (rs->fetchNext(&status, output.getData()) == IStatus::RESULT_OK)
|
while (rs->fetchNext(&status, output.getData()) == IStatus::RESULT_OK)
|
||||||
{
|
{
|
||||||
unsigned lRelName = output->relationNameNull ? 0 : output->relationName.length;
|
unsigned lRelName = output->relationNameNull ? 0 : output->relationName.length;
|
||||||
unsigned lDesc = output->descriptionNull ? 0 : output->description.length;
|
unsigned lDesc = output->descriptionNull ? 0 : output->description.length;
|
||||||
char t16[IDecFloat16::STRING_SIZE];
|
char t16[IDecFloat16::STRING_SIZE];
|
||||||
idf16->toString(&status, &output->df16, sizeof(t16), t16);
|
idf16->toString(&status, &output->df16, sizeof(t16), t16);
|
||||||
|
char huge[IInt128::STRING_SIZE];
|
||||||
|
ii128->toString(&status, &output->iHuge, -3, sizeof(huge), huge);
|
||||||
|
|
||||||
printf("%4d %*.*s%c%*.*s (%s)\n", output->relationId,
|
printf("%4d %*.*s [Decfloat16:%s Int128:%s] %c%*.*s\n", output->relationId,
|
||||||
lRelName, lRelName, output->relationName.str,
|
lRelName, lRelName, output->relationName.str,
|
||||||
|
t16, huge,
|
||||||
lDesc ? '/' : ' ',
|
lDesc ? '/' : ' ',
|
||||||
lDesc, lDesc, output->description.str,
|
lDesc, lDesc, output->description.str);
|
||||||
t16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rs->close(&status);
|
rs->close(&status);
|
||||||
|
@ -131,6 +131,11 @@
|
|||||||
builder->setLength(status, index, sizeof(ISC_INT64)); \
|
builder->setLength(status, index, sizeof(ISC_INT64)); \
|
||||||
builder->setScale(status, index, scale);
|
builder->setScale(status, index, scale);
|
||||||
|
|
||||||
|
#define FB__META_FB_SCALED_INT128(scale) \
|
||||||
|
builder->setType(status, index, SQL_INT128); \
|
||||||
|
builder->setLength(status, index, sizeof(FB_I128)); \
|
||||||
|
builder->setScale(status, index, scale);
|
||||||
|
|
||||||
#define FB__META_FB_FLOAT \
|
#define FB__META_FB_FLOAT \
|
||||||
builder->setType(status, index, SQL_FLOAT); \
|
builder->setType(status, index, SQL_FLOAT); \
|
||||||
builder->setLength(status, index, sizeof(float));
|
builder->setLength(status, index, sizeof(float));
|
||||||
@ -204,15 +209,18 @@
|
|||||||
#define FB__META_FB_SMALLINT FB__META_FB_SCALED_SMALLINT(0)
|
#define FB__META_FB_SMALLINT FB__META_FB_SCALED_SMALLINT(0)
|
||||||
#define FB__META_FB_INTEGER FB__META_FB_SCALED_INTEGER(0)
|
#define FB__META_FB_INTEGER FB__META_FB_SCALED_INTEGER(0)
|
||||||
#define FB__META_FB_BIGINT FB__META_FB_SCALED_BIGINT(0)
|
#define FB__META_FB_BIGINT FB__META_FB_SCALED_BIGINT(0)
|
||||||
|
#define FB__META_FB_INT128 FB__META_FB_SCALED_INT128(0)
|
||||||
|
|
||||||
// Types - struct
|
// Types - struct
|
||||||
|
|
||||||
#define FB__TYPE_FB_SCALED_SMALLINT(x) ISC_SHORT
|
#define FB__TYPE_FB_SCALED_SMALLINT(x) ISC_SHORT
|
||||||
#define FB__TYPE_FB_SCALED_INTEGER(x) ISC_LONG
|
#define FB__TYPE_FB_SCALED_INTEGER(x) ISC_LONG
|
||||||
#define FB__TYPE_FB_SCALED_BIGINT(x) FB__INT64_ALIGNAS ISC_INT64
|
#define FB__TYPE_FB_SCALED_BIGINT(x) FB__INT64_ALIGNAS ISC_INT64
|
||||||
|
#define FB__TYPE_FB_SCALED_INT128(x) FB__INT64_ALIGNAS FB_I128
|
||||||
#define FB__TYPE_FB_SMALLINT ISC_SHORT
|
#define FB__TYPE_FB_SMALLINT ISC_SHORT
|
||||||
#define FB__TYPE_FB_INTEGER ISC_LONG
|
#define FB__TYPE_FB_INTEGER ISC_LONG
|
||||||
#define FB__TYPE_FB_BIGINT FB__INT64_ALIGNAS ISC_INT64
|
#define FB__TYPE_FB_BIGINT FB__INT64_ALIGNAS ISC_INT64
|
||||||
|
#define FB__TYPE_FB_INT128 FB__INT64_ALIGNAS FB_I128
|
||||||
#define FB__TYPE_FB_FLOAT float
|
#define FB__TYPE_FB_FLOAT float
|
||||||
#define FB__TYPE_FB_DOUBLE double
|
#define FB__TYPE_FB_DOUBLE double
|
||||||
#define FB__TYPE_FB_DECFLOAT16 FB__INT64_ALIGNAS FB_DEC16
|
#define FB__TYPE_FB_DECFLOAT16 FB__INT64_ALIGNAS FB_DEC16
|
||||||
|
Loading…
Reference in New Issue
Block a user