summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-11-24 16:37:41 +0200
committerunknown <monty@mashka.mysql.fi>2002-11-24 16:37:41 +0200
commit18ca5c4dbc890684316df6c29e5b34c018849126 (patch)
treeca03b2abab93a9d6172ede495fa358909c306f94 /sql/opt_range.cc
parent72da2e4c9463aeb80083fd53cc0e6f5091b5f4f7 (diff)
parentbb948c635507db07365554d0e33bc09522c77557 (diff)
downloadmariadb-git-18ca5c4dbc890684316df6c29e5b34c018849126.tar.gz
merge with 3.23 to get bugfixes for <=> NULL and --bind-address
Build-tools/Do-compile: Auto merged mysql-test/r/func_test.result: Auto merged mysql-test/t/func_test.test: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/null_key.test: Auto merged mysql-test/mysql-test-run.sh: Ignore changes from 3.23 mysql-test/r/func_time.result: Update results mysql-test/r/null_key.result: Update results scripts/mysqld_safe.sh: Don't apply NICE handling change from 3.23 sql/mysqld.cc: merge sql/opt_range.cc: merge support-files/mysql.server.sh: Don't apply changes from 3.23
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index f33a2d312b4..d1f99604959 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -936,8 +936,11 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
if (!(res= value->val_str(&tmp)))
DBUG_RETURN(&null_element);
- // Check if this was a function. This should have be optimized away
- // in the sql_select.cc
+ /*
+ TODO:
+ Check if this was a function. This should have be optimized away
+ in the sql_select.cc
+ */
if (res != &tmp)
{
tmp.copy(*res); // Get own copy
@@ -1017,8 +1020,10 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
type != Item_func::EQUAL_FUNC)
DBUG_RETURN(0); // Can't optimize this
- /* We can't always use indexes when comparing a string index to a number */
- /* cmp_type() is checked to allow compare of dates to numbers */
+ /*
+ We can't always use indexes when comparing a string index to a number
+ cmp_type() is checked to allow compare of dates to numbers
+ */
if (field->result_type() == STRING_RESULT &&
value->result_type() != STRING_RESULT &&
field->cmp_type() != value->result_type())
@@ -1026,6 +1031,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
if (value->save_in_field(field))
{
+ /* This happens when we try to insert a NULL field in a not null column */
// TODO; Check if we can we remove the following block.
if (type == Item_func::EQUAL_FUNC)
{
@@ -1037,7 +1043,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
*str = 1;
DBUG_RETURN(new SEL_ARG(field,str,str));
}
- DBUG_RETURN(&null_element); // NULL is never true
+ DBUG_RETURN(&null_element); // cmp with NULL is never true
}
// Get local copy of key
char *str= (char*) alloc_root(param->mem_root,
@@ -1045,7 +1051,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
if (!str)
DBUG_RETURN(0);
if (maybe_null)
- *str=0; // Not NULL
+ *str= (char) field->is_real_null(); // Set to 1 if null
field->get_key_image(str+maybe_null,key_part->part_length);
if (!(tree=new SEL_ARG(field,str,str)))
DBUG_RETURN(0);