summaryrefslogtreecommitdiff
path: root/sql/key.cc
diff options
context:
space:
mode:
authorunknown <serg@janus.mylan>2007-01-29 10:40:26 +0100
committerunknown <serg@janus.mylan>2007-01-29 10:40:26 +0100
commit4e8b49d656828fbe2f84d9970a036db644185981 (patch)
treef14bd08181ddd81d2a41f06d9bf0f11d6edf53b5 /sql/key.cc
parent6e1ba88418887369ca71b49222c6fd66335bbe0c (diff)
downloadmariadb-git-4e8b49d656828fbe2f84d9970a036db644185981.tar.gz
WL#3700: Handler API change: all index search methods - that is,
index_read(), index_read_idx(), index_read_last(), and records_in_range() - instead of 'uint keylen' argument take 'ulonglong keypart_map', a bitmap showing which keyparts are present in the key value. Fallback method is provided for handlers that are lagging behind.
Diffstat (limited to 'sql/key.cc')
-rw-r--r--sql/key.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/sql/key.cc b/sql/key.cc
index bd614b10a70..faa7bf1f04b 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -29,6 +29,7 @@
field Field to search after
key_length On partial match, contains length of fields before
field
+ keypart key part # of a field
NOTES
Used when calculating key for NEXT_NUMBER
@@ -45,7 +46,7 @@
*/
int find_ref_key(KEY *key, uint key_count, byte *record, Field *field,
- uint *key_length)
+ uint *key_length, uint *keypart)
{
reg2 int i;
reg3 KEY *key_info;
@@ -60,8 +61,8 @@ int find_ref_key(KEY *key, uint key_count, byte *record, Field *field,
{
if (key_info->key_part[0].offset == fieldpos)
{ /* Found key. Calc keylength */
- *key_length=0;
- return(i); /* Use this key */
+ *key_length= *keypart= 0;
+ return i; /* Use this key */
}
}
@@ -78,8 +79,11 @@ int find_ref_key(KEY *key, uint key_count, byte *record, Field *field,
j++, key_part++)
{
if (key_part->offset == fieldpos)
- return(i); /* Use this key */
- *key_length+=key_part->store_length;
+ {
+ *keypart= j;
+ return i; /* Use this key */
+ }
+ *key_length+= key_part->store_length;
}
}
return(-1); /* No key is ok */