summaryrefslogtreecommitdiff
path: root/storage/federated
diff options
context:
space:
mode:
authorunknown <antony@pcg5ppc.xiphis.org>2008-03-07 13:46:29 -0800
committerunknown <antony@pcg5ppc.xiphis.org>2008-03-07 13:46:29 -0800
commit7b5da0aa77b070d997f40cdc73d1bf8ccd503ed7 (patch)
tree5eca346659ddf3033d7dcf7b2af9b45a8f391a92 /storage/federated
parent6c2420ed3c0e074fc3b7f47ce00e7ce220906e2c (diff)
parente0075179c3b69770ad7d8a5a9d1373ff1657e79f (diff)
downloadmariadb-git-7b5da0aa77b070d997f40cdc73d1bf8ccd503ed7.tar.gz
Merge pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/mysql-5.1-engines
into pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/merge.20080307/mysql-5.1 configure.in: Auto merged include/mysql/plugin.h: Auto merged mysql-test/r/information_schema.result: Auto merged mysql-test/r/partition_innodb.result: Auto merged mysql-test/t/information_schema.test: Auto merged mysql-test/t/partition_innodb.test: Auto merged sql/item.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/repl_failsafe.cc: Auto merged sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_partition.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged storage/myisam/mi_dynrec.c: Auto merged
Diffstat (limited to 'storage/federated')
-rw-r--r--storage/federated/ha_federated.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index 091a26f6f36..d7040c44fe8 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -1292,10 +1292,21 @@ bool ha_federated::create_where_from_key(String *to,
{
if (*ptr++)
{
+ /*
+ We got "IS [NOT] NULL" condition against nullable column. We
+ distinguish between "IS NOT NULL" and "IS NULL" by flag. For
+ "IS NULL", flag is set to HA_READ_KEY_EXACT.
+ */
if (emit_key_part_name(&tmp, key_part) ||
- tmp.append(STRING_WITH_LEN(" IS NULL ")))
+ (ranges[i]->flag == HA_READ_KEY_EXACT ?
+ tmp.append(STRING_WITH_LEN(" IS NULL ")) :
+ tmp.append(STRING_WITH_LEN(" IS NOT NULL "))))
goto err;
- continue;
+ /*
+ We need to adjust pointer and length to be prepared for next
+ key part. As well as check if this was last key part.
+ */
+ goto prepare_for_next_key_part;
}
}
@@ -1403,12 +1414,18 @@ bool ha_federated::create_where_from_key(String *to,
if (tmp.append(STRING_WITH_LEN(") ")))
goto err;
+prepare_for_next_key_part:
if (store_length >= length)
break;
DBUG_PRINT("info", ("remainder %d", remainder));
DBUG_ASSERT(remainder > 1);
length-= store_length;
- ptr+= store_length;
+ /*
+ For nullable columns, null-byte is already skipped before, that is
+ ptr was incremented by 1. Since store_length still counts null-byte,
+ we need to subtract 1 from store_length.
+ */
+ ptr+= store_length - test(key_part->null_bit);
if (tmp.append(STRING_WITH_LEN(" AND ")))
goto err;