1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
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.
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.
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
23
* Contains #includes and definitions that apply to ALL server-related
24
* executables, including storage engine plugins.
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.
35
#ifndef DRIZZLE_SERVER_COMMON_INCLUDES_H
36
#define DRIZZLE_SERVER_COMMON_INCLUDES_H
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>
50
#include <mysys/hash.h>
51
/* Standard signals API */
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...*/
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>
87
#define _DTRACE_VERSION 1
89
#undef _DTRACE_VERSION
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).
102
Move this out of here once Stew's done with UDF breakout. The following headers need it:
104
sql_lex.h --> included by sql_class.h
121
* @TODO convert all these three maps to Bitmap classes
123
* @TODO Move these to a more appropriate header file (maps.h?). The following files use them:
131
* unireg.h (going bye bye?)
142
* Since most of these include table.h, I think that would appropriate...
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 */
148
typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */
150
typedef uint32_t nesting_map; /* Used for flags of nesting constructs */
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
157
typedef uint64_t nested_join_map; /* Needed by sql_select.h and table.h */
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;
165
* @TODO Move the following into a drizzled.h header?
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
171
typedef uint64_t query_id_t;
172
extern query_id_t global_query_id;
174
/* increment query_id and return it. */
175
inline query_id_t next_query_id() { return global_query_id++; }
177
extern const CHARSET_INFO *system_charset_info, *files_charset_info ;
178
extern const CHARSET_INFO *national_charset_info, *table_alias_charset;
181
* @TODO Move to a separate header?
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
187
* What is needed is a separate header file that is included
188
* by *both* item.h and field.h to resolve inter-dependencies
190
* But, probably want to hold off on this until Stew finished the UDF cleanup
194
DERIVATION_IGNORABLE= 5,
195
DERIVATION_COERCIBLE= 4,
196
DERIVATION_SYSCONST= 3,
197
DERIVATION_IMPLICIT= 2,
199
DERIVATION_EXPLICIT= 0
203
* Opening modes for open_temporary_table and open_table_from_share
205
* @TODO Put this into an appropriate header. It is only needed in:
217
enum enum_parsing_place
226
enum enum_mysql_completiontype {
229
, ROLLBACK_AND_CHAIN= 7
232
, COMMIT_AND_CHAIN= 6
235
enum enum_check_fields
239
, CHECK_FIELD_ERROR_FOR_NULL
249
/* Forward declarations */
255
class user_var_entry;
256
class Security_context;
258
extern pthread_key(THD*, THR_THD);
259
inline THD *_current_thd(void)
261
return (THD *)pthread_getspecific(THR_THD);
263
#define current_thd _current_thd()
265
extern "C" void set_thd_proc_info(THD *thd, const char *info);
266
extern "C" const char *get_thd_proc_info(THD *thd);
271
extern ulong server_id;
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"
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"
286
extern my_decimal decimal_zero;
288
/** @TODO Find a good header to put this guy... */
289
void close_thread_tables(THD *thd);
291
#include <drizzled/sql_parse.h>
293
#include "sql_class.h"
294
#include "slave.h" // for tables_ok(), rpl_filter
297
void sql_perror(const char *message);
299
bool fn_format_relative_to_data_home(char * to, const char *name,
300
const char *dir, const char *extension);
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?
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,
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 */
330
#endif /* DRIZZLE_SERVER_COMMON_INCLUDES_H */