diff options
author | unknown <monty@mashka.mysql.fi> | 2003-07-01 14:38:38 +0300 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-07-01 14:38:38 +0300 |
commit | 23a9a5805cd258c5699e782cebdb5763acb1d85d (patch) | |
tree | 624e1dedb3475d160136c91bf352c5b698a469e8 /sql | |
parent | 0fe578f52a7b699cc4ff726428c9701530d9f827 (diff) | |
download | mariadb-git-23a9a5805cd258c5699e782cebdb5763acb1d85d.tar.gz |
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
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field_conv.cc | 6 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 17 | ||||
-rw-r--r-- | sql/opt_range.cc | 6 |
3 files changed, 13 insertions, 16 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc index ce67455881b..db0cc71c6bf 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -1,4 +1,4 @@ -/* 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) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 995d413626c..d18436d2c61 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -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; } diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 5704ce6e432..2d949810b63 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -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) |