~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Eric Day
  • Date: 2009-10-31 21:53:33 UTC
  • mfrom: (1200 staging)
  • mto: This revision was merged to the branch mainline in revision 1202.
  • Revision ID: eday@oddments.org-20091031215333-j94bjoanwmi68p6f
Merged trunk.

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
{
 
290
        (void)table;
266
291
        ut_ad(table);
267
292
        ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
268
293
        ut_ad(table->cached);
270
295
        return(DATA_N_SYS_COLS);
271
296
}
272
297
 
273
 
/************************************************************************
 
298
/********************************************************************//**
274
299
Gets the number of all columns (also system) in a table in the dictionary
275
 
cache. */
 
300
cache.
 
301
@return number of columns of a table */
276
302
UNIV_INLINE
277
303
ulint
278
304
dict_table_get_n_cols(
279
305
/*==================*/
280
 
                                        /* out: number of columns of a table */
281
 
        const dict_table_t*     table)  /* in: table */
 
306
        const dict_table_t*     table)  /*!< in: table */
282
307
{
283
308
        ut_ad(table);
284
309
        ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
287
312
}
288
313
 
289
314
#ifdef UNIV_DEBUG
290
 
/************************************************************************
291
 
Gets the nth column of a table. */
 
315
/********************************************************************//**
 
316
Gets the nth column of a table.
 
317
@return pointer to column object */
292
318
UNIV_INLINE
293
319
dict_col_t*
294
320
dict_table_get_nth_col(
295
321
/*===================*/
296
 
                                        /* out: pointer to column object */
297
 
        const dict_table_t*     table,  /* in: table */
298
 
        ulint                   pos)    /* in: position of column */
 
322
        const dict_table_t*     table,  /*!< in: table */
 
323
        ulint                   pos)    /*!< in: position of column */
299
324
{
300
325
        ut_ad(table);
301
326
        ut_ad(pos < table->n_def);
304
329
        return((dict_col_t*) (table->cols) + pos);
305
330
}
306
331
 
307
 
/************************************************************************
308
 
Gets the given system column of a table. */
 
332
/********************************************************************//**
 
333
Gets the given system column of a table.
 
334
@return pointer to column object */
309
335
UNIV_INLINE
310
336
dict_col_t*
311
337
dict_table_get_sys_col(
312
338
/*===================*/
313
 
                                        /* out: pointer to column object */
314
 
        const dict_table_t*     table,  /* in: table */
315
 
        ulint                   sys)    /* in: DATA_ROW_ID, ... */
 
339
        const dict_table_t*     table,  /*!< in: table */
 
340
        ulint                   sys)    /*!< in: DATA_ROW_ID, ... */
316
341
{
317
342
        dict_col_t*     col;
318
343
 
329
354
}
330
355
#endif /* UNIV_DEBUG */
331
356
 
332
 
/************************************************************************
333
 
Gets the given system column number of a table. */
 
357
/********************************************************************//**
 
358
Gets the given system column number of a table.
 
359
@return column number */
334
360
UNIV_INLINE
335
361
ulint
336
362
dict_table_get_sys_col_no(
337
363
/*======================*/
338
 
                                        /* out: column number */
339
 
        const dict_table_t*     table,  /* in: table */
340
 
        ulint                   sys)    /* in: DATA_ROW_ID, ... */
 
364
        const dict_table_t*     table,  /*!< in: table */
 
365
        ulint                   sys)    /*!< in: DATA_ROW_ID, ... */
341
366
{
342
367
        ut_ad(table);
343
368
        ut_ad(sys < DATA_N_SYS_COLS);
346
371
        return(table->n_cols - DATA_N_SYS_COLS + sys);
347
372
}
348
373
 
349
 
/************************************************************************
350
 
Check whether the table uses the compact page format. */
 
374
/********************************************************************//**
 
375
Check whether the table uses the compact page format.
 
376
@return TRUE if table uses the compact page format */
351
377
UNIV_INLINE
352
378
ibool
353
379
dict_table_is_comp(
354
380
/*===============*/
355
 
                                        /* out: TRUE if table uses the
356
 
                                        compact page format */
357
 
        const dict_table_t*     table)  /* in: table */
 
381
        const dict_table_t*     table)  /*!< in: table */
358
382
{
359
383
        ut_ad(table);
360
384
 
365
389
        return(UNIV_LIKELY(table->flags & DICT_TF_COMPACT));
366
390
}
367
391
 
368
 
/************************************************************************
369
 
Determine the file format of a table. */
 
392
/********************************************************************//**
 
393
Determine the file format of a table.
 
394
@return file format version */
370
395
UNIV_INLINE
371
396
ulint
372
397
dict_table_get_format(
373
398
/*==================*/
374
 
                                        /* out: file format version */
375
 
        const dict_table_t*     table)  /* in: table */
 
399
        const dict_table_t*     table)  /*!< in: table */
376
400
{
377
401
        ut_ad(table);
378
402
 
379
403
        return((table->flags & DICT_TF_FORMAT_MASK) >> DICT_TF_FORMAT_SHIFT);
380
404
}
381
405
 
382
 
/************************************************************************
 
406
/********************************************************************//**
383
407
Determine the file format of a table. */
384
408
UNIV_INLINE
385
409
void
386
410
dict_table_set_format(
387
411
/*==================*/
388
 
        dict_table_t*   table,  /* in/out: table */
389
 
        ulint           format) /* in: file format version */
 
412
        dict_table_t*   table,  /*!< in/out: table */
 
413
        ulint           format) /*!< in: file format version */
390
414
{
391
415
        ut_ad(table);
392
416
 
394
418
                | (format << DICT_TF_FORMAT_SHIFT);
395
419
}
396
420
 
397
 
/************************************************************************
398
 
Extract the compressed page size from table flags. */
 
421
/********************************************************************//**
 
422
Extract the compressed page size from table flags.
 
423
@return compressed page size, or 0 if not compressed */
399
424
UNIV_INLINE
400
425
ulint
401
426
dict_table_flags_to_zip_size(
402
427
/*=========================*/
403
 
                        /* out: compressed page size,
404
 
                        or 0 if not compressed */
405
 
        ulint   flags)  /* in: flags */
 
428
        ulint   flags)  /*!< in: flags */
406
429
{
407
430
        ulint   zip_size = flags & DICT_TF_ZSSIZE_MASK;
408
431
 
416
439
        return(zip_size);
417
440
}
418
441
 
419
 
/************************************************************************
420
 
Check whether the table uses the compressed compact page format. */
 
442
/********************************************************************//**
 
443
Check whether the table uses the compressed compact page format.
 
444
@return compressed page size, or 0 if not compressed */
421
445
UNIV_INLINE
422
446
ulint
423
447
dict_table_zip_size(
424
448
/*================*/
425
 
                                        /* out: compressed page size,
426
 
                                        or 0 if not compressed */
427
 
        const dict_table_t*     table)  /* in: table */
 
449
        const dict_table_t*     table)  /*!< in: table */
428
450
{
429
451
        ut_ad(table);
430
452
 
431
453
        return(dict_table_flags_to_zip_size(table->flags));
432
454
}
433
455
 
434
 
/************************************************************************
 
456
/********************************************************************//**
435
457
Gets the number of fields in the internal representation of an index,
436
 
including fields added by the dictionary system. */
 
458
including fields added by the dictionary system.
 
459
@return number of fields */
437
460
UNIV_INLINE
438
461
ulint
439
462
dict_index_get_n_fields(
440
463
/*====================*/
441
 
                                        /* out: number of fields */
442
 
        const dict_index_t*     index)  /* in: an internal
 
464
        const dict_index_t*     index)  /*!< in: an internal
443
465
                                        representation of index (in
444
466
                                        the dictionary cache) */
445
467
{
449
471
        return(index->n_fields);
450
472
}
451
473
 
452
 
/************************************************************************
 
474
/********************************************************************//**
453
475
Gets the number of fields in the internal representation of an index
454
476
that uniquely determine the position of an index entry in the index, if
455
477
we do not take multiversioning into account: in the B-tree use the value
456
 
returned by dict_index_get_n_unique_in_tree. */
 
478
returned by dict_index_get_n_unique_in_tree.
 
479
@return number of fields */
457
480
UNIV_INLINE
458
481
ulint
459
482
dict_index_get_n_unique(
460
483
/*====================*/
461
 
                                        /* out: number of fields */
462
 
        const dict_index_t*     index)  /* in: an internal representation
 
484
        const dict_index_t*     index)  /*!< in: an internal representation
463
485
                                        of index (in the dictionary cache) */
464
486
{
465
487
        ut_ad(index);
469
491
        return(index->n_uniq);
470
492
}
471
493
 
472
 
/************************************************************************
 
494
/********************************************************************//**
473
495
Gets the number of fields in the internal representation of an index
474
496
which uniquely determine the position of an index entry in the index, if
475
 
we also take multiversioning into account. */
 
497
we also take multiversioning into account.
 
498
@return number of fields */
476
499
UNIV_INLINE
477
500
ulint
478
501
dict_index_get_n_unique_in_tree(
479
502
/*============================*/
480
 
                                        /* out: number of fields */
481
 
        const dict_index_t*     index)  /* in: an internal representation
 
503
        const dict_index_t*     index)  /*!< in: an internal representation
482
504
                                        of index (in the dictionary cache) */
483
505
{
484
506
        ut_ad(index);
493
515
        return(dict_index_get_n_fields(index));
494
516
}
495
517
 
496
 
/************************************************************************
 
518
/********************************************************************//**
497
519
Gets the number of user-defined ordering fields in the index. In the internal
498
520
representation of clustered indexes we add the row id to the ordering fields
499
521
to make a clustered index unique, but this function returns the number of
500
 
fields the user defined in the index as ordering fields. */
 
522
fields the user defined in the index as ordering fields.
 
523
@return number of fields */
501
524
UNIV_INLINE
502
525
ulint
503
526
dict_index_get_n_ordering_defined_by_user(
504
527
/*======================================*/
505
 
                                        /* out: number of fields */
506
 
        const dict_index_t*     index)  /* in: an internal representation
 
528
        const dict_index_t*     index)  /*!< in: an internal representation
507
529
                                        of index (in the dictionary cache) */
508
530
{
509
531
        return(index->n_user_defined_cols);
510
532
}
511
533
 
512
534
#ifdef UNIV_DEBUG
513
 
/************************************************************************
514
 
Gets the nth field of an index. */
 
535
/********************************************************************//**
 
536
Gets the nth field of an index.
 
537
@return pointer to field object */
515
538
UNIV_INLINE
516
539
dict_field_t*
517
540
dict_index_get_nth_field(
518
541
/*=====================*/
519
 
                                        /* out: pointer to field object */
520
 
        const dict_index_t*     index,  /* in: index */
521
 
        ulint                   pos)    /* in: position of field */
 
542
        const dict_index_t*     index,  /*!< in: index */
 
543
        ulint                   pos)    /*!< in: position of field */
522
544
{
523
545
        ut_ad(index);
524
546
        ut_ad(pos < index->n_def);
528
550
}
529
551
#endif /* UNIV_DEBUG */
530
552
 
531
 
/************************************************************************
532
 
Returns the position of a system column in an index. */
 
553
/********************************************************************//**
 
554
Returns the position of a system column in an index.
 
555
@return position, ULINT_UNDEFINED if not contained */
533
556
UNIV_INLINE
534
557
ulint
535
558
dict_index_get_sys_col_pos(
536
559
/*=======================*/
537
 
                                        /* out: position,
538
 
                                        ULINT_UNDEFINED if not contained */
539
 
        const dict_index_t*     index,  /* in: index */
540
 
        ulint                   type)   /* in: DATA_ROW_ID, ... */
 
560
        const dict_index_t*     index,  /*!< in: index */
 
561
        ulint                   type)   /*!< in: DATA_ROW_ID, ... */
541
562
{
542
563
        ut_ad(index);
543
564
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
554
575
                       index, dict_table_get_sys_col_no(index->table, type)));
555
576
}
556
577
 
557
 
/*************************************************************************
558
 
Gets the field column. */
 
578
/*********************************************************************//**
 
579
Gets the field column.
 
580
@return field->col, pointer to the table column */
559
581
UNIV_INLINE
560
582
const dict_col_t*
561
583
dict_field_get_col(
562
584
/*===============*/
563
 
        const dict_field_t*     field)
 
585
        const dict_field_t*     field)  /*!< in: index field */
564
586
{
565
587
        ut_ad(field);
566
588
 
567
589
        return(field->col);
568
590
}
569
591
 
570
 
/************************************************************************
571
 
Gets pointer to the nth column in an index. */
 
592
/********************************************************************//**
 
593
Gets pointer to the nth column in an index.
 
594
@return column */
572
595
UNIV_INLINE
573
596
const dict_col_t*
574
597
dict_index_get_nth_col(
575
598
/*===================*/
576
 
                                        /* out: column */
577
 
        const dict_index_t*     index,  /* in: index */
578
 
        ulint                   pos)    /* in: position of the field */
 
599
        const dict_index_t*     index,  /*!< in: index */
 
600
        ulint                   pos)    /*!< in: position of the field */
579
601
{
580
602
        return(dict_field_get_col(dict_index_get_nth_field(index, pos)));
581
603
}
582
604
 
583
 
/************************************************************************
584
 
Gets the column number the nth field in an index. */
 
605
/********************************************************************//**
 
606
Gets the column number the nth field in an index.
 
607
@return column number */
585
608
UNIV_INLINE
586
609
ulint
587
610
dict_index_get_nth_col_no(
588
611
/*======================*/
589
 
                                        /* out: column number */
590
 
        const dict_index_t*     index,  /* in: index */
591
 
        ulint                   pos)    /* in: position of the field */
 
612
        const dict_index_t*     index,  /*!< in: index */
 
613
        ulint                   pos)    /*!< in: position of the field */
592
614
{
593
615
        return(dict_col_get_no(dict_index_get_nth_col(index, pos)));
594
616
}
595
617
 
596
 
/************************************************************************
597
 
Returns the minimum data size of an index record. */
 
618
#ifndef UNIV_HOTBACKUP
 
619
/********************************************************************//**
 
620
Returns the minimum data size of an index record.
 
621
@return minimum data size in bytes */
598
622
UNIV_INLINE
599
623
ulint
600
624
dict_index_get_min_size(
601
625
/*====================*/
602
 
                                        /* out: minimum data size in bytes */
603
 
        const dict_index_t*     index)  /* in: index */
 
626
        const dict_index_t*     index)  /*!< in: index */
604
627
{
605
628
        ulint   n       = dict_index_get_n_fields(index);
606
629
        ulint   size    = 0;
613
636
        return(size);
614
637
}
615
638
 
616
 
/*************************************************************************
617
 
Gets the space id of the root of the index tree. */
 
639
/*********************************************************************//**
 
640
Gets the space id of the root of the index tree.
 
641
@return space id */
618
642
UNIV_INLINE
619
643
ulint
620
644
dict_index_get_space(
621
645
/*=================*/
622
 
                                        /* out: space id */
623
 
        const dict_index_t*     index)  /* in: index */
 
646
        const dict_index_t*     index)  /*!< in: index */
624
647
{
625
648
        ut_ad(index);
626
649
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
628
651
        return(index->space);
629
652
}
630
653
 
631
 
/*************************************************************************
 
654
/*********************************************************************//**
632
655
Sets the space id of the root of the index tree. */
633
656
UNIV_INLINE
634
657
void
635
658
dict_index_set_space(
636
659
/*=================*/
637
 
        dict_index_t*   index,  /* in/out: index */
638
 
        ulint           space)  /* in: space id */
 
660
        dict_index_t*   index,  /*!< in/out: index */
 
661
        ulint           space)  /*!< in: space id */
639
662
{
640
663
        ut_ad(index);
641
664
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
643
666
        index->space = space;
644
667
}
645
668
 
646
 
/*************************************************************************
647
 
Gets the page number of the root of the index tree. */
 
669
/*********************************************************************//**
 
670
Gets the page number of the root of the index tree.
 
671
@return page number */
648
672
UNIV_INLINE
649
673
ulint
650
674
dict_index_get_page(
651
675
/*================*/
652
 
                                        /* out: page number */
653
 
        const dict_index_t*     index)  /* in: index */
 
676
        const dict_index_t*     index)  /*!< in: index */
654
677
{
655
678
        ut_ad(index);
656
679
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
658
681
        return(index->page);
659
682
}
660
683
 
661
 
/*************************************************************************
 
684
/*********************************************************************//**
662
685
Sets the page number of the root of index tree. */
663
686
UNIV_INLINE
664
687
void
665
688
dict_index_set_page(
666
689
/*================*/
667
 
        dict_index_t*   index,  /* in/out: index */
668
 
        ulint           page)   /* in: page number */
 
690
        dict_index_t*   index,  /*!< in/out: index */
 
691
        ulint           page)   /*!< in: page number */
669
692
{
670
693
        ut_ad(index);
671
694
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
673
696
        index->page = page;
674
697
}
675
698
 
676
 
/*************************************************************************
677
 
Gets the read-write lock of the index tree. */
 
699
/*********************************************************************//**
 
700
Gets the read-write lock of the index tree.
 
701
@return read-write lock */
678
702
UNIV_INLINE
679
703
rw_lock_t*
680
704
dict_index_get_lock(
681
705
/*================*/
682
 
                                /* out: read-write lock */
683
 
        dict_index_t*   index)  /* in: index */
 
706
        dict_index_t*   index)  /*!< in: index */
684
707
{
685
708
        ut_ad(index);
686
709
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
688
711
        return(&(index->lock));
689
712
}
690
713
 
691
 
/************************************************************************
 
714
/********************************************************************//**
692
715
Returns free space reserved for future updates of records. This is
693
716
relevant only in the case of many consecutive inserts, as updates
694
 
which make the records bigger might fragment the index. */
 
717
which make the records bigger might fragment the index.
 
718
@return number of free bytes on page, reserved for updates */
695
719
UNIV_INLINE
696
720
ulint
697
721
dict_index_get_space_reserve(void)
698
722
/*==============================*/
699
 
                                /* out: number of free bytes on page,
700
 
                                reserved for updates */
701
723
{
702
724
        return(UNIV_PAGE_SIZE / 16);
703
725
}
704
726
 
705
 
/**************************************************************************
706
 
Checks if a table is in the dictionary cache. */
 
727
/**********************************************************************//**
 
728
Checks if a table is in the dictionary cache.
 
729
@return table, NULL if not found */
707
730
UNIV_INLINE
708
731
dict_table_t*
709
732
dict_table_check_if_in_cache_low(
710
733
/*=============================*/
711
 
                                        /* out: table, NULL if not found */
712
 
        const char*     table_name)     /* in: table name */
 
734
        const char*     table_name)     /*!< in: table name */
713
735
{
714
736
        dict_table_t*   table;
715
737
        ulint           table_fold;
726
748
        return(table);
727
749
}
728
750
 
729
 
/**************************************************************************
 
751
/**********************************************************************//**
730
752
Gets a table; loads it to the dictionary cache if necessary. A low-level
731
 
function. */
 
753
function.
 
754
@return table, NULL if not found */
732
755
UNIV_INLINE
733
756
dict_table_t*
734
757
dict_table_get_low(
735
758
/*===============*/
736
 
                                        /* out: table, NULL if not found */
737
 
        const char*     table_name)     /* in: table name */
 
759
        const char*     table_name)     /*!< in: table name */
738
760
{
739
761
        dict_table_t*   table;
740
762
 
752
774
        return(table);
753
775
}
754
776
 
755
 
/**************************************************************************
756
 
Returns a table object based on table id. */
 
777
/**********************************************************************//**
 
778
Returns a table object based on table id.
 
779
@return table, NULL if does not exist */
757
780
UNIV_INLINE
758
781
dict_table_t*
759
782
dict_table_get_on_id_low(
760
783
/*=====================*/
761
 
                                /* out: table, NULL if does not exist */
762
 
        dulint  table_id)       /* in: table id */
 
784
        dulint  table_id)       /*!< in: table id */
763
785
{
764
786
        dict_table_t*   table;
765
787
        ulint           fold;
782
804
 
783
805
        return(table);
784
806
}
785
 
 
 
807
#endif /* !UNIV_HOTBACKUP */