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

Function check_nullify_source

src/jrd/vio.cpp:4777–4824  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4775
4776
4777static bool check_nullify_source(thread_db* tdbb,
4778 record_param* org_rpb,
4779 record_param* new_rpb,
4780 int field_id_1,
4781 int field_id_2)
4782{
4783/**************************************
4784 *
4785 * c h e c k _ n u l l i f y _ s o u r c e
4786 *
4787 **************************************
4788 *
4789 * Functional description
4790 * A record in a system relation containing a source blob is
4791 * being changed. Check to see if only the source blob has changed,
4792 * and if so, validate whether it was an assignment to NULL.
4793 *
4794 **************************************/
4795 if (!tdbb->getAttachment()->locksmith(tdbb, NULL_PRIVILEGE)) // legacy right - no system privilege tuning !!!
4796 return false;
4797
4798 bool nullify_found = false;
4799
4800 dsc org_desc, new_desc;
4801 for (USHORT iter = 0; iter < org_rpb->rpb_record->getFormat()->fmt_count; ++iter)
4802 {
4803 const bool org_null = !EVL_field(NULL, org_rpb->rpb_record, iter, &org_desc);
4804 const bool new_null = !EVL_field(NULL, new_rpb->rpb_record, iter, &new_desc);
4805
4806 if ((field_id_1 >= 0 && iter == (USHORT) field_id_1) ||
4807 (field_id_2 >= 0 && iter == (USHORT) field_id_2))
4808 {
4809 fb_assert(org_desc.dsc_dtype == dtype_blob);
4810 fb_assert(new_desc.dsc_dtype == dtype_blob);
4811
4812 if (new_null && !org_null)
4813 {
4814 nullify_found = true;
4815 continue;
4816 }
4817 }
4818
4819 if (org_null != new_null || (!new_null && MOV_compare(tdbb, &org_desc, &new_desc)))
4820 return false;
4821 }
4822
4823 return nullify_found;
4824}
4825
4826
4827static void check_owner(thread_db* tdbb,

Callers 1

VIO_modifyFunction · 0.85

Calls 5

EVL_fieldFunction · 0.85
MOV_compareFunction · 0.85
locksmithMethod · 0.45
getAttachmentMethod · 0.45
getFormatMethod · 0.45

Tested by

no test coverage detected