| 1 |
/***************************************************************************** |
| 2 |
|
| 3 |
Copyright (c) 1996, 2026, Oracle and/or its affiliates. |
| 4 |
Copyright (c) 2012, Facebook Inc. |
| 5 |
|
| 6 |
This program is free software; you can redistribute it and/or modify it under |
| 7 |
the terms of the GNU General Public License, version 2.0, as published by the |
| 8 |
Free Software Foundation. |
| 9 |
|
| 10 |
This program is designed to work with certain software (including |
| 11 |
but not limited to OpenSSL) that is licensed under separate terms, |
| 12 |
as designated in a particular file or component or in included license |
| 13 |
documentation. The authors of MySQL hereby grant you an additional |
| 14 |
permission to link the program and your derivative works with the |
| 15 |
separately licensed software that they have either included with |
| 16 |
the program or referenced in the documentation. |
| 17 |
|
| 18 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 19 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 20 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, |
| 21 |
for more details. |
| 22 |
|
| 23 |
You should have received a copy of the GNU General Public License along with |
| 24 |
this program; if not, write to the Free Software Foundation, Inc., |
| 25 |
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 26 |
|
| 27 |
*****************************************************************************/ |
| 28 |
|
| 29 |
/** @file dict/mem.h |
| 30 |
Data dictionary memory object creation |
| 31 |
|
| 32 |
Created 1/8/1996 Heikki Tuuri |
| 33 |
*******************************************************/ |
| 34 |
|
| 35 |
#ifndef dict_mem_h |
| 36 |
#define dict_mem_h |
| 37 |
/** Creates a table memory object. |
| 38 |
@param[in] name table name |
| 39 |
@param[in] space space where the clustered index of the table is placed |
| 40 |
@param[in] n_cols total number of columns including virtual and |
| 41 |
non-virtual columns |
| 42 |
@param[in] n_v_cols number of virtual columns |
| 43 |
@param[in] n_m_v_cols number of multi-value virtual columns |
| 44 |
@param[in] flags table flags |
| 45 |
@param[in] flags2 table flags2 |
| 46 |
@param[in] n_drop_cols Number of INSTANT drop cols |
| 47 |
@return own: table object */ |
| 48 |
dict_table_t *dict_mem_table_create(const char *name, space_id_t space, |
| 49 |
ulint n_cols, ulint n_v_cols, |
| 50 |
ulint n_m_v_cols, uint32_t flags, |
| 51 |
uint32_t flags2, uint32_t n_drop_cols = 0); |
| 52 |
|
| 53 |
/** Free a table memory object. */ |
| 54 |
void dict_mem_table_free(dict_table_t *table); /*!< in: table */ |
| 55 |
|
| 56 |
/** Creates an index memory object. |
| 57 |
@return own: index object */ |
| 58 |
dict_index_t *dict_mem_index_create( |
| 59 |
const char *table_name, /*!< in: table name */ |
| 60 |
const char *index_name, /*!< in: index name */ |
| 61 |
ulint space, /*!< in: space where the index tree is |
| 62 |
placed, ignored if the index is of |
| 63 |
the clustered type */ |
| 64 |
ulint type, /*!< in: DICT_UNIQUE, |
| 65 |
DICT_CLUSTERED, ... ORed */ |
| 66 |
ulint n_fields); /*!< in: number of fields */ |
| 67 |
|
| 68 |
/** Adds a column definition to a table. |
| 69 |
@param[in] table table |
| 70 |
@param[in] heap temporary memory heap, or NULL |
| 71 |
@param[in] name column name, or NULL |
| 72 |
@param[in] mtype main datatype |
| 73 |
@param[in] prtype precise type |
| 74 |
@param[in] len length of column |
| 75 |
@param[in] is_visible true if column is visible |
| 76 |
@param[in] phy_pos position of col in physical record |
| 77 |
@param[in] v_added table row version when col was added INSTANTly |
| 78 |
@param[in] v_dropped table_row version when col was dropped INSTANTly */ |
| 79 |
void dict_mem_table_add_col(dict_table_t *table, mem_heap_t *heap, |
| 80 |
const char *name, ulint mtype, ulint prtype, |
| 81 |
ulint len, bool is_visible, |
| 82 |
uint32_t phy_pos = UINT32_UNDEFINED, |
| 83 |
uint8_t v_added = UINT8_UNDEFINED, |
| 84 |
uint8_t v_dropped = UINT8_UNDEFINED); |
| 85 |
|
| 86 |
/** This function populates a dict_col_t memory structure with |
| 87 |
supplied information. |
| 88 |
@param[out] column column struct to be filled |
| 89 |
@param[in] col_pos column position |
| 90 |
@param[in] mtype main data type |
| 91 |
@param[in] prtype precise type |
| 92 |
@param[in] col_len column length |
| 93 |
@param[in] is_visible true if column is visible |
| 94 |
@param[in] phy_pos position of col in physical record |
| 95 |
@param[in] v_added table row version when col was added INSTANTly |
| 96 |
@param[in] v_dropped table row version when col was dropped INSTANTly */ |
| 97 |
void dict_mem_fill_column_struct(dict_col_t *column, ulint col_pos, ulint mtype, |
| 98 |
ulint prtype, ulint col_len, bool is_visible, |
| 99 |
uint32_t phy_pos, uint8_t v_added, |
| 100 |
uint8_t v_dropped); |
| 101 |
|
| 102 |
/** Append 'name' to 'col_names'. @see dict_table_t::col_names |
| 103 |
@return new column names array */ |
| 104 |
const char *dict_add_col_name(const char *col_names, /*!< in: existing column |
| 105 |
names, or NULL */ |
| 106 |
ulint cols, /*!< in: number of existing columns */ |
| 107 |
const char *name, /*!< in: new column name */ |
| 108 |
mem_heap_t *heap); /*!< in: heap */ |
| 109 |
#endif |