994
994
******************************************************************************/
996
996
int check_that_all_fields_are_given_values(Session *session, Table *entry,
997
TableList *table_list)
1000
1000
MY_BITMAP *write_set= entry->write_set;
1002
1002
for (Field **field=entry->field ; *field ; field++)
1004
if (!bitmap_is_set(write_set, (*field)->field_index) &&
1005
((*field)->flags & NO_DEFAULT_VALUE_FLAG) &&
1004
if (!bitmap_is_set(write_set, (*field)->field_index))
1007
* If the field doesn't have any default value
1008
* and there is no actual value specified in the
1009
* INSERT statement, throw error ER_NO_DEFAULT_FOR_FIELD.
1011
if (((*field)->flags & NO_DEFAULT_VALUE_FLAG) &&
1006
1012
((*field)->real_type() != DRIZZLE_TYPE_ENUM))
1011
table_list= table_list->top_table();
1014
my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), (*field)->field_name);
1021
* However, if an actual NULL value was specified
1022
* for the field and the field is a NOT NULL field,
1023
* throw ER_BAD_NULL_ERROR.
1015
1025
* Per the SQL standard, inserting NULL into a NOT NULL
1016
1026
* field requires an error to be thrown.
1018
my_error(ER_BAD_NULL_ERROR, MYF(0), (*field)->field_name);
1028
if (((*field)->flags & NOT_NULL_FLAG) &&
1029
(*field)->is_null())
1031
my_error(ER_BAD_NULL_ERROR, MYF(0), (*field)->field_name);
1022
1036
return session->abort_on_warning ? err : 0;