summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-06-19 00:22:30 +0300
committerunknown <monty@hundin.mysql.fi>2002-06-19 00:22:30 +0300
commit518787c29965d10f65a7e9c073718076aceb058c (patch)
treedf0fd78ddd1c83d577e830a40da77487a62451b7 /sql/table.cc
parent9424f80f19a84eb667c3d588d8c0d19b833c7c28 (diff)
downloadmariadb-git-518787c29965d10f65a7e9c073718076aceb058c.tar.gz
Made keyread (key scanning) a key specific attribute.
This avoids using fulltext keys for table scanning. This also reverts Sinisa's original fix for this problem. Docs/manual.texi: Update of SQL_JOIN_MAX_SIZE information3602 client/mysqldump.c: comment cleanup include/my_aes.h: General cleanup for new file include/rijndael.h: General cleanup for new file include/sha1.h: General cleanup for new file mysys/my_aes.c: General cleanup for new file mysys/rijndael.c: General cleanup for new file mysys/sha1.c: General cleanup for new file sql/ha_berkeley.h: Made keyread (key scanning) a key specific attribute. sql/ha_innodb.cc: Merge with 3.23.x sql/ha_innodb.h: Made keyread (key scanning) a key specific attribute. sql/ha_isam.cc: Moved things to table_flags() sql/ha_isam.h: Made keyread (key scanning) a key specific attribute. sql/ha_myisam.cc: Made keyread (key scanning) a key specific attribute. sql/ha_myisam.h: Made keyread (key scanning) a key specific attribute. sql/ha_myisammrg.h: Made keyread (key scanning) a key specific attribute. sql/handler.h: Made keyread (key scanning) a key specific attribute. sql/item_strfunc.cc: Cleanup of AES_xxx code sql/opt_range.cc: Made keyread (key scanning) a key specific attribute. sql/sql_base.cc: Made keyread (key scanning) a key specific attribute. sql/sql_cache.cc: Removed compiler warning sql/sql_select.cc: Removed wrong patch to fulltext problem sql/table.cc: Made keyread (key scanning) a key specific attribute. sql/table.h: Made keyread (key scanning) a key specific attribute.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 5664099adda..9435a83120e 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -133,7 +133,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if (read_string(file,(gptr*) &disk_buff,key_info_length))
goto err_not_open; /* purecov: inspected */
outparam->keys=keys= disk_buff[0];
- outparam->keys_in_use= set_bits(key_map, keys);
+ outparam->keys_for_keyread= outparam->keys_in_use= set_bits(key_map, keys);
outparam->key_parts=key_parts=disk_buff[1];
n_length=keys*sizeof(KEY)+key_parts*sizeof(KEY_PART_INFO);
@@ -199,6 +199,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
for (i=0 ; i < keys ; i++, keyinfo++)
keyinfo->algorithm= (enum ha_key_alg) *(strpos++);
}
+
outparam->reclength = uint2korr((head+16));
if (*(head+26) == 1)
outparam->system=1; /* one-record-database */
@@ -386,7 +387,17 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
for (uint key=0 ; key < outparam->keys ; key++,keyinfo++)
{
uint usable_parts=0;
+ ulong index_flags;
keyinfo->name=(char*) outparam->keynames.type_names[key];
+ /* Fix fulltext keys for old .frm files */
+ if (outparam->key_info[key].flags & HA_FULLTEXT)
+ outparam->key_info[key].algorithm= HA_KEY_ALG_FULLTEXT;
+
+ /* This has to be done after the above fulltext correction */
+ index_flags=outparam->file->index_flags(key);
+ if (!(index_flags & HA_KEY_READ_ONLY))
+ outparam->keys_for_keyread&= ~((key_map) 1 << key);
+
if (primary_key >= MAX_KEY && (keyinfo->flags & HA_NOSAME))
{
/*
@@ -444,7 +455,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
keyinfo->key_length ? UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG);
if (i == 0)
field->key_start|= ((key_map) 1 << key);
- if ((ha_option & HA_HAVE_KEY_READ_ONLY) &&
+ if ((index_flags & HA_KEY_READ_ONLY) &&
field->key_length() == key_part->length &&
field->type() != FIELD_TYPE_BLOB)
{
@@ -454,8 +465,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
field->part_of_key|= ((key_map) 1 << key);
if ((field->key_type() != HA_KEYTYPE_TEXT ||
!(keyinfo->flags & HA_FULLTEXT)) &&
- !(outparam->file->index_flags(key) &
- HA_WRONG_ASCII_ORDER))
+ !(index_flags & HA_WRONG_ASCII_ORDER))
field->part_of_sortkey|= ((key_map) 1 << key);
}
if (!(key_part->key_part_flag & HA_REVERSE_SORT) &&