~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/dict0mem.ic

  • Committer: Monty Taylor
  • Date: 2010-11-26 22:50:54 UTC
  • mfrom: (1953.1.6 build)
  • Revision ID: mordred@inaugust.com-20101126225054-sg90svw8579t5p3i
Stewart - InnoDB 1.1.1
Monty - Fixed some autoconf tests which were returning false positives.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
Created 1/8/1996 Heikki Tuuri
24
24
***********************************************************************/
25
25
 
26
 
 
 
26
#include "data0type.h"
 
27
#include "dict0mem.h"
 
28
#include "fil0fil.h"
 
29
 
 
30
/**********************************************************************//**
 
31
This function poplulates a dict_index_t index memory structure with
 
32
supplied information. */
 
33
UNIV_INLINE
 
34
void
 
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
 
43
                                        the clustered type */
 
44
        ulint           type,           /*!< in: DICT_UNIQUE,
 
45
                                        DICT_CLUSTERED, ... ORed */
 
46
        ulint           n_fields)       /*!< in: number of fields */
 
47
{
 
48
 
 
49
        if (heap) {
 
50
                index->heap = heap;
 
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));
 
54
        } else {
 
55
                index->name = index_name;
 
56
                index->heap = NULL;
 
57
                index->fields = NULL;
 
58
        }
 
59
 
 
60
        index->type = type;
 
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 */
 
69
#ifdef UNIV_DEBUG
 
70
        index->magic_n = DICT_INDEX_MAGIC_N;
 
71
#endif /* UNIV_DEBUG */
 
72
}
 
73
 
 
74
/**********************************************************************//**
 
75
This function poplulates a dict_col_t memory structure with
 
76
supplied information. */
 
77
UNIV_INLINE
 
78
void
 
79
dict_mem_fill_column_struct(
 
80
/*========================*/
 
81
        dict_col_t*     column,         /*!< out: column struct to be
 
82
                                        filled */
 
83
        ulint           col_pos,        /*!< in: column position */
 
84
        ulint           mtype,          /*!< in: main data type */
 
85
        ulint           prtype,         /*!< in: precise type */
 
86
        ulint           col_len)        /*!< in: column lenght */
 
87
{
 
88
#ifndef UNIV_HOTBACKUP
 
89
        ulint   mbminlen;
 
90
        ulint   mbmaxlen;
 
91
#endif /* !UNIV_HOTBACKUP */
 
92
 
 
93
        column->ind = (unsigned int) col_pos;
 
94
        column->ord_part = 0;
 
95
        column->mtype = (unsigned int) mtype;
 
96
        column->prtype = (unsigned int) prtype;
 
97
        column->len = (unsigned int) col_len;
 
98
#ifndef UNIV_HOTBACKUP
 
99
        dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen);
 
100
 
 
101
        column->mbminlen = (unsigned int) mbminlen;
 
102
        column->mbmaxlen = (unsigned int) mbmaxlen;
 
103
#endif /* !UNIV_HOTBACKUP */
 
104
}