~drizzle-trunk/drizzle/development

1089.1.11 by Brian Aker
Cleanup on enum
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2009 Sun Microsystems
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
21
#ifndef DRIZZLED_ENUM_H
22
#define DRIZZLED_ENUM_H
23
24
/**
25
  Query type constants.
26
27
  QT_ORDINARY -- ordinary SQL query.
28
  QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without
29
  character set introducers).
30
31
  @TODO
32
33
  Move this out of here once Stew's done with UDF breakout.  The following headers need it:
34
35
    sql_lex.h --> included by session.h
36
    item.h
37
    table.h
38
    item_func.h
39
    item_subselect.h
40
    item_timefunc.h
41
    item_sum.h
42
    item_cmpfunc.h
43
    item_strfunc.h
44
*/
45
enum enum_query_type
46
{
47
  QT_ORDINARY,
48
  QT_IS
49
};
50
51
52
/**
53
 * @TODO Move to a separate header?
54
 *
55
 * It's needed by item.h and field.h, which are both inter-dependent
56
 * and contain forward declarations of many structs/classes in the
57
 * other header file.
58
 *
59
 * What is needed is a separate header file that is included
60
 * by *both* item.h and field.h to resolve inter-dependencies
61
 *
62
 * But, probably want to hold off on this until Stew finished the UDF cleanup
63
 */
64
enum Derivation
65
{
66
  DERIVATION_IGNORABLE= 5,
67
  DERIVATION_COERCIBLE= 4,
68
  DERIVATION_SYSCONST= 3,
69
  DERIVATION_IMPLICIT= 2,
70
  DERIVATION_NONE= 1,
71
  DERIVATION_EXPLICIT= 0
72
};
73
74
enum enum_parsing_place
75
{
76
  NO_MATTER, 
77
  IN_HAVING, 
78
  SELECT_LIST, 
79
  IN_WHERE, 
1100.2.3 by Brian Aker
Remove final bits on SJ
80
  IN_ON 
81
};
1089.1.11 by Brian Aker
Cleanup on enum
82
83
enum enum_mysql_completiontype 
84
{
85
  ROLLBACK_RELEASE= -2, 
86
  ROLLBACK= 1, 
87
  ROLLBACK_AND_CHAIN= 7, 
88
  COMMIT_RELEASE= -1, 
89
  COMMIT= 0, 
90
  COMMIT_AND_CHAIN= 6
91
};
92
93
enum enum_check_fields
94
{
95
  CHECK_FIELD_IGNORE, 
96
  CHECK_FIELD_WARN, 
97
  CHECK_FIELD_ERROR_FOR_NULL
98
};
99
100
enum enum_var_type
101
{
102
  OPT_DEFAULT= 0, 
103
  OPT_SESSION, 
104
  OPT_GLOBAL
105
};
106
107
enum row_type 
108
{ 
109
  ROW_TYPE_NOT_USED=-1, 
110
  ROW_TYPE_DEFAULT, 
111
  ROW_TYPE_FIXED,
112
  ROW_TYPE_DYNAMIC, 
113
  ROW_TYPE_COMPRESSED,
114
  ROW_TYPE_REDUNDANT, 
115
  ROW_TYPE_COMPACT, 
116
  ROW_TYPE_PAGE 
117
};
118
119
enum column_format_type 
120
{
121
  COLUMN_FORMAT_TYPE_NOT_USED= -1,
122
  COLUMN_FORMAT_TYPE_DEFAULT= 0,
123
  COLUMN_FORMAT_TYPE_FIXED= 1,
124
  COLUMN_FORMAT_TYPE_DYNAMIC= 2 
125
};
126
127
128
/**
129
  Category of table found in the table share.
130
*/
131
enum enum_table_category
132
{
133
  /**
134
    Unknown value.
135
  */
136
  TABLE_UNKNOWN_CATEGORY=0,
137
138
  /**
139
    Temporary table.
140
    The table is visible only in the session.
141
    Therefore,
142
    - FLUSH TABLES WITH READ LOCK
143
    - SET GLOBAL READ_ONLY = ON
144
    do not apply to this table.
145
    Note that LOCK Table t FOR READ/WRITE
146
    can be used on temporary tables.
147
    Temporary tables are not part of the table cache.
148
  */
149
  TABLE_CATEGORY_TEMPORARY=1,
150
151
  /**
152
    User table.
153
    These tables do honor:
154
    - LOCK Table t FOR READ/WRITE
155
    - FLUSH TABLES WITH READ LOCK
156
    - SET GLOBAL READ_ONLY = ON
157
    User tables are cached in the table cache.
158
  */
159
  TABLE_CATEGORY_USER=2,
160
161
  /**
162
    Information schema tables.
163
    These tables are an interface provided by the system
164
    to inspect the system metadata.
165
    These tables do *not* honor:
166
    - LOCK Table t FOR READ/WRITE
167
    - FLUSH TABLES WITH READ LOCK
168
    - SET GLOBAL READ_ONLY = ON
169
    as there is no point in locking explicitely
170
    an INFORMATION_SCHEMA table.
171
    Nothing is directly written to information schema tables.
172
    Note that this value is not used currently,
173
    since information schema tables are not shared,
174
    but implemented as session specific temporary tables.
175
  */
176
  /*
177
    TODO: Fixing the performance issues of I_S will lead
178
    to I_S tables in the table cache, which should use
179
    this table type.
180
  */
181
  TABLE_CATEGORY_INFORMATION
182
};
183
184
enum enum_enable_or_disable 
185
{
186
  LEAVE_AS_IS, 
187
  ENABLE, 
188
  DISABLE 
189
};
190
191
192
enum enum_mark_columns
193
{ 
194
  MARK_COLUMNS_NONE, 
195
  MARK_COLUMNS_READ, 
196
  MARK_COLUMNS_WRITE
197
};
198
199
enum enum_filetype 
200
{ 
201
  FILETYPE_CSV, 
202
  FILETYPE_XML 
203
};
204
205
enum find_item_error_report_type 
206
{
207
  REPORT_ALL_ERRORS, 
208
  REPORT_EXCEPT_NOT_FOUND,
209
  IGNORE_ERRORS, 
210
  REPORT_EXCEPT_NON_UNIQUE,
211
  IGNORE_EXCEPT_NON_UNIQUE
212
};
213
214
enum tmp_table_type
215
{
1235.1.3 by Brian Aker
Remove the need for trans/non-trans temp tables for lock conditions.
216
  NO_TMP_TABLE,
217
  TEMP_TABLE,
218
  INTERNAL_TMP_TABLE,
1217.1.2 by Brian Aker
Remove dead TMP_TABLE_FRM_FILE_ONLY enum type for tmp tables.
219
  SYSTEM_TMP_TABLE
1089.1.11 by Brian Aker
Cleanup on enum
220
};
221
222
/*
223
  Values in this enum are used to indicate how a tables TIMESTAMP field
224
  should be treated. It can be set to the current timestamp on insert or
225
  update or both.
226
  WARNING: The values are used for bit operations. If you change the
227
  enum, you must keep the bitwise relation of the values. For example:
228
  (int) TIMESTAMP_AUTO_SET_ON_BOTH must be equal to
229
  (int) TIMESTAMP_AUTO_SET_ON_INSERT | (int) TIMESTAMP_AUTO_SET_ON_UPDATE.
230
  We use an enum here so that the debugger can display the value names.
231
*/
232
enum timestamp_auto_set_type
233
{
234
  TIMESTAMP_NO_AUTO_SET= 0, 
235
  TIMESTAMP_AUTO_SET_ON_INSERT= 1,
236
  TIMESTAMP_AUTO_SET_ON_UPDATE= 2, 
237
  TIMESTAMP_AUTO_SET_ON_BOTH= 3
238
};
239
240
enum enum_ha_read_modes 
241
{ 
242
  RFIRST, 
243
  RNEXT, 
244
  RPREV, 
245
  RLAST, 
246
  RKEY, 
247
  RNEXT_SAME 
248
};
249
250
enum enum_tx_isolation 
251
{
252
  ISO_READ_UNCOMMITTED, 
253
  ISO_READ_COMMITTED,
254
  ISO_REPEATABLE_READ, 
255
  ISO_SERIALIZABLE
256
};
257
258
259
enum SHOW_COMP_OPTION 
260
{ 
261
  SHOW_OPTION_YES, 
262
  SHOW_OPTION_NO, 
263
  SHOW_OPTION_DISABLED
264
};
265
266
/*
267
  When a command is added here, be sure it's also added in mysqld.cc
268
  in "struct show_var_st status_vars[]= {" ...
269
270
  If the command returns a result set or is not allowed in stored
271
  functions or triggers, please also make sure that
272
  sp_get_flags_for_command (sp_head.cc) returns proper flags for the
273
  added SQLCOM_.
274
*/
275
276
enum enum_sql_command {
277
  SQLCOM_SELECT, 
278
  SQLCOM_CREATE_TABLE, 
279
  SQLCOM_CREATE_INDEX, 
280
  SQLCOM_ALTER_TABLE,
281
  SQLCOM_UPDATE, 
282
  SQLCOM_INSERT, 
283
  SQLCOM_INSERT_SELECT,
284
  SQLCOM_DELETE, 
285
  SQLCOM_TRUNCATE, 
286
  SQLCOM_DROP_TABLE, 
287
  SQLCOM_DROP_INDEX,
288
  SQLCOM_SHOW_DATABASES, 
289
  SQLCOM_SHOW_TABLES, 
290
  SQLCOM_SHOW_FIELDS,
291
  SQLCOM_SHOW_KEYS, 
292
  SQLCOM_SHOW_VARIABLES, 
293
  SQLCOM_SHOW_STATUS,
294
  SQLCOM_SHOW_ENGINE_STATUS, 
295
  SQLCOM_SHOW_ENGINE_MUTEX,
296
  SQLCOM_SHOW_PROCESSLIST,
297
  SQLCOM_SHOW_CREATE,
298
  SQLCOM_SHOW_CREATE_DB,
299
  SQLCOM_SHOW_TABLE_STATUS,
300
  SQLCOM_LOAD,
301
  SQLCOM_SET_OPTION,
302
  SQLCOM_UNLOCK_TABLES,
303
  SQLCOM_CHANGE_DB, 
304
  SQLCOM_CREATE_DB, 
305
  SQLCOM_DROP_DB, 
306
  SQLCOM_ALTER_DB,
307
  SQLCOM_REPLACE, 
308
  SQLCOM_REPLACE_SELECT,
309
  SQLCOM_CHECK,
310
  SQLCOM_FLUSH, 
311
  SQLCOM_KILL, 
312
  SQLCOM_ANALYZE,
313
  SQLCOM_ROLLBACK, 
314
  SQLCOM_ROLLBACK_TO_SAVEPOINT,
315
  SQLCOM_COMMIT, 
316
  SQLCOM_SAVEPOINT, 
317
  SQLCOM_RELEASE_SAVEPOINT,
318
  SQLCOM_BEGIN,
319
  SQLCOM_RENAME_TABLE,
320
  SQLCOM_SHOW_OPEN_TABLES,
321
  SQLCOM_SHOW_WARNS,
322
  SQLCOM_EMPTY_QUERY,
323
  SQLCOM_SHOW_ERRORS,
324
  SQLCOM_CHECKSUM,
325
  /*
326
    When a command is added here, be sure it's also added in mysqld.cc
327
    in "struct show_var_st status_vars[]= {" ...
328
  */
329
  /* This should be the last !!! */
330
  SQLCOM_END
331
};
332
333
enum enum_duplicates 
334
{ 
335
  DUP_ERROR, 
336
  DUP_REPLACE, 
337
  DUP_UPDATE 
338
};
339
340
#endif /* DRIZZLED_ENUM_H */