~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/server_includes.h

Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
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
 
 * Various server-wide declarations and variables.
24
 
 */
25
 
 
26
 
#ifndef DRIZZLED_SERVER_INCLUDES_H
27
 
#define DRIZZLED_SERVER_INCLUDES_H
28
 
 
29
 
/* Cross-platform portability code and standard includes */
30
 
#include <drizzled/global.h>
31
 
/* Contains system-wide constants and #defines */
32
 
#include <drizzled/definitions.h>
33
 
 
34
 
/* Lots of system-wide struct definitions like IO_CACHE,
35
 
   prototypes for all my_* functions */
36
 
#include <mysys/my_sys.h>
37
 
/* Custom C string functions */
38
 
#include <mystrings/m_string.h>
39
 
#include <drizzled/sql_string.h>
40
 
 
41
 
/* Routines for dropping, repairing, checking schema tables */
42
 
#include <drizzled/sql_table.h>
43
 
 
44
 
/* Routines for printing error messages */
45
 
#include <drizzled/errmsg_print.h>
46
 
 
47
 
/* for List */
48
 
#include <drizzled/sql_list.h>
49
 
 
50
 
#include <string>
51
 
#include <vector>
52
 
#include <sstream>
53
 
#include <bitset>
54
 
 
55
 
typedef struct st_ha_create_information HA_CREATE_INFO;
56
 
typedef struct drizzle_lex_string LEX_STRING;
57
 
 
58
 
/* information schema */
59
 
extern const std::string INFORMATION_SCHEMA_NAME;
60
 
 
61
 
/* drizzled.cc */
62
 
void refresh_status(Session *session);
63
 
void unlink_session(Session *session);
64
 
 
65
 
/* item_func.cc */
66
 
extern bool check_reserved_words(LEX_STRING *name);
67
 
 
68
 
/* strfunc.cc */
69
 
uint64_t find_set(TYPELIB *lib, const char *x, uint32_t length, const CHARSET_INFO * const cs,
70
 
                   char **err_pos, uint32_t *err_len, bool *set_warning);
71
 
uint32_t find_type(const TYPELIB *lib, const char *find, uint32_t length,
72
 
               bool part_match);
73
 
uint32_t find_type2(const TYPELIB *lib, const char *find, uint32_t length,
74
 
                const CHARSET_INFO *cs);
75
 
 
76
 
extern const std::string &drizzled_version();
77
 
 
78
 
/*
79
 
  External variables
80
 
*/
81
 
 
82
 
extern const CHARSET_INFO *system_charset_info;
83
 
extern const CHARSET_INFO *files_charset_info;
84
 
extern const CHARSET_INFO *table_alias_charset;
85
 
 
86
 
extern char *drizzle_tmpdir;
87
 
extern const LEX_STRING command_name[];
88
 
extern const char *first_keyword;
89
 
extern const char *binary_keyword;
90
 
extern const char *in_left_expr_name;
91
 
extern const char *in_additional_cond;
92
 
extern const char *in_having_cond;
93
 
extern char language[FN_REFLEN];
94
 
extern char glob_hostname[FN_REFLEN];
95
 
extern char drizzle_home[FN_REFLEN];
96
 
extern char pidfile_name[FN_REFLEN];
97
 
extern char system_time_zone[30];
98
 
extern char *opt_tc_log_file;
99
 
extern const double log_10[309];
100
 
extern uint64_t session_startup_options;
101
 
extern uint32_t global_thread_id;
102
 
extern uint64_t aborted_threads;
103
 
extern uint64_t aborted_connects;
104
 
extern uint64_t table_cache_size;
105
 
extern size_t table_def_size;
106
 
extern uint64_t max_connect_errors;
107
 
extern uint32_t back_log;
108
 
extern pid_t current_pid;
109
 
extern std::bitset<12> test_flags;
110
 
extern uint32_t ha_open_options;
111
 
extern char *drizzled_bind_host;
112
 
extern uint32_t drizzled_bind_timeout;
113
 
extern uint32_t dropping_tables;
114
 
extern bool opt_endinfo;
115
 
extern bool locked_in_memory;
116
 
extern bool volatile abort_loop;
117
 
extern bool volatile shutdown_in_progress;
118
 
extern uint32_t volatile thread_running;
119
 
extern uint32_t volatile global_read_lock;
120
 
extern bool opt_readonly;
121
 
extern char* opt_secure_file_priv;
122
 
extern char *default_tz_name;
123
 
 
124
 
extern FILE *stderror_file;
125
 
extern pthread_mutex_t LOCK_create_db;
126
 
extern pthread_mutex_t LOCK_open;
127
 
extern pthread_mutex_t LOCK_thread_count;
128
 
extern pthread_mutex_t LOCK_status;
129
 
extern pthread_mutex_t LOCK_global_read_lock;
130
 
extern pthread_mutex_t LOCK_global_system_variables;
131
 
 
132
 
extern pthread_rwlock_t LOCK_system_variables_hash;
133
 
extern pthread_cond_t COND_refresh;
134
 
extern pthread_cond_t COND_thread_count;
135
 
extern pthread_cond_t COND_global_read_lock;
136
 
extern pthread_attr_t connection_attrib;
137
 
extern std::vector<Session *> session_list;
138
 
extern String my_empty_string;
139
 
extern const String my_null_string;
140
 
extern struct system_variables max_system_variables;
141
 
extern struct system_status_var global_status_var;
142
 
 
143
 
extern Table *unused_tables;
144
 
extern struct my_option my_long_options[];
145
 
extern std::bitset<5> sql_command_flags[];
146
 
 
147
 
namespace drizzled { namespace plugin { class StorageEngine; } }
148
 
class TableList;
149
 
class TableShare;
150
 
class DRIZZLE_ERROR;
151
 
 
152
 
extern drizzled::plugin::StorageEngine *myisam_engine;
153
 
extern drizzled::plugin::StorageEngine *heap_engine;
154
 
 
155
 
extern SHOW_COMP_OPTION have_symlink;
156
 
 
157
 
extern pthread_t signal_thread;
158
 
 
159
 
/* table.cc */
160
 
TableShare *alloc_table_share(TableList *table_list, char *key,
161
 
                               uint32_t key_length);
162
 
int open_table_def(Session& session, TableShare *share);
163
 
void open_table_error(TableShare *share, int error, int db_errno, int errarg);
164
 
int open_table_from_share(Session *session, TableShare *share, const char *alias,
165
 
                          uint32_t db_stat, uint32_t prgflag, uint32_t ha_open_flags,
166
 
                          Table *outparam);
167
 
void free_blobs(Table *table);
168
 
int set_zone(int nr,int min_zone,int max_zone);
169
 
uint32_t convert_period_to_month(uint32_t period);
170
 
uint32_t convert_month_to_period(uint32_t month);
171
 
 
172
 
int test_if_number(char *str,int *res,bool allow_wildcards);
173
 
void change_byte(unsigned char *,uint,char,char);
174
 
 
175
 
namespace drizzled { namespace optimizer { class SqlSelect; } }
176
 
 
177
 
ha_rows filesort(Session *session,
178
 
                 Table *form,
179
 
                 struct st_sort_field *sortorder,
180
 
                             uint32_t s_length,
181
 
                 drizzled::optimizer::SqlSelect *select,
182
 
                             ha_rows max_rows,
183
 
                 bool sort_positions,
184
 
                 ha_rows *examined_rows);
185
 
 
186
 
void filesort_free_buffers(Table *table, bool full);
187
 
void change_double_for_sort(double nr,unsigned char *to);
188
 
double my_double_round(double value, int64_t dec, bool dec_unsigned,
189
 
                       bool truncate);
190
 
int get_quick_record(drizzled::optimizer::SqlSelect *select);
191
 
 
192
 
void find_date(char *pos,uint32_t *vek,uint32_t flag);
193
 
TYPELIB *convert_strings_to_array_type(char * *typelibs, char * *end);
194
 
TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings);
195
 
ulong get_form_pos(File file, unsigned char *head, TYPELIB *save_names);
196
 
ulong next_io_size(ulong pos);
197
 
void append_unescaped(String *res, const char *pos, uint32_t length);
198
 
 
199
 
 
200
 
int rename_file_ext(const char * from,const char * to,const char * ext);
201
 
bool check_column_name(const char *name);
202
 
bool check_table_name(const char *name, uint32_t length);
203
 
 
204
 
/* Conversion functions */
205
 
size_t build_tmptable_filename(char *buff, size_t bufflen);
206
 
size_t build_table_filename(char *buff, size_t bufflen, const char *db,
207
 
                            const char *table_name, bool is_tmp);
208
 
 
209
 
/* Flags for conversion functions. */
210
 
#define FN_FROM_IS_TMP  (1 << 0)
211
 
#define FN_TO_IS_TMP    (1 << 1)
212
 
 
213
 
inline uint32_t sql_rnd()
214
 
{
215
 
  return (uint32_t) (rand() * 0xffffffff); /* make all bits random */
216
 
}
217
 
 
218
 
/**
219
 
  convert a hex digit into number.
220
 
*/
221
 
inline int hexchar_to_int(char c)
222
 
{
223
 
  if (c <= '9' && c >= '0')
224
 
    return c-'0';
225
 
  c|=32;
226
 
  if (c <= 'f' && c >= 'a')
227
 
    return c-'a'+10;
228
 
  return -1;
229
 
}
230
 
 
231
 
#endif /* DRIZZLED_SERVER_INCLUDES_H */