diff options
author | unknown <monty@hundin.mysql.fi> | 2002-10-16 10:32:45 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-10-16 10:32:45 +0300 |
commit | 39a84b7913dd37b6732ce94e0ba90a9ccbb1b892 (patch) | |
tree | b2749496347a8bc7352927d95fef69660bb47fe3 /sql/field_conv.cc | |
parent | b6c1bb0ce555ea6f2f56e8695ce0ce0e736e021b (diff) | |
download | mariadb-git-39a84b7913dd37b6732ce94e0ba90a9ccbb1b892.tar.gz |
Fixed bug in LEFT JOIN ... WHERE not_null_key_column=NULL;
Docs/manual.texi:
ChangeLog
sql/field.h:
New virtual function to set a field to null or signal an error
sql/field_conv.cc:
New function to set a field to null or signal an error
sql/item.cc:
When setting a field to null internally (for WHERE testing) don't autoconvert NULL -> now() or last_insert_id()
sql/item.h:
New virtual function to set a field to null or signal an error
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))) { } |