diff options
author | unknown <monty@hundin.mysql.fi> | 2002-10-16 10:39:02 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-10-16 10:39:02 +0300 |
commit | 74b73109c1304e62430faa85d2a63a6f2ffa626d (patch) | |
tree | d0d8ebdfe6f2d1ad61eb8a1ba903d666c1845bca /sql/field_conv.cc | |
parent | b95b51e53ad89f2ff1e6155c86cc3736c6402283 (diff) | |
parent | b3e3a09e726501dc1147563725dc80f718467e70 (diff) | |
download | mariadb-git-74b73109c1304e62430faa85d2a63a6f2ffa626d.tar.gz |
Merge work:/home/bk/mysql into hundin.mysql.fi:/my/bk/mysql
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r-- | sql/field_conv.cc | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 606edd84c74..dab96a9b827 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -112,35 +112,52 @@ static void do_outer_field_to_null_str(Copy_field *copy) bool set_field_to_null(Field *field) { - if (field->maybe_null()) + if (field->real_maybe_null()) { field->set_null(); field->reset(); + return 0; } - else + return 1; +} + + +bool +set_field_to_null_with_conversions(Field *field) +{ + if (field->real_maybe_null()) { - if (field->type() == FIELD_TYPE_TIMESTAMP) - { - ((Field_timestamp*) field)->set_time(); - return 0; // Ok to set time to NULL - } + field->set_null(); field->reset(); - if (field == field->table->next_number_field) - return 0; // field is set in handler.cc - if (current_thd->count_cuted_fields) - { - current_thd->cuted_fields++; // Increment error counter - return 0; - } - if (!current_thd->no_errors) - my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0), - field->field_name); - return 1; + return 0; + } + + /* + Check if this is a special type, which will get a special walue + when set to NULL + */ + if (field->type() == FIELD_TYPE_TIMESTAMP) + { + ((Field_timestamp*) field)->set_time(); + return 0; // Ok to set time to NULL + } + field->reset(); + if (field == field->table->next_number_field) + return 0; // field is set in handler.cc + if (current_thd->count_cuted_fields) + { + current_thd->cuted_fields++; // Increment error counter + return 0; } - return 0; + if (!current_thd->no_errors) + my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0), + field->field_name); + return 1; } + + static void do_skip(Copy_field *copy __attribute__((unused))) { } |