1 /*****************************************************************************
2 
3 Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License, version 2.0,
7 as published by the Free Software Foundation.
8 
9 This program is also distributed with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation.  The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have included with MySQL.
15 
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 GNU General Public License, version 2.0, for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
24 
25 *****************************************************************************/
26 
27 /********************************************************************//**
28 @file include/rem0types.h
29 Record manager global types
30 
31 Created 5/30/1994 Heikki Tuuri
32 *************************************************************************/
33 
34 #ifndef rem0types_h
35 #define rem0types_h
36 
37 /* We define the physical record simply as an array of bytes */
38 typedef byte	rec_t;
39 
40 /* Maximum values for various fields (for non-blob tuples) */
41 #define REC_MAX_N_FIELDS	(1024 - 1)
42 #define REC_MAX_HEAP_NO		(2 * 8192 - 1)
43 #define REC_MAX_N_OWNED		(16 - 1)
44 
45 /* Maximum number of user defined fields/columns. The reserved columns
46 are the ones InnoDB adds internally: DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR.
47 We need "* 2" because mlog_parse_index() creates a dummy table object
48 possibly, with some of the system columns in it, and then adds the 3
49 system columns (again) using dict_table_add_system_columns(). The problem
50 is that mlog_parse_index() cannot recognize the system columns by
51 just having n_fields, n_uniq and the lengths of the columns. */
52 #define REC_MAX_N_USER_FIELDS	(REC_MAX_N_FIELDS - DATA_N_SYS_COLS * 2)
53 
54 /* REC_ANTELOPE_MAX_INDEX_COL_LEN is measured in bytes and is the maximum
55 indexed field length (or indexed prefix length) for indexes on tables of
56 ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT format.
57 Before we support UTF-8 encodings with mbmaxlen = 4, a UTF-8 character
58 may take at most 3 bytes.  So the limit was set to 3*256, so that one
59 can create a column prefix index on 256 characters of a TEXT or VARCHAR
60 column also in the UTF-8 charset.
61 This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data
62 files would be at risk! */
63 #define REC_ANTELOPE_MAX_INDEX_COL_LEN		768
64 
65 /** Maximum indexed field length for table format UNIV_FORMAT_B and
66 beyond.
67 This (3072) is the maximum index row length allowed, so we cannot create index
68 prefix column longer than that. */
69 #define REC_VERSION_56_MAX_INDEX_COL_LEN	3072
70 
71 /** Innodb row types are a subset of the MySQL global enum row_type.
72 They are made into their own enum so that switch statements can account
73 for each of them. */
74 enum rec_format_enum {
75 	REC_FORMAT_REDUNDANT	= 0,	/*!< REDUNDANT row format */
76 	REC_FORMAT_COMPACT	= 1,	/*!< COMPACT row format */
77 	REC_FORMAT_COMPRESSED	= 2,	/*!< COMPRESSED row format */
78 	REC_FORMAT_DYNAMIC	= 3	/*!< DYNAMIC row format */
79 };
80 typedef enum rec_format_enum rec_format_t;
81 
82 #endif
83