From fe68255f6214c17e7b4fd69db5b5f1e02229bb76 Mon Sep 17 00:00:00 2001 From: hvlad Date: Wed, 23 May 2018 20:42:22 +0300 Subject: [PATCH] According to Adriano's suggestions --- doc/sql.extensions/README.keywords | 1 + src/common/DecFloat.h | 11 ++++++++--- src/jrd/Attachment.cpp | 8 ++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/doc/sql.extensions/README.keywords b/doc/sql.extensions/README.keywords index 61dafd1a7b..109a5805f5 100644 --- a/doc/sql.extensions/README.keywords +++ b/doc/sql.extensions/README.keywords @@ -330,6 +330,7 @@ Firebird 4.0 PRIVILEGE * QUANTIZE * RANGE (1) + RESET * SECURITY SESSION SQL (1) diff --git a/src/common/DecFloat.h b/src/common/DecFloat.h index 20f5320f97..4d2a810b21 100644 --- a/src/common/DecFloat.h +++ b/src/common/DecFloat.h @@ -55,6 +55,12 @@ struct DecimalStatus : decExtFlag(exc), roundingMode(DEC_ROUND_HALF_UP) { } + DecimalStatus() + : decExtFlag(FB_DEC_Errors), roundingMode(DEC_ROUND_HALF_UP) + { } + + static const DecimalStatus DEFAULT; + USHORT decExtFlag, roundingMode; }; @@ -64,15 +70,14 @@ struct DecimalBinding : bind(DEC_NATIVE), numScale(0) { } + static const DecimalBinding DEFAULT; + enum Bind { DEC_NATIVE, DEC_TEXT, DEC_DOUBLE, DEC_NUMERIC }; Bind bind; SCHAR numScale; }; -// Default values for user sessions -const DecimalStatus DefaultDecimalStatus(FB_DEC_Errors); -const DecimalBinding DefaultDecimalBinding; class DecimalFixed; diff --git a/src/jrd/Attachment.cpp b/src/jrd/Attachment.cpp index 304c952fa1..fd43d4c2c9 100644 --- a/src/jrd/Attachment.cpp +++ b/src/jrd/Attachment.cpp @@ -204,8 +204,8 @@ Jrd::Attachment::Attachment(MemoryPool* pool, Database* dbb) att_functions(*pool), att_internal(*pool), att_dyn_req(*pool), - att_dec_status(DefaultDecimalStatus), - att_dec_binding(DefaultDecimalBinding), + att_dec_status(DecimalStatus::DEFAULT), + att_dec_binding(DecimalBinding::DEFAULT), att_charsets(*pool), att_charset_ids(*pool), att_pools(*pool), @@ -384,8 +384,8 @@ void Jrd::Attachment::releaseGTTs(thread_db* tdbb) void Jrd::Attachment::resetSession(thread_db* tdbb) { // reset DecFloat - att_dec_status = DefaultDecimalStatus; - att_dec_binding = DefaultDecimalBinding; + att_dec_status = DecimalStatus::DEFAULT; + att_dec_binding = DecimalBinding::DEFAULT; // reset timeouts setIdleTimeout(0);