summaryrefslogtreecommitdiff
path: root/sql
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
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')
-rw-r--r--sql/ha_berkeley.h3
-rw-r--r--sql/ha_innodb.cc3
-rw-r--r--sql/ha_innodb.h3
-rw-r--r--sql/ha_isam.cc2
-rw-r--r--sql/ha_isam.h18
-rw-r--r--sql/ha_myisam.cc3
-rw-r--r--sql/ha_myisam.h7
-rw-r--r--sql/ha_myisammrg.h9
-rw-r--r--sql/handler.h4
-rw-r--r--sql/item_strfunc.cc31
-rw-r--r--sql/opt_range.cc24
-rw-r--r--sql/sql_base.cc16
-rw-r--r--sql/sql_cache.cc4
-rw-r--r--sql/sql_select.cc9
-rw-r--r--sql/table.cc18
-rw-r--r--sql/table.h4
16 files changed, 85 insertions, 73 deletions
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index f56ee5ef1a9..ae425421c70 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -88,8 +88,7 @@ class ha_berkeley: public handler
ha_berkeley(TABLE *table): handler(table), alloc_ptr(0),rec_buff(0), file(0),
int_table_flags(HA_REC_NOT_IN_SEQ |
HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
- HA_NULL_KEY | HA_HAVE_KEY_READ_ONLY |
- HA_BLOB_KEY | HA_NOT_EXACT_COUNT |
+ HA_NULL_KEY | HA_BLOB_KEY | HA_NOT_EXACT_COUNT |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE |
HA_AUTO_PART_KEY | HA_TABLE_SCAN_ON_INDEX),
changed_rows(0),last_dup_key((uint) -1),version(0),using_ignore(0)
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 2199547334a..8bb866341b7 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -356,13 +356,12 @@ ha_innobase::update_thd(
/*************************************************************************
Opens an InnoDB database. */
-char current_lib[3]; // Set if using current lib
-
bool
innobase_init(void)
/*===============*/
/* out: TRUE if error */
{
+ static char current_lib[3]; // Set if using current lib
int err;
bool ret;
char *default_path;
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index b2aa963f91a..4924056f5d2 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -77,7 +77,6 @@ class ha_innobase: public handler
ha_innobase(TABLE *table): handler(table),
int_table_flags(HA_REC_NOT_IN_SEQ |
HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
- HA_HAVE_KEY_READ_ONLY |
HA_NULL_KEY |
HA_NOT_EXACT_COUNT |
HA_NO_WRITE_DELAYED |
@@ -98,7 +97,7 @@ class ha_innobase: public handler
ulong index_flags(uint idx) const
{
return (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER |
- HA_NOT_READ_PREFIX_LAST);
+ HA_NOT_READ_PREFIX_LAST | HA_KEY_READ_ONLY);
}
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return MAX_KEY; }
diff --git a/sql/ha_isam.cc b/sql/ha_isam.cc
index 55d24f5edb9..b83dabd86b1 100644
--- a/sql/ha_isam.cc
+++ b/sql/ha_isam.cc
@@ -51,8 +51,6 @@ int ha_isam::open(const char *name, int mode, uint test_if_locked)
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED))
(void) nisam_extra(file,HA_EXTRA_WAIT_LOCK);
- if (!table->db_record_offset)
- int_table_flags|=HA_REC_NOT_IN_SEQ;
return (0);
}
diff --git a/sql/ha_isam.h b/sql/ha_isam.h
index bae9700f149..135424892f5 100644
--- a/sql/ha_isam.h
+++ b/sql/ha_isam.h
@@ -26,21 +26,20 @@
class ha_isam: public handler
{
N_INFO *file;
- uint int_table_flags;
public:
- ha_isam(TABLE *table): handler(table), file(0),
- int_table_flags(HA_READ_RND_SAME |
- HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
- HA_HAVE_KEY_READ_ONLY |
- HA_KEY_READ_WRONG_STR | HA_DUPP_POS |
- HA_NOT_DELETE_WITH_CACHE)
- {}
+ ha_isam(TABLE *table): handler(table), file(0)
+ {}
~ha_isam() {}
const char *table_type() const { return "ISAM"; }
const char *index_type(uint key_number) { return "BTREE"; }
const char **bas_ext() const;
- ulong table_flags() const { return int_table_flags; }
+ ulong table_flags() const
+ {
+ return (HA_READ_RND_SAME | HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
+ HA_KEY_READ_WRONG_STR | HA_DUPP_POS | HA_NOT_DELETE_WITH_CACHE |
+ ((table->db_record_offset) ? 0 : HA_REC_NOT_IN_SEQ));
+ }
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return N_MAXKEY; }
uint max_key_parts() const { return N_MAXKEY_SEG; }
@@ -80,5 +79,4 @@ class ha_isam: public handler
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type);
-
};
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index dc0136b7138..15a85620cd4 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -885,7 +885,8 @@ void ha_myisam::info(uint flag)
ref_length=info.reflength;
table->db_options_in_use = info.options;
block_size=myisam_block_size;
- table->keys_in_use &= info.key_map;
+ table->keys_in_use&= info.key_map;
+ table->keys_for_keyread&= info.key_map;
table->db_record_offset=info.record_offset;
if (table->key_parts)
memcpy((char*) table->key_info[0].rec_per_key,
diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h
index d304085fdd5..e7f426bb76c 100644
--- a/sql/ha_myisam.h
+++ b/sql/ha_myisam.h
@@ -45,7 +45,6 @@ class ha_myisam: public handler
public:
ha_myisam(TABLE *table): handler(table), file(0),
int_table_flags(HA_READ_RND_SAME | HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
- HA_HAVE_KEY_READ_ONLY |
HA_NULL_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
HA_DUPP_POS | HA_BLOB_KEY | HA_AUTO_PART_KEY),
enable_activate_all_index(1)
@@ -55,6 +54,12 @@ class ha_myisam: public handler
const char *index_type(uint key_number);
const char **bas_ext() const;
ulong table_flags() const { return int_table_flags; }
+ ulong index_flags(uint inx) const
+ {
+ ulong flags=(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER);
+ return (flags | ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
+ 0 : HA_KEY_READ_ONLY));
+ }
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return MI_MAX_KEY; }
uint max_key_parts() const { return MAX_REF_PARTS; }
diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h
index ed2817f3ca6..2b9d7433d2f 100644
--- a/sql/ha_myisammrg.h
+++ b/sql/ha_myisammrg.h
@@ -35,10 +35,15 @@ class ha_myisammrg: public handler
ulong table_flags() const
{
return (HA_REC_NOT_IN_SEQ | HA_READ_RND_SAME |
- HA_HAVE_KEY_READ_ONLY | HA_KEYPOS_TO_RNDPOS |
- HA_LASTKEY_ORDER |
+ HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
HA_NULL_KEY | HA_BLOB_KEY);
}
+ ulong index_flags(uint inx) const
+ {
+ ulong flags=(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER);
+ return (flags | ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
+ 0 : HA_KEY_READ_ONLY));
+ }
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return MI_MAX_KEY; }
uint max_key_parts() const { return MAX_REF_PARTS; }
diff --git a/sql/handler.h b/sql/handler.h
index 668453f8905..7984be87058 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -48,7 +48,6 @@
#define HA_TABLE_SCAN_ON_INDEX 4 /* No separate data/index file */
#define HA_REC_NOT_IN_SEQ 8 /* ha_info don't return recnumber;
It returns a position to ha_r_rnd */
-#define HA_HAVE_KEY_READ_ONLY 16 /* Can read only keys (no record) */
#define HA_NO_INDEX 32 /* No index needed for next/prev */
#define HA_KEY_READ_WRONG_STR 64 /* keyread returns converted strings */
#define HA_NULL_KEY 128 /* One can have keys with NULL */
@@ -83,6 +82,7 @@
#define HA_READ_ORDER 8 /* Read through record-keys in order */
#define HA_ONLY_WHOLE_INDEX 16 /* Can't use part key searches */
#define HA_NOT_READ_PREFIX_LAST 32
+#define HA_KEY_READ_ONLY 64 /* Support HA_EXTRA_KEYREAD */
/*
Parameters for open() (in register form->filestat)
@@ -321,7 +321,7 @@ public:
virtual ulong table_flags(void) const =0;
virtual ulong index_flags(uint idx) const
{
- return (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER);
+ return (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_KEY_READ_ONLY);
}
virtual uint max_record_length() const =0;
virtual uint max_keys() const =0;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index fd52668da3f..dfb53a32910 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -153,15 +153,15 @@ String *Item_func_aes_encrypt::val_str(String *str)
null_value=0;
aes_length=my_aes_get_size(sptr->length()); // calculate result length
- if ( !str->alloc(aes_length) ) // Ensure that memory is free
+ if (!str->alloc(aes_length)) // Ensure that memory is free
{
// finally encrypt directly to allocated buffer.
- if (my_aes_encrypt(sptr->ptr(),sptr->length(),str->ptr(),key->ptr(),
- key->length()) == aes_length)
+ if (my_aes_encrypt(sptr->ptr(),sptr->length(), (char*) str->ptr(),
+ key->ptr(), key->length()) == aes_length)
{
- // we have to get expected result length
- str->length((uint) aes_length);
- return str;
+ // We got the expected result length
+ str->length((uint) aes_length);
+ return str;
}
}
}
@@ -169,9 +169,10 @@ String *Item_func_aes_encrypt::val_str(String *str)
return 0;
}
+
void Item_func_aes_encrypt::fix_length_and_dec()
{
- max_length=my_aes_get_size(args[0]->max_length);
+ max_length=my_aes_get_size(args[0]->max_length);
}
@@ -184,12 +185,12 @@ String *Item_func_aes_decrypt::val_str(String *str)
if (sptr && key) // Need to have both arguments not NULL
{
null_value=0;
- if ( !str->alloc(sptr->length()) ) // Ensure that memory is free
+ if (!str->alloc(sptr->length())) // Ensure that memory is free
{
- // finally decencrypt directly to allocated buffer.
- length=my_aes_decrypt(sptr->ptr(),sptr->length(),str->ptr(),
- key->ptr(),key->length());
- if (length>=0) // if we got correct data data
+ // finally decrypt directly to allocated buffer.
+ length=my_aes_decrypt(sptr->ptr(), sptr->length(), (char*) str->ptr(),
+ key->ptr(), key->length());
+ if (length >= 0) // if we got correct data data
{
str->length((uint) length);
return str;
@@ -208,9 +209,9 @@ void Item_func_aes_decrypt::fix_length_and_dec()
/*
-** Concatinate args with the following premissess
-** If only one arg which is ok, return value of arg
-** Don't reallocate val_str() if not absolute necessary.
+ Concatenate args with the following premises:
+ If only one arg (which is ok), return value of arg
+ Don't reallocate val_str() if not absolute necessary.
*/
String *Item_func_concat::val_str(String *str)
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 5a359cc4239..33574a81431 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -682,27 +682,27 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
{
ha_rows found_records;
double found_read_time;
-
if (*key)
{
+ uint keynr= param.real_keynr[idx];
if ((*key)->type == SEL_ARG::MAYBE_KEY ||
(*key)->maybe_flag)
- needed_reg|= (key_map) 1 << param.real_keynr[idx];
+ needed_reg|= (key_map) 1 << keynr;
- found_records=check_quick_select(&param,idx, *key);
+ found_records=check_quick_select(&param, idx, *key);
if (found_records != HA_POS_ERROR && found_records > 2 &&
- head->used_keys & ((table_map) 1 << param.real_keynr[idx]) &&
- (head->file->table_flags() & HA_HAVE_KEY_READ_ONLY))
+ head->used_keys & ((table_map) 1 << keynr) &&
+ (head->file->index_flags(keynr) & HA_KEY_READ_ONLY))
{
/*
- ** We can resolve this by only reading through this key
- ** Assume that we will read trough the whole key range
- ** and that all key blocks are half full (normally things are
- ** much better)
+ We can resolve this by only reading through this key.
+ Assume that we will read trough the whole key range
+ and that all key blocks are half full (normally things are
+ much better).
*/
- uint keys_per_block= head->file->block_size/2/
- (head->key_info[param.real_keynr[idx]].key_length+
- head->file->ref_length) + 1;
+ uint keys_per_block= (head->file->block_size/2/
+ (head->key_info[keynr].key_length+
+ head->file->ref_length) + 1);
found_read_time=((double) (found_records+keys_per_block-1)/
(double) keys_per_block);
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index d93b40180ee..40f6b40f9b5 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -730,7 +730,8 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
table->const_table=0;
table->outer_join=table->null_row=table->maybe_null=0;
table->status=STATUS_NO_RECORD;
- table->keys_in_use_for_query=table->used_keys= table->keys_in_use;
+ table->keys_in_use_for_query= table->keys_in_use;
+ table->used_keys= table->keys_for_keyread;
DBUG_RETURN(table);
}
@@ -884,7 +885,8 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
table->const_table=0;
table->outer_join=table->null_row=table->maybe_null=0;
table->status=STATUS_NO_RECORD;
- table->keys_in_use_for_query=table->used_keys= table->keys_in_use;
+ table->keys_in_use_for_query= table->keys_in_use;
+ table->used_keys= table->keys_for_keyread;
DBUG_ASSERT(table->key_read == 0);
DBUG_RETURN(table);
}
@@ -950,7 +952,8 @@ bool reopen_table(TABLE *table,bool locked)
tmp.null_row= table->null_row;
tmp.maybe_null= table->maybe_null;
tmp.status= table->status;
- tmp.keys_in_use_for_query=tmp.used_keys=tmp.keys_in_use;
+ tmp.keys_in_use_for_query= tmp.keys_in_use;
+ tmp.used_keys= tmp.keys_for_keyread;
/* Get state */
tmp.key_length= table->key_length;
@@ -1578,7 +1581,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
{
field->query_id=thd->query_id;
table->used_fields++;
- table->used_keys&=field->part_of_key;
+ table->used_keys&= field->part_of_key;
}
else
thd->dupp_field=field;
@@ -1783,7 +1786,8 @@ bool setup_tables(TABLE_LIST *tables)
table->const_table=0;
table->outer_join=table->null_row=0;
table->status=STATUS_NO_RECORD;
- table->keys_in_use_for_query=table->used_keys= table->keys_in_use;
+ table->keys_in_use_for_query= table->keys_in_use;
+ table->used_keys= table->keys_for_keyread;
table->maybe_null=test(table->outer_join=table_list->outer_join);
table->tablenr=tablenr;
table->map= (table_map) 1 << tablenr;
@@ -1873,7 +1877,7 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
if (field->query_id == thd->query_id)
thd->dupp_field=field;
field->query_id=thd->query_id;
- table->used_keys&=field->part_of_key;
+ table->used_keys&= field->part_of_key;
}
/* All fields are used */
table->used_fields=table->fields;
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index eb4316efca2..dd38f8fd79b 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -3063,8 +3063,8 @@ my_bool Query_cache::check_integrity(bool not_locked)
DBUG_PRINT("qcache", ("block 0x%lx, type %u...",
(ulong) block, (uint) block->type));
// Check allignment
- if ((((ulonglong)block) % (ulonglong)ALIGN_SIZE(1)) !=
- (((ulonglong)first_block) % (ulonglong)ALIGN_SIZE(1)))
+ if ((((long)block) % (long) ALIGN_SIZE(1)) !=
+ (((long)first_block) % (long)ALIGN_SIZE(1)))
{
DBUG_PRINT("error",
("block 0x%lx do not aligned by %d", (ulong) block,
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 94fa08b769a..0af91c443a8 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -233,7 +233,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
and no GROUP BY.
TODO: Add check of calculation of GROUP functions and fields:
SELECT COUNT(*)+table.col1 from table1;
- */
+ */
join.table=0;
join.tables=0;
{
@@ -257,14 +257,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
}
TABLE_LIST *table;
for (table=tables ; table ; table=table->next)
- {
join.tables++;
- if (!thd->used_tables)
- {
- TABLE *tbl=table->table;
- tbl->keys_in_use_for_query=tbl->used_keys= tbl->keys_in_use=0;
- }
- }
}
procedure=setup_procedure(thd,proc_param,result,fields,&error);
if (error)
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) &&
diff --git a/sql/table.h b/sql/table.h
index b6bc3fa8cf1..63b7a9bc2f7 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -61,7 +61,8 @@ struct st_table {
uint uniques;
uint null_fields; /* number of null fields */
uint blob_fields; /* number of blob fields */
- key_map keys_in_use, keys_in_use_for_query;
+ key_map keys_in_use, keys_for_keyread;
+ key_map quick_keys, used_keys, keys_in_use_for_query;
KEY *key_info; /* data of keys in database */
TYPELIB keynames; /* Pointers to keynames */
ha_rows max_rows; /* create information */
@@ -119,7 +120,6 @@ struct st_table {
byte *record_pointers; /* If sorted in memory */
ha_rows found_records; /* How many records in sort */
ORDER *group;
- key_map quick_keys, used_keys;
ha_rows quick_rows[MAX_KEY];
uint quick_key_parts[MAX_KEY];
key_part_map const_key_parts[MAX_KEY];