From f92e56a1b8cd86ebd89490541d89336ecfbb2dc2 Mon Sep 17 00:00:00 2001 From: asfernandes Date: Sun, 14 May 2006 14:47:18 +0000 Subject: [PATCH] More corrections to TRIM and NULLs --- src/jrd/cmp.cpp | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/jrd/cmp.cpp b/src/jrd/cmp.cpp index 91c212da03..0251a3b979 100644 --- a/src/jrd/cmp.cpp +++ b/src/jrd/cmp.cpp @@ -1820,23 +1820,32 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de } case nod_trim: - CMP_get_desc(tdbb, csb, node->nod_arg[e_trim_value], desc); - - if (desc->dsc_dtype != dtype_blob) { - USHORT length = DSC_string_length(desc); + CMP_get_desc(tdbb, csb, node->nod_arg[e_trim_value], desc); - if (!DTYPE_IS_TEXT(desc->dsc_dtype)) + if (node->nod_arg[e_trim_characters]) { - desc->dsc_ttype() = ttype_ascii; - desc->dsc_scale = 0; + DSC desc1; + CMP_get_desc(tdbb, csb, node->nod_arg[e_trim_characters], &desc1); + desc->dsc_flags |= desc1.dsc_flags & DSC_null; } - desc->dsc_dtype = dtype_varying; - desc->dsc_length = length + sizeof(USHORT); - } + if (desc->dsc_dtype != dtype_blob) + { + USHORT length = DSC_string_length(desc); - return; + if (!DTYPE_IS_TEXT(desc->dsc_dtype)) + { + desc->dsc_ttype() = ttype_ascii; + desc->dsc_scale = 0; + } + + desc->dsc_dtype = dtype_varying; + desc->dsc_length = length + sizeof(USHORT); + } + + return; + } case nod_function: {