8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 23:23:04 +01:00

Fixed CORE-2039: Domain-level CHECK constraints wrongly process NULL values.

This commit is contained in:
dimitr 2008-08-12 07:22:12 +00:00
parent 6d332dec56
commit 585d8a3eec

View File

@ -1973,18 +1973,25 @@ void EVL_validate(thread_db* tdbb, const Item& item, const ItemInfo* itemInfo, d
request->req_map_field_info.get(itemInfo->field, fieldInfo) &&
fieldInfo.validation)
{
if (desc && null)
{
desc->dsc_flags |= DSC_null;
}
const bool desc_is_null = !desc || (desc->dsc_flags & DSC_null);
request->req_domain_validation = desc;
const USHORT flags = request->req_flags;
if (!EVL_boolean(tdbb, fieldInfo.validation) &&
!(request->req_flags & req_null))
{
const USHORT length = desc && !(desc->dsc_flags & DSC_null) ?
const USHORT length = desc_is_null ? 0 :
MOV_make_string(desc, ttype_dynamic, &value,
reinterpret_cast<vary*>(temp),
sizeof(temp)) : 0;
sizeof(temp));
if (desc == NULL || (desc->dsc_flags & DSC_null))
if (desc_is_null)
value = NULL_STRING_MARK;
else if (!length)
value = "";