MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / EVL_validate

Function EVL_validate

src/jrd/evl.cpp:612–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

610
611
612void EVL_validate(thread_db* tdbb, const Item& item, const ItemInfo* itemInfo, dsc* desc, bool null)
613{
614/**************************************
615 *
616 * E V L _ v a l i d a t e
617 *
618 **************************************
619 *
620 * Functional description
621 * Validate argument/variable for not null and check constraint
622 *
623 **************************************/
624 if (itemInfo == NULL)
625 return;
626
627 Request* request = tdbb->getRequest();
628 bool err = false;
629
630 if (null && !itemInfo->nullable)
631 err = true;
632
633 const char* value = NULL_STRING_MARK;
634 VaryStr<TEMP_STR_LENGTH> temp;
635
636 MapFieldInfo::ValueType fieldInfo;
637 if (!err && itemInfo->fullDomain &&
638 request->getStatement()->mapFieldInfo.get(itemInfo->field, fieldInfo) &&
639 fieldInfo.validationExpr)
640 {
641 if (desc && null)
642 desc->dsc_flags |= DSC_null;
643
644 const bool desc_is_null = !desc || (desc->dsc_flags & DSC_null);
645
646 request->req_domain_validation = desc;
647 const ULONG flags = request->req_flags;
648
649 if (!fieldInfo.validationExpr->execute(tdbb, request) && !(request->req_flags & req_null))
650 {
651 const USHORT length = desc_is_null ? 0 :
652 MOV_make_string(tdbb, desc, ttype_dynamic, &value, &temp, sizeof(temp) - 1);
653
654 if (desc_is_null)
655 value = NULL_STRING_MARK;
656 else if (!length)
657 value = "";
658 else
659 const_cast<char*>(value)[length] = 0; // safe cast - data is on our local stack
660
661 err = true;
662 }
663
664 request->req_flags = flags;
665 }
666
667 if (err)
668 {
669 ISC_STATUS status = isc_not_valid_for_var;

Callers 2

executeMethod · 0.85
EXE_assignmentFunction · 0.85

Calls 12

MOV_make_stringFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
ERR_postFunction · 0.70
getRequestMethod · 0.45
getMethod · 0.45
getStatementMethod · 0.45
executeMethod · 0.45
isEmptyMethod · 0.45
getCountMethod · 0.45
printfMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected