MCPcopy Create free account
hub / github.com/MariaDB/server / not_null_fields_have_null_values

Function not_null_fields_have_null_values

sql/sql_base.cc:9426–9459  ·  view source on GitHub ↗

Test NOT NULL constraint after BEFORE triggers */

Source from the content-addressed store, hash-verified

9424 Test NOT NULL constraint after BEFORE triggers
9425*/
9426static bool not_null_fields_have_null_values(TABLE *table)
9427{
9428 Field **orig_field= table->field;
9429 Field **filled_field= table->field_to_fill();
9430
9431 if (filled_field != orig_field)
9432 {
9433 THD *thd=table->in_use;
9434 for (uint i=0; i < table->s->fields; i++)
9435 {
9436 Field *of= orig_field[i];
9437 Field *ff= filled_field[i];
9438 if (ff != of)
9439 {
9440 // copy after-update flags to of, copy before-update flags to ff
9441 swap_variables(uint32, of->flags, ff->flags);
9442 if (ff->is_real_null())
9443 {
9444 uint err= ER_BAD_NULL_ERROR;
9445 if (ff->flags & NO_DEFAULT_VALUE_FLAG && !ff->has_explicit_value())
9446 {
9447 err= ER_NO_DEFAULT_FOR_FIELD;
9448 table->in_use->count_cuted_fields= CHECK_FIELD_WARN;
9449 }
9450 ff->set_notnull(); // for next row WHERE condition in UPDATE
9451 if (convert_null_to_field_value_or_error(of, err) || thd->is_error())
9452 return true;
9453 }
9454 }
9455 }
9456 }
9457
9458 return false;
9459}
9460
9461
9462/**

Callers 1

Calls 6

field_to_fillMethod · 0.80
is_real_nullMethod · 0.80
has_explicit_valueMethod · 0.80
set_notnullMethod · 0.80
is_errorMethod · 0.45

Tested by

no test coverage detected