From 0cd5e57eaa99fc5e85512b4388d40db3c4ca3fdc Mon Sep 17 00:00:00 2001 From: dimitr Date: Wed, 24 Aug 2005 09:42:14 +0000 Subject: [PATCH] Added optional seconds precision to CURRENT_TIME and CURRENT_TIMESTAMP as agreed with Ann and others times ago. --- src/dsql/pass1.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/dsql/pass1.cpp b/src/dsql/pass1.cpp index 6573555377..dd9bd51bb0 100644 --- a/src/dsql/pass1.cpp +++ b/src/dsql/pass1.cpp @@ -927,6 +927,21 @@ dsql_nod* PASS1_node(dsql_req* request, dsql_nod* input, bool proc_flag) } break; + case nod_current_time: + case nod_current_timestamp: + { + dsql_nod* const_node = input->nod_arg[0]; + fb_assert(const_node->nod_type == nod_constant); + const int precision = (int)(IPTR) const_node->nod_arg[0]; + fb_assert(precision >= 0); + // We pass precision as a single byte, hence a check + // to avoid overflows + if (precision > MAX_UCHAR) { + const_node->nod_arg[0] = (dsql_nod*)(IPTR) MAX_UCHAR; + } + } + break; + case nod_join: return pass1_join(request, input, proc_flag);