diff options
author | unknown <heikki@hundin.mysql.fi> | 2003-06-22 16:20:06 +0300 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2003-06-22 16:20:06 +0300 |
commit | e0be1a89304afb756b9df8118612dc79cc13912e (patch) | |
tree | 1a135d13bab7894d25062ffd291711e2075c27ef /innobase | |
parent | f403da4bf2dba7f21c1076d986c73ef5d1ce2025 (diff) | |
download | mariadb-git-e0be1a89304afb756b9df8118612dc79cc13912e.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
sql/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
innobase/dict/dict0dict.c:
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
innobase/include/dict0dict.h:
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')
-rw-r--r-- | innobase/dict/dict0dict.c | 40 | ||||
-rw-r--r-- | innobase/include/dict0dict.h | 10 |
2 files changed, 50 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. */ diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h index e88c6a52bcb..b5ec5381db2 100644 --- a/innobase/include/dict0dict.h +++ b/innobase/include/dict0dict.h @@ -569,6 +569,16 @@ dict_index_get_nth_col_pos( dict_index_t* index, /* in: index */ ulint n); /* in: column number */ /************************************************************************ +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 */ +/************************************************************************ Looks for a matching field in an index. The column and the prefix len has to be the same. */ |