diff options
author | heikki@hundin.mysql.fi <> | 2003-06-22 16:20:06 +0300 |
---|---|---|
committer | heikki@hundin.mysql.fi <> | 2003-06-22 16:20:06 +0300 |
commit | e2efb08c505d6e5edafb06bfebf3b089815dbf27 (patch) | |
tree | 1a135d13bab7894d25062ffd291711e2075c27ef /innobase/dict | |
parent | 9990ce576b666980904ae8202b079bdd8fdd00ba (diff) | |
download | mariadb-git-e2efb08c505d6e5edafb06bfebf3b089815dbf27.tar.gz |
dict0dict.h, dict0dict.c, ha_innodb.cc:
In ORDER BY MySQL seems to set the key read flag also in the case where the primary key contains only a prefix of a column - not the whole column; to prevent potential bugs retrieve the whole column if the index contains a prefix of it
Diffstat (limited to 'innobase/dict')
-rw-r--r-- | innobase/dict/dict0dict.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 2fc05b1923f..b1d7b5f762e 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -495,6 +495,46 @@ dict_index_get_nth_col_pos( } /************************************************************************ +Returns TRUE if the index contains a column or a prefix of that column. */ + +ibool +dict_index_contains_col_or_prefix( +/*==============================*/ + /* out: TRUE if contains the column or its + prefix */ + dict_index_t* index, /* in: index */ + ulint n) /* in: column number */ +{ + dict_field_t* field; + dict_col_t* col; + ulint pos; + ulint n_fields; + + ut_ad(index); + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + + if (index->type & DICT_CLUSTERED) { + + return(TRUE); + } + + col = dict_table_get_nth_col(index->table, n); + + n_fields = dict_index_get_n_fields(index); + + for (pos = 0; pos < n_fields; pos++) { + field = dict_index_get_nth_field(index, pos); + + if (col == field->col) { + + return(TRUE); + } + } + + return(FALSE); +} + +/************************************************************************ Looks for a matching field in an index. The column and the prefix len have to be the same. */ |