~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/common_includes.h

  • Committer: Brian Aker
  • Date: 2008-07-14 22:40:46 UTC
  • Revision ID: brian@tangent.org-20080714224046-x183907w9wp1txwv
Removed sql_manager. Ever heard of just setting up the OS to sync when you
want it to?

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 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; version 2 of the License.
9
 
 *
10
 
 *  This program is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with this program; if not, write to the Free Software
17
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 */
19
 
 
20
 
/**
21
 
 * @file
22
 
 * 
23
 
 * Contains #includes and definitions that apply to ALL server-related
24
 
 * executables, including storage engine plugins.
25
 
 *
26
 
 * @details
27
 
 *
28
 
 * Previously, the mysql_priv.h file contained a number of conditional
29
 
 * #ifdef DRIZZLE_SERVER blocks which made it very difficult to determine
30
 
 * which headers and definitions were actually necessary for plugins to 
31
 
 * include.  The file, and NOT mysql_priv.h, should now be the main included
32
 
 * header for storage engine plugins, as it contains all definitions and 
33
 
 * declarations needed by the plugin and nothing more.
34
 
 */
35
 
#ifndef DRIZZLE_SERVER_COMMON_INCLUDES_H
36
 
#define DRIZZLE_SERVER_COMMON_INCLUDES_H
37
 
 
38
 
 
39
 
/* Cross-platform portability code and standard includes */
40
 
#include <drizzled/global.h>                    
41
 
/* Server versioning information and defines */
42
 
#include <drizzled/version.h>                   
43
 
/* Lots of system-wide struct definitions like IO_CACHE, prototypes for all my_* functions */
44
 
#include <mysys/my_sys.h>                       
45
 
/* Convenience functions for working with times */
46
 
#include <mysys/my_time.h>
47
 
/* Custom C string functions */
48
 
#include <mystrings/m_string.h>
49
 
/* Custom HASH API */
50
 
#include <mysys/hash.h>
51
 
/* Standard signals API */
52
 
#include <signal.h>
53
 
/* Deadlock-free table-list lock API */
54
 
#include <mysys/thr_lock.h>
55
 
/* Custom error API */
56
 
#include <drizzled/error.h>
57
 
/* Defines for the storage engine handler -- i.e. HA_XXX defines */
58
 
#include <drizzled/base.h>                                      /* Needed by field.h */
59
 
/* Custom queue API */
60
 
#include <mysys/queues.h>
61
 
/* Custom Bitmap API */
62
 
#include <drizzled/sql_bitmap.h>
63
 
/* Array of pointers to Elem that uses memory from MEM_ROOT */
64
 
#include "sql_array.h"
65
 
/* The <strong>INTERNAL</strong> plugin API - not the external, or public, server plugin API */
66
 
#include "sql_plugin.h"
67
 
/* The <strong>connection</strong> thread scheduler API */
68
 
#include "scheduler.h"
69
 
/* Network database operations (hostent, netent, servent, etc...*/
70
 
#include <netdb.h>
71
 
/* Definitions that the client and the server have in common */
72
 
#include <libdrizzle/drizzle_com.h>
73
 
/* gettext() convenience wrappers */
74
 
#include <libdrizzle/gettext.h>
75
 
/* Contains system-wide constants and #defines */
76
 
#include <drizzled/definitions.h>
77
 
/* System-wide common data structures */
78
 
#include <drizzled/structs.h>
79
 
/* Custom error definitions */
80
 
#include <drizzled/error.h>
81
 
/* Custom continguous-section memory allocator */
82
 
#include <drizzled/sql_alloc.h>
83
 
/* Definition of the MY_LOCALE struct and some convenience functions */
84
 
#include <drizzled/sql_locale.h>
85
 
 
86
 
#ifdef HAVE_DTRACE
87
 
#define _DTRACE_VERSION 1
88
 
#else
89
 
#undef _DTRACE_VERSION
90
 
#endif
91
 
#include "probes.h"
92
 
 
93
 
/**
94
 
  Query type constants.
95
 
 
96
 
  QT_ORDINARY -- ordinary SQL query.
97
 
  QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without
98
 
  character set introducers).
99
 
 
100
 
  @TODO
101
 
 
102
 
  Move this out of here once Stew's done with UDF breakout.  The following headers need it:
103
 
 
104
 
    sql_lex.h --> included by sql_class.h
105
 
    item.h
106
 
    table.h
107
 
    item_func.h
108
 
    item_subselect.h
109
 
    item_timefunc.h
110
 
    item_sum.h
111
 
    item_cmpfunc.h
112
 
    item_strfunc.h
113
 
*/
114
 
enum enum_query_type
115
 
{
116
 
  QT_ORDINARY,
117
 
  QT_IS
118
 
};
119
 
 
120
 
/** 
121
 
 * @TODO convert all these three maps to Bitmap classes 
122
 
 *
123
 
 * @TODO Move these to a more appropriate header file (maps.h?).  The following files use them:
124
 
 *
125
 
 *    item_sum.h
126
 
 *    item_compfunc.h
127
 
 *    item.h
128
 
 *    table.h
129
 
 *    item_subselect.h
130
 
 *    sql_bitmap.h
131
 
 *    unireg.h (going bye bye?)
132
 
 *    sql_udf.h
133
 
 *    item_row.h
134
 
 *    handler.cc
135
 
 *    sql_insert.cc
136
 
 *    opt_range.h
137
 
 *    opt_sum.cc
138
 
 *    item_strfunc.h
139
 
 *    sql_delete.cc
140
 
 *    sql_select.h
141
 
 *
142
 
 *    Since most of these include table.h, I think that would appropriate...
143
 
 */
144
 
typedef uint64_t table_map;          /* Used for table bits in join */
145
 
#if MAX_INDEXES <= 64
146
 
typedef Bitmap<64>  key_map;          /* Used for finding keys */
147
 
#else
148
 
typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */
149
 
#endif
150
 
typedef uint32_t nesting_map;  /* Used for flags of nesting constructs */
151
 
 
152
 
/*
153
 
  Used to identify NESTED_JOIN structures within a join (applicable only to
154
 
  structures that have not been simplified away and embed more the one
155
 
  element)
156
 
*/
157
 
typedef uint64_t nested_join_map; /* Needed by sql_select.h and table.h */
158
 
 
159
 
/* useful constants */#
160
 
extern const key_map key_map_empty;
161
 
extern key_map key_map_full;          /* Should be threaded as const */
162
 
extern const char *primary_key_name;
163
 
 
164
 
/**
165
 
 * @TODO Move the following into a drizzled.h header?
166
 
 *
167
 
 * I feel that global variables and functions referencing them directly
168
 
 * and that are used only in the server should be separated out into 
169
 
 * a drizzled.h header file -- JRP
170
 
 */
171
 
typedef uint64_t query_id_t;
172
 
extern query_id_t global_query_id;
173
 
 
174
 
/* increment query_id and return it.  */
175
 
inline query_id_t next_query_id() { return global_query_id++; }
176
 
 
177
 
extern const CHARSET_INFO *system_charset_info, *files_charset_info ;
178
 
extern const CHARSET_INFO *national_charset_info, *table_alias_charset;
179
 
 
180
 
/**
181
 
 * @TODO Move to a separate header?
182
 
 *
183
 
 * It's needed by item.h and field.h, which are both inter-dependent
184
 
 * and contain forward declarations of many structs/classes in the
185
 
 * other header file.
186
 
 *
187
 
 * What is needed is a separate header file that is included
188
 
 * by *both* item.h and field.h to resolve inter-dependencies
189
 
 *
190
 
 * But, probably want to hold off on this until Stew finished the UDF cleanup
191
 
 */
192
 
enum Derivation
193
 
{
194
 
  DERIVATION_IGNORABLE= 5,
195
 
  DERIVATION_COERCIBLE= 4,
196
 
  DERIVATION_SYSCONST= 3,
197
 
  DERIVATION_IMPLICIT= 2,
198
 
  DERIVATION_NONE= 1,
199
 
  DERIVATION_EXPLICIT= 0
200
 
};
201
 
 
202
 
/**
203
 
 * Opening modes for open_temporary_table and open_table_from_share
204
 
 *
205
 
 * @TODO Put this into an appropriate header. It is only needed in:
206
 
 *
207
 
 *    table.cc
208
 
 *    sql_base.cc
209
 
 */
210
 
enum open_table_mode
211
 
{
212
 
  OTM_OPEN= 0,
213
 
  OTM_CREATE= 1,
214
 
  OTM_ALTER= 2
215
 
};
216
 
 
217
 
enum enum_parsing_place
218
 
{
219
 
  NO_MATTER
220
 
  , IN_HAVING
221
 
  , SELECT_LIST
222
 
  , IN_WHERE
223
 
  , IN_ON
224
 
};
225
 
 
226
 
enum enum_mysql_completiontype {
227
 
  ROLLBACK_RELEASE= -2
228
 
  , ROLLBACK= 1
229
 
  , ROLLBACK_AND_CHAIN= 7
230
 
  , COMMIT_RELEASE= -1
231
 
  , COMMIT= 0
232
 
  , COMMIT_AND_CHAIN= 6
233
 
};
234
 
 
235
 
enum enum_check_fields
236
 
{
237
 
  CHECK_FIELD_IGNORE
238
 
  , CHECK_FIELD_WARN
239
 
  , CHECK_FIELD_ERROR_FOR_NULL
240
 
};
241
 
 
242
 
enum enum_var_type
243
 
{
244
 
  OPT_DEFAULT= 0
245
 
  , OPT_SESSION
246
 
  , OPT_GLOBAL
247
 
};
248
 
 
249
 
/* Forward declarations */
250
 
 
251
 
class TableList;
252
 
class String;
253
 
class Table;
254
 
class THD;
255
 
class user_var_entry;
256
 
class Security_context;
257
 
 
258
 
extern pthread_key(THD*, THR_THD);
259
 
inline THD *_current_thd(void)
260
 
{
261
 
  return (THD *)pthread_getspecific(THR_THD);
262
 
}
263
 
#define current_thd _current_thd()
264
 
 
265
 
extern "C" void set_thd_proc_info(THD *thd, const char *info);
266
 
extern "C" const char *get_thd_proc_info(THD *thd);
267
 
 
268
 
/*
269
 
  External variables
270
 
*/
271
 
extern ulong server_id;
272
 
 
273
 
/* Custom C++-style String class API */
274
 
#include <drizzled/sql_string.h>
275
 
/* Custom singly-linked list lite struct and full-blown type-safe, templatized class */
276
 
#include <drizzled/sql_list.h>
277
 
#include "my_decimal.h"
278
 
#include "handler.h"
279
 
#include <drizzled/table_list.h>
280
 
#include "sql_error.h"
281
 
/* Drizzle server data type class definitions */
282
 
#include <drizzled/field.h>
283
 
#include "protocol.h"
284
 
#include "item.h"
285
 
 
286
 
extern my_decimal decimal_zero;
287
 
 
288
 
/** @TODO Find a good header to put this guy... */
289
 
void close_thread_tables(THD *thd);
290
 
 
291
 
#include <drizzled/sql_parse.h>
292
 
 
293
 
#include "sql_class.h"
294
 
#include "slave.h" // for tables_ok(), rpl_filter
295
 
#include "tztime.h"
296
 
 
297
 
void sql_perror(const char *message);
298
 
 
299
 
bool fn_format_relative_to_data_home(char * to, const char *name,
300
 
                                     const char *dir, const char *extension);
301
 
 
302
 
/**
303
 
 * @TODO
304
 
 *
305
 
 * This is much better than the previous situation of a crap-ton
306
 
 * of conditional defines all over mysql_priv.h, but this still
307
 
 * is hackish.  Put these things into a separate header?  Or fix
308
 
 * InnoDB?  Or does the InnoDB plugin already fix this stuff?
309
 
 */
310
 
#if defined DRIZZLE_SERVER || defined INNODB_COMPATIBILITY_HOOKS
311
 
bool check_global_access(THD *thd, ulong want_access);
312
 
int get_quote_char_for_identifier(THD *thd, const char *name, uint32_t length);
313
 
extern struct system_variables global_system_variables;
314
 
extern uint32_t mysql_data_home_len;
315
 
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
316
 
            mysql_real_data_home[], mysql_unpacked_real_data_home[];
317
 
extern const CHARSET_INFO *character_set_filesystem;
318
 
extern char reg_ext[FN_EXTLEN];
319
 
extern uint32_t reg_ext_length;
320
 
extern ulong specialflag;
321
 
extern uint32_t lower_case_table_names;
322
 
uint32_t strconvert(const CHARSET_INFO *from_cs, const char *from,
323
 
                const CHARSET_INFO *to_cs, char *to, uint32_t to_length,
324
 
                uint32_t *errors);
325
 
uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length);
326
 
uint32_t tablename_to_filename(const char *from, char *to, uint32_t to_length);
327
 
#endif /* DRIZZLE_SERVER || INNODB_COMPATIBILITY_HOOKS */
328
 
 
329
 
 
330
 
#endif /* DRIZZLE_SERVER_COMMON_INCLUDES_H */