Commit 23a9a580 authored by unknown's avatar unknown

Optimized old patches

Don't set field to DEFAULT value when set to NULL


mysql-test/r/insert.result:
  Updated results after patch
sql/field_conv.cc:
  Revert patch: Don't set field to DEFAULT value when set to NULL
sql/item_strfunc.cc:
  Optimized patch for null handling with elt
sql/opt_range.cc:
  Safety fix for range with null patch
parent 0fe578f5
......@@ -65,7 +65,7 @@ insert into t1 values (1), (NULL), (2);
select * from t1;
id
1
8
0
2
drop table t1;
drop database if exists foo;
......
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -118,7 +118,7 @@ set_field_to_null(Field *field)
field->reset();
return 0;
}
field->set_default();
field->reset();
if (current_thd->count_cuted_fields)
{
current_thd->cuted_fields++; // Increment error counter
......@@ -170,7 +170,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions)
((Field_timestamp*) field)->set_time();
return 0; // Ok to set time to NULL
}
field->set_default();
field->reset();
if (field == field->table->next_number_field)
return 0; // field is set in handler.cc
if (current_thd->count_cuted_fields)
......
......@@ -1546,13 +1546,11 @@ double Item_func_elt::val()
return 0.0;
double result= args[tmp-1]->val();
if (args[tmp-1]->is_null())
return 0.0;
null_value=0;
null_value= args[tmp-1]->null_value;
return result;
}
longlong Item_func_elt::val_int()
{
uint tmp;
......@@ -1561,13 +1559,11 @@ longlong Item_func_elt::val_int()
return 0;
int result= args[tmp-1]->val_int();
if (args[tmp-1]->is_null())
return 0;
null_value=0;
null_value= args[tmp-1]->null_value;
return result;
}
String *Item_func_elt::val_str(String *str)
{
uint tmp;
......@@ -1576,10 +1572,7 @@ String *Item_func_elt::val_str(String *str)
return NULL;
String *result= args[tmp-1]->val_str(str);
if (args[tmp-1]->is_null())
return NULL;
null_value=0;
null_value= args[tmp-1]->null_value;
return result;
}
......
......@@ -2409,7 +2409,11 @@ QUICK_SELECT *get_quick_select_for_ref(TABLE *table, TABLE_REF *ref)
if (!quick)
return 0;
if (cp_buffer_from_ref(ref))
return quick; /* empty range */
{
if (current_thd->fatal_error)
return 0; // End of memory
return quick; // empty range
}
QUICK_RANGE *range= new QUICK_RANGE();
if (!range)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment