Commit a04f290b authored by Marko Mäkelä's avatar Marko Mäkelä

Merge mysql-5.1 to mysql-5.5.

parents dba286c9 20e1d3c6
...@@ -487,10 +487,12 @@ Looks for column n in an index. ...@@ -487,10 +487,12 @@ Looks for column n in an index.
ULINT_UNDEFINED if not contained */ ULINT_UNDEFINED if not contained */
UNIV_INTERN UNIV_INTERN
ulint ulint
dict_index_get_nth_col_pos( dict_index_get_nth_col_or_prefix_pos(
/*=======================*/ /*=================================*/
const dict_index_t* index, /*!< in: index */ const dict_index_t* index, /*!< in: index */
ulint n) /*!< in: column number */ ulint n, /*!< in: column number */
ibool inc_prefix) /*!< in: TRUE=consider
column prefixes too */
{ {
const dict_field_t* field; const dict_field_t* field;
const dict_col_t* col; const dict_col_t* col;
...@@ -512,7 +514,8 @@ dict_index_get_nth_col_pos( ...@@ -512,7 +514,8 @@ dict_index_get_nth_col_pos(
for (pos = 0; pos < n_fields; pos++) { for (pos = 0; pos < n_fields; pos++) {
field = dict_index_get_nth_field(index, pos); field = dict_index_get_nth_field(index, pos);
if (col == field->col && field->prefix_len == 0) { if (col == field->col
&& (inc_prefix || field->prefix_len == 0)) {
return(pos); return(pos);
} }
...@@ -521,6 +524,20 @@ dict_index_get_nth_col_pos( ...@@ -521,6 +524,20 @@ dict_index_get_nth_col_pos(
return(ULINT_UNDEFINED); return(ULINT_UNDEFINED);
} }
/********************************************************************//**
Looks for column n in an index.
@return position in internal representation of the index;
ULINT_UNDEFINED if not contained */
UNIV_INTERN
ulint
dict_index_get_nth_col_pos(
/*=======================*/
const dict_index_t* index, /*!< in: index */
ulint n) /*!< in: column number */
{
return(dict_index_get_nth_col_or_prefix_pos(index, n, FALSE));
}
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
/********************************************************************//** /********************************************************************//**
Returns TRUE if the index contains a column or a prefix of that column. Returns TRUE if the index contains a column or a prefix of that column.
......
...@@ -151,7 +151,7 @@ innobase_rec_to_mysql( ...@@ -151,7 +151,7 @@ innobase_rec_to_mysql(
field->reset(); field->reset();
ipos = dict_index_get_nth_col_pos(index, i); ipos = dict_index_get_nth_col_or_prefix_pos(index, i, TRUE);
if (UNIV_UNLIKELY(ipos == ULINT_UNDEFINED)) { if (UNIV_UNLIKELY(ipos == ULINT_UNDEFINED)) {
null_field: null_field:
......
...@@ -910,6 +910,18 @@ dict_index_get_nth_col_pos( ...@@ -910,6 +910,18 @@ dict_index_get_nth_col_pos(
const dict_index_t* index, /*!< in: index */ const dict_index_t* index, /*!< in: index */
ulint n); /*!< in: column number */ ulint n); /*!< in: column number */
/********************************************************************//** /********************************************************************//**
Looks for column n in an index.
@return position in internal representation of the index;
ULINT_UNDEFINED if not contained */
UNIV_INTERN
ulint
dict_index_get_nth_col_or_prefix_pos(
/*=================================*/
const dict_index_t* index, /*!< in: index */
ulint n, /*!< in: column number */
ibool inc_prefix); /*!< in: TRUE=consider
column prefixes too */
/********************************************************************//**
Returns TRUE if the index contains a column or a prefix of that column. Returns TRUE if the index contains a column or a prefix of that column.
@return TRUE if contains the column or its prefix */ @return TRUE if contains the column or its prefix */
UNIV_INTERN UNIV_INTERN
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment