390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
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 |
*/
|
|
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
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
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
29 |
* #ifdef DRIZZLE_SERVER blocks which made it very difficult to determine
|
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
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 |
||
390.1.6
by Monty Taylor
Oh dear god the changes. The changes. I'd tell you what they are, but I'd just be making stuff up. Suffice it to day it's mostly all around splitting files in libdrizzle into different files and removing interdepends. And whatever else I happened to see... |
38 |
|
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
39 |
/* Cross-platform portability code and standard includes */
|
40 |
#include <drizzled/global.h> |
|
41 |
/* Server versioning information and defines */
|
|
42 |
#include <drizzled/version.h> |
|
373.1.8
by Monty Taylor
Removed DYNAMIC_STRING. |
43 |
/* Lots of system-wide struct definitions like IO_CACHE, prototypes for all my_* functions */
|
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
44 |
#include <mysys/my_sys.h> |
45 |
/* Convenience functions for working with times */
|
|
383.1.17
by Brian Aker
Cleanup of time code (moved into mysys) |
46 |
#include <mysys/my_time.h> |
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
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> |
|
373.1.5
by Monty Taylor
Removed templated Dynamic_array class - we don't need it. |
63 |
/* Array of pointers to Elem that uses memory from MEM_ROOT */
|
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
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
|
|
139.1.11
by Trond Norbye
Allow compilation without dtrace probes on Solaris |
88 |
#else
|
89 |
#undef _DTRACE_VERSION
|
|
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
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 |
||
264.1.6
by Monty Taylor
Merged from Jay. |
177 |
extern const CHARSET_INFO *system_charset_info, *files_charset_info ; |
178 |
extern const CHARSET_INFO *national_charset_info, *table_alias_charset; |
|
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
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 |
||
327.2.4
by Brian Aker
Refactoring table.h |
251 |
class TableList; |
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
252 |
class String; |
327.1.1
by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure). |
253 |
class Table; |
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
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 |
||
322.2.5
by Mats Kindahl
Replaced use of thd_proc_info() macro with calls to |
265 |
extern "C" void set_thd_proc_info(THD *thd, const char *info); |
266 |
extern "C" const char *get_thd_proc_info(THD *thd); |
|
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
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" |
|
347
by Monty Taylor
Fixed a few build oopses for out-of-tree builds. |
279 |
#include <drizzled/table_list.h> |
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
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 |
*/
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
310 |
#if defined DRIZZLE_SERVER || defined INNODB_COMPATIBILITY_HOOKS
|
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
311 |
bool check_global_access(THD *thd, ulong want_access); |
482
by Brian Aker
Remove uint. |
312 |
int get_quote_char_for_identifier(THD *thd, const char *name, uint32_t length); |
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
313 |
extern struct system_variables global_system_variables; |
482
by Brian Aker
Remove uint. |
314 |
extern uint32_t mysql_data_home_len; |
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
315 |
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH], |
316 |
mysql_real_data_home[], mysql_unpacked_real_data_home[]; |
|
264.1.6
by Monty Taylor
Merged from Jay. |
317 |
extern const CHARSET_INFO *character_set_filesystem; |
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
318 |
extern char reg_ext[FN_EXTLEN]; |
482
by Brian Aker
Remove uint. |
319 |
extern uint32_t reg_ext_length; |
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
320 |
extern ulong specialflag; |
482
by Brian Aker
Remove uint. |
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); |
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
327 |
#endif /* DRIZZLE_SERVER || INNODB_COMPATIBILITY_HOOKS */ |
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
328 |
|
390.1.6
by Monty Taylor
Oh dear god the changes. The changes. I'd tell you what they are, but I'd just be making stuff up. Suffice it to day it's mostly all around splitting files in libdrizzle into different files and removing interdepends. And whatever else I happened to see... |
329 |
|
243.1.15
by Jay Pipes
Added new non-server, non-client common includes header, new show.h and connect.h headers |
330 |
#endif /* DRIZZLE_SERVER_COMMON_INCLUDES_H */ |