mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / innodb_plugin / include / dict0boot.ic
blob97c79b02dc6bb27bc6c4ffca2024991af42f3d03
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., 
15 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *****************************************************************************/
19 /**************************************************//**
20 @file include/dict0boot.ic
21 Data dictionary creation and booting
23 Created 4/18/1996 Heikki Tuuri
24 *******************************************************/
26 /**********************************************************************//**
27 Writes the current value of the row id counter to the dictionary header file
28 page. */
29 UNIV_INTERN
30 void
31 dict_hdr_flush_row_id(void);
32 /*=======================*/
35 /**********************************************************************//**
36 Returns a new row id.
37 @return the new id */
38 UNIV_INLINE
39 dulint
40 dict_sys_get_new_row_id(void)
41 /*=========================*/
43         dulint  id;
45         mutex_enter(&(dict_sys->mutex));
47         id = dict_sys->row_id;
49         if (0 == (ut_dulint_get_low(id) % DICT_HDR_ROW_ID_WRITE_MARGIN)) {
51                 dict_hdr_flush_row_id();
52         }
54         UT_DULINT_INC(dict_sys->row_id);
56         mutex_exit(&(dict_sys->mutex));
58         return(id);
61 /**********************************************************************//**
62 Reads a row id from a record or other 6-byte stored form.
63 @return row id */
64 UNIV_INLINE
65 dulint
66 dict_sys_read_row_id(
67 /*=================*/
68         byte*   field)  /*!< in: record field */
70 #if DATA_ROW_ID_LEN != 6
71 # error "DATA_ROW_ID_LEN != 6"
72 #endif
74         return(mach_read_from_6(field));
77 /**********************************************************************//**
78 Writes a row id to a record or other 6-byte stored form. */
79 UNIV_INLINE
80 void
81 dict_sys_write_row_id(
82 /*==================*/
83         byte*   field,  /*!< in: record field */
84         dulint  row_id) /*!< in: row id */
86 #if DATA_ROW_ID_LEN != 6
87 # error "DATA_ROW_ID_LEN != 6"
88 #endif
90         mach_write_to_6(field, row_id);