8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 12:03:02 +01:00

More corrections to TRIM and NULLs

This commit is contained in:
asfernandes 2006-05-14 14:47:18 +00:00
parent 91dd820689
commit f92e56a1b8

View File

@ -1820,23 +1820,32 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
} }
case nod_trim: 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; DSC desc1;
desc->dsc_scale = 0; 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; if (desc->dsc_dtype != dtype_blob)
desc->dsc_length = length + sizeof(USHORT); {
} 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: case nod_function:
{ {