Commit 1595953a authored by marko's avatar marko

branches/zip: Add some const qualifiers or in/out comments to the

dict_index_t* and dict_table_t* parameters of some functions.
parent 9bbb520f
...@@ -309,7 +309,7 @@ Decrements the count of open MySQL handles to a table. */ ...@@ -309,7 +309,7 @@ Decrements the count of open MySQL handles to a table. */
void void
dict_table_decrement_handle_count( dict_table_decrement_handle_count(
/*==============================*/ /*==============================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
ibool dict_locked) /* in: TRUE=data dictionary locked */ ibool dict_locked) /* in: TRUE=data dictionary locked */
{ {
if (!dict_locked) { if (!dict_locked) {
...@@ -363,7 +363,7 @@ Acquire the autoinc lock.*/ ...@@ -363,7 +363,7 @@ Acquire the autoinc lock.*/
void void
dict_table_autoinc_lock( dict_table_autoinc_lock(
/*====================*/ /*====================*/
dict_table_t* table) dict_table_t* table) /* in/out: table */
{ {
mutex_enter(&table->autoinc_mutex); mutex_enter(&table->autoinc_mutex);
} }
...@@ -375,7 +375,7 @@ initialized counter. */ ...@@ -375,7 +375,7 @@ initialized counter. */
void void
dict_table_autoinc_initialize( dict_table_autoinc_initialize(
/*==========================*/ /*==========================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
ib_longlong value) /* in: next value to assign to a row */ ib_longlong value) /* in: next value to assign to a row */
{ {
table->autoinc_inited = TRUE; table->autoinc_inited = TRUE;
...@@ -389,8 +389,8 @@ initialized. */ ...@@ -389,8 +389,8 @@ initialized. */
ib_longlong ib_longlong
dict_table_autoinc_read( dict_table_autoinc_read(
/*====================*/ /*====================*/
/* out: value for a new row, or 0 */ /* out: value for a new row, or 0 */
dict_table_t* table) /* in: table */ const dict_table_t* table) /* in: table */
{ {
ib_longlong value; ib_longlong value;
...@@ -412,7 +412,7 @@ void ...@@ -412,7 +412,7 @@ void
dict_table_autoinc_update( dict_table_autoinc_update(
/*======================*/ /*======================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
ib_longlong value) /* in: value which was assigned to a row */ ib_longlong value) /* in: value which was assigned to a row */
{ {
if (table->autoinc_inited && value > table->autoinc) { if (table->autoinc_inited && value > table->autoinc) {
...@@ -427,7 +427,7 @@ Release the autoinc lock.*/ ...@@ -427,7 +427,7 @@ Release the autoinc lock.*/
void void
dict_table_autoinc_unlock( dict_table_autoinc_unlock(
/*======================*/ /*======================*/
dict_table_t* table) /* in: release autoinc lock for this table */ dict_table_t* table) /* in/out: table */
{ {
mutex_exit(&table->autoinc_mutex); mutex_exit(&table->autoinc_mutex);
} }
...@@ -507,10 +507,10 @@ Returns TRUE if the index contains a column or a prefix of that column. */ ...@@ -507,10 +507,10 @@ Returns TRUE if the index contains a column or a prefix of that column. */
ibool ibool
dict_index_contains_col_or_prefix( dict_index_contains_col_or_prefix(
/*==============================*/ /*==============================*/
/* out: TRUE if contains the column or its /* out: TRUE if contains the column
prefix */ or its prefix */
dict_index_t* index, /* in: index */ const dict_index_t* index, /* in: index */
ulint n) /* in: column number */ ulint n) /* in: column number */
{ {
const dict_field_t* field; const dict_field_t* field;
const dict_col_t* col; const dict_col_t* col;
...@@ -550,17 +550,18 @@ from the prefix in index. */ ...@@ -550,17 +550,18 @@ from the prefix in index. */
ulint ulint
dict_index_get_nth_field_pos( dict_index_get_nth_field_pos(
/*=========================*/ /*=========================*/
/* out: position in internal representation /* out: position in internal
of the index; if not contained, returns representation of the index;
ULINT_UNDEFINED */ if not contained, returns
dict_index_t* index, /* in: index from which to search */ ULINT_UNDEFINED */
dict_index_t* index2, /* in: index */ const dict_index_t* index, /* in: index from which to search */
ulint n) /* in: field number in index2 */ const dict_index_t* index2, /* in: index */
ulint n) /* in: field number in index2 */
{ {
dict_field_t* field; const dict_field_t* field;
dict_field_t* field2; const dict_field_t* field2;
ulint n_fields; ulint n_fields;
ulint pos; ulint pos;
ut_ad(index); ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
...@@ -624,10 +625,11 @@ Looks for column n position in the clustered index. */ ...@@ -624,10 +625,11 @@ Looks for column n position in the clustered index. */
ulint ulint
dict_table_get_nth_col_pos( dict_table_get_nth_col_pos(
/*=======================*/ /*=======================*/
/* out: position in internal representation /* out: position in internal
of the clustered index */ representation of
dict_table_t* table, /* in: table */ the clustered index */
ulint n) /* in: column number */ const dict_table_t* table, /* in: table */
ulint n) /* in: column number */
{ {
return(dict_index_get_nth_col_pos(dict_table_get_first_index(table), return(dict_index_get_nth_col_pos(dict_table_get_first_index(table),
n)); n));
...@@ -640,12 +642,12 @@ table. Column prefixes are treated like whole columns. */ ...@@ -640,12 +642,12 @@ table. Column prefixes are treated like whole columns. */
ibool ibool
dict_table_col_in_clustered_key( dict_table_col_in_clustered_key(
/*============================*/ /*============================*/
/* out: TRUE if the column, or its prefix, is /* out: TRUE if the column, or its
in the clustered key */ prefix, is in the clustered key */
dict_table_t* table, /* in: table */ const dict_table_t* table, /* in: table */
ulint n) /* in: column number */ ulint n) /* in: column number */
{ {
dict_index_t* index; const dict_index_t* index;
const dict_field_t* field; const dict_field_t* field;
const dict_col_t* col; const dict_col_t* col;
ulint pos; ulint pos;
...@@ -903,7 +905,7 @@ ibool ...@@ -903,7 +905,7 @@ ibool
dict_table_rename_in_cache( dict_table_rename_in_cache(
/*=======================*/ /*=======================*/
/* out: TRUE if success */ /* out: TRUE if success */
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
const char* new_name, /* in: new name */ const char* new_name, /* in: new name */
ibool rename_also_foreigns)/* in: in ALTER TABLE we want ibool rename_also_foreigns)/* in: in ALTER TABLE we want
to preserve the original table name to preserve the original table name
...@@ -1119,7 +1121,7 @@ DISCARD TABLESPACE. */ ...@@ -1119,7 +1121,7 @@ DISCARD TABLESPACE. */
void void
dict_table_change_id_in_cache( dict_table_change_id_in_cache(
/*==========================*/ /*==========================*/
dict_table_t* table, /* in: table object already in cache */ dict_table_t* table, /* in/out: table object already in cache */
dulint new_id) /* in: new id to set */ dulint new_id) /* in: new id to set */
{ {
ut_ad(table); ut_ad(table);
...@@ -1329,7 +1331,7 @@ Removes an index from the dictionary cache. */ ...@@ -1329,7 +1331,7 @@ Removes an index from the dictionary cache. */
void void
dict_index_remove_from_cache( dict_index_remove_from_cache(
/*=========================*/ /*=========================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
dict_index_t* index) /* in, own: index */ dict_index_t* index) /* in, own: index */
{ {
ulint size; ulint size;
...@@ -1396,10 +1398,10 @@ Adds a column to index. */ ...@@ -1396,10 +1398,10 @@ Adds a column to index. */
void void
dict_index_add_col( dict_index_add_col(
/*===============*/ /*===============*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in/out: index */
dict_table_t* table, /* in: table */ const dict_table_t* table, /* in: table */
dict_col_t* col, /* in: column */ dict_col_t* col, /* in: column */
ulint prefix_len) /* in: column prefix length */ ulint prefix_len) /* in: column prefix length */
{ {
dict_field_t* field; dict_field_t* field;
const char* col_name; const char* col_name;
...@@ -3603,9 +3605,9 @@ no comparison can occur with the page number field in a node pointer. */ ...@@ -3603,9 +3605,9 @@ no comparison can occur with the page number field in a node pointer. */
ibool ibool
dict_index_check_search_tuple( dict_index_check_search_tuple(
/*==========================*/ /*==========================*/
/* out: TRUE if ok */ /* out: TRUE if ok */
dict_index_t* index, /* in: index tree */ const dict_index_t* index, /* in: index tree */
const dtuple_t* tuple) /* in: tuple used in a search */ const dtuple_t* tuple) /* in: tuple used in a search */
{ {
ut_a(index); ut_a(index);
ut_a(dtuple_get_n_fields_cmp(tuple) ut_a(dtuple_get_n_fields_cmp(tuple)
...@@ -3620,14 +3622,16 @@ Builds a node pointer out of a physical record and a page number. */ ...@@ -3620,14 +3622,16 @@ Builds a node pointer out of a physical record and a page number. */
dtuple_t* dtuple_t*
dict_index_build_node_ptr( dict_index_build_node_ptr(
/*======================*/ /*======================*/
/* out, own: node pointer */ /* out, own: node pointer */
dict_index_t* index, /* in: index tree */ const dict_index_t* index, /* in: index */
rec_t* rec, /* in: record for which to build node const rec_t* rec, /* in: record for which to build node
pointer */ pointer */
ulint page_no,/* in: page number to put in node pointer */ ulint page_no,/* in: page number to put in node
mem_heap_t* heap, /* in: memory heap where pointer created */ pointer */
ulint level) /* in: level of rec in tree: 0 means leaf mem_heap_t* heap, /* in: memory heap where pointer
level */ created */
ulint level) /* in: level of rec in tree:
0 means leaf level */
{ {
dtuple_t* tuple; dtuple_t* tuple;
dfield_t* field; dfield_t* field;
...@@ -3745,7 +3749,7 @@ Calculates the minimum record length in an index. */ ...@@ -3745,7 +3749,7 @@ Calculates the minimum record length in an index. */
ulint ulint
dict_index_calc_min_rec_len( dict_index_calc_min_rec_len(
/*========================*/ /*========================*/
dict_index_t* index) /* in: index */ const dict_index_t* index) /* in: index */
{ {
ulint sum = 0; ulint sum = 0;
ulint i; ulint i;
...@@ -3796,7 +3800,7 @@ are used in query optimization. */ ...@@ -3796,7 +3800,7 @@ are used in query optimization. */
void void
dict_update_statistics_low( dict_update_statistics_low(
/*=======================*/ /*=======================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
ibool has_dict_mutex __attribute__((unused))) ibool has_dict_mutex __attribute__((unused)))
/* in: TRUE if the caller has the /* in: TRUE if the caller has the
dictionary mutex */ dictionary mutex */
...@@ -3880,7 +3884,7 @@ are used in query optimization. */ ...@@ -3880,7 +3884,7 @@ are used in query optimization. */
void void
dict_update_statistics( dict_update_statistics(
/*===================*/ /*===================*/
dict_table_t* table) /* in: table */ dict_table_t* table) /* in/out: table */
{ {
dict_update_statistics_low(table, FALSE); dict_update_statistics_low(table, FALSE);
} }
...@@ -4456,20 +4460,21 @@ dict_table_get_index_by_max_id( ...@@ -4456,20 +4460,21 @@ dict_table_get_index_by_max_id(
return(dict_find_index_by_max_id(table, name, column_names, n_cols)); return(dict_find_index_by_max_id(table, name, column_names, n_cols));
} }
#ifdef UNIV_DEBUG
/************************************************************************** /**************************************************************************
Check for duplicate index entries in a table [using the index name] */ Check for duplicate index entries in a table [using the index name] */
#ifdef UNIV_DEBUG
void void
dict_table_check_for_dup_indexes( dict_table_check_for_dup_indexes(
/*=============================*/ /*=============================*/
dict_table_t* table) /* in: Check for dup indexes in this table */ const dict_table_t* table) /* in: Check for dup indexes
in this table */
{ {
/* Check for duplicates, ignoring indexes that are marked /* Check for duplicates, ignoring indexes that are marked
as to be dropped */ as to be dropped */
dict_index_t* index1; const dict_index_t* index1;
dict_index_t* index2; const dict_index_t* index2;
/* The primary index _must_ exist */ /* The primary index _must_ exist */
ut_a(UT_LIST_GET_LEN(table->indexes) > 0); ut_a(UT_LIST_GET_LEN(table->indexes) > 0);
......
...@@ -68,7 +68,7 @@ Decrements the count of open MySQL handles to a table. */ ...@@ -68,7 +68,7 @@ Decrements the count of open MySQL handles to a table. */
void void
dict_table_decrement_handle_count( dict_table_decrement_handle_count(
/*==============================*/ /*==============================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
ibool dict_locked); /* in: TRUE=data dictionary locked */ ibool dict_locked); /* in: TRUE=data dictionary locked */
/************************************************************************** /**************************************************************************
Inits the data dictionary module. */ Inits the data dictionary module. */
...@@ -170,7 +170,7 @@ Acquire the autoinc lock.*/ ...@@ -170,7 +170,7 @@ Acquire the autoinc lock.*/
void void
dict_table_autoinc_lock( dict_table_autoinc_lock(
/*====================*/ /*====================*/
dict_table_t* table); /* in: table */ dict_table_t* table); /* in/out: table */
/************************************************************************ /************************************************************************
Initializes the autoinc counter. It is not an error to initialize an already Initializes the autoinc counter. It is not an error to initialize an already
initialized counter. */ initialized counter. */
...@@ -178,7 +178,7 @@ initialized counter. */ ...@@ -178,7 +178,7 @@ initialized counter. */
void void
dict_table_autoinc_initialize( dict_table_autoinc_initialize(
/*==========================*/ /*==========================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
ib_longlong value); /* in: next value to assign to a row */ ib_longlong value); /* in: next value to assign to a row */
/************************************************************************ /************************************************************************
Reads the next autoinc value (== autoinc counter value), 0 if not yet Reads the next autoinc value (== autoinc counter value), 0 if not yet
...@@ -187,8 +187,8 @@ initialized. */ ...@@ -187,8 +187,8 @@ initialized. */
ib_longlong ib_longlong
dict_table_autoinc_read( dict_table_autoinc_read(
/*====================*/ /*====================*/
/* out: value for a new row, or 0 */ /* out: value for a new row, or 0 */
dict_table_t* table); /* in: table */ const dict_table_t* table); /* in: table */
/************************************************************************ /************************************************************************
Updates the autoinc counter if the value supplied is equal or bigger than the Updates the autoinc counter if the value supplied is equal or bigger than the
current value. If not inited, does nothing. */ current value. If not inited, does nothing. */
...@@ -197,7 +197,7 @@ void ...@@ -197,7 +197,7 @@ void
dict_table_autoinc_update( dict_table_autoinc_update(
/*======================*/ /*======================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
ib_longlong value); /* in: value which was assigned to a row */ ib_longlong value); /* in: value which was assigned to a row */
/************************************************************************ /************************************************************************
Release the autoinc lock.*/ Release the autoinc lock.*/
...@@ -205,7 +205,7 @@ Release the autoinc lock.*/ ...@@ -205,7 +205,7 @@ Release the autoinc lock.*/
void void
dict_table_autoinc_unlock( dict_table_autoinc_unlock(
/*======================*/ /*======================*/
dict_table_t* table); /* in: table */ dict_table_t* table); /* in/out: table */
/************************************************************************** /**************************************************************************
Adds system columns to a table object. */ Adds system columns to a table object. */
...@@ -236,7 +236,7 @@ ibool ...@@ -236,7 +236,7 @@ ibool
dict_table_rename_in_cache( dict_table_rename_in_cache(
/*=======================*/ /*=======================*/
/* out: TRUE if success */ /* out: TRUE if success */
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
const char* new_name, /* in: new name */ const char* new_name, /* in: new name */
ibool rename_also_foreigns);/* in: in ALTER TABLE we want ibool rename_also_foreigns);/* in: in ALTER TABLE we want
to preserve the original table name to preserve the original table name
...@@ -247,7 +247,7 @@ Removes an index from the dictionary cache. */ ...@@ -247,7 +247,7 @@ Removes an index from the dictionary cache. */
void void
dict_index_remove_from_cache( dict_index_remove_from_cache(
/*=========================*/ /*=========================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
dict_index_t* index); /* in, own: index */ dict_index_t* index); /* in, own: index */
/************************************************************************** /**************************************************************************
Change the id of a table object in the dictionary cache. This is used in Change the id of a table object in the dictionary cache. This is used in
...@@ -256,7 +256,7 @@ DISCARD TABLESPACE. */ ...@@ -256,7 +256,7 @@ DISCARD TABLESPACE. */
void void
dict_table_change_id_in_cache( dict_table_change_id_in_cache(
/*==========================*/ /*==========================*/
dict_table_t* table, /* in: table object already in cache */ dict_table_t* table, /* in/out: table object already in cache */
dulint new_id);/* in: new id to set */ dulint new_id);/* in: new id to set */
/************************************************************************** /**************************************************************************
Adds a foreign key constraint object to the dictionary cache. May free Adds a foreign key constraint object to the dictionary cache. May free
...@@ -634,10 +634,10 @@ table. Column prefixes are treated like whole columns. */ ...@@ -634,10 +634,10 @@ table. Column prefixes are treated like whole columns. */
ibool ibool
dict_table_col_in_clustered_key( dict_table_col_in_clustered_key(
/*============================*/ /*============================*/
/* out: TRUE if the column, or its prefix, is /* out: TRUE if the column, or its
in the clustered key */ prefix, is in the clustered key */
dict_table_t* table, /* in: table */ const dict_table_t* table, /* in: table */
ulint n); /* in: column number */ ulint n); /* in: column number */
/*********************************************************************** /***********************************************************************
Copies types of columns contained in table to tuple. */ Copies types of columns contained in table to tuple. */
...@@ -672,7 +672,7 @@ Removes an index from the dictionary cache. */ ...@@ -672,7 +672,7 @@ Removes an index from the dictionary cache. */
void void
dict_index_remove_from_cache( dict_index_remove_from_cache(
/*=========================*/ /*=========================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
dict_index_t* index); /* in, own: index */ dict_index_t* index); /* in, own: index */
/************************************************************************ /************************************************************************
Gets the number of fields in the internal representation of an index, Gets the number of fields in the internal representation of an index,
...@@ -717,9 +717,9 @@ UNIV_INLINE ...@@ -717,9 +717,9 @@ UNIV_INLINE
ulint ulint
dict_index_get_n_ordering_defined_by_user( dict_index_get_n_ordering_defined_by_user(
/*======================================*/ /*======================================*/
/* out: number of fields */ /* out: number of fields */
dict_index_t* index); /* in: an internal representation of index const dict_index_t* index); /* in: an internal representation
(in the dictionary cache) */ of index (in the dictionary cache) */
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/************************************************************************ /************************************************************************
Gets the nth field of an index. */ Gets the nth field of an index. */
...@@ -769,10 +769,10 @@ Returns TRUE if the index contains a column or a prefix of that column. */ ...@@ -769,10 +769,10 @@ Returns TRUE if the index contains a column or a prefix of that column. */
ibool ibool
dict_index_contains_col_or_prefix( dict_index_contains_col_or_prefix(
/*==============================*/ /*==============================*/
/* out: TRUE if contains the column or its /* out: TRUE if contains the column
prefix */ or its prefix */
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 a matching field in an index. The column has to be the same. The Looks for a matching field in an index. The column has to be the same. The
column in index must be complete, or must contain a prefix longer than the column in index must be complete, or must contain a prefix longer than the
...@@ -782,22 +782,24 @@ from the prefix in index. */ ...@@ -782,22 +782,24 @@ from the prefix in index. */
ulint ulint
dict_index_get_nth_field_pos( dict_index_get_nth_field_pos(
/*=========================*/ /*=========================*/
/* out: position in internal representation /* out: position in internal
of the index; if not contained, returns representation of the index;
ULINT_UNDEFINED */ if not contained, returns
dict_index_t* index, /* in: index from which to search */ ULINT_UNDEFINED */
dict_index_t* index2, /* in: index */ const dict_index_t* index, /* in: index from which to search */
ulint n); /* in: field number in index2 */ const dict_index_t* index2, /* in: index */
ulint n); /* in: field number in index2 */
/************************************************************************ /************************************************************************
Looks for column n position in the clustered index. */ Looks for column n position in the clustered index. */
ulint ulint
dict_table_get_nth_col_pos( dict_table_get_nth_col_pos(
/*=======================*/ /*=======================*/
/* out: position in internal representation /* out: position in internal
of the clustered index */ representation of
dict_table_t* table, /* in: table */ the clustered index */
ulint n); /* in: column number */ const dict_table_t* table, /* in: table */
ulint n); /* in: column number */
/************************************************************************ /************************************************************************
Returns the position of a system column in an index. */ Returns the position of a system column in an index. */
UNIV_INLINE UNIV_INLINE
...@@ -814,10 +816,10 @@ Adds a column to index. */ ...@@ -814,10 +816,10 @@ Adds a column to index. */
void void
dict_index_add_col( dict_index_add_col(
/*===============*/ /*===============*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in/out: index */
dict_table_t* table, /* in: table */ const dict_table_t* table, /* in: table */
dict_col_t* col, /* in: column */ dict_col_t* col, /* in: column */
ulint prefix_len); /* in: column prefix length */ ulint prefix_len); /* in: column prefix length */
/*********************************************************************** /***********************************************************************
Copies types of fields contained in index to tuple. */ Copies types of fields contained in index to tuple. */
...@@ -863,16 +865,17 @@ no comparison can occur with the page number field in a node pointer. */ ...@@ -863,16 +865,17 @@ no comparison can occur with the page number field in a node pointer. */
ibool ibool
dict_index_check_search_tuple( dict_index_check_search_tuple(
/*==========================*/ /*==========================*/
/* out: TRUE if ok */ /* out: TRUE if ok */
dict_index_t* index, /* in: index */ const dict_index_t* index, /* in: index tree */
const dtuple_t* tuple); /* in: tuple used in a search */ const dtuple_t* tuple); /* in: tuple used in a search */
/************************************************************************** /**************************************************************************
Check for duplicate index entries in a table [using the index name] */ Check for duplicate index entries in a table [using the index name] */
void void
dict_table_check_for_dup_indexes( dict_table_check_for_dup_indexes(
/*=============================*/ /*=============================*/
dict_table_t* table); /* in: Check for dup indexes in this table */ const dict_table_t* table); /* in: Check for dup indexes
in this table */
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/************************************************************************** /**************************************************************************
...@@ -881,14 +884,16 @@ Builds a node pointer out of a physical record and a page number. */ ...@@ -881,14 +884,16 @@ Builds a node pointer out of a physical record and a page number. */
dtuple_t* dtuple_t*
dict_index_build_node_ptr( dict_index_build_node_ptr(
/*======================*/ /*======================*/
/* out, own: node pointer */ /* out, own: node pointer */
dict_index_t* index, /* in: index */ const dict_index_t* index, /* in: index */
rec_t* rec, /* in: record for which to build node const rec_t* rec, /* in: record for which to build node
pointer */ pointer */
ulint page_no,/* in: page number to put in node pointer */ ulint page_no,/* in: page number to put in node
mem_heap_t* heap, /* in: memory heap where pointer created */ pointer */
ulint level); /* in: level of rec in tree: 0 means leaf mem_heap_t* heap, /* in: memory heap where pointer
level */ created */
ulint level); /* in: level of rec in tree:
0 means leaf level */
/************************************************************************** /**************************************************************************
Copies an initial segment of a physical record, long enough to specify an Copies an initial segment of a physical record, long enough to specify an
index entry uniquely. */ index entry uniquely. */
...@@ -920,15 +925,15 @@ UNIV_INLINE ...@@ -920,15 +925,15 @@ UNIV_INLINE
ulint ulint
dict_index_get_space( dict_index_get_space(
/*=================*/ /*=================*/
/* out: space id */ /* out: space id */
dict_index_t* index); /* in: index */ const dict_index_t* index); /* in: index */
/************************************************************************* /*************************************************************************
Sets the space id of the root of the index tree. */ Sets the space id of the root of the index tree. */
UNIV_INLINE UNIV_INLINE
void void
dict_index_set_space( dict_index_set_space(
/*=================*/ /*=================*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in/out: index */
ulint space); /* in: space id */ ulint space); /* in: space id */
/************************************************************************* /*************************************************************************
Gets the page number of the root of the index tree. */ Gets the page number of the root of the index tree. */
...@@ -936,15 +941,15 @@ UNIV_INLINE ...@@ -936,15 +941,15 @@ UNIV_INLINE
ulint ulint
dict_index_get_page( dict_index_get_page(
/*================*/ /*================*/
/* out: page number */ /* out: page number */
dict_index_t* tree); /* in: index */ const dict_index_t* tree); /* in: index */
/************************************************************************* /*************************************************************************
Sets the page number of the root of index tree. */ Sets the page number of the root of index tree. */
UNIV_INLINE UNIV_INLINE
void void
dict_index_set_page( dict_index_set_page(
/*================*/ /*================*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in/out: index */
ulint page); /* in: page number */ ulint page); /* in: page number */
/************************************************************************* /*************************************************************************
Gets the type of the index tree. */ Gets the type of the index tree. */
...@@ -952,8 +957,8 @@ UNIV_INLINE ...@@ -952,8 +957,8 @@ UNIV_INLINE
ulint ulint
dict_index_get_type( dict_index_get_type(
/*================*/ /*================*/
/* out: type */ /* out: type */
dict_index_t* index); /* in: index */ const dict_index_t* index); /* in: index */
/************************************************************************* /*************************************************************************
Gets the read-write lock of the index tree. */ Gets the read-write lock of the index tree. */
UNIV_INLINE UNIV_INLINE
...@@ -978,7 +983,7 @@ Calculates the minimum record length in an index. */ ...@@ -978,7 +983,7 @@ Calculates the minimum record length in an index. */
ulint ulint
dict_index_calc_min_rec_len( dict_index_calc_min_rec_len(
/*========================*/ /*========================*/
dict_index_t* index); /* in: index */ const dict_index_t* index); /* in: index */
/************************************************************************* /*************************************************************************
Calculates new estimates for table and index statistics. The statistics Calculates new estimates for table and index statistics. The statistics
are used in query optimization. */ are used in query optimization. */
...@@ -986,7 +991,7 @@ are used in query optimization. */ ...@@ -986,7 +991,7 @@ are used in query optimization. */
void void
dict_update_statistics_low( dict_update_statistics_low(
/*=======================*/ /*=======================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
ibool has_dict_mutex);/* in: TRUE if the caller has the ibool has_dict_mutex);/* in: TRUE if the caller has the
dictionary mutex */ dictionary mutex */
/************************************************************************* /*************************************************************************
...@@ -996,7 +1001,7 @@ are used in query optimization. */ ...@@ -996,7 +1001,7 @@ are used in query optimization. */
void void
dict_update_statistics( dict_update_statistics(
/*===================*/ /*===================*/
dict_table_t* table); /* in: table */ dict_table_t* table); /* in/out: table */
/************************************************************************ /************************************************************************
Reserves the dictionary system mutex for MySQL. */ Reserves the dictionary system mutex for MySQL. */
...@@ -1037,7 +1042,7 @@ Removes an index from the cache */ ...@@ -1037,7 +1042,7 @@ Removes an index from the cache */
void void
dict_index_remove_from_cache( dict_index_remove_from_cache(
/*=========================*/ /*=========================*/
dict_table_t* table, /* in: table */ dict_table_t* table, /* in/out: table */
dict_index_t* index); /* in, own: index */ dict_index_t* index); /* in, own: index */
/************************************************************************** /**************************************************************************
Get index by name */ Get index by name */
......
...@@ -419,9 +419,9 @@ UNIV_INLINE ...@@ -419,9 +419,9 @@ UNIV_INLINE
ulint ulint
dict_index_get_n_ordering_defined_by_user( dict_index_get_n_ordering_defined_by_user(
/*======================================*/ /*======================================*/
/* out: number of fields */ /* out: number of fields */
dict_index_t* index) /* in: an internal representation of index const dict_index_t* index) /* in: an internal representation
(in the dictionary cache) */ of index (in the dictionary cache) */
{ {
return(index->n_user_defined_cols); return(index->n_user_defined_cols);
} }
...@@ -536,8 +536,8 @@ UNIV_INLINE ...@@ -536,8 +536,8 @@ UNIV_INLINE
ulint ulint
dict_index_get_space( dict_index_get_space(
/*=================*/ /*=================*/
/* out: space id */ /* out: space id */
dict_index_t* index) /* in: index */ const dict_index_t* index) /* in: index */
{ {
ut_ad(index); ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
...@@ -551,7 +551,7 @@ UNIV_INLINE ...@@ -551,7 +551,7 @@ UNIV_INLINE
void void
dict_index_set_space( dict_index_set_space(
/*=================*/ /*=================*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in/out: index */
ulint space) /* in: space id */ ulint space) /* in: space id */
{ {
ut_ad(index); ut_ad(index);
...@@ -566,8 +566,8 @@ UNIV_INLINE ...@@ -566,8 +566,8 @@ UNIV_INLINE
ulint ulint
dict_index_get_page( dict_index_get_page(
/*================*/ /*================*/
/* out: page number */ /* out: page number */
dict_index_t* index) /* in: index */ const dict_index_t* index) /* in: index */
{ {
ut_ad(index); ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
...@@ -581,7 +581,7 @@ UNIV_INLINE ...@@ -581,7 +581,7 @@ UNIV_INLINE
void void
dict_index_set_page( dict_index_set_page(
/*================*/ /*================*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in/out: index */
ulint page) /* in: page number */ ulint page) /* in: page number */
{ {
ut_ad(index); ut_ad(index);
...@@ -596,8 +596,8 @@ UNIV_INLINE ...@@ -596,8 +596,8 @@ UNIV_INLINE
ulint ulint
dict_index_get_type( dict_index_get_type(
/*================*/ /*================*/
/* out: type */ /* out: type */
dict_index_t* index) /* in: index */ const dict_index_t* index) /* in: index */
{ {
ut_ad(index); ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
......
...@@ -320,17 +320,19 @@ in the record. It can reuse a previously allocated array. */ ...@@ -320,17 +320,19 @@ in the record. It can reuse a previously allocated array. */
ulint* ulint*
rec_get_offsets_func( rec_get_offsets_func(
/*=================*/ /*=================*/
/* out: the new offsets */ /* out: the new offsets */
const rec_t* rec, /* in: physical record */ const rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */ const dict_index_t* index, /* in: record descriptor */
ulint* offsets,/* in: array consisting of offsets[0] ulint* offsets,/* in/out: array consisting of
allocated elements, or an array from offsets[0] allocated elements,
rec_get_offsets(), or NULL */ or an array from rec_get_offsets(),
ulint n_fields,/* in: maximum number of initialized fields or NULL */
(ULINT_UNDEFINED if all fields) */ ulint n_fields,/* in: maximum number of
mem_heap_t** heap, /* in/out: memory heap */ initialized fields
const char* file, /* in: file name where called */ (ULINT_UNDEFINED if all fields) */
ulint line); /* in: line number where called */ mem_heap_t** heap, /* in/out: memory heap */
const char* file, /* in: file name where called */
ulint line); /* in: line number where called */
#define rec_get_offsets(rec,index,offsets,n,heap) \ #define rec_get_offsets(rec,index,offsets,n,heap) \
rec_get_offsets_func(rec,index,offsets,n,heap,__FILE__,__LINE__) rec_get_offsets_func(rec,index,offsets,n,heap,__FILE__,__LINE__)
...@@ -343,13 +345,15 @@ rec_init_offsets() and rec_get_offsets_func(). */ ...@@ -343,13 +345,15 @@ rec_init_offsets() and rec_get_offsets_func(). */
void void
rec_init_offsets_comp_ordinary( rec_init_offsets_comp_ordinary(
/*===========================*/ /*===========================*/
const rec_t* rec, /* in: physical record in ROW_FORMAT=COMPACT */ const rec_t* rec, /* in: physical record in
ulint extra, /* in: number of bytes to reserve between ROW_FORMAT=COMPACT */
the record header and the data payload ulint extra, /* in: number of bytes to reserve
(usually REC_N_NEW_EXTRA_BYTES) */ between the record header and
dict_index_t* index, /* in: record descriptor */ the data payload
ulint* offsets);/* in/out: array of offsets; (usually REC_N_NEW_EXTRA_BYTES) */
in: n=rec_offs_n_fields(offsets) */ const dict_index_t* index, /* in: record descriptor */
ulint* offsets);/* in/out: array of offsets;
in: n=rec_offs_n_fields(offsets) */
/********************************************************** /**********************************************************
The following function determines the offsets to each field The following function determines the offsets to each field
...@@ -358,13 +362,15 @@ in the record. It can reuse a previously allocated array. */ ...@@ -358,13 +362,15 @@ in the record. It can reuse a previously allocated array. */
void void
rec_get_offsets_reverse( rec_get_offsets_reverse(
/*====================*/ /*====================*/
const byte* extra, /* in: the extra bytes of a compact record const byte* extra, /* in: the extra bytes of a
in reverse order, excluding the fixed-size compact record in reverse order,
REC_N_NEW_EXTRA_BYTES */ excluding the fixed-size
dict_index_t* index, /* in: record descriptor */ REC_N_NEW_EXTRA_BYTES */
ulint node_ptr,/* in: nonzero=node pointer, 0=leaf node */ const dict_index_t* index, /* in: record descriptor */
ulint* offsets);/* in/out: array consisting of offsets[0] ulint node_ptr,/* in: nonzero=node pointer,
allocated elements */ 0=leaf node */
ulint* offsets);/* in/out: array consisting of
offsets[0] allocated elements */
/**************************************************************** /****************************************************************
Validates offsets returned by rec_get_offsets(). */ Validates offsets returned by rec_get_offsets(). */
...@@ -583,13 +589,15 @@ a buffer. */ ...@@ -583,13 +589,15 @@ a buffer. */
rec_t* rec_t*
rec_copy_prefix_to_buf( rec_copy_prefix_to_buf(
/*===================*/ /*===================*/
/* out, own: copied record */ /* out, own: copied record */
const rec_t* rec, /* in: physical record */ const rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */ const dict_index_t* index, /* in: record descriptor */
ulint n_fields, /* in: number of fields to copy */ ulint n_fields, /* in: number of fields
byte** buf, /* in/out: memory buffer to copy */
for the copied prefix, or NULL */ byte** buf, /* in/out: memory buffer
ulint* buf_size); /* in/out: buffer size */ for the copied prefix,
or NULL */
ulint* buf_size); /* in/out: buffer size */
/**************************************************************** /****************************************************************
Folds a prefix of a physical record to a ulint. */ Folds a prefix of a physical record to a ulint. */
UNIV_INLINE UNIV_INLINE
...@@ -677,11 +685,12 @@ The fields are copied to the memory heap. */ ...@@ -677,11 +685,12 @@ The fields are copied to the memory heap. */
void void
rec_copy_prefix_to_dtuple( rec_copy_prefix_to_dtuple(
/*======================*/ /*======================*/
dtuple_t* tuple, /* out: data tuple */ dtuple_t* tuple, /* out: data tuple */
const rec_t* rec, /* in: physical record */ const rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */ const dict_index_t* index, /* in: record descriptor */
ulint n_fields, /* in: number of fields to copy */ ulint n_fields, /* in: number of fields
mem_heap_t* heap); /* in: memory heap */ to copy */
mem_heap_t* heap); /* in: memory heap */
/******************************************************************* /*******************************************************************
Validates the consistency of a physical record. */ Validates the consistency of a physical record. */
......
...@@ -219,13 +219,15 @@ rec_init_offsets() and rec_get_offsets_func(). */ ...@@ -219,13 +219,15 @@ rec_init_offsets() and rec_get_offsets_func(). */
void void
rec_init_offsets_comp_ordinary( rec_init_offsets_comp_ordinary(
/*===========================*/ /*===========================*/
const rec_t* rec, /* in: physical record in ROW_FORMAT=COMPACT */ const rec_t* rec, /* in: physical record in
ulint extra, /* in: number of bytes to reserve between ROW_FORMAT=COMPACT */
the record header and the data payload ulint extra, /* in: number of bytes to reserve
(usually REC_N_NEW_EXTRA_BYTES) */ between the record header and
dict_index_t* index, /* in: record descriptor */ the data payload
ulint* offsets)/* in/out: array of offsets; (usually REC_N_NEW_EXTRA_BYTES) */
in: n=rec_offs_n_fields(offsets) */ const dict_index_t* index, /* in: record descriptor */
ulint* offsets)/* in/out: array of offsets;
in: n=rec_offs_n_fields(offsets) */
{ {
ulint i = 0; ulint i = 0;
ulint offs = 0; ulint offs = 0;
...@@ -329,10 +331,10 @@ static ...@@ -329,10 +331,10 @@ static
void void
rec_init_offsets( rec_init_offsets(
/*=============*/ /*=============*/
const rec_t* rec, /* in: physical record */ const rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */ const dict_index_t* index, /* in: record descriptor */
ulint* offsets)/* in/out: array of offsets; ulint* offsets)/* in/out: array of offsets;
in: n=rec_offs_n_fields(offsets) */ in: n=rec_offs_n_fields(offsets) */
{ {
ulint i = 0; ulint i = 0;
ulint offs; ulint offs;
...@@ -480,17 +482,19 @@ in the record. It can reuse a previously returned array. */ ...@@ -480,17 +482,19 @@ in the record. It can reuse a previously returned array. */
ulint* ulint*
rec_get_offsets_func( rec_get_offsets_func(
/*=================*/ /*=================*/
/* out: the new offsets */ /* out: the new offsets */
const rec_t* rec, /* in: physical record */ const rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */ const dict_index_t* index, /* in: record descriptor */
ulint* offsets,/* in/out: array consisting of offsets[0] ulint* offsets,/* in/out: array consisting of
allocated elements, or an array from offsets[0] allocated elements,
rec_get_offsets(), or NULL */ or an array from rec_get_offsets(),
ulint n_fields,/* in: maximum number of initialized fields or NULL */
(ULINT_UNDEFINED if all fields) */ ulint n_fields,/* in: maximum number of
mem_heap_t** heap, /* in/out: memory heap */ initialized fields
const char* file, /* in: file name where called */ (ULINT_UNDEFINED if all fields) */
ulint line) /* in: line number where called */ mem_heap_t** heap, /* in/out: memory heap */
const char* file, /* in: file name where called */
ulint line) /* in: line number where called */
{ {
ulint n; ulint n;
ulint size; ulint size;
...@@ -550,13 +554,15 @@ in the record. It can reuse a previously allocated array. */ ...@@ -550,13 +554,15 @@ in the record. It can reuse a previously allocated array. */
void void
rec_get_offsets_reverse( rec_get_offsets_reverse(
/*====================*/ /*====================*/
const byte* extra, /* in: the extra bytes of a compact record const byte* extra, /* in: the extra bytes of a
in reverse order, excluding the fixed-size compact record in reverse order,
REC_N_NEW_EXTRA_BYTES */ excluding the fixed-size
dict_index_t* index, /* in: record descriptor */ REC_N_NEW_EXTRA_BYTES */
ulint node_ptr,/* in: nonzero=node pointer, 0=leaf node */ const dict_index_t* index, /* in: record descriptor */
ulint* offsets)/* in/out: array consisting of offsets[0] ulint node_ptr,/* in: nonzero=node pointer,
allocated elements */ 0=leaf node */
ulint* offsets)/* in/out: array consisting of
offsets[0] allocated elements */
{ {
ulint n; ulint n;
ulint i; ulint i;
...@@ -1192,11 +1198,12 @@ are copied to the memory heap. */ ...@@ -1192,11 +1198,12 @@ are copied to the memory heap. */
void void
rec_copy_prefix_to_dtuple( rec_copy_prefix_to_dtuple(
/*======================*/ /*======================*/
dtuple_t* tuple, /* out: data tuple */ dtuple_t* tuple, /* out: data tuple */
const rec_t* rec, /* in: physical record */ const rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */ const dict_index_t* index, /* in: record descriptor */
ulint n_fields, /* in: number of fields to copy */ ulint n_fields, /* in: number of fields
mem_heap_t* heap) /* in: memory heap */ to copy */
mem_heap_t* heap) /* in: memory heap */
{ {
ulint i; ulint i;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
...@@ -1279,13 +1286,15 @@ a buffer. */ ...@@ -1279,13 +1286,15 @@ a buffer. */
rec_t* rec_t*
rec_copy_prefix_to_buf( rec_copy_prefix_to_buf(
/*===================*/ /*===================*/
/* out, own: copied record */ /* out, own: copied record */
const rec_t* rec, /* in: physical record */ const rec_t* rec, /* in: physical record */
dict_index_t* index, /* in: record descriptor */ const dict_index_t* index, /* in: record descriptor */
ulint n_fields, /* in: number of fields to copy */ ulint n_fields, /* in: number of fields
byte** buf, /* in/out: memory buffer to copy */
for the copied prefix, or NULL */ byte** buf, /* in/out: memory buffer
ulint* buf_size) /* in/out: buffer size */ for the copied prefix,
or NULL */
ulint* buf_size) /* in/out: buffer size */
{ {
const byte* nulls; const byte* nulls;
const byte* lens; const byte* lens;
......
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