~drizzle-trunk/drizzle/development

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
 */
1 by brian
clean slate
19
20
/**
21
  @file
22
23
  @details
24
  Mostly this file is used in the server. But a little part of it is used in
25
  mysqlbinlog too (definition of SELECT_DISTINCT and others).
243.1.11 by Jay Pipes
* Added include guards in a couple places, and removed unecessary
26
27
  @TODO Name this file better. "priv" could mean private, privileged, privileges.
1 by brian
clean slate
28
*/
29
575.4.7 by Monty Taylor
More header cleanup.
30
#ifndef DRIZZLED_SERVER_INCLUDES_H
31
#define DRIZZLED_SERVER_INCLUDES_H
1 by brian
clean slate
32
670.2.2 by Monty Taylor
Got rid of the rest of common_includes. Now on to server_includes.
33
/* Cross-platform portability code and standard includes */
34
#include <drizzled/global.h>
35
/* Contains system-wide constants and #defines */
36
#include <drizzled/definitions.h>
37
/* System-wide common data structures */
38
#include <drizzled/structs.h>
39
/* Defines for the storage engine handler -- i.e. HA_XXX defines */
40
/* Needed by field.h */
41
#include <drizzled/base.h>
42
43
/* Lots of system-wide struct definitions like IO_CACHE,
44
   prototypes for all my_* functions */
45
#include <mysys/my_sys.h>
46
/* Custom C string functions */
47
#include <mystrings/m_string.h>
48
49
/* The <strong>INTERNAL</strong> plugin API - not the external, or public, server plugin API */
50
#include <drizzled/sql_plugin.h>
243.1.16 by Jay Pipes
minor cleanup and final removal of all client and server prepared statement declarations and definitions
51
/* Range optimization API/library */
52
#include <drizzled/opt_range.h>
53
/* Simple error injection (crash) module */
54
#include <drizzled/error_injection.h>
243.1.17 by Jay Pipes
FINAL PHASE removal of mysql_priv.h (Bye, bye my friend.)
55
/* Routines for dropping, repairing, checking schema tables */
56
#include <drizzled/sql_table.h>
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
57
#include <drizzled/log.h>
58
59
#include <string>
670.3.1 by Toru Maesaka
Replaced MySQL's my_stpncpy() with libc and c++ calls
60
#include <sstream>
602.2.1 by Yoshinori Sano
The global variable sql_command_flags uses std::bitset.
61
#include <bitset>
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
62
670.2.1 by Monty Taylor
Moved pthread keys
63
670.2.2 by Monty Taylor
Got rid of the rest of common_includes. Now on to server_includes.
64
extern const CHARSET_INFO *system_charset_info, *files_charset_info ;
65
extern const CHARSET_INFO *national_charset_info, *table_alias_charset;
670.2.1 by Monty Taylor
Moved pthread keys
66
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
67
typedef class st_select_lex SELECT_LEX;
68
typedef struct st_mysql_lock DRIZZLE_LOCK;
69
typedef struct st_ha_create_information HA_CREATE_INFO;
243.1.17 by Jay Pipes
FINAL PHASE removal of mysql_priv.h (Bye, bye my friend.)
70
1 by brian
clean slate
71
/* information schema */
575.4.7 by Monty Taylor
More header cleanup.
72
static const std::string INFORMATION_SCHEMA_NAME("information_schema");
1 by brian
clean slate
73
74
75
76
/* mysqld.cc */
520.1.22 by Brian Aker
Second pass of thd cleanup
77
void refresh_status(Session *session);
575.4.4 by Yoshinori Sano
Rename mysql to drizzle.
78
bool drizzle_rm_tmp_tables(void);
520.1.22 by Brian Aker
Second pass of thd cleanup
79
void handle_connection_in_main_thread(Session *session);
80
void create_thread_to_handle_connection(Session *session);
81
void unlink_session(Session *session);
82
bool one_thread_per_connection_end(Session *session, bool put_in_cache);
1 by brian
clean slate
83
void flush_thread_cache();
84
85
/* item_func.cc */
86
extern bool check_reserved_words(LEX_STRING *name);
482 by Brian Aker
Remove uint.
87
extern enum_field_types agg_field_type(Item **items, uint32_t nitems);
1 by brian
clean slate
88
89
/* strfunc.cc */
482 by Brian Aker
Remove uint.
90
uint64_t find_set(TYPELIB *lib, const char *x, uint32_t length, const CHARSET_INFO * const cs,
91
		   char **err_pos, uint32_t *err_len, bool *set_warning);
92
uint32_t find_type(const TYPELIB *lib, const char *find, uint32_t length,
1 by brian
clean slate
93
               bool part_match);
482 by Brian Aker
Remove uint.
94
uint32_t find_type2(const TYPELIB *lib, const char *find, uint32_t length,
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
95
                const CHARSET_INFO *cs);
1 by brian
clean slate
96
void unhex_type2(TYPELIB *lib);
482 by Brian Aker
Remove uint.
97
uint32_t check_word(TYPELIB *lib, const char *val, const char *end,
1 by brian
clean slate
98
		const char **end_of_word);
99
int find_string_in_array(LEX_STRING * const haystack, LEX_STRING * const needle,
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
100
                         const CHARSET_INFO * const cs);
1 by brian
clean slate
101
102
482 by Brian Aker
Remove uint.
103
bool is_keyword(const char *name, uint32_t len);
1 by brian
clean slate
104
105
/*
106
  External variables
107
*/
108
680 by Brian Aker
Remove locks around temp tables for searching tmp directory path.
109
extern char *drizzle_tmpdir;
1 by brian
clean slate
110
extern const LEX_STRING command_name[];
111
extern const char *first_keyword, *my_localhost, *delayed_user, *binary_keyword;
112
extern const char *myisam_recover_options_str;
113
extern const char *in_left_expr_name, *in_additional_cond, *in_having_cond;
114
extern const char * const TRG_EXT;
115
extern const char * const TRN_EXT;
116
extern char language[FN_REFLEN];
575.4.1 by ysano
Rename mysql to drizzle.
117
extern char glob_hostname[FN_REFLEN], drizzle_home[FN_REFLEN];
1 by brian
clean slate
118
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
119
extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
120
extern const double log_10[309];
151 by Brian Aker
Ulonglong to uint64_t
121
extern uint64_t log_10_int[20];
122
extern uint64_t keybuff_size;
520.1.22 by Brian Aker
Second pass of thd cleanup
123
extern uint64_t session_startup_options;
1 by brian
clean slate
124
extern ulong thread_id;
625 by Brian Aker
ulong/64 bit straighten out.
125
extern uint64_t binlog_cache_use;
126
extern uint64_t binlog_cache_disk_use;
127
extern uint64_t aborted_threads;
128
extern uint64_t aborted_connects;
129
extern uint64_t slave_open_temp_tables;
626 by Brian Aker
More of the same (ulong/64)
130
extern uint64_t slow_launch_threads;
622.1.1 by Brian Aker
32bit fixes around vars
131
extern uint64_t slow_launch_time;
132
extern uint64_t table_cache_size;
133
extern uint64_t table_def_size;
134
extern uint64_t max_connections;
135
extern uint64_t max_connect_errors;
136
extern uint64_t connect_timeout;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
137
extern bool slave_allow_batching;
622.1.1 by Brian Aker
32bit fixes around vars
138
extern uint64_t slave_net_timeout;
139
extern uint64_t slave_trans_retries;
482 by Brian Aker
Remove uint.
140
extern uint32_t max_user_connections;
622.1.1 by Brian Aker
32bit fixes around vars
141
extern ulong what_to_log;
142
extern uint64_t binlog_cache_size;
143
extern uint64_t max_binlog_cache_size;
625 by Brian Aker
ulong/64 bit straighten out.
144
extern uint64_t open_files_limit;
622.1.1 by Brian Aker
32bit fixes around vars
145
extern uint64_t max_binlog_size;
146
extern uint64_t max_relay_log_size;
626 by Brian Aker
More of the same (ulong/64)
147
extern uint64_t opt_binlog_rows_event_max_size;
622.1.1 by Brian Aker
32bit fixes around vars
148
extern uint64_t thread_pool_size;
626 by Brian Aker
More of the same (ulong/64)
149
extern uint32_t back_log;
606 by Brian Aker
Remove dead lex structure and clean up use of pid_t
150
extern pid_t current_pid;
622.1.1 by Brian Aker
32bit fixes around vars
151
extern uint64_t expire_logs_days;
152
extern uint64_t sync_binlog_period;
625 by Brian Aker
ulong/64 bit straighten out.
153
extern uint64_t tc_log_max_pages_used;
154
extern uint64_t tc_log_page_size;
155
extern uint64_t opt_tc_log_size;
156
extern uint64_t tc_log_page_waits;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
157
extern bool relay_log_purge;
198 by Brian Aker
More my_bool... man am I getting tired of writing this.
158
extern bool opt_innodb_safe_binlog, opt_innodb;
482 by Brian Aker
Remove uint.
159
extern uint32_t test_flags,select_errors,ha_open_options;
574.2.1 by ysano
Rename mysql to drizzle.
160
extern uint32_t protocol_version, drizzled_port, dropping_tables;
482 by Brian Aker
Remove uint.
161
extern uint32_t delay_key_write_options;
1 by brian
clean slate
162
extern bool opt_endinfo, using_udf_functions;
150 by Brian Aker
More bool removal. More cow bell!
163
extern bool locked_in_memory;
1 by brian
clean slate
164
extern bool opt_using_transactions;
30 by Brian Aker
Large file and ftruncate() support
165
extern bool using_update_log, server_id_supplied;
1 by brian
clean slate
166
extern bool opt_update_log, opt_bin_log, opt_error_log;
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
167
extern bool opt_log;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
168
extern bool opt_slow_log;
1 by brian
clean slate
169
extern ulong log_output_options;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
170
extern bool opt_log_queries_not_using_indexes;
150 by Brian Aker
More bool removal. More cow bell!
171
extern bool opt_character_set_client_handshake;
1 by brian
clean slate
172
extern bool volatile abort_loop, shutdown_in_progress;
482 by Brian Aker
Remove uint.
173
extern uint32_t volatile thread_count, thread_running, global_read_lock;
174
extern uint32_t connection_count;
150 by Brian Aker
More bool removal. More cow bell!
175
extern bool opt_sql_bin_update;
176
extern bool opt_safe_user_create;
198 by Brian Aker
More my_bool... man am I getting tired of writing this.
177
extern bool opt_no_mix_types;
178
extern bool opt_safe_show_db, opt_myisam_use_mmap;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
179
extern bool opt_local_infile;
180
extern bool opt_slave_compressed_protocol;
150 by Brian Aker
More bool removal. More cow bell!
181
extern bool use_temp_pool;
1 by brian
clean slate
182
extern ulong slave_exec_mode_options;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
183
extern bool opt_readonly;
1 by brian
clean slate
184
extern char* opt_secure_file_priv;
150 by Brian Aker
More bool removal. More cow bell!
185
extern bool opt_noacl;
186
extern bool opt_old_style_user_limits;
482 by Brian Aker
Remove uint.
187
extern uint32_t opt_crash_binlog_innodb;
1 by brian
clean slate
188
extern char *default_tz_name;
189
extern char *opt_logname, *opt_slow_logname;
190
extern const char *log_output_str;
191
586.1.1 by Yoshinori Sano
Rename mysql to drizzle, specifically mysql_bin_log to drizzle_bin_log.
192
extern DRIZZLE_BIN_LOG drizzle_bin_log;
327.2.4 by Brian Aker
Refactoring table.h
193
extern TableList general_log, slow_log;
1 by brian
clean slate
194
extern FILE *stderror_file;
575.4.4 by Yoshinori Sano
Rename mysql to drizzle.
195
extern pthread_mutex_t LOCK_drizzle_create_db,LOCK_open, LOCK_lock_db,
327.2.2 by Brian Aker
Removed dead/not used code.
196
       LOCK_thread_count,LOCK_user_locks, LOCK_status,
1 by brian
clean slate
197
       LOCK_error_log, LOCK_uuid_generator,
12 by Brian Aker
More dead code removal.
198
       LOCK_crypt, LOCK_timezone,
160 by Brian Aker
Removed sql_manager. Ever heard of just setting up the OS to sync when you
199
       LOCK_slave_list, LOCK_active_mi, LOCK_global_read_lock,
1 by brian
clean slate
200
       LOCK_global_system_variables, LOCK_user_conn,
201
       LOCK_bytes_sent, LOCK_bytes_received, LOCK_connection_count;
202
extern pthread_mutex_t LOCK_server_started;
658 by Brian Aker
Part removal of my_pthread.h
203
extern pthread_rwlock_t LOCK_sys_init_connect;
204
extern pthread_rwlock_t LOCK_sys_init_slave;
205
extern pthread_rwlock_t LOCK_system_variables_hash;
1 by brian
clean slate
206
extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager;
207
extern pthread_cond_t COND_global_read_lock;
208
extern pthread_attr_t connection_attrib;
520.1.21 by Brian Aker
THD -> Session rename
209
extern I_List<Session> threads;
1 by brian
clean slate
210
extern MY_BITMAP temp_pool;
211
extern String my_empty_string;
212
extern const String my_null_string;
213
extern SHOW_VAR status_vars[];
214
extern struct system_variables max_system_variables;
215
extern struct system_status_var global_status_var;
216
extern struct rand_struct sql_rand;
217
218
extern const char *opt_date_time_formats[];
219
extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
220
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
221
extern Table *unused_tables;
1 by brian
clean slate
222
extern const char* any_db;
223
extern struct my_option my_long_options[];
224
extern const LEX_STRING view_type;
225
extern TYPELIB thread_handling_typelib;
206 by Brian Aker
Removed final uint dead types.
226
extern uint8_t uc_update_queries[SQLCOM_END+1];
590.2.18 by Monty Taylor
Changed the bitset<32> to a bitset<5>. Made the int constants into bitset constants.
227
extern std::bitset<5> sql_command_flags[];
1 by brian
clean slate
228
extern TYPELIB log_output_typelib;
229
230
/* optional things, have_* variables */
231
extern SHOW_COMP_OPTION have_community_features;
232
233
extern handlerton *myisam_hton;
234
extern handlerton *heap_hton;
235
177.3.1 by mark
remove ifdef HAVE_DLOPEN, make configure require dlopen()
236
extern SHOW_COMP_OPTION have_symlink;
1 by brian
clean slate
237
extern SHOW_COMP_OPTION have_compress;
238
239
240
extern pthread_t signal_thread;
241
242
243
/* table.cc */
327.2.4 by Brian Aker
Refactoring table.h
244
TABLE_SHARE *alloc_table_share(TableList *table_list, char *key,
482 by Brian Aker
Remove uint.
245
                               uint32_t key_length);
520.1.22 by Brian Aker
Second pass of thd cleanup
246
void init_tmp_table_share(Session *session, TABLE_SHARE *share, const char *key,
482 by Brian Aker
Remove uint.
247
                          uint32_t key_length,
1 by brian
clean slate
248
                          const char *table_name, const char *path);
249
void free_table_share(TABLE_SHARE *share);
520.1.22 by Brian Aker
Second pass of thd cleanup
250
int open_table_def(Session *session, TABLE_SHARE *share, uint32_t db_flags);
1 by brian
clean slate
251
void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg);
520.1.22 by Brian Aker
Second pass of thd cleanup
252
int open_table_from_share(Session *session, TABLE_SHARE *share, const char *alias,
482 by Brian Aker
Remove uint.
253
                          uint32_t db_stat, uint32_t prgflag, uint32_t ha_open_flags,
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
254
                          Table *outparam, open_table_mode open_mode);
481 by Brian Aker
Remove all of uchar.
255
int readfrm(const char *name, unsigned char **data, size_t *length);
256
int writefrm(const char* name, const unsigned char* data, size_t len);
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
257
int closefrm(Table *table, bool free_share);
481 by Brian Aker
Remove all of uchar.
258
int read_string(File file, unsigned char* *to, size_t length);
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
259
void free_blobs(Table *table);
1 by brian
clean slate
260
int set_zone(int nr,int min_zone,int max_zone);
520.1.6 by Brian Aker
Fixed ulong in time calculation.
261
uint32_t convert_period_to_month(uint32_t period);
262
uint32_t convert_month_to_period(uint32_t month);
482 by Brian Aker
Remove uint.
263
void get_date_from_daynr(long daynr,uint32_t *year, uint32_t *month,
264
			 uint32_t *day);
520.1.22 by Brian Aker
Second pass of thd cleanup
265
my_time_t TIME_to_timestamp(Session *session, const DRIZZLE_TIME *t, bool *not_exist);
482 by Brian Aker
Remove uint.
266
bool str_to_time_with_warn(const char *str,uint32_t length,DRIZZLE_TIME *l_time);
267
enum enum_drizzle_timestamp_type str_to_datetime_with_warn(const char *str, uint32_t length,
268
                                         DRIZZLE_TIME *l_time, uint32_t flags);
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
269
void localtime_to_TIME(DRIZZLE_TIME *to, struct tm *from);
270
void calc_time_from_sec(DRIZZLE_TIME *to, long seconds, long microseconds);
1 by brian
clean slate
271
520.1.22 by Brian Aker
Second pass of thd cleanup
272
void make_truncated_value_warning(Session *session, DRIZZLE_ERROR::enum_warning_level level,
1 by brian
clean slate
273
                                  const char *str_val,
482 by Brian Aker
Remove uint.
274
				  uint32_t str_length, enum enum_drizzle_timestamp_type time_type,
1 by brian
clean slate
275
                                  const char *field_name);
276
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
277
bool date_add_interval(DRIZZLE_TIME *ltime, interval_type int_type, INTERVAL interval);
278
bool calc_time_diff(DRIZZLE_TIME *l_time1, DRIZZLE_TIME *l_time2, int l_sign,
152 by Brian Aker
longlong replacement
279
                    int64_t *seconds_out, long *microseconds_out);
1 by brian
clean slate
280
281
extern LEX_STRING interval_type_to_name[];
282
398.1.1 by Monty Taylor
Remove typedef enum enum_drizzle_timestamp_type timestamp_type;
283
extern DATE_TIME_FORMAT *date_time_format_make(enum enum_drizzle_timestamp_type format_type,
1 by brian
clean slate
284
					       const char *format_str,
482 by Brian Aker
Remove uint.
285
					       uint32_t format_length);
520.1.22 by Brian Aker
Second pass of thd cleanup
286
extern DATE_TIME_FORMAT *date_time_format_copy(Session *session,
1 by brian
clean slate
287
					       DATE_TIME_FORMAT *format);
288
const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
398.1.1 by Monty Taylor
Remove typedef enum enum_drizzle_timestamp_type timestamp_type;
289
				                             enum enum_drizzle_timestamp_type type);
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
290
void make_datetime(const DATE_TIME_FORMAT *format, const DRIZZLE_TIME *l_time,
1 by brian
clean slate
291
                   String *str);
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
292
void make_date(const DATE_TIME_FORMAT *format, const DRIZZLE_TIME *l_time,
293
               String *str);
294
void make_time(const DATE_TIME_FORMAT *format, const DRIZZLE_TIME *l_time,
295
               String *str);
296
int my_time_compare(DRIZZLE_TIME *a, DRIZZLE_TIME *b);
520.1.22 by Brian Aker
Second pass of thd cleanup
297
uint64_t get_datetime_value(Session *session, Item ***item_arg, Item **cache_arg,
1 by brian
clean slate
298
                             Item *warn_item, bool *is_null);
299
300
int test_if_number(char *str,int *res,bool allow_wildcards);
481 by Brian Aker
Remove all of uchar.
301
void change_byte(unsigned char *,uint,char,char);
520.1.22 by Brian Aker
Second pass of thd cleanup
302
void init_read_record(READ_RECORD *info, Session *session, Table *reg_form,
1 by brian
clean slate
303
		      SQL_SELECT *select,
304
		      int use_record_cache, bool print_errors);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
305
void init_read_record_idx(READ_RECORD *info, Session *session, Table *table,
482 by Brian Aker
Remove uint.
306
                          bool print_error, uint32_t idx);
1 by brian
clean slate
307
void end_read_record(READ_RECORD *info);
520.1.22 by Brian Aker
Second pass of thd cleanup
308
ha_rows filesort(Session *session, Table *form,struct st_sort_field *sortorder,
482 by Brian Aker
Remove uint.
309
		 uint32_t s_length, SQL_SELECT *select,
1 by brian
clean slate
310
		 ha_rows max_rows, bool sort_positions,
311
                 ha_rows *examined_rows);
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
312
void filesort_free_buffers(Table *table, bool full);
481 by Brian Aker
Remove all of uchar.
313
void change_double_for_sort(double nr,unsigned char *to);
152 by Brian Aker
longlong replacement
314
double my_double_round(double value, int64_t dec, bool dec_unsigned,
1 by brian
clean slate
315
                       bool truncate);
316
int get_quick_record(SQL_SELECT *select);
317
318
int calc_weekday(long daynr,bool sunday_first_day_of_week);
482 by Brian Aker
Remove uint.
319
uint32_t calc_week(DRIZZLE_TIME *l_time, uint32_t week_behaviour, uint32_t *year);
320
void find_date(char *pos,uint32_t *vek,uint32_t flag);
1 by brian
clean slate
321
TYPELIB *convert_strings_to_array_type(char * *typelibs, char * *end);
322
TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings);
481 by Brian Aker
Remove all of uchar.
323
ulong get_form_pos(File file, unsigned char *head, TYPELIB *save_names);
324
ulong make_new_entry(File file,unsigned char *fileinfo,TYPELIB *formnames,
1 by brian
clean slate
325
		     const char *newname);
326
ulong next_io_size(ulong pos);
482 by Brian Aker
Remove uint.
327
void append_unescaped(String *res, const char *pos, uint32_t length);
520.1.22 by Brian Aker
Second pass of thd cleanup
328
int create_frm(Session *session, const char *name, const char *db, const char *table,
482 by Brian Aker
Remove uint.
329
               uint32_t reclength, unsigned char *fileinfo,
330
	       HA_CREATE_INFO *create_info, uint32_t keys, KEY *key_info);
584.2.7 by Stewart Smith
rename and delete tabledefinition protobuf file
331
int rename_table_proto_file(const char *from, const char* to);
332
int delete_table_proto_file(char *file_name);
1 by brian
clean slate
333
int rename_file_ext(const char * from,const char * to,const char * ext);
334
bool check_db_name(LEX_STRING *db);
335
bool check_column_name(const char *name);
482 by Brian Aker
Remove uint.
336
bool check_table_name(const char *name, uint32_t length);
1 by brian
clean slate
337
char *get_field(MEM_ROOT *mem, Field *field);
338
bool get_field(MEM_ROOT *mem, Field *field, class String *res);
339
char *fn_rext(char *name);
340
341
/* Conversion functions */
482 by Brian Aker
Remove uint.
342
uint32_t build_table_filename(char *buff, size_t bufflen, const char *db,
343
                          const char *table, const char *ext, uint32_t flags);
1 by brian
clean slate
344
345
#define MYSQL50_TABLE_NAME_PREFIX         "#mysql50#"
534 by Monty Taylor
Removed stxnmov. Also deleted strstr which had already been removed.
346
#define MYSQL50_TABLE_NAME_PREFIX_LENGTH  sizeof(MYSQL50_TABLE_NAME_PREFIX)
1 by brian
clean slate
347
348
/* Flags for conversion functions. */
349
#define FN_FROM_IS_TMP  (1 << 0)
350
#define FN_TO_IS_TMP    (1 << 1)
351
#define FN_IS_TMP       (FN_FROM_IS_TMP | FN_TO_IS_TMP)
352
#define NO_FRM_RENAME   (1 << 2)
353
354
251 by Brian Aker
Cleanup around rand.
355
inline ulong sql_rnd()
1 by brian
clean slate
356
{
251 by Brian Aker
Cleanup around rand.
357
  ulong tmp= (ulong) (rand() * 0xffffffff); /* make all bits random */
358
1 by brian
clean slate
359
  return tmp;
360
}
361
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
362
1 by brian
clean slate
363
364
/**
365
  convert a hex digit into number.
366
*/
367
368
inline int hexchar_to_int(char c)
369
{
370
  if (c <= '9' && c >= '0')
371
    return c-'0';
372
  c|=32;
373
  if (c <= 'f' && c >= 'a')
374
    return c-'a'+10;
375
  return -1;
376
}
377
378
243.1.17 by Jay Pipes
FINAL PHASE removal of mysql_priv.h (Bye, bye my friend.)
379
#endif /* DRIZZLE_SERVER_SERVER_INCLUDES_H */