~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
/**
75
 * Opening modes for open_temporary_table and open_table_from_share
76
 *
77
 * @TODO Put this into an appropriate header. It is only needed in:
78
 *
79
 *    table.cc
80
 *    sql_base.cc
81
 */
82
enum open_table_mode
83
{
84
  OTM_OPEN= 0,
85
  OTM_CREATE= 1,
86
  OTM_ALTER= 2
87
};
88
89
enum enum_parsing_place
90
{
91
  NO_MATTER, 
92
  IN_HAVING, 
93
  SELECT_LIST, 
94
  IN_WHERE, 
1100.2.3 by Brian Aker
Remove final bits on SJ
95
  IN_ON 
96
};
1089.1.11 by Brian Aker
Cleanup on enum
97
98
enum enum_mysql_completiontype 
99
{
100
  ROLLBACK_RELEASE= -2, 
101
  ROLLBACK= 1, 
102
  ROLLBACK_AND_CHAIN= 7, 
103
  COMMIT_RELEASE= -1, 
104
  COMMIT= 0, 
105
  COMMIT_AND_CHAIN= 6
106
};
107
108
enum enum_check_fields
109
{
110
  CHECK_FIELD_IGNORE, 
111
  CHECK_FIELD_WARN, 
112
  CHECK_FIELD_ERROR_FOR_NULL
113
};
114
115
enum enum_var_type
116
{
117
  OPT_DEFAULT= 0, 
118
  OPT_SESSION, 
119
  OPT_GLOBAL
120
};
121
122
enum row_type 
123
{ 
124
  ROW_TYPE_NOT_USED=-1, 
125
  ROW_TYPE_DEFAULT, 
126
  ROW_TYPE_FIXED,
127
  ROW_TYPE_DYNAMIC, 
128
  ROW_TYPE_COMPRESSED,
129
  ROW_TYPE_REDUNDANT, 
130
  ROW_TYPE_COMPACT, 
131
  ROW_TYPE_PAGE 
132
};
133
134
enum column_format_type 
135
{
136
  COLUMN_FORMAT_TYPE_NOT_USED= -1,
137
  COLUMN_FORMAT_TYPE_DEFAULT= 0,
138
  COLUMN_FORMAT_TYPE_FIXED= 1,
139
  COLUMN_FORMAT_TYPE_DYNAMIC= 2 
140
};
141
142
143
/**
144
  Category of table found in the table share.
145
*/
146
enum enum_table_category
147
{
148
  /**
149
    Unknown value.
150
  */
151
  TABLE_UNKNOWN_CATEGORY=0,
152
153
  /**
154
    Temporary table.
155
    The table is visible only in the session.
156
    Therefore,
157
    - FLUSH TABLES WITH READ LOCK
158
    - SET GLOBAL READ_ONLY = ON
159
    do not apply to this table.
160
    Note that LOCK Table t FOR READ/WRITE
161
    can be used on temporary tables.
162
    Temporary tables are not part of the table cache.
163
  */
164
  TABLE_CATEGORY_TEMPORARY=1,
165
166
  /**
167
    User table.
168
    These tables do honor:
169
    - LOCK Table t FOR READ/WRITE
170
    - FLUSH TABLES WITH READ LOCK
171
    - SET GLOBAL READ_ONLY = ON
172
    User tables are cached in the table cache.
173
  */
174
  TABLE_CATEGORY_USER=2,
175
176
  /**
177
    Information schema tables.
178
    These tables are an interface provided by the system
179
    to inspect the system metadata.
180
    These tables do *not* honor:
181
    - LOCK Table t FOR READ/WRITE
182
    - FLUSH TABLES WITH READ LOCK
183
    - SET GLOBAL READ_ONLY = ON
184
    as there is no point in locking explicitely
185
    an INFORMATION_SCHEMA table.
186
    Nothing is directly written to information schema tables.
187
    Note that this value is not used currently,
188
    since information schema tables are not shared,
189
    but implemented as session specific temporary tables.
190
  */
191
  /*
192
    TODO: Fixing the performance issues of I_S will lead
193
    to I_S tables in the table cache, which should use
194
    this table type.
195
  */
196
  TABLE_CATEGORY_INFORMATION
197
};
198
199
enum enum_enable_or_disable 
200
{
201
  LEAVE_AS_IS, 
202
  ENABLE, 
203
  DISABLE 
204
};
205
206
207
enum enum_mark_columns
208
{ 
209
  MARK_COLUMNS_NONE, 
210
  MARK_COLUMNS_READ, 
211
  MARK_COLUMNS_WRITE
212
};
213
214
enum enum_filetype 
215
{ 
216
  FILETYPE_CSV, 
217
  FILETYPE_XML 
218
};
219
220
enum find_item_error_report_type 
221
{
222
  REPORT_ALL_ERRORS, 
223
  REPORT_EXCEPT_NOT_FOUND,
224
  IGNORE_ERRORS, 
225
  REPORT_EXCEPT_NON_UNIQUE,
226
  IGNORE_EXCEPT_NON_UNIQUE
227
};
228
229
enum enum_schema_table_state
230
{
231
  NOT_PROCESSED= 0,
232
  PROCESSED_BY_CREATE_SORT_INDEX,
233
  PROCESSED_BY_JOIN_EXEC
234
};
235
236
237
enum tmp_table_type
238
{
239
  NO_TMP_TABLE, 
240
  NON_TRANSACTIONAL_TMP_TABLE, 
241
  TRANSACTIONAL_TMP_TABLE,
242
  INTERNAL_TMP_TABLE, 
243
  SYSTEM_TMP_TABLE, 
244
  TMP_TABLE_FRM_FILE_ONLY
245
};
246
247
/*
248
  Values in this enum are used to indicate how a tables TIMESTAMP field
249
  should be treated. It can be set to the current timestamp on insert or
250
  update or both.
251
  WARNING: The values are used for bit operations. If you change the
252
  enum, you must keep the bitwise relation of the values. For example:
253
  (int) TIMESTAMP_AUTO_SET_ON_BOTH must be equal to
254
  (int) TIMESTAMP_AUTO_SET_ON_INSERT | (int) TIMESTAMP_AUTO_SET_ON_UPDATE.
255
  We use an enum here so that the debugger can display the value names.
256
*/
257
enum timestamp_auto_set_type
258
{
259
  TIMESTAMP_NO_AUTO_SET= 0, 
260
  TIMESTAMP_AUTO_SET_ON_INSERT= 1,
261
  TIMESTAMP_AUTO_SET_ON_UPDATE= 2, 
262
  TIMESTAMP_AUTO_SET_ON_BOTH= 3
263
};
264
265
enum enum_ha_read_modes 
266
{ 
267
  RFIRST, 
268
  RNEXT, 
269
  RPREV, 
270
  RLAST, 
271
  RKEY, 
272
  RNEXT_SAME 
273
};
274
275
enum enum_tx_isolation 
276
{
277
  ISO_READ_UNCOMMITTED, 
278
  ISO_READ_COMMITTED,
279
  ISO_REPEATABLE_READ, 
280
  ISO_SERIALIZABLE
281
};
282
283
284
enum SHOW_COMP_OPTION 
285
{ 
286
  SHOW_OPTION_YES, 
287
  SHOW_OPTION_NO, 
288
  SHOW_OPTION_DISABLED
289
};
290
291
/*
292
  When a command is added here, be sure it's also added in mysqld.cc
293
  in "struct show_var_st status_vars[]= {" ...
294
295
  If the command returns a result set or is not allowed in stored
296
  functions or triggers, please also make sure that
297
  sp_get_flags_for_command (sp_head.cc) returns proper flags for the
298
  added SQLCOM_.
299
*/
300
301
enum enum_sql_command {
302
  SQLCOM_SELECT, 
303
  SQLCOM_CREATE_TABLE, 
304
  SQLCOM_CREATE_INDEX, 
305
  SQLCOM_ALTER_TABLE,
306
  SQLCOM_UPDATE, 
307
  SQLCOM_INSERT, 
308
  SQLCOM_INSERT_SELECT,
309
  SQLCOM_DELETE, 
310
  SQLCOM_TRUNCATE, 
311
  SQLCOM_DROP_TABLE, 
312
  SQLCOM_DROP_INDEX,
313
  SQLCOM_SHOW_DATABASES, 
314
  SQLCOM_SHOW_TABLES, 
315
  SQLCOM_SHOW_FIELDS,
316
  SQLCOM_SHOW_KEYS, 
317
  SQLCOM_SHOW_VARIABLES, 
318
  SQLCOM_SHOW_STATUS,
319
  SQLCOM_SHOW_ENGINE_STATUS, 
320
  SQLCOM_SHOW_ENGINE_MUTEX,
321
  SQLCOM_SHOW_PROCESSLIST,
322
  SQLCOM_SHOW_CREATE,
323
  SQLCOM_SHOW_CREATE_DB,
324
  SQLCOM_SHOW_TABLE_STATUS,
325
  SQLCOM_LOAD,
326
  SQLCOM_SET_OPTION,
327
  SQLCOM_UNLOCK_TABLES,
328
  SQLCOM_CHANGE_DB, 
329
  SQLCOM_CREATE_DB, 
330
  SQLCOM_DROP_DB, 
331
  SQLCOM_ALTER_DB,
332
  SQLCOM_REPLACE, 
333
  SQLCOM_REPLACE_SELECT,
334
  SQLCOM_OPTIMIZE, 
335
  SQLCOM_CHECK,
336
  SQLCOM_FLUSH, 
337
  SQLCOM_KILL, 
338
  SQLCOM_ANALYZE,
339
  SQLCOM_ROLLBACK, 
340
  SQLCOM_ROLLBACK_TO_SAVEPOINT,
341
  SQLCOM_COMMIT, 
342
  SQLCOM_SAVEPOINT, 
343
  SQLCOM_RELEASE_SAVEPOINT,
344
  SQLCOM_BEGIN,
345
  SQLCOM_RENAME_TABLE,
346
  SQLCOM_SHOW_OPEN_TABLES,
347
  SQLCOM_SHOW_WARNS,
348
  SQLCOM_EMPTY_QUERY,
349
  SQLCOM_SHOW_ERRORS,
350
  SQLCOM_CHECKSUM,
351
  /*
352
    When a command is added here, be sure it's also added in mysqld.cc
353
    in "struct show_var_st status_vars[]= {" ...
354
  */
355
  /* This should be the last !!! */
356
  SQLCOM_END
357
};
358
359
enum enum_duplicates 
360
{ 
361
  DUP_ERROR, 
362
  DUP_REPLACE, 
363
  DUP_UPDATE 
364
};
365
366
367
#endif /* DRIZZLED_ENUM_H */