~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/dict0dict.ic

  • Committer: Monty Taylor
  • Date: 2009-08-12 06:25:19 UTC
  • mto: (1114.1.1 innodb-plugin-merge)
  • mto: This revision was merged to the branch mainline in revision 1183.
  • Revision ID: mordred@inaugust.com-20090812062519-cij02mrrunvnxblt
Tags: innodb-plugin-1.0.4
InnoDB Plugin 1.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/**********************************************************************
 
19
/******************************************************************//**
 
20
@file include/dict0dict.ic
20
21
Data dictionary system
21
22
 
22
23
Created 1/8/1996 Heikki Tuuri
23
24
***********************************************************************/
24
25
 
 
26
#include "data0type.h"
 
27
#ifndef UNIV_HOTBACKUP
25
28
#include "dict0load.h"
26
29
#include "rem0types.h"
27
 
#include "data0type.h"
28
30
 
29
 
/*************************************************************************
 
31
/*********************************************************************//**
30
32
Gets the column data type. */
31
33
UNIV_INLINE
32
34
void
33
35
dict_col_copy_type(
34
36
/*===============*/
35
 
        const dict_col_t*       col,    /* in: column */
36
 
        dtype_t*                type)   /* out: data type */
 
37
        const dict_col_t*       col,    /*!< in: column */
 
38
        dtype_t*                type)   /*!< out: data type */
37
39
{
38
40
        ut_ad(col && type);
39
41
 
43
45
        type->mbminlen = col->mbminlen;
44
46
        type->mbmaxlen = col->mbmaxlen;
45
47
}
 
48
#endif /* !UNIV_HOTBACKUP */
46
49
 
47
50
#ifdef UNIV_DEBUG
48
 
/*************************************************************************
49
 
Assert that a column and a data type match. */
 
51
/*********************************************************************//**
 
52
Assert that a column and a data type match.
 
53
@return TRUE */
50
54
UNIV_INLINE
51
55
ibool
52
56
dict_col_type_assert_equal(
53
57
/*=======================*/
54
 
                                        /* out: TRUE */
55
 
        const dict_col_t*       col,    /* in: column */
56
 
        const dtype_t*          type)   /* in: data type */
 
58
        const dict_col_t*       col,    /*!< in: column */
 
59
        const dtype_t*          type)   /*!< in: data type */
57
60
{
58
61
        ut_ad(col);
59
62
        ut_ad(type);
61
64
        ut_ad(col->mtype == type->mtype);
62
65
        ut_ad(col->prtype == type->prtype);
63
66
        ut_ad(col->len == type->len);
 
67
# ifndef UNIV_HOTBACKUP
64
68
        ut_ad(col->mbminlen == type->mbminlen);
65
69
        ut_ad(col->mbmaxlen == type->mbmaxlen);
 
70
# endif /* !UNIV_HOTBACKUP */
66
71
 
67
72
        return(TRUE);
68
73
}
69
74
#endif /* UNIV_DEBUG */
70
75
 
71
 
/***************************************************************************
72
 
Returns the minimum size of the column. */
 
76
#ifndef UNIV_HOTBACKUP
 
77
/***********************************************************************//**
 
78
Returns the minimum size of the column.
 
79
@return minimum size */
73
80
UNIV_INLINE
74
81
ulint
75
82
dict_col_get_min_size(
76
83
/*==================*/
77
 
                                        /* out: minimum size */
78
 
        const dict_col_t*       col)    /* in: column */
 
84
        const dict_col_t*       col)    /*!< in: column */
79
85
{
80
86
        return(dtype_get_min_size_low(col->mtype, col->prtype, col->len,
81
87
                                      col->mbminlen, col->mbmaxlen));
82
88
}
83
 
/***************************************************************************
84
 
Returns the maximum size of the column. */
 
89
/***********************************************************************//**
 
90
Returns the maximum size of the column.
 
91
@return maximum size */
85
92
UNIV_INLINE
86
93
ulint
87
94
dict_col_get_max_size(
88
95
/*==================*/
89
 
                                        /* out: maximum size */
90
 
        const dict_col_t*       col)    /* in: column */
 
96
        const dict_col_t*       col)    /*!< in: column */
91
97
{
92
98
        return(dtype_get_max_size_low(col->mtype, col->len));
93
99
}
94
 
/***************************************************************************
95
 
Returns the size of a fixed size column, 0 if not a fixed size column. */
 
100
#endif /* !UNIV_HOTBACKUP */
 
101
/***********************************************************************//**
 
102
Returns the size of a fixed size column, 0 if not a fixed size column.
 
103
@return fixed size, or 0 */
96
104
UNIV_INLINE
97
105
ulint
98
106
dict_col_get_fixed_size(
99
107
/*====================*/
100
 
                                        /* out: fixed size, or 0 */
101
 
        const dict_col_t*       col)    /* in: column */
 
108
        const dict_col_t*       col,    /*!< in: column */
 
109
        ulint                   comp)   /*!< in: nonzero=ROW_FORMAT=COMPACT  */
102
110
{
103
111
        return(dtype_get_fixed_size_low(col->mtype, col->prtype, col->len,
104
 
                                        col->mbminlen, col->mbmaxlen));
 
112
                                        col->mbminlen, col->mbmaxlen, comp));
105
113
}
106
 
/***************************************************************************
 
114
/***********************************************************************//**
107
115
Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column.
108
 
For fixed length types it is the fixed length of the type, otherwise 0. */
 
116
For fixed length types it is the fixed length of the type, otherwise 0.
 
117
@return SQL null storage size in ROW_FORMAT=REDUNDANT */
109
118
UNIV_INLINE
110
119
ulint
111
120
dict_col_get_sql_null_size(
112
121
/*=======================*/
113
 
                                        /* out: SQL null storage size
114
 
                                        in ROW_FORMAT=REDUNDANT */
115
 
        const dict_col_t*       col)    /* in: column */
 
122
        const dict_col_t*       col,    /*!< in: column */
 
123
        ulint                   comp)   /*!< in: nonzero=ROW_FORMAT=COMPACT  */
116
124
{
117
 
        return(dict_col_get_fixed_size(col));
 
125
        return(dict_col_get_fixed_size(col, comp));
118
126
}
119
127
 
120
 
/*************************************************************************
121
 
Gets the column number. */
 
128
/*********************************************************************//**
 
129
Gets the column number.
 
130
@return col->ind, table column position (starting from 0) */
122
131
UNIV_INLINE
123
132
ulint
124
133
dict_col_get_no(
125
134
/*============*/
126
 
        const dict_col_t*       col)
 
135
        const dict_col_t*       col)    /*!< in: column */
127
136
{
128
137
        ut_ad(col);
129
138
 
130
139
        return(col->ind);
131
140
}
132
141
 
133
 
/*************************************************************************
 
142
/*********************************************************************//**
134
143
Gets the column position in the clustered index. */
135
144
UNIV_INLINE
136
145
ulint
137
146
dict_col_get_clust_pos(
138
147
/*===================*/
139
 
        const dict_col_t*       col,            /* in: table column */
140
 
        const dict_index_t*     clust_index)    /* in: clustered index */
 
148
        const dict_col_t*       col,            /*!< in: table column */
 
149
        const dict_index_t*     clust_index)    /*!< in: clustered index */
141
150
{
142
151
        ulint   i;
143
152
 
156
165
        return(ULINT_UNDEFINED);
157
166
}
158
167
 
 
168
#ifndef UNIV_HOTBACKUP
159
169
#ifdef UNIV_DEBUG
160
 
/************************************************************************
161
 
Gets the first index on the table (the clustered index). */
 
170
/********************************************************************//**
 
171
Gets the first index on the table (the clustered index).
 
172
@return index, NULL if none exists */
162
173
UNIV_INLINE
163
174
dict_index_t*
164
175
dict_table_get_first_index(
165
176
/*=======================*/
166
 
                                        /* out: index, NULL if none exists */
167
 
        const dict_table_t*     table)  /* in: table */
 
177
        const dict_table_t*     table)  /*!< in: table */
168
178
{
169
179
        ut_ad(table);
170
180
        ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
172
182
        return(UT_LIST_GET_FIRST(((dict_table_t*) table)->indexes));
173
183
}
174
184
 
175
 
/************************************************************************
176
 
Gets the next index on the table. */
 
185
/********************************************************************//**
 
186
Gets the next index on the table.
 
187
@return index, NULL if none left */
177
188
UNIV_INLINE
178
189
dict_index_t*
179
190
dict_table_get_next_index(
180
191
/*======================*/
181
 
                                        /* out: index, NULL if none left */
182
 
        const dict_index_t*     index)  /* in: index */
 
192
        const dict_index_t*     index)  /*!< in: index */
183
193
{
184
194
        ut_ad(index);
185
195
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
187
197
        return(UT_LIST_GET_NEXT(indexes, (dict_index_t*) index));
188
198
}
189
199
#endif /* UNIV_DEBUG */
 
200
#endif /* !UNIV_HOTBACKUP */
190
201
 
191
 
/************************************************************************
192
 
Check whether the index is the clustered index. */
 
202
/********************************************************************//**
 
203
Check whether the index is the clustered index.
 
204
@return nonzero for clustered index, zero for other indexes */
193
205
UNIV_INLINE
194
206
ulint
195
207
dict_index_is_clust(
196
208
/*================*/
197
 
                                        /* out: nonzero for clustered index,
198
 
                                        zero for other indexes */
199
 
        const dict_index_t*     index)  /* in: index */
 
209
        const dict_index_t*     index)  /*!< in: index */
200
210
{
201
211
        ut_ad(index);
202
212
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
203
213
 
204
214
        return(UNIV_UNLIKELY(index->type & DICT_CLUSTERED));
205
215
}
206
 
/************************************************************************
207
 
Check whether the index is unique. */
 
216
/********************************************************************//**
 
217
Check whether the index is unique.
 
218
@return nonzero for unique index, zero for other indexes */
208
219
UNIV_INLINE
209
220
ulint
210
221
dict_index_is_unique(
211
222
/*=================*/
212
 
                                        /* out: nonzero for unique index,
213
 
                                        zero for other indexes */
214
 
        const dict_index_t*     index)  /* in: index */
 
223
        const dict_index_t*     index)  /*!< in: index */
215
224
{
216
225
        ut_ad(index);
217
226
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
219
228
        return(UNIV_UNLIKELY(index->type & DICT_UNIQUE));
220
229
}
221
230
 
222
 
/************************************************************************
223
 
Check whether the index is the insert buffer tree. */
 
231
/********************************************************************//**
 
232
Check whether the index is the insert buffer tree.
 
233
@return nonzero for insert buffer, zero for other indexes */
224
234
UNIV_INLINE
225
235
ulint
226
236
dict_index_is_ibuf(
227
237
/*===============*/
228
 
                                        /* out: nonzero for insert buffer,
229
 
                                        zero for other indexes */
230
 
        const dict_index_t*     index)  /* in: index */
 
238
        const dict_index_t*     index)  /*!< in: index */
231
239
{
232
240
        ut_ad(index);
233
241
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
235
243
        return(UNIV_UNLIKELY(index->type & DICT_IBUF));
236
244
}
237
245
 
238
 
/************************************************************************
 
246
/********************************************************************//**
 
247
Check whether the index is a secondary index or the insert buffer tree.
 
248
@return nonzero for insert buffer, zero for other indexes */
 
249
UNIV_INLINE
 
250
ulint
 
251
dict_index_is_sec_or_ibuf(
 
252
/*======================*/
 
253
        const dict_index_t*     index)  /*!< in: index */
 
254
{
 
255
        ulint   type;
 
256
 
 
257
        ut_ad(index);
 
258
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
 
259
 
 
260
        type = index->type;
 
261
 
 
262
        return(UNIV_LIKELY(!(type & DICT_CLUSTERED) || (type & DICT_IBUF)));
 
263
}
 
264
 
 
265
/********************************************************************//**
239
266
Gets the number of user-defined columns in a table in the dictionary
240
 
cache. */
 
267
cache.
 
268
@return number of user-defined (e.g., not ROW_ID) columns of a table */
241
269
UNIV_INLINE
242
270
ulint
243
271
dict_table_get_n_user_cols(
244
272
/*=======================*/
245
 
                                        /* out: number of user-defined
246
 
                                        (e.g., not ROW_ID)
247
 
                                        columns of a table */
248
 
        const dict_table_t*     table)  /* in: table */
 
273
        const dict_table_t*     table)  /*!< in: table */
249
274
{
250
275
        ut_ad(table);
251
276
        ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
253
278
        return(table->n_cols - DATA_N_SYS_COLS);
254
279
}
255
280
 
256
 
/************************************************************************
257
 
Gets the number of system columns in a table in the dictionary cache. */
 
281
/********************************************************************//**
 
282
Gets the number of system columns in a table in the dictionary cache.
 
283
@return number of system (e.g., ROW_ID) columns of a table */
258
284
UNIV_INLINE
259
285
ulint
260
286
dict_table_get_n_sys_cols(
261
287
/*======================*/
262
 
                                        /* out: number of system (e.g.,
263
 
                                        ROW_ID) columns of a table */
264
 
        const dict_table_t*     table __attribute__((unused)))  /* in: table */
 
288
        const dict_table_t*     table __attribute__((unused)))  /*!< in: table */
265
289
{
266
290
        ut_ad(table);
267
291
        ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
270
294
        return(DATA_N_SYS_COLS);
271
295
}
272
296
 
273
 
/************************************************************************
 
297
/********************************************************************//**
274
298
Gets the number of all columns (also system) in a table in the dictionary
275
 
cache. */
 
299
cache.
 
300
@return number of columns of a table */
276
301
UNIV_INLINE
277
302
ulint
278
303
dict_table_get_n_cols(
279
304
/*==================*/
280
 
                                        /* out: number of columns of a table */
281
 
        const dict_table_t*     table)  /* in: table */
 
305
        const dict_table_t*     table)  /*!< in: table */
282
306
{
283
307
        ut_ad(table);
284
308
        ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
287
311
}
288
312
 
289
313
#ifdef UNIV_DEBUG
290
 
/************************************************************************
291
 
Gets the nth column of a table. */
 
314
/********************************************************************//**
 
315
Gets the nth column of a table.
 
316
@return pointer to column object */
292
317
UNIV_INLINE
293
318
dict_col_t*
294
319
dict_table_get_nth_col(
295
320
/*===================*/
296
 
                                        /* out: pointer to column object */
297
 
        const dict_table_t*     table,  /* in: table */
298
 
        ulint                   pos)    /* in: position of column */
 
321
        const dict_table_t*     table,  /*!< in: table */
 
322
        ulint                   pos)    /*!< in: position of column */
299
323
{
300
324
        ut_ad(table);
301
325
        ut_ad(pos < table->n_def);
304
328
        return((dict_col_t*) (table->cols) + pos);
305
329
}
306
330
 
307
 
/************************************************************************
308
 
Gets the given system column of a table. */
 
331
/********************************************************************//**
 
332
Gets the given system column of a table.
 
333
@return pointer to column object */
309
334
UNIV_INLINE
310
335
dict_col_t*
311
336
dict_table_get_sys_col(
312
337
/*===================*/
313
 
                                        /* out: pointer to column object */
314
 
        const dict_table_t*     table,  /* in: table */
315
 
        ulint                   sys)    /* in: DATA_ROW_ID, ... */
 
338
        const dict_table_t*     table,  /*!< in: table */
 
339
        ulint                   sys)    /*!< in: DATA_ROW_ID, ... */
316
340
{
317
341
        dict_col_t*     col;
318
342
 
329
353
}
330
354
#endif /* UNIV_DEBUG */
331
355
 
332
 
/************************************************************************
333
 
Gets the given system column number of a table. */
 
356
/********************************************************************//**
 
357
Gets the given system column number of a table.
 
358
@return column number */
334
359
UNIV_INLINE
335
360
ulint
336
361
dict_table_get_sys_col_no(
337
362
/*======================*/
338
 
                                        /* out: column number */
339
 
        const dict_table_t*     table,  /* in: table */
340
 
        ulint                   sys)    /* in: DATA_ROW_ID, ... */
 
363
        const dict_table_t*     table,  /*!< in: table */
 
364
        ulint                   sys)    /*!< in: DATA_ROW_ID, ... */
341
365
{
342
366
        ut_ad(table);
343
367
        ut_ad(sys < DATA_N_SYS_COLS);
346
370
        return(table->n_cols - DATA_N_SYS_COLS + sys);
347
371
}
348
372
 
349
 
/************************************************************************
350
 
Check whether the table uses the compact page format. */
 
373
/********************************************************************//**
 
374
Check whether the table uses the compact page format.
 
375
@return TRUE if table uses the compact page format */
351
376
UNIV_INLINE
352
377
ibool
353
378
dict_table_is_comp(
354
379
/*===============*/
355
 
                                        /* out: TRUE if table uses the
356
 
                                        compact page format */
357
 
        const dict_table_t*     table)  /* in: table */
 
380
        const dict_table_t*     table)  /*!< in: table */
358
381
{
359
382
        ut_ad(table);
360
383
 
365
388
        return(UNIV_LIKELY(table->flags & DICT_TF_COMPACT));
366
389
}
367
390
 
368
 
/************************************************************************
369
 
Determine the file format of a table. */
 
391
/********************************************************************//**
 
392
Determine the file format of a table.
 
393
@return file format version */
370
394
UNIV_INLINE
371
395
ulint
372
396
dict_table_get_format(
373
397
/*==================*/
374
 
                                        /* out: file format version */
375
 
        const dict_table_t*     table)  /* in: table */
 
398
        const dict_table_t*     table)  /*!< in: table */
376
399
{
377
400
        ut_ad(table);
378
401
 
379
402
        return((table->flags & DICT_TF_FORMAT_MASK) >> DICT_TF_FORMAT_SHIFT);
380
403
}
381
404
 
382
 
/************************************************************************
 
405
/********************************************************************//**
383
406
Determine the file format of a table. */
384
407
UNIV_INLINE
385
408
void
386
409
dict_table_set_format(
387
410
/*==================*/
388
 
        dict_table_t*   table,  /* in/out: table */
389
 
        ulint           format) /* in: file format version */
 
411
        dict_table_t*   table,  /*!< in/out: table */
 
412
        ulint           format) /*!< in: file format version */
390
413
{
391
414
        ut_ad(table);
392
415
 
394
417
                | (format << DICT_TF_FORMAT_SHIFT);
395
418
}
396
419
 
397
 
/************************************************************************
398
 
Extract the compressed page size from table flags. */
 
420
/********************************************************************//**
 
421
Extract the compressed page size from table flags.
 
422
@return compressed page size, or 0 if not compressed */
399
423
UNIV_INLINE
400
424
ulint
401
425
dict_table_flags_to_zip_size(
402
426
/*=========================*/
403
 
                        /* out: compressed page size,
404
 
                        or 0 if not compressed */
405
 
        ulint   flags)  /* in: flags */
 
427
        ulint   flags)  /*!< in: flags */
406
428
{
407
429
        ulint   zip_size = flags & DICT_TF_ZSSIZE_MASK;
408
430
 
416
438
        return(zip_size);
417
439
}
418
440
 
419
 
/************************************************************************
420
 
Check whether the table uses the compressed compact page format. */
 
441
/********************************************************************//**
 
442
Check whether the table uses the compressed compact page format.
 
443
@return compressed page size, or 0 if not compressed */
421
444
UNIV_INLINE
422
445
ulint
423
446
dict_table_zip_size(
424
447
/*================*/
425
 
                                        /* out: compressed page size,
426
 
                                        or 0 if not compressed */
427
 
        const dict_table_t*     table)  /* in: table */
 
448
        const dict_table_t*     table)  /*!< in: table */
428
449
{
429
450
        ut_ad(table);
430
451
 
431
452
        return(dict_table_flags_to_zip_size(table->flags));
432
453
}
433
454
 
434
 
/************************************************************************
 
455
/********************************************************************//**
435
456
Gets the number of fields in the internal representation of an index,
436
 
including fields added by the dictionary system. */
 
457
including fields added by the dictionary system.
 
458
@return number of fields */
437
459
UNIV_INLINE
438
460
ulint
439
461
dict_index_get_n_fields(
440
462
/*====================*/
441
 
                                        /* out: number of fields */
442
 
        const dict_index_t*     index)  /* in: an internal
 
463
        const dict_index_t*     index)  /*!< in: an internal
443
464
                                        representation of index (in
444
465
                                        the dictionary cache) */
445
466
{
449
470
        return(index->n_fields);
450
471
}
451
472
 
452
 
/************************************************************************
 
473
/********************************************************************//**
453
474
Gets the number of fields in the internal representation of an index
454
475
that uniquely determine the position of an index entry in the index, if
455
476
we do not take multiversioning into account: in the B-tree use the value
456
 
returned by dict_index_get_n_unique_in_tree. */
 
477
returned by dict_index_get_n_unique_in_tree.
 
478
@return number of fields */
457
479
UNIV_INLINE
458
480
ulint
459
481
dict_index_get_n_unique(
460
482
/*====================*/
461
 
                                        /* out: number of fields */
462
 
        const dict_index_t*     index)  /* in: an internal representation
 
483
        const dict_index_t*     index)  /*!< in: an internal representation
463
484
                                        of index (in the dictionary cache) */
464
485
{
465
486
        ut_ad(index);
469
490
        return(index->n_uniq);
470
491
}
471
492
 
472
 
/************************************************************************
 
493
/********************************************************************//**
473
494
Gets the number of fields in the internal representation of an index
474
495
which uniquely determine the position of an index entry in the index, if
475
 
we also take multiversioning into account. */
 
496
we also take multiversioning into account.
 
497
@return number of fields */
476
498
UNIV_INLINE
477
499
ulint
478
500
dict_index_get_n_unique_in_tree(
479
501
/*============================*/
480
 
                                        /* out: number of fields */
481
 
        const dict_index_t*     index)  /* in: an internal representation
 
502
        const dict_index_t*     index)  /*!< in: an internal representation
482
503
                                        of index (in the dictionary cache) */
483
504
{
484
505
        ut_ad(index);
493
514
        return(dict_index_get_n_fields(index));
494
515
}
495
516
 
496
 
/************************************************************************
 
517
/********************************************************************//**
497
518
Gets the number of user-defined ordering fields in the index. In the internal
498
519
representation of clustered indexes we add the row id to the ordering fields
499
520
to make a clustered index unique, but this function returns the number of
500
 
fields the user defined in the index as ordering fields. */
 
521
fields the user defined in the index as ordering fields.
 
522
@return number of fields */
501
523
UNIV_INLINE
502
524
ulint
503
525
dict_index_get_n_ordering_defined_by_user(
504
526
/*======================================*/
505
 
                                        /* out: number of fields */
506
 
        const dict_index_t*     index)  /* in: an internal representation
 
527
        const dict_index_t*     index)  /*!< in: an internal representation
507
528
                                        of index (in the dictionary cache) */
508
529
{
509
530
        return(index->n_user_defined_cols);
510
531
}
511
532
 
512
533
#ifdef UNIV_DEBUG
513
 
/************************************************************************
514
 
Gets the nth field of an index. */
 
534
/********************************************************************//**
 
535
Gets the nth field of an index.
 
536
@return pointer to field object */
515
537
UNIV_INLINE
516
538
dict_field_t*
517
539
dict_index_get_nth_field(
518
540
/*=====================*/
519
 
                                        /* out: pointer to field object */
520
 
        const dict_index_t*     index,  /* in: index */
521
 
        ulint                   pos)    /* in: position of field */
 
541
        const dict_index_t*     index,  /*!< in: index */
 
542
        ulint                   pos)    /*!< in: position of field */
522
543
{
523
544
        ut_ad(index);
524
545
        ut_ad(pos < index->n_def);
528
549
}
529
550
#endif /* UNIV_DEBUG */
530
551
 
531
 
/************************************************************************
532
 
Returns the position of a system column in an index. */
 
552
/********************************************************************//**
 
553
Returns the position of a system column in an index.
 
554
@return position, ULINT_UNDEFINED if not contained */
533
555
UNIV_INLINE
534
556
ulint
535
557
dict_index_get_sys_col_pos(
536
558
/*=======================*/
537
 
                                        /* out: position,
538
 
                                        ULINT_UNDEFINED if not contained */
539
 
        const dict_index_t*     index,  /* in: index */
540
 
        ulint                   type)   /* in: DATA_ROW_ID, ... */
 
559
        const dict_index_t*     index,  /*!< in: index */
 
560
        ulint                   type)   /*!< in: DATA_ROW_ID, ... */
541
561
{
542
562
        ut_ad(index);
543
563
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
554
574
                       index, dict_table_get_sys_col_no(index->table, type)));
555
575
}
556
576
 
557
 
/*************************************************************************
558
 
Gets the field column. */
 
577
/*********************************************************************//**
 
578
Gets the field column.
 
579
@return field->col, pointer to the table column */
559
580
UNIV_INLINE
560
581
const dict_col_t*
561
582
dict_field_get_col(
562
583
/*===============*/
563
 
        const dict_field_t*     field)
 
584
        const dict_field_t*     field)  /*!< in: index field */
564
585
{
565
586
        ut_ad(field);
566
587
 
567
588
        return(field->col);
568
589
}
569
590
 
570
 
/************************************************************************
571
 
Gets pointer to the nth column in an index. */
 
591
/********************************************************************//**
 
592
Gets pointer to the nth column in an index.
 
593
@return column */
572
594
UNIV_INLINE
573
595
const dict_col_t*
574
596
dict_index_get_nth_col(
575
597
/*===================*/
576
 
                                        /* out: column */
577
 
        const dict_index_t*     index,  /* in: index */
578
 
        ulint                   pos)    /* in: position of the field */
 
598
        const dict_index_t*     index,  /*!< in: index */
 
599
        ulint                   pos)    /*!< in: position of the field */
579
600
{
580
601
        return(dict_field_get_col(dict_index_get_nth_field(index, pos)));
581
602
}
582
603
 
583
 
/************************************************************************
584
 
Gets the column number the nth field in an index. */
 
604
/********************************************************************//**
 
605
Gets the column number the nth field in an index.
 
606
@return column number */
585
607
UNIV_INLINE
586
608
ulint
587
609
dict_index_get_nth_col_no(
588
610
/*======================*/
589
 
                                        /* out: column number */
590
 
        const dict_index_t*     index,  /* in: index */
591
 
        ulint                   pos)    /* in: position of the field */
 
611
        const dict_index_t*     index,  /*!< in: index */
 
612
        ulint                   pos)    /*!< in: position of the field */
592
613
{
593
614
        return(dict_col_get_no(dict_index_get_nth_col(index, pos)));
594
615
}
595
616
 
596
 
/************************************************************************
597
 
Returns the minimum data size of an index record. */
 
617
#ifndef UNIV_HOTBACKUP
 
618
/********************************************************************//**
 
619
Returns the minimum data size of an index record.
 
620
@return minimum data size in bytes */
598
621
UNIV_INLINE
599
622
ulint
600
623
dict_index_get_min_size(
601
624
/*====================*/
602
 
                                        /* out: minimum data size in bytes */
603
 
        const dict_index_t*     index)  /* in: index */
 
625
        const dict_index_t*     index)  /*!< in: index */
604
626
{
605
627
        ulint   n       = dict_index_get_n_fields(index);
606
628
        ulint   size    = 0;
613
635
        return(size);
614
636
}
615
637
 
616
 
/*************************************************************************
617
 
Gets the space id of the root of the index tree. */
 
638
/*********************************************************************//**
 
639
Gets the space id of the root of the index tree.
 
640
@return space id */
618
641
UNIV_INLINE
619
642
ulint
620
643
dict_index_get_space(
621
644
/*=================*/
622
 
                                        /* out: space id */
623
 
        const dict_index_t*     index)  /* in: index */
 
645
        const dict_index_t*     index)  /*!< in: index */
624
646
{
625
647
        ut_ad(index);
626
648
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
628
650
        return(index->space);
629
651
}
630
652
 
631
 
/*************************************************************************
 
653
/*********************************************************************//**
632
654
Sets the space id of the root of the index tree. */
633
655
UNIV_INLINE
634
656
void
635
657
dict_index_set_space(
636
658
/*=================*/
637
 
        dict_index_t*   index,  /* in/out: index */
638
 
        ulint           space)  /* in: space id */
 
659
        dict_index_t*   index,  /*!< in/out: index */
 
660
        ulint           space)  /*!< in: space id */
639
661
{
640
662
        ut_ad(index);
641
663
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
643
665
        index->space = space;
644
666
}
645
667
 
646
 
/*************************************************************************
647
 
Gets the page number of the root of the index tree. */
 
668
/*********************************************************************//**
 
669
Gets the page number of the root of the index tree.
 
670
@return page number */
648
671
UNIV_INLINE
649
672
ulint
650
673
dict_index_get_page(
651
674
/*================*/
652
 
                                        /* out: page number */
653
 
        const dict_index_t*     index)  /* in: index */
 
675
        const dict_index_t*     index)  /*!< in: index */
654
676
{
655
677
        ut_ad(index);
656
678
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
658
680
        return(index->page);
659
681
}
660
682
 
661
 
/*************************************************************************
 
683
/*********************************************************************//**
662
684
Sets the page number of the root of index tree. */
663
685
UNIV_INLINE
664
686
void
665
687
dict_index_set_page(
666
688
/*================*/
667
 
        dict_index_t*   index,  /* in/out: index */
668
 
        ulint           page)   /* in: page number */
 
689
        dict_index_t*   index,  /*!< in/out: index */
 
690
        ulint           page)   /*!< in: page number */
669
691
{
670
692
        ut_ad(index);
671
693
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
673
695
        index->page = page;
674
696
}
675
697
 
676
 
/*************************************************************************
677
 
Gets the read-write lock of the index tree. */
 
698
/*********************************************************************//**
 
699
Gets the read-write lock of the index tree.
 
700
@return read-write lock */
678
701
UNIV_INLINE
679
702
rw_lock_t*
680
703
dict_index_get_lock(
681
704
/*================*/
682
 
                                /* out: read-write lock */
683
 
        dict_index_t*   index)  /* in: index */
 
705
        dict_index_t*   index)  /*!< in: index */
684
706
{
685
707
        ut_ad(index);
686
708
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
688
710
        return(&(index->lock));
689
711
}
690
712
 
691
 
/************************************************************************
 
713
/********************************************************************//**
692
714
Returns free space reserved for future updates of records. This is
693
715
relevant only in the case of many consecutive inserts, as updates
694
 
which make the records bigger might fragment the index. */
 
716
which make the records bigger might fragment the index.
 
717
@return number of free bytes on page, reserved for updates */
695
718
UNIV_INLINE
696
719
ulint
697
720
dict_index_get_space_reserve(void)
698
721
/*==============================*/
699
 
                                /* out: number of free bytes on page,
700
 
                                reserved for updates */
701
722
{
702
723
        return(UNIV_PAGE_SIZE / 16);
703
724
}
704
725
 
705
 
/**************************************************************************
706
 
Checks if a table is in the dictionary cache. */
 
726
/**********************************************************************//**
 
727
Checks if a table is in the dictionary cache.
 
728
@return table, NULL if not found */
707
729
UNIV_INLINE
708
730
dict_table_t*
709
731
dict_table_check_if_in_cache_low(
710
732
/*=============================*/
711
 
                                        /* out: table, NULL if not found */
712
 
        const char*     table_name)     /* in: table name */
 
733
        const char*     table_name)     /*!< in: table name */
713
734
{
714
735
        dict_table_t*   table;
715
736
        ulint           table_fold;
726
747
        return(table);
727
748
}
728
749
 
729
 
/**************************************************************************
 
750
/**********************************************************************//**
730
751
Gets a table; loads it to the dictionary cache if necessary. A low-level
731
 
function. */
 
752
function.
 
753
@return table, NULL if not found */
732
754
UNIV_INLINE
733
755
dict_table_t*
734
756
dict_table_get_low(
735
757
/*===============*/
736
 
                                        /* out: table, NULL if not found */
737
 
        const char*     table_name)     /* in: table name */
 
758
        const char*     table_name)     /*!< in: table name */
738
759
{
739
760
        dict_table_t*   table;
740
761
 
752
773
        return(table);
753
774
}
754
775
 
755
 
/**************************************************************************
756
 
Returns a table object based on table id. */
 
776
/**********************************************************************//**
 
777
Returns a table object based on table id.
 
778
@return table, NULL if does not exist */
757
779
UNIV_INLINE
758
780
dict_table_t*
759
781
dict_table_get_on_id_low(
760
782
/*=====================*/
761
 
                                /* out: table, NULL if does not exist */
762
 
        dulint  table_id)       /* in: table id */
 
783
        dulint  table_id)       /*!< in: table id */
763
784
{
764
785
        dict_table_t*   table;
765
786
        ulint           fold;
782
803
 
783
804
        return(table);
784
805
}
785
 
 
 
806
#endif /* !UNIV_HOTBACKUP */