summaryrefslogtreecommitdiff
path: root/sql/ha_ndbcluster.cc
diff options
context:
space:
mode:
authortomas@poseidon.ndb.mysql.com <>2004-10-06 13:18:55 +0000
committertomas@poseidon.ndb.mysql.com <>2004-10-06 13:18:55 +0000
commit884892a650992514c40dd652a4a8cf89e4f3a6f7 (patch)
treeebaf89381e7d046d746e9a8e8a1180e2b5c3de48 /sql/ha_ndbcluster.cc
parent96458f8f64641d5b974a17733af8c709b513bfe0 (diff)
downloadmariadb-git-884892a650992514c40dd652a4a8cf89e4f3a6f7.tar.gz
bug#5736, subqueries and not in
and testcases
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r--sql/ha_ndbcluster.cc44
1 files changed, 40 insertions, 4 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 57232778d48..8faa0b33756 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -2135,11 +2135,47 @@ int ha_ndbcluster::index_read(byte *buf,
DBUG_PRINT("enter", ("active_index: %u, key_len: %u, find_flag: %d",
active_index, key_len, find_flag));
+ int error;
+ ndb_index_type type = get_index_type(active_index);
+ const KEY* key_info = table->key_info+active_index;
+ switch (type){
+ case PRIMARY_KEY_ORDERED_INDEX:
+ case PRIMARY_KEY_INDEX:
+ if (find_flag == HA_READ_KEY_EXACT && key_info->key_length == key_len)
+ {
+ DBUG_RETURN(pk_read(key, key_len, buf));
+ }
+ else if (type == PRIMARY_KEY_INDEX)
+ {
+ DBUG_RETURN(1);
+ }
+ break;
+ case UNIQUE_ORDERED_INDEX:
+ case UNIQUE_INDEX:
+ if (find_flag == HA_READ_KEY_EXACT && key_info->key_length == key_len)
+ {
+ DBUG_RETURN(unique_index_read(key, key_len, buf));
+ }
+ else if (type == UNIQUE_INDEX)
+ {
+ DBUG_RETURN(1);
+ }
+ break;
+ case ORDERED_INDEX:
+ break;
+ default:
+ case UNDEFINED_INDEX:
+ DBUG_ASSERT(false);
+ return 1;
+ break;
+ }
+
key_range start_key;
- start_key.key= key;
- start_key.length= key_len;
- start_key.flag= find_flag;
- DBUG_RETURN(read_range_first_to_buf(&start_key, NULL, false, true, buf));
+ start_key.key = key;
+ start_key.length = key_len;
+ start_key.flag = find_flag;
+ error= ordered_index_scan(&start_key, 0, true, buf);
+ DBUG_RETURN(error == HA_ERR_END_OF_FILE ? HA_ERR_KEY_NOT_FOUND : error);
}