1
1
/*****************************************************************************
3
Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
3
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
29
29
#include "rem0types.h"
31
31
/*********************************************************************//**
32
Gets the minimum number of bytes per character.
33
@return minimum multi-byte char size, in bytes */
36
dict_col_get_mbminlen(
37
/*==================*/
38
const dict_col_t* col) /*!< in: column */
40
return(DATA_MBMINLEN(col->mbminmaxlen));
42
/*********************************************************************//**
43
Gets the maximum number of bytes per character.
44
@return maximum multi-byte char size, in bytes */
47
dict_col_get_mbmaxlen(
48
/*==================*/
49
const dict_col_t* col) /*!< in: column */
51
return(DATA_MBMAXLEN(col->mbminmaxlen));
53
/*********************************************************************//**
54
Sets the minimum and maximum number of bytes per character. */
57
dict_col_set_mbminmaxlen(
58
/*=====================*/
59
dict_col_t* col, /*!< in/out: column */
60
ulint mbminlen, /*!< in: minimum multi-byte
61
character size, in bytes */
62
ulint mbmaxlen) /*!< in: minimum multi-byte
63
character size, in bytes */
65
ut_ad(mbminlen < DATA_MBMAX);
66
ut_ad(mbmaxlen < DATA_MBMAX);
67
ut_ad(mbminlen <= mbmaxlen);
69
col->mbminmaxlen = DATA_MBMINMAXLEN(mbminlen, mbmaxlen);
71
/*********************************************************************//**
72
32
Gets the column data type. */
82
42
type->mtype = col->mtype;
83
43
type->prtype = col->prtype;
84
44
type->len = col->len;
85
type->mbminmaxlen = col->mbminmaxlen;
45
type->mbminlen = col->mbminlen;
46
type->mbmaxlen = col->mbmaxlen;
87
48
#endif /* !UNIV_HOTBACKUP */
104
65
ut_ad(col->prtype == type->prtype);
105
66
ut_ad(col->len == type->len);
106
67
# ifndef UNIV_HOTBACKUP
107
ut_ad(col->mbminmaxlen == type->mbminmaxlen);
68
ut_ad(col->mbminlen == type->mbminlen);
69
ut_ad(col->mbmaxlen == type->mbmaxlen);
108
70
# endif /* !UNIV_HOTBACKUP */
122
84
const dict_col_t* col) /*!< in: column */
124
86
return(dtype_get_min_size_low(col->mtype, col->prtype, col->len,
87
col->mbminlen, col->mbmaxlen));
127
89
/***********************************************************************//**
128
90
Returns the maximum size of the column.
147
109
ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */
149
111
return(dtype_get_fixed_size_low(col->mtype, col->prtype, col->len,
150
col->mbminmaxlen, comp));
112
col->mbminlen, col->mbmaxlen, comp));
152
114
/***********************************************************************//**
153
115
Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column.
491
453
return(dict_table_flags_to_zip_size(table->flags));
494
/*********************************************************************//**
495
Obtain exclusive locks on all index trees of the table. This is to prevent
496
accessing index trees while InnoDB is updating internal metadata for
497
operations such as truncate tables. */
500
dict_table_x_lock_indexes(
501
/*======================*/
502
dict_table_t* table) /*!< in: table */
507
ut_ad(mutex_own(&(dict_sys->mutex)));
509
/* Loop through each index of the table and lock them */
510
for (index = dict_table_get_first_index(table);
512
index = dict_table_get_next_index(index)) {
513
rw_lock_x_lock(dict_index_get_lock(index));
517
/*********************************************************************//**
518
Release the exclusive locks on all index tree. */
521
dict_table_x_unlock_indexes(
522
/*========================*/
523
dict_table_t* table) /*!< in: table */
528
ut_ad(mutex_own(&(dict_sys->mutex)));
530
for (index = dict_table_get_first_index(table);
532
index = dict_table_get_next_index(index)) {
533
rw_lock_x_unlock(dict_index_get_lock(index));
536
456
/********************************************************************//**
537
457
Gets the number of fields in the internal representation of an index,
538
458
including fields added by the dictionary system.
846
766
table = dict_table_check_if_in_cache_low(table_name);
848
768
if (table == NULL) {
849
table = dict_load_table(table_name, TRUE);
769
table = dict_load_table(table_name);
852
772
ut_ad(!table || table->cached);
869
789
ut_ad(mutex_own(&(dict_sys->mutex)));
871
791
/* Look for the table name in the hash table */
872
fold = ut_fold_ull(table_id);
792
fold = ut_fold_dulint(table_id);
874
794
HASH_SEARCH(id_hash, dict_sys->table_id_hash, fold,
875
795
dict_table_t*, table, ut_ad(table->cached),
876
table->id == table_id);
796
!ut_dulint_cmp(table->id, table_id));
877
797
if (table == NULL) {
878
798
table = dict_load_table_on_id(table_id);