summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2002-10-16 10:32:45 +0300
committermonty@hundin.mysql.fi <>2002-10-16 10:32:45 +0300
commitb4343ba9398082b74a02b568625aee42587450f0 (patch)
treeb2749496347a8bc7352927d95fef69660bb47fe3 /sql/field_conv.cc
parent73506bb612822dc25c940a2ca2f8b1e84a0a395d (diff)
downloadmariadb-git-b4343ba9398082b74a02b568625aee42587450f0.tar.gz
Fixed bug in LEFT JOIN ... WHERE not_null_key_column=NULL;
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r--sql/field_conv.cc55
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)))
{
}