1
/*****************************************************************************
3
Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
17
*****************************************************************************/
19
/******************************************************************//**
20
@file include/dict0mem.ic
21
Data dictionary memory object creation
23
Created 1/8/1996 Heikki Tuuri
24
***********************************************************************/
26
#include "data0type.h"
30
/**********************************************************************//**
31
This function poplulates a dict_index_t index memory structure with
32
supplied information. */
35
dict_mem_fill_index_struct(
36
/*=======================*/
37
dict_index_t* index, /*!< out: index to be filled */
38
mem_heap_t* heap, /*!< in: memory heap */
39
const char* table_name, /*!< in: table name */
40
const char* index_name, /*!< in: index name */
41
ulint space, /*!< in: space where the index tree is
42
placed, ignored if the index is of
44
ulint type, /*!< in: DICT_UNIQUE,
45
DICT_CLUSTERED, ... ORed */
46
ulint n_fields) /*!< in: number of fields */
51
index->name = mem_heap_strdup(heap, index_name);
52
index->fields = (dict_field_t*) mem_heap_alloc(
53
heap, 1 + n_fields * sizeof(dict_field_t));
55
index->name = index_name;
61
#ifndef UNIV_HOTBACKUP
62
index->space = (unsigned int) space;
63
index->page = FIL_NULL;
64
#endif /* !UNIV_HOTBACKUP */
65
index->table_name = table_name;
66
index->n_fields = (unsigned int) n_fields;
67
/* The '1 +' above prevents allocation
68
of an empty mem block */
70
index->magic_n = DICT_INDEX_MAGIC_N;
71
#endif /* UNIV_DEBUG */