~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
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
33
/**
575.4.6 by Monty Taylor
Removed my_getwd.
34
 * Contains all headers, definitions, and declarations common to
35
 * the server and the plugin infrastructure, and not the client
243.1.14 by Jay Pipes
* Ensured all drizzled/field/x.cc files to include mysql_priv.h
36
 */
575.4.6 by Monty Taylor
Removed my_getwd.
37
#include <drizzled/common_includes.h>
243.1.16 by Jay Pipes
minor cleanup and final removal of all client and server prepared statement declarations and definitions
38
/* Range optimization API/library */
39
#include <drizzled/opt_range.h>
40
/* Simple error injection (crash) module */
41
#include <drizzled/error_injection.h>
42
/* API for connecting, logging in to a drizzled server */
43
#include <drizzled/connect.h>
243.1.17 by Jay Pipes
FINAL PHASE removal of mysql_priv.h (Bye, bye my friend.)
44
/* Routines for dropping, repairing, checking schema tables */
45
#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.
46
#include <drizzled/log.h>
47
48
#include <string>
602.2.1 by Yoshinori Sano
The global variable sql_command_flags uses std::bitset.
49
#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.
50
51
typedef class st_select_lex SELECT_LEX;
52
typedef struct st_mysql_lock DRIZZLE_LOCK;
53
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.)
54
1 by brian
clean slate
55
/* information schema */
575.4.7 by Monty Taylor
More header cleanup.
56
static const std::string INFORMATION_SCHEMA_NAME("information_schema");
1 by brian
clean slate
57
58
59
#define is_schema_db(X) \
60
  !my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X))
61
62
/* sql_calc.cc */
63
bool eval_const_cond(COND *cond);
64
65
66
/* sql_test.cc */
67
void print_where(COND *cond,const char *info, enum_query_type query_type);
68
void print_cached_tables(void);
482 by Brian Aker
Remove uint.
69
void print_plan(JOIN* join,uint32_t idx, double record_count, double read_time,
1 by brian
clean slate
70
                double current_read_time, const char *info);
71
void print_keyuse_array(DYNAMIC_ARRAY *keyuse_array);
327.2.4 by Brian Aker
Refactoring table.h
72
void dump_TableList_graph(SELECT_LEX *select_lex, TableList* tl);
1 by brian
clean slate
73
void mysql_print_status();
74
75
/* key.cc */
482 by Brian Aker
Remove uint.
76
int find_ref_key(KEY *key, uint32_t key_count, unsigned char *record, Field *field,
77
                 uint32_t *key_length, uint32_t *keypart);
78
void key_copy(unsigned char *to_key, unsigned char *from_record, KEY *key_info, uint32_t key_length);
481 by Brian Aker
Remove all of uchar.
79
void key_restore(unsigned char *to_record, unsigned char *from_key, KEY *key_info,
287.3.8 by Monty Taylor
Oy. Replaced max and min macros with std::max and std::min so that we get
80
                 uint16_t key_length);
481 by Brian Aker
Remove all of uchar.
81
void key_zero_nulls(unsigned char *tuple, KEY *key_info);
482 by Brian Aker
Remove uint.
82
bool key_cmp_if_same(Table *form,const unsigned char *key,uint32_t index,uint32_t key_length);
83
void key_unpack(String *to,Table *form,uint32_t index);
84
bool is_key_used(Table *table, uint32_t idx, const MY_BITMAP *fields);
85
int key_cmp(KEY_PART_INFO *key_part, const unsigned char *key, uint32_t key_length);
481 by Brian Aker
Remove all of uchar.
86
extern "C" int key_rec_cmp(void *key_info, unsigned char *a, unsigned char *b);
1 by brian
clean slate
87
88
bool init_errmessage(void);
89
File open_binlog(IO_CACHE *log, const char *log_file_name,
90
                 const char **errmsg);
91
92
/* mysqld.cc */
520.1.22 by Brian Aker
Second pass of thd cleanup
93
void refresh_status(Session *session);
575.4.4 by Yoshinori Sano
Rename mysql to drizzle.
94
bool drizzle_rm_tmp_tables(void);
520.1.22 by Brian Aker
Second pass of thd cleanup
95
void handle_connection_in_main_thread(Session *session);
96
void create_thread_to_handle_connection(Session *session);
97
void unlink_session(Session *session);
98
bool one_thread_per_connection_end(Session *session, bool put_in_cache);
1 by brian
clean slate
99
void flush_thread_cache();
100
101
/* item_func.cc */
102
extern bool check_reserved_words(LEX_STRING *name);
482 by Brian Aker
Remove uint.
103
extern enum_field_types agg_field_type(Item **items, uint32_t nitems);
1 by brian
clean slate
104
105
/* strfunc.cc */
482 by Brian Aker
Remove uint.
106
uint64_t find_set(TYPELIB *lib, const char *x, uint32_t length, const CHARSET_INFO * const cs,
107
		   char **err_pos, uint32_t *err_len, bool *set_warning);
108
uint32_t find_type(const TYPELIB *lib, const char *find, uint32_t length,
1 by brian
clean slate
109
               bool part_match);
482 by Brian Aker
Remove uint.
110
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.
111
                const CHARSET_INFO *cs);
1 by brian
clean slate
112
void unhex_type2(TYPELIB *lib);
482 by Brian Aker
Remove uint.
113
uint32_t check_word(TYPELIB *lib, const char *val, const char *end,
1 by brian
clean slate
114
		const char **end_of_word);
115
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.
116
                         const CHARSET_INFO * const cs);
1 by brian
clean slate
117
118
482 by Brian Aker
Remove uint.
119
bool is_keyword(const char *name, uint32_t len);
1 by brian
clean slate
120
121
/*
122
  External variables
123
*/
124
125
extern time_t server_start_time, flush_status_time;
575.4.3 by ysano
Rename mysql to drizzle.
126
extern char *opt_drizzle_tmpdir;
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.
127
575.4.3 by ysano
Rename mysql to drizzle.
128
#define drizzle_tmpdir (my_tmpdir(&drizzle_tmpdir_list))
129
extern MY_TMPDIR drizzle_tmpdir_list;
1 by brian
clean slate
130
extern const LEX_STRING command_name[];
131
extern const char *first_keyword, *my_localhost, *delayed_user, *binary_keyword;
132
extern const char *myisam_recover_options_str;
133
extern const char *in_left_expr_name, *in_additional_cond, *in_having_cond;
134
extern const char * const TRG_EXT;
135
extern const char * const TRN_EXT;
136
extern char language[FN_REFLEN];
575.4.1 by ysano
Rename mysql to drizzle.
137
extern char glob_hostname[FN_REFLEN], drizzle_home[FN_REFLEN];
1 by brian
clean slate
138
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
139
extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
140
extern const double log_10[309];
151 by Brian Aker
Ulonglong to uint64_t
141
extern uint64_t log_10_int[20];
142
extern uint64_t keybuff_size;
520.1.22 by Brian Aker
Second pass of thd cleanup
143
extern uint64_t session_startup_options;
1 by brian
clean slate
144
extern ulong thread_id;
625 by Brian Aker
ulong/64 bit straighten out.
145
extern uint64_t binlog_cache_use;
146
extern uint64_t binlog_cache_disk_use;
147
extern uint64_t aborted_threads;
148
extern uint64_t aborted_connects;
149
extern uint64_t slave_open_temp_tables;
626 by Brian Aker
More of the same (ulong/64)
150
extern uint64_t slow_launch_threads;
622.1.1 by Brian Aker
32bit fixes around vars
151
extern uint64_t slow_launch_time;
152
extern uint64_t table_cache_size;
153
extern uint64_t table_def_size;
154
extern uint64_t max_connections;
155
extern uint64_t max_connect_errors;
156
extern uint64_t connect_timeout;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
157
extern bool slave_allow_batching;
622.1.1 by Brian Aker
32bit fixes around vars
158
extern uint64_t slave_net_timeout;
159
extern uint64_t slave_trans_retries;
482 by Brian Aker
Remove uint.
160
extern uint32_t max_user_connections;
622.1.1 by Brian Aker
32bit fixes around vars
161
extern ulong what_to_log;
162
extern uint64_t binlog_cache_size;
163
extern uint64_t max_binlog_cache_size;
625 by Brian Aker
ulong/64 bit straighten out.
164
extern uint64_t open_files_limit;
622.1.1 by Brian Aker
32bit fixes around vars
165
extern uint64_t max_binlog_size;
166
extern uint64_t max_relay_log_size;
626 by Brian Aker
More of the same (ulong/64)
167
extern uint64_t opt_binlog_rows_event_max_size;
622.1.1 by Brian Aker
32bit fixes around vars
168
extern uint64_t thread_pool_size;
626 by Brian Aker
More of the same (ulong/64)
169
extern uint32_t back_log;
606 by Brian Aker
Remove dead lex structure and clean up use of pid_t
170
extern pid_t current_pid;
622.1.1 by Brian Aker
32bit fixes around vars
171
extern uint64_t expire_logs_days;
172
extern uint64_t sync_binlog_period;
625 by Brian Aker
ulong/64 bit straighten out.
173
extern uint64_t tc_log_max_pages_used;
174
extern uint64_t tc_log_page_size;
175
extern uint64_t opt_tc_log_size;
176
extern uint64_t tc_log_page_waits;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
177
extern bool relay_log_purge;
198 by Brian Aker
More my_bool... man am I getting tired of writing this.
178
extern bool opt_innodb_safe_binlog, opt_innodb;
482 by Brian Aker
Remove uint.
179
extern uint32_t test_flags,select_errors,ha_open_options;
574.2.1 by ysano
Rename mysql to drizzle.
180
extern uint32_t protocol_version, drizzled_port, dropping_tables;
482 by Brian Aker
Remove uint.
181
extern uint32_t delay_key_write_options;
1 by brian
clean slate
182
extern bool opt_endinfo, using_udf_functions;
150 by Brian Aker
More bool removal. More cow bell!
183
extern bool locked_in_memory;
1 by brian
clean slate
184
extern bool opt_using_transactions;
30 by Brian Aker
Large file and ftruncate() support
185
extern bool using_update_log, server_id_supplied;
1 by brian
clean slate
186
extern bool opt_update_log, opt_bin_log, opt_error_log;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
187
extern bool opt_log; 
188
extern bool opt_slow_log;
1 by brian
clean slate
189
extern ulong log_output_options;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
190
extern bool opt_log_queries_not_using_indexes;
150 by Brian Aker
More bool removal. More cow bell!
191
extern bool opt_character_set_client_handshake;
1 by brian
clean slate
192
extern bool volatile abort_loop, shutdown_in_progress;
482 by Brian Aker
Remove uint.
193
extern uint32_t volatile thread_count, thread_running, global_read_lock;
194
extern uint32_t connection_count;
150 by Brian Aker
More bool removal. More cow bell!
195
extern bool opt_sql_bin_update;
196
extern bool opt_safe_user_create;
198 by Brian Aker
More my_bool... man am I getting tired of writing this.
197
extern bool opt_no_mix_types;
198
extern bool opt_safe_show_db, opt_myisam_use_mmap;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
199
extern bool opt_local_infile;
200
extern bool opt_slave_compressed_protocol;
150 by Brian Aker
More bool removal. More cow bell!
201
extern bool use_temp_pool;
1 by brian
clean slate
202
extern ulong slave_exec_mode_options;
147 by Brian Aker
More my_bool conversion. This time the set_var class.
203
extern bool opt_readonly;
1 by brian
clean slate
204
extern char* opt_secure_file_priv;
150 by Brian Aker
More bool removal. More cow bell!
205
extern bool opt_noacl;
206
extern bool opt_old_style_user_limits;
482 by Brian Aker
Remove uint.
207
extern uint32_t opt_crash_binlog_innodb;
1 by brian
clean slate
208
extern char *default_tz_name;
209
extern char *opt_logname, *opt_slow_logname;
210
extern const char *log_output_str;
211
586.1.1 by Yoshinori Sano
Rename mysql to drizzle, specifically mysql_bin_log to drizzle_bin_log.
212
extern DRIZZLE_BIN_LOG drizzle_bin_log;
1 by brian
clean slate
213
extern LOGGER logger;
327.2.4 by Brian Aker
Refactoring table.h
214
extern TableList general_log, slow_log;
1 by brian
clean slate
215
extern FILE *stderror_file;
520.6.7 by Monty Taylor
Moved a bunch of crap out of common_includes.
216
extern pthread_key_t THR_MALLOC;
575.4.4 by Yoshinori Sano
Rename mysql to drizzle.
217
extern pthread_mutex_t LOCK_drizzle_create_db,LOCK_open, LOCK_lock_db,
327.2.2 by Brian Aker
Removed dead/not used code.
218
       LOCK_thread_count,LOCK_user_locks, LOCK_status,
1 by brian
clean slate
219
       LOCK_error_log, LOCK_uuid_generator,
12 by Brian Aker
More dead code removal.
220
       LOCK_crypt, LOCK_timezone,
160 by Brian Aker
Removed sql_manager. Ever heard of just setting up the OS to sync when you
221
       LOCK_slave_list, LOCK_active_mi, LOCK_global_read_lock,
1 by brian
clean slate
222
       LOCK_global_system_variables, LOCK_user_conn,
223
       LOCK_bytes_sent, LOCK_bytes_received, LOCK_connection_count;
224
extern pthread_mutex_t LOCK_server_started;
225
extern rw_lock_t LOCK_sys_init_connect, LOCK_sys_init_slave;
226
extern rw_lock_t LOCK_system_variables_hash;
227
extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager;
228
extern pthread_cond_t COND_global_read_lock;
229
extern pthread_attr_t connection_attrib;
520.1.21 by Brian Aker
THD -> Session rename
230
extern I_List<Session> threads;
1 by brian
clean slate
231
extern MY_BITMAP temp_pool;
232
extern String my_empty_string;
233
extern const String my_null_string;
234
extern SHOW_VAR status_vars[];
235
extern struct system_variables max_system_variables;
236
extern struct system_status_var global_status_var;
237
extern struct rand_struct sql_rand;
238
239
extern const char *opt_date_time_formats[];
240
extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
241
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
242
extern Table *unused_tables;
1 by brian
clean slate
243
extern const char* any_db;
244
extern struct my_option my_long_options[];
245
extern const LEX_STRING view_type;
246
extern TYPELIB thread_handling_typelib;
206 by Brian Aker
Removed final uint dead types.
247
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.
248
extern std::bitset<5> sql_command_flags[];
1 by brian
clean slate
249
extern TYPELIB log_output_typelib;
250
251
/* optional things, have_* variables */
252
extern SHOW_COMP_OPTION have_community_features;
253
254
extern handlerton *myisam_hton;
255
extern handlerton *heap_hton;
256
177.3.1 by mark
remove ifdef HAVE_DLOPEN, make configure require dlopen()
257
extern SHOW_COMP_OPTION have_symlink;
1 by brian
clean slate
258
extern SHOW_COMP_OPTION have_compress;
259
260
261
extern pthread_t signal_thread;
262
520.1.22 by Brian Aker
Second pass of thd cleanup
263
DRIZZLE_LOCK *mysql_lock_tables(Session *session, Table **table, uint32_t count,
482 by Brian Aker
Remove uint.
264
                              uint32_t flags, bool *need_reopen);
1 by brian
clean slate
265
/* mysql_lock_tables() and open_table() flags bits */
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
266
#define DRIZZLE_LOCK_IGNORE_GLOBAL_READ_LOCK      0x0001
267
#define DRIZZLE_LOCK_IGNORE_FLUSH                 0x0002
268
#define DRIZZLE_LOCK_NOTIFY_IF_NEED_REOPEN        0x0004
269
#define DRIZZLE_OPEN_TEMPORARY_ONLY               0x0008
270
#define DRIZZLE_LOCK_IGNORE_GLOBAL_READ_ONLY      0x0010
271
#define DRIZZLE_LOCK_PERF_SCHEMA                  0x0020
1 by brian
clean slate
272
520.1.22 by Brian Aker
Second pass of thd cleanup
273
void mysql_unlock_tables(Session *session, DRIZZLE_LOCK *sql_lock);
274
void mysql_unlock_read_tables(Session *session, DRIZZLE_LOCK *sql_lock);
275
void mysql_unlock_some_tables(Session *session, Table **table,uint32_t count);
276
void mysql_lock_remove(Session *session, DRIZZLE_LOCK *locked,Table *table,
1 by brian
clean slate
277
                       bool always_unlock);
520.1.22 by Brian Aker
Second pass of thd cleanup
278
void mysql_lock_abort(Session *session, Table *table, bool upgrade_lock);
279
void mysql_lock_downgrade_write(Session *session, Table *table,
1 by brian
clean slate
280
                                thr_lock_type new_lock_type);
520.1.22 by Brian Aker
Second pass of thd cleanup
281
bool mysql_lock_abort_for_thread(Session *session, Table *table);
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
282
DRIZZLE_LOCK *mysql_lock_merge(DRIZZLE_LOCK *a,DRIZZLE_LOCK *b);
520.1.22 by Brian Aker
Second pass of thd cleanup
283
TableList *mysql_lock_have_duplicate(Session *session, TableList *needle,
327.2.4 by Brian Aker
Refactoring table.h
284
                                      TableList *haystack);
520.1.22 by Brian Aker
Second pass of thd cleanup
285
bool lock_global_read_lock(Session *session);
286
void unlock_global_read_lock(Session *session);
287
bool wait_if_global_read_lock(Session *session, bool abort_on_refresh,
1 by brian
clean slate
288
                              bool is_not_commit);
520.1.22 by Brian Aker
Second pass of thd cleanup
289
void start_waiting_global_read_lock(Session *session);
290
bool make_global_read_lock_block_commit(Session *session);
1 by brian
clean slate
291
bool set_protect_against_global_read_lock(void);
292
void unset_protect_against_global_read_lock(void);
293
void broadcast_refresh(void);
520.1.22 by Brian Aker
Second pass of thd cleanup
294
int try_transactional_lock(Session *session, TableList *table_list);
295
int check_transactional_lock(Session *session, TableList *table_list);
296
int set_handler_table_locks(Session *session, TableList *table_list,
1 by brian
clean slate
297
                            bool transactional);
298
299
/* Lock based on name */
520.1.22 by Brian Aker
Second pass of thd cleanup
300
int lock_and_wait_for_table_name(Session *session, TableList *table_list);
301
int lock_table_name(Session *session, TableList *table_list, bool check_in_use);
302
void unlock_table_name(Session *session, TableList *table_list);
303
bool wait_for_locked_table_names(Session *session, TableList *table_list);
304
bool lock_table_names(Session *session, TableList *table_list);
305
void unlock_table_names(Session *session, TableList *table_list,
327.2.4 by Brian Aker
Refactoring table.h
306
			TableList *last_table);
520.1.22 by Brian Aker
Second pass of thd cleanup
307
bool lock_table_names_exclusively(Session *session, TableList *table_list);
308
bool is_table_name_exclusively_locked_by_this_thread(Session *session, 
327.2.4 by Brian Aker
Refactoring table.h
309
                                                     TableList *table_list);
520.1.22 by Brian Aker
Second pass of thd cleanup
310
bool is_table_name_exclusively_locked_by_this_thread(Session *session, unsigned char *key,
1 by brian
clean slate
311
                                                     int key_length);
312
313
314
/* old unireg functions */
315
316
void unireg_init(ulong options);
317
void unireg_end(void) __attribute__((noreturn));
520.1.22 by Brian Aker
Second pass of thd cleanup
318
bool mysql_create_frm(Session *session, const char *file_name,
1 by brian
clean slate
319
                      const char *db, const char *table,
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.
320
                      HA_CREATE_INFO *create_info,
321
                      List<Create_field> &create_field,
322
                      uint32_t key_count,KEY *key_info,handler *db_type);
520.1.22 by Brian Aker
Second pass of thd cleanup
323
int rea_create_table(Session *session, const char *path,
1 by brian
clean slate
324
                     const char *db, const char *table_name,
325
                     HA_CREATE_INFO *create_info,
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.
326
                     List<Create_field> &create_field,
482 by Brian Aker
Remove uint.
327
                     uint32_t key_count,KEY *key_info,
1 by brian
clean slate
328
                     handler *file);
482 by Brian Aker
Remove uint.
329
int format_number(uint32_t inputflag,uint32_t max_length,char * pos,uint32_t length,
1 by brian
clean slate
330
		  char * *errpos);
331
332
/* table.cc */
327.2.4 by Brian Aker
Refactoring table.h
333
TABLE_SHARE *alloc_table_share(TableList *table_list, char *key,
482 by Brian Aker
Remove uint.
334
                               uint32_t key_length);
520.1.22 by Brian Aker
Second pass of thd cleanup
335
void init_tmp_table_share(Session *session, TABLE_SHARE *share, const char *key,
482 by Brian Aker
Remove uint.
336
                          uint32_t key_length,
1 by brian
clean slate
337
                          const char *table_name, const char *path);
338
void free_table_share(TABLE_SHARE *share);
520.1.22 by Brian Aker
Second pass of thd cleanup
339
int open_table_def(Session *session, TABLE_SHARE *share, uint32_t db_flags);
1 by brian
clean slate
340
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
341
int open_table_from_share(Session *session, TABLE_SHARE *share, const char *alias,
482 by Brian Aker
Remove uint.
342
                          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
343
                          Table *outparam, open_table_mode open_mode);
481 by Brian Aker
Remove all of uchar.
344
int readfrm(const char *name, unsigned char **data, size_t *length);
345
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
346
int closefrm(Table *table, bool free_share);
481 by Brian Aker
Remove all of uchar.
347
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
348
void free_blobs(Table *table);
1 by brian
clean slate
349
int set_zone(int nr,int min_zone,int max_zone);
520.1.6 by Brian Aker
Fixed ulong in time calculation.
350
uint32_t convert_period_to_month(uint32_t period);
351
uint32_t convert_month_to_period(uint32_t month);
482 by Brian Aker
Remove uint.
352
void get_date_from_daynr(long daynr,uint32_t *year, uint32_t *month,
353
			 uint32_t *day);
520.1.22 by Brian Aker
Second pass of thd cleanup
354
my_time_t TIME_to_timestamp(Session *session, const DRIZZLE_TIME *t, bool *not_exist);
482 by Brian Aker
Remove uint.
355
bool str_to_time_with_warn(const char *str,uint32_t length,DRIZZLE_TIME *l_time);
356
enum enum_drizzle_timestamp_type str_to_datetime_with_warn(const char *str, uint32_t length,
357
                                         DRIZZLE_TIME *l_time, uint32_t flags);
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
358
void localtime_to_TIME(DRIZZLE_TIME *to, struct tm *from);
359
void calc_time_from_sec(DRIZZLE_TIME *to, long seconds, long microseconds);
1 by brian
clean slate
360
520.1.22 by Brian Aker
Second pass of thd cleanup
361
void make_truncated_value_warning(Session *session, DRIZZLE_ERROR::enum_warning_level level,
1 by brian
clean slate
362
                                  const char *str_val,
482 by Brian Aker
Remove uint.
363
				  uint32_t str_length, enum enum_drizzle_timestamp_type time_type,
1 by brian
clean slate
364
                                  const char *field_name);
365
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
366
bool date_add_interval(DRIZZLE_TIME *ltime, interval_type int_type, INTERVAL interval);
367
bool calc_time_diff(DRIZZLE_TIME *l_time1, DRIZZLE_TIME *l_time2, int l_sign,
152 by Brian Aker
longlong replacement
368
                    int64_t *seconds_out, long *microseconds_out);
1 by brian
clean slate
369
370
extern LEX_STRING interval_type_to_name[];
371
398.1.1 by Monty Taylor
Remove typedef enum enum_drizzle_timestamp_type timestamp_type;
372
extern DATE_TIME_FORMAT *date_time_format_make(enum enum_drizzle_timestamp_type format_type,
1 by brian
clean slate
373
					       const char *format_str,
482 by Brian Aker
Remove uint.
374
					       uint32_t format_length);
520.1.22 by Brian Aker
Second pass of thd cleanup
375
extern DATE_TIME_FORMAT *date_time_format_copy(Session *session,
1 by brian
clean slate
376
					       DATE_TIME_FORMAT *format);
377
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;
378
				                             enum enum_drizzle_timestamp_type type);
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
379
void make_datetime(const DATE_TIME_FORMAT *format, const DRIZZLE_TIME *l_time,
1 by brian
clean slate
380
                   String *str);
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
381
void make_date(const DATE_TIME_FORMAT *format, const DRIZZLE_TIME *l_time,
382
               String *str);
383
void make_time(const DATE_TIME_FORMAT *format, const DRIZZLE_TIME *l_time,
384
               String *str);
385
int my_time_compare(DRIZZLE_TIME *a, DRIZZLE_TIME *b);
520.1.22 by Brian Aker
Second pass of thd cleanup
386
uint64_t get_datetime_value(Session *session, Item ***item_arg, Item **cache_arg,
1 by brian
clean slate
387
                             Item *warn_item, bool *is_null);
388
389
int test_if_number(char *str,int *res,bool allow_wildcards);
481 by Brian Aker
Remove all of uchar.
390
void change_byte(unsigned char *,uint,char,char);
520.1.22 by Brian Aker
Second pass of thd cleanup
391
void init_read_record(READ_RECORD *info, Session *session, Table *reg_form,
1 by brian
clean slate
392
		      SQL_SELECT *select,
393
		      int use_record_cache, bool print_errors);
520.1.22 by Brian Aker
Second pass of thd cleanup
394
void init_read_record_idx(READ_RECORD *info, Session *session, Table *table, 
482 by Brian Aker
Remove uint.
395
                          bool print_error, uint32_t idx);
1 by brian
clean slate
396
void end_read_record(READ_RECORD *info);
520.1.22 by Brian Aker
Second pass of thd cleanup
397
ha_rows filesort(Session *session, Table *form,struct st_sort_field *sortorder,
482 by Brian Aker
Remove uint.
398
		 uint32_t s_length, SQL_SELECT *select,
1 by brian
clean slate
399
		 ha_rows max_rows, bool sort_positions,
400
                 ha_rows *examined_rows);
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
401
void filesort_free_buffers(Table *table, bool full);
481 by Brian Aker
Remove all of uchar.
402
void change_double_for_sort(double nr,unsigned char *to);
152 by Brian Aker
longlong replacement
403
double my_double_round(double value, int64_t dec, bool dec_unsigned,
1 by brian
clean slate
404
                       bool truncate);
405
int get_quick_record(SQL_SELECT *select);
406
407
int calc_weekday(long daynr,bool sunday_first_day_of_week);
482 by Brian Aker
Remove uint.
408
uint32_t calc_week(DRIZZLE_TIME *l_time, uint32_t week_behaviour, uint32_t *year);
409
void find_date(char *pos,uint32_t *vek,uint32_t flag);
1 by brian
clean slate
410
TYPELIB *convert_strings_to_array_type(char * *typelibs, char * *end);
411
TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings);
481 by Brian Aker
Remove all of uchar.
412
ulong get_form_pos(File file, unsigned char *head, TYPELIB *save_names);
413
ulong make_new_entry(File file,unsigned char *fileinfo,TYPELIB *formnames,
1 by brian
clean slate
414
		     const char *newname);
415
ulong next_io_size(ulong pos);
482 by Brian Aker
Remove uint.
416
void append_unescaped(String *res, const char *pos, uint32_t length);
520.1.22 by Brian Aker
Second pass of thd cleanup
417
int create_frm(Session *session, const char *name, const char *db, const char *table,
482 by Brian Aker
Remove uint.
418
               uint32_t reclength, unsigned char *fileinfo,
419
	       HA_CREATE_INFO *create_info, uint32_t keys, KEY *key_info);
584.2.7 by Stewart Smith
rename and delete tabledefinition protobuf file
420
int rename_table_proto_file(const char *from, const char* to);
421
int delete_table_proto_file(char *file_name);
1 by brian
clean slate
422
int rename_file_ext(const char * from,const char * to,const char * ext);
423
bool check_db_name(LEX_STRING *db);
424
bool check_column_name(const char *name);
482 by Brian Aker
Remove uint.
425
bool check_table_name(const char *name, uint32_t length);
1 by brian
clean slate
426
char *get_field(MEM_ROOT *mem, Field *field);
427
bool get_field(MEM_ROOT *mem, Field *field, class String *res);
428
char *fn_rext(char *name);
429
430
/* Conversion functions */
482 by Brian Aker
Remove uint.
431
uint32_t build_table_filename(char *buff, size_t bufflen, const char *db,
432
                          const char *table, const char *ext, uint32_t flags);
1 by brian
clean slate
433
434
#define MYSQL50_TABLE_NAME_PREFIX         "#mysql50#"
534 by Monty Taylor
Removed stxnmov. Also deleted strstr which had already been removed.
435
#define MYSQL50_TABLE_NAME_PREFIX_LENGTH  sizeof(MYSQL50_TABLE_NAME_PREFIX)
1 by brian
clean slate
436
437
/* Flags for conversion functions. */
438
#define FN_FROM_IS_TMP  (1 << 0)
439
#define FN_TO_IS_TMP    (1 << 1)
440
#define FN_IS_TMP       (FN_FROM_IS_TMP | FN_TO_IS_TMP)
441
#define NO_FRM_RENAME   (1 << 2)
442
443
/* item_func.cc */
520.1.22 by Brian Aker
Second pass of thd cleanup
444
Item *get_system_var(Session *session, enum_var_type var_type, LEX_STRING name,
1 by brian
clean slate
445
		     LEX_STRING component);
520.1.22 by Brian Aker
Second pass of thd cleanup
446
int get_var_with_binlog(Session *session, enum_sql_command sql_command,
1 by brian
clean slate
447
                        LEX_STRING &name, user_var_entry **out_entry);
448
/* log.cc */
449
bool flush_error_log(void);
450
451
251 by Brian Aker
Cleanup around rand.
452
inline ulong sql_rnd()
1 by brian
clean slate
453
{
251 by Brian Aker
Cleanup around rand.
454
  ulong tmp= (ulong) (rand() * 0xffffffff); /* make all bits random */
455
1 by brian
clean slate
456
  return tmp;
457
}
458
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.
459
1 by brian
clean slate
460
461
/**
462
  convert a hex digit into number.
463
*/
464
465
inline int hexchar_to_int(char c)
466
{
467
  if (c <= '9' && c >= '0')
468
    return c-'0';
469
  c|=32;
470
  if (c <= 'f' && c >= 'a')
471
    return c-'a'+10;
472
  return -1;
473
}
474
475
/*
476
  Some functions that are different in the embedded library and the normal
477
  server
478
*/
479
480
extern "C" void unireg_abort(int exit_code) __attribute__((noreturn));
520.1.22 by Brian Aker
Second pass of thd cleanup
481
bool check_stack_overrun(Session *session, long margin, unsigned char *dummy);
1 by brian
clean slate
482
243.1.17 by Jay Pipes
FINAL PHASE removal of mysql_priv.h (Bye, bye my friend.)
483
#endif /* DRIZZLE_SERVER_SERVER_INCLUDES_H */