1 /*
2    Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License, version 2.0,
6    as published by the Free Software Foundation.
7 
8    This program is also distributed with certain software (including
9    but not limited to OpenSSL) that is licensed under separate terms,
10    as designated in a particular file or component or in included license
11    documentation.  The authors of MySQL hereby grant you an additional
12    permission to link the program and your derivative works with the
13    separately licensed software that they have included with MySQL.
14 
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License, version 2.0, for more details.
19 
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
23 */
24 
25 /**
26  * @file ndb_constants.h
27  *
28  * Constants common to NDB API and NDB kernel.
29  * Changing the values makes database upgrade impossible.
30  *
31  * New or removed definitions must be replicated to
32  * NdbDictionary.hpp and NdbSqlUtil.hpp.
33  *
34  * Not for use by application programs.
35  * Use the enums provided by NdbDictionary instead.
36  */
37 
38 #ifndef NDB_CONSTANTS_H
39 #define NDB_CONSTANTS_H
40 
41 /*
42  * Data type constants.
43  */
44 
45 #define NDB_TYPE_UNDEFINED              0
46 
47 #define NDB_TYPE_TINYINT                1
48 #define NDB_TYPE_TINYUNSIGNED           2
49 #define NDB_TYPE_SMALLINT               3
50 #define NDB_TYPE_SMALLUNSIGNED          4
51 #define NDB_TYPE_MEDIUMINT              5
52 #define NDB_TYPE_MEDIUMUNSIGNED         6
53 #define NDB_TYPE_INT                    7
54 #define NDB_TYPE_UNSIGNED               8
55 #define NDB_TYPE_BIGINT                 9
56 #define NDB_TYPE_BIGUNSIGNED            10
57 #define NDB_TYPE_FLOAT                  11
58 #define NDB_TYPE_DOUBLE                 12
59 #define NDB_TYPE_OLDDECIMAL             13
60 #define NDB_TYPE_CHAR                   14
61 #define NDB_TYPE_VARCHAR                15
62 #define NDB_TYPE_BINARY                 16
63 #define NDB_TYPE_VARBINARY              17
64 #define NDB_TYPE_DATETIME               18
65 #define NDB_TYPE_DATE                   19
66 #define NDB_TYPE_BLOB                   20
67 #define NDB_TYPE_TEXT                   21
68 #define NDB_TYPE_BIT                    22
69 #define NDB_TYPE_LONGVARCHAR            23
70 #define NDB_TYPE_LONGVARBINARY          24
71 #define NDB_TYPE_TIME                   25
72 #define NDB_TYPE_YEAR                   26
73 #define NDB_TYPE_TIMESTAMP              27
74 #define NDB_TYPE_OLDDECIMALUNSIGNED     28
75 #define NDB_TYPE_DECIMAL                29
76 #define NDB_TYPE_DECIMALUNSIGNED        30
77 #define NDB_TYPE_TIME2                  31
78 #define NDB_TYPE_DATETIME2              32
79 #define NDB_TYPE_TIMESTAMP2             33
80 
81 #define NDB_TYPE_MAX                    34
82 
83 
84 /*
85  * Attribute array type.
86  */
87 
88 #define NDB_ARRAYTYPE_FIXED             0 /* 0 length bytes */
89 #define NDB_ARRAYTYPE_SHORT_VAR         1 /* 1 length bytes */
90 #define NDB_ARRAYTYPE_MEDIUM_VAR        2 /* 2 length bytes */
91 #define NDB_ARRAYTYPE_NONE_VAR          3 /* 0 length bytes */
92 
93 /*
94  * Attribute storage type.
95  */
96 
97 #define NDB_STORAGETYPE_MEMORY          0
98 #define NDB_STORAGETYPE_DISK            1
99 #define NDB_STORAGETYPE_DEFAULT         2 /* not set */
100 
101 /*
102  * Table temporary status.
103  */
104 #define NDB_TEMP_TAB_PERMANENT          0
105 #define NDB_TEMP_TAB_TEMPORARY          1
106 
107 /*
108  * Table single user mode
109  */
110 #define NDB_SUM_LOCKED       0
111 #define NDB_SUM_READONLY     1
112 #define NDB_SUM_READ_WRITE   2
113 
114 /**
115  * *No* nodegroup
116  */
117 #define NDB_NO_NODEGROUP     65536
118 
119 /*
120  * SYSTAB_0 reserved keys
121  */
122 #define NDB_BACKUP_SEQUENCE 0x1F000000
123 
124 /**
125  * Defines for index statistics
126  */
127 #define NDB_INDEX_STAT_DB     "mysql"
128 #define NDB_INDEX_STAT_SCHEMA "def"
129 
130 #define NDB_INDEX_STAT_HEAD_TABLE    "ndb_index_stat_head"
131 #define NDB_INDEX_STAT_SAMPLE_TABLE  "ndb_index_stat_sample"
132 #define NDB_INDEX_STAT_SAMPLE_INDEX1 "ndb_index_stat_sample_x1"
133 #define NDB_INDEX_STAT_HEAD_EVENT    "ndb_index_stat_head_event"
134 
135 #define NDB_INDEX_STAT_PREFIX        "ndb_index_stat"
136 
137 /**
138  * Defines for NDB$INFO.OPERATIONS
139  */
140 #define NDB_INFO_OP_UNKNOWN  0
141 #define NDB_INFO_OP_READ     1
142 #define NDB_INFO_OP_READ_SH  2
143 #define NDB_INFO_OP_READ_EX  3
144 #define NDB_INFO_OP_INSERT   4
145 #define NDB_INFO_OP_UPDATE   5
146 #define NDB_INFO_OP_DELETE   6
147 #define NDB_INFO_OP_WRITE    7
148 #define NDB_INFO_OP_UNLOCK   8
149 #define NDB_INFO_OP_REFRESH  9
150 #define NDB_INFO_OP_SCAN_UNKNOWN (256 + 0)
151 #define NDB_INFO_OP_SCAN         (256 + 1)
152 #define NDB_INFO_OP_SCAN_SH      (256 + 2)
153 #define NDB_INFO_OP_SCAN_EX      (256 + 3)
154 
155 /**
156  * FK actions
157  */
158 #define NDB_FK_NO_ACTION   0
159 #define NDB_FK_RESTRICT    1
160 #define NDB_FK_CASCADE     2
161 #define NDB_FK_SET_NULL    3
162 #define NDB_FK_SET_DEFAULT 4
163 
164 #endif
165