~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/server_includes.h

  • Committer: Brian Aker
  • Date: 2008-11-13 02:56:15 UTC
  • mfrom: (575.4.10 devel)
  • Revision ID: brian@tangent.org-20081113025615-snhsi52yb2ivmx6f
Merging Monty's code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
  @TODO Name this file better. "priv" could mean private, privileged, privileges.
28
28
*/
29
29
 
30
 
#ifndef DRIZZLE_SERVER_SERVER_INCLUDES_H
31
 
#define DRIZZLE_SERVER_SERVER_INCLUDES_H
 
30
#ifndef DRIZZLED_SERVER_INCLUDES_H
 
31
#define DRIZZLED_SERVER_INCLUDES_H
32
32
 
33
33
/* Some forward declarations just for the server */
34
34
 
36
36
typedef Comp_creator* (*chooser_compare_func_creator)(bool invert);
37
37
 
38
38
/**
39
 
 * Contains all headers, definitions, and declarations common to 
40
 
 * the server and the plugin infrastructure, and not the client 
 
39
 * Contains all headers, definitions, and declarations common to
 
40
 * the server and the plugin infrastructure, and not the client
41
41
 */
42
 
#include <drizzled/common_includes.h>       
 
42
#include <drizzled/common_includes.h>
43
43
/* Range optimization API/library */
44
44
#include <drizzled/opt_range.h>
45
45
/* Simple error injection (crash) module */
49
49
/* Routines for dropping, repairing, checking schema tables */
50
50
#include <drizzled/sql_table.h>
51
51
 
52
 
/* sql_db.cc */
53
 
int mysql_create_db(Session *session, char *db, HA_CREATE_INFO *create, bool silent);
54
 
bool mysql_alter_db(Session *session, const char *db, HA_CREATE_INFO *create);
55
 
bool mysql_rm_db(Session *session,char *db,bool if_exists, bool silent);
56
 
bool mysql_change_db(Session *session, const LEX_STRING *new_db_name,
57
 
                     bool force_switch);
58
 
bool mysql_opt_change_db(Session *session,
59
 
                         const LEX_STRING *new_db_name,
60
 
                         LEX_STRING *saved_db_name,
61
 
                         bool force_switch,
62
 
                         bool *cur_db_changed);
63
 
 
64
 
/* sql_repl.cc */
65
 
void write_bin_log(Session *session, bool clear_error,
66
 
                   char const *query, ulong query_length);
67
 
void mysql_binlog_send(Session* session, char* log_ident, my_off_t pos, uint16_t flags);
68
 
void mysql_client_binlog_statement(Session *session);
69
 
 
70
 
/* sql_rename.cc */
71
 
bool drizzle_rename_tables(Session *session, TableList *table_list, bool silent);
72
 
bool do_rename(Session *session, TableList *ren_table, char *new_db,
73
 
                      char *new_table_name, char *new_table_alias,
74
 
                      bool skip_error);
75
 
 
76
 
/* sql_parse.cc */
77
 
void mysql_parse(Session *session, const char *inBuf, uint32_t length,
78
 
                 const char ** semicolon);
79
 
 
80
 
bool mysql_test_parse_for_slave(Session *session,char *inBuf,uint32_t length);
81
 
 
82
 
 
83
 
bool is_update_query(enum enum_sql_command command);
84
 
 
85
 
bool alloc_query(Session *session, const char *packet, uint32_t packet_length);
86
 
 
87
 
void mysql_reset_session_for_next_command(Session *session);
88
 
 
89
 
void create_select_for_variable(const char *var_name);
90
 
 
91
 
void mysql_init_multi_delete(LEX *lex);
92
 
 
93
 
bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
94
 
 
95
 
void init_update_queries(void);
96
 
 
97
 
bool do_command(Session *session);
98
 
 
99
 
bool dispatch_command(enum enum_server_command command, Session *session,
100
 
                      char* packet, uint32_t packet_length);
101
 
 
102
 
void log_slow_statement(Session *session);
103
 
 
104
 
bool append_file_to_dir(Session *session, const char **filename_ptr, 
105
 
                        const char *table_name);
106
 
 
107
 
bool reload_cache(Session *session, ulong options, TableList *tables, bool *write_to_binlog);
108
 
 
109
 
bool check_simple_select();
110
 
 
111
 
void mysql_init_select(LEX *lex);
112
 
bool mysql_new_select(LEX *lex, bool move_down);
113
 
 
114
 
/* sql_base.cc */
115
 
void table_cache_free(void);
116
 
bool table_cache_init(void);
117
 
bool table_def_init(void);
118
 
void table_def_free(void);
119
 
void assign_new_table_id(TABLE_SHARE *share);
120
 
uint32_t cached_open_tables(void);
121
 
uint32_t cached_table_definitions(void);
122
 
 
123
 
/* drizzled.cc */
124
 
void kill_mysql(void);
125
 
void close_connection(Session *session, uint32_t errcode, bool lock);
126
 
 
127
 
/* sql_select.cc */
128
 
Table *create_virtual_tmp_table(Session *session, List<Create_field> &field_list);
129
 
 
130
 
/* handler.cc */
131
 
bool mysql_xa_recover(Session *session);
132
 
 
133
 
SORT_FIELD * make_unireg_sortorder(order_st *order, uint32_t *length,
134
 
                                  SORT_FIELD *sortorder);
135
 
int setup_order(Session *session, Item **ref_pointer_array, TableList *tables,
136
 
                List<Item> &fields, List <Item> &all_fields, order_st *order);
137
 
int setup_group(Session *session, Item **ref_pointer_array, TableList *tables,
138
 
                List<Item> &fields, List<Item> &all_fields, order_st *order,
139
 
                bool *hidden_group_fields);
140
 
bool fix_inner_refs(Session *session, List<Item> &all_fields, SELECT_LEX *select,
141
 
                   Item **ref_pointer_array);
142
 
 
143
 
bool handle_select(Session *session, LEX *lex, select_result *result,
144
 
                   ulong setup_tables_done_option);
145
 
bool mysql_select(Session *session, Item ***rref_pointer_array,
146
 
                  TableList *tables, uint32_t wild_num,  List<Item> &list,
147
 
                  COND *conds, uint32_t og_num, order_st *order, order_st *group,
148
 
                  Item *having, order_st *proc_param, uint64_t select_type, 
149
 
                  select_result *result, SELECT_LEX_UNIT *unit, 
150
 
                  SELECT_LEX *select_lex);
151
 
void free_underlaid_joins(Session *session, SELECT_LEX *select);
152
 
bool mysql_explain_union(Session *session, SELECT_LEX_UNIT *unit,
153
 
                         select_result *result);
154
 
int mysql_explain_select(Session *session, SELECT_LEX *sl, char const *type,
155
 
                         select_result *result);
156
 
bool mysql_union(Session *session, LEX *lex, select_result *result,
157
 
                 SELECT_LEX_UNIT *unit, ulong setup_tables_done_option);
158
 
bool mysql_handle_derived(LEX *lex, bool (*processor)(Session *session,
159
 
                                                      LEX *lex,
160
 
                                                      TableList *table));
161
 
bool mysql_derived_prepare(Session *session, LEX *lex, TableList *t);
162
 
bool mysql_derived_filling(Session *session, LEX *lex, TableList *t);
163
 
Field *create_tmp_field(Session *session, Table *table,Item *item, Item::Type type,
164
 
                        Item ***copy_func, Field **from_field,
165
 
                        Field **def_field,
166
 
                        bool group, bool modify_item,
167
 
                        bool table_cant_handle_bit_fields,
168
 
                        bool make_copy_field,
169
 
                        uint32_t convert_blob_length);
170
 
void sp_prepare_create_field(Session *session, Create_field *sql_field);
171
 
int prepare_create_field(Create_field *sql_field, 
172
 
                         uint32_t *blob_columns, 
173
 
                         int *timestamps, int *timestamps_with_niladic,
174
 
                         int64_t table_flags);
175
 
bool mysql_create_table(Session *session,const char *db, const char *table_name,
176
 
                        HA_CREATE_INFO *create_info,
177
 
                        Alter_info *alter_info,
178
 
                        bool tmp_table, uint32_t select_field_count);
179
 
bool mysql_create_table_no_lock(Session *session, const char *db,
180
 
                                const char *table_name,
181
 
                                HA_CREATE_INFO *create_info,
182
 
                                Alter_info *alter_info,
183
 
                                bool tmp_table, uint32_t select_field_count,
184
 
                                bool lock_open_lock);
185
 
 
186
 
bool mysql_alter_table(Session *session, char *new_db, char *new_name,
187
 
                       HA_CREATE_INFO *create_info,
188
 
                       TableList *table_list,
189
 
                       Alter_info *alter_info,
190
 
                       uint32_t order_num, order_st *order, bool ignore);
191
 
bool mysql_recreate_table(Session *session, TableList *table_list);
192
 
bool mysql_create_like_table(Session *session, TableList *table,
193
 
                             TableList *src_table,
194
 
                             HA_CREATE_INFO *create_info);
195
 
bool mysql_rename_table(handlerton *base, const char *old_db,
196
 
                        const char * old_name, const char *new_db,
197
 
                        const char * new_name, uint32_t flags);
198
 
bool mysql_prepare_update(Session *session, TableList *table_list,
199
 
                          Item **conds, uint32_t order_num, order_st *order);
200
 
int mysql_update(Session *session,TableList *tables,List<Item> &fields,
201
 
                 List<Item> &values,COND *conds,
202
 
                 uint32_t order_num, order_st *order, ha_rows limit,
203
 
                 enum enum_duplicates handle_duplicates, bool ignore);
204
 
bool mysql_multi_update(Session *session, TableList *table_list,
205
 
                        List<Item> *fields, List<Item> *values,
206
 
                        COND *conds, uint64_t options,
207
 
                        enum enum_duplicates handle_duplicates, bool ignore,
208
 
                        SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
209
 
bool mysql_prepare_insert(Session *session, TableList *table_list, Table *table,
210
 
                          List<Item> &fields, List_item *values,
211
 
                          List<Item> &update_fields,
212
 
                          List<Item> &update_values, enum_duplicates duplic,
213
 
                          COND **where, bool select_insert,
214
 
                          bool check_fields, bool abort_on_warning);
215
 
bool mysql_insert(Session *session,TableList *table,List<Item> &fields,
216
 
                  List<List_item> &values, List<Item> &update_fields,
217
 
                  List<Item> &update_values, enum_duplicates flag,
218
 
                  bool ignore);
219
 
int check_that_all_fields_are_given_values(Session *session, Table *entry,
220
 
                                           TableList *table_list);
221
 
void prepare_triggers_for_insert_stmt(Table *table);
222
 
int mysql_prepare_delete(Session *session, TableList *table_list, Item **conds);
223
 
bool mysql_delete(Session *session, TableList *table_list, COND *conds,
224
 
                  SQL_LIST *order, ha_rows rows, uint64_t options,
225
 
                  bool reset_auto_increment);
226
 
bool mysql_truncate(Session *session, TableList *table_list, bool dont_send_ok);
227
 
uint32_t create_table_def_key(Session *session, char *key, TableList *table_list,
228
 
                          bool tmp_table);
229
 
TABLE_SHARE *get_table_share(Session *session, TableList *table_list, char *key,
230
 
                             uint32_t key_length, uint32_t db_flags, int *error);
231
 
void release_table_share(TABLE_SHARE *share, enum release_type type);
232
 
TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
233
 
Table *open_ltable(Session *session, TableList *table_list, thr_lock_type update,
234
 
                   uint32_t lock_flags);
235
 
Table *open_table(Session *session, TableList *table_list, bool *refresh, uint32_t flags);
236
 
bool name_lock_locked_table(Session *session, TableList *tables);
237
 
bool reopen_name_locked_table(Session* session, TableList* table_list, bool link_in);
238
 
Table *table_cache_insert_placeholder(Session *session, const char *key,
239
 
                                      uint32_t key_length);
240
 
bool lock_table_name_if_not_cached(Session *session, const char *db,
241
 
                                   const char *table_name, Table **table);
242
 
Table *find_locked_table(Session *session, const char *db,const char *table_name);
243
 
void detach_merge_children(Table *table, bool clear_refs);
244
 
bool fix_merge_after_open(TableList *old_child_list, TableList **old_last,
245
 
                          TableList *new_child_list, TableList **new_last);
246
 
bool reopen_table(Table *table);
247
 
bool reopen_tables(Session *session,bool get_locks,bool in_refresh);
248
 
void close_data_files_and_morph_locks(Session *session, const char *db,
249
 
                                      const char *table_name);
250
 
void close_handle_and_leave_table_as_lock(Table *table);
251
 
bool open_new_frm(Session *session, TABLE_SHARE *share, const char *alias,
252
 
                  uint32_t db_stat, uint32_t prgflag,
253
 
                  uint32_t ha_open_flags, Table *outparam,
254
 
                  TableList *table_desc, MEM_ROOT *mem_root);
255
 
bool wait_for_tables(Session *session);
256
 
bool table_is_used(Table *table, bool wait_for_name_lock);
257
 
Table *drop_locked_tables(Session *session,const char *db, const char *table_name);
258
 
void abort_locked_tables(Session *session,const char *db, const char *table_name);
259
 
void execute_init_command(Session *session, sys_var_str *init_command_var,
260
 
                          rw_lock_t *var_mutex);
261
 
extern Field *not_found_field;
262
 
extern Field *view_ref_found;
263
 
 
264
 
enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
265
 
                                  IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
266
 
                                  IGNORE_EXCEPT_NON_UNIQUE};
267
 
Field *
268
 
find_field_in_tables(Session *session, Item_ident *item,
269
 
                     TableList *first_table, TableList *last_table,
270
 
                     Item **ref, find_item_error_report_type report_error,
271
 
                     bool check_privileges, bool register_tree_change);
272
 
Field *
273
 
find_field_in_table_ref(Session *session, TableList *table_list,
274
 
                        const char *name, uint32_t length,
275
 
                        const char *item_name, const char *db_name,
276
 
                        const char *table_name, Item **ref,
277
 
                        bool check_privileges, bool allow_rowid,
278
 
                        uint32_t *cached_field_index_ptr,
279
 
                        bool register_tree_change, TableList **actual_table);
280
 
Field *
281
 
find_field_in_table(Session *session, Table *table, const char *name, uint32_t length,
282
 
                    bool allow_rowid, uint32_t *cached_field_index_ptr);
283
 
Field *
284
 
find_field_in_table_sef(Table *table, const char *name);
285
 
int update_virtual_fields_marked_for_write(Table *table,
286
 
                                           bool ignore_stored=true);
287
 
 
288
 
/* sql_do.cc */
289
 
bool mysql_do(Session *session, List<Item> &values);
290
 
 
291
 
/* sql_analyse.h */
292
 
bool append_escaped(String *to_str, String *from_str);
293
 
 
294
 
#include <drizzled/show.h>
295
 
 
296
52
/* information schema */
297
 
extern LEX_STRING INFORMATION_SCHEMA_NAME;
298
 
/* log tables */
299
 
extern LEX_STRING DRIZZLE_SCHEMA_NAME;
300
 
extern LEX_STRING GENERAL_LOG_NAME;
301
 
extern LEX_STRING SLOW_LOG_NAME;
 
53
static const std::string INFORMATION_SCHEMA_NAME("information_schema");
302
54
 
303
 
extern const LEX_STRING partition_keywords[];
304
 
ST_SCHEMA_TABLE *find_schema_table(Session *session, const char* table_name);
305
 
ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
306
 
int prepare_schema_table(Session *session, LEX *lex, Table_ident *table_ident,
307
 
                         enum enum_schema_tables schema_table_idx);
308
 
int make_schema_select(Session *session,  SELECT_LEX *sel,
309
 
                       enum enum_schema_tables schema_table_idx);
310
 
int mysql_schema_table(Session *session, LEX *lex, TableList *table_list);
311
 
bool get_schema_tables_result(JOIN *join,
312
 
                              enum enum_schema_table_state executed_place);
313
 
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
314
55
 
315
56
#define is_schema_db(X) \
316
57
  !my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X))
554
295
 
555
296
/* mysqld.cc */
556
297
void refresh_status(Session *session);
557
 
bool mysql_rm_tmp_tables(void);
 
298
bool drizzle_rm_tmp_tables(void);
558
299
void handle_connection_in_main_thread(Session *session);
559
300
void create_thread_to_handle_connection(Session *session);
560
301
void unlink_session(Session *session);
599
340
*/
600
341
 
601
342
extern time_t server_start_time, flush_status_time;
602
 
extern char *opt_mysql_tmpdir;
 
343
extern char *opt_drizzle_tmpdir;
603
344
            
604
 
#define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list))
605
 
extern MY_TMPDIR mysql_tmpdir_list;
 
345
#define drizzle_tmpdir (my_tmpdir(&drizzle_tmpdir_list))
 
346
extern MY_TMPDIR drizzle_tmpdir_list;
606
347
extern const LEX_STRING command_name[];
607
348
extern const char *first_keyword, *my_localhost, *delayed_user, *binary_keyword;
608
349
extern const char *myisam_recover_options_str;
683
424
extern TableList general_log, slow_log;
684
425
extern FILE *stderror_file;
685
426
extern pthread_key_t THR_MALLOC;
686
 
extern pthread_mutex_t LOCK_mysql_create_db,LOCK_open, LOCK_lock_db,
 
427
extern pthread_mutex_t LOCK_drizzle_create_db,LOCK_open, LOCK_lock_db,
687
428
       LOCK_thread_count,LOCK_user_locks, LOCK_status,
688
429
       LOCK_error_log, LOCK_uuid_generator,
689
430
       LOCK_crypt, LOCK_timezone,