~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/server_includes.h

  • Committer: Brian Aker
  • Date: 2008-10-20 04:28:21 UTC
  • mto: (492.3.21 drizzle-clean-code)
  • mto: This revision was merged to the branch mainline in revision 530.
  • Revision ID: brian@tangent.org-20081020042821-rqqdrccuu8195k3y
Second pass of thd cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
#include <drizzled/sql_table.h>
51
51
 
52
52
/* sql_db.cc */
53
 
int mysql_create_db(Session *thd, char *db, HA_CREATE_INFO *create, bool silent);
54
 
bool mysql_alter_db(Session *thd, const char *db, HA_CREATE_INFO *create);
55
 
bool mysql_rm_db(Session *thd,char *db,bool if_exists, bool silent);
56
 
bool mysql_change_db(Session *thd, const LEX_STRING *new_db_name,
 
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
57
                     bool force_switch);
58
 
bool mysql_opt_change_db(Session *thd,
 
58
bool mysql_opt_change_db(Session *session,
59
59
                         const LEX_STRING *new_db_name,
60
60
                         LEX_STRING *saved_db_name,
61
61
                         bool force_switch,
62
62
                         bool *cur_db_changed);
63
63
 
64
64
/* sql_repl.cc */
65
 
void write_bin_log(Session *thd, bool clear_error,
 
65
void write_bin_log(Session *session, bool clear_error,
66
66
                   char const *query, ulong query_length);
67
 
void mysql_binlog_send(Session* thd, char* log_ident, my_off_t pos, uint16_t flags);
68
 
void mysql_client_binlog_statement(Session *thd);
 
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
69
 
70
70
/* sql_rename.cc */
71
 
bool mysql_rename_tables(Session *thd, TableList *table_list, bool silent);
72
 
bool do_rename(Session *thd, TableList *ren_table, char *new_db,
 
71
bool mysql_rename_tables(Session *session, TableList *table_list, bool silent);
 
72
bool do_rename(Session *session, TableList *ren_table, char *new_db,
73
73
                      char *new_table_name, char *new_table_alias,
74
74
                      bool skip_error);
75
75
 
76
76
/* sql_parse.cc */
77
 
void mysql_parse(Session *thd, const char *inBuf, uint32_t length,
 
77
void mysql_parse(Session *session, const char *inBuf, uint32_t length,
78
78
                 const char ** semicolon);
79
79
 
80
 
bool mysql_test_parse_for_slave(Session *thd,char *inBuf,uint32_t length);
 
80
bool mysql_test_parse_for_slave(Session *session,char *inBuf,uint32_t length);
81
81
 
82
82
 
83
83
bool is_update_query(enum enum_sql_command command);
84
84
 
85
 
bool alloc_query(Session *thd, const char *packet, uint32_t packet_length);
 
85
bool alloc_query(Session *session, const char *packet, uint32_t packet_length);
86
86
 
87
 
void mysql_reset_thd_for_next_command(Session *thd);
 
87
void mysql_reset_session_for_next_command(Session *session);
88
88
 
89
89
void create_select_for_variable(const char *var_name);
90
90
 
94
94
 
95
95
void init_update_queries(void);
96
96
 
97
 
bool do_command(Session *thd);
 
97
bool do_command(Session *session);
98
98
 
99
 
bool dispatch_command(enum enum_server_command command, Session *thd,
 
99
bool dispatch_command(enum enum_server_command command, Session *session,
100
100
                      char* packet, uint32_t packet_length);
101
101
 
102
 
void log_slow_statement(Session *thd);
 
102
void log_slow_statement(Session *session);
103
103
 
104
 
bool append_file_to_dir(Session *thd, const char **filename_ptr, 
 
104
bool append_file_to_dir(Session *session, const char **filename_ptr, 
105
105
                        const char *table_name);
106
106
 
107
 
bool reload_cache(Session *thd, ulong options, TableList *tables, bool *write_to_binlog);
 
107
bool reload_cache(Session *session, ulong options, TableList *tables, bool *write_to_binlog);
108
108
 
109
109
bool check_simple_select();
110
110
 
122
122
 
123
123
/* drizzled.cc */
124
124
void kill_mysql(void);
125
 
void close_connection(Session *thd, uint32_t errcode, bool lock);
 
125
void close_connection(Session *session, uint32_t errcode, bool lock);
126
126
 
127
127
/* sql_select.cc */
128
 
Table *create_virtual_tmp_table(Session *thd, List<Create_field> &field_list);
 
128
Table *create_virtual_tmp_table(Session *session, List<Create_field> &field_list);
129
129
 
130
130
/* handler.cc */
131
 
bool mysql_xa_recover(Session *thd);
 
131
bool mysql_xa_recover(Session *session);
132
132
 
133
133
SORT_FIELD * make_unireg_sortorder(order_st *order, uint32_t *length,
134
134
                                  SORT_FIELD *sortorder);
135
 
int setup_order(Session *thd, Item **ref_pointer_array, TableList *tables,
 
135
int setup_order(Session *session, Item **ref_pointer_array, TableList *tables,
136
136
                List<Item> &fields, List <Item> &all_fields, order_st *order);
137
 
int setup_group(Session *thd, Item **ref_pointer_array, TableList *tables,
 
137
int setup_group(Session *session, Item **ref_pointer_array, TableList *tables,
138
138
                List<Item> &fields, List<Item> &all_fields, order_st *order,
139
139
                bool *hidden_group_fields);
140
 
bool fix_inner_refs(Session *thd, List<Item> &all_fields, SELECT_LEX *select,
 
140
bool fix_inner_refs(Session *session, List<Item> &all_fields, SELECT_LEX *select,
141
141
                   Item **ref_pointer_array);
142
142
 
143
 
bool handle_select(Session *thd, LEX *lex, select_result *result,
 
143
bool handle_select(Session *session, LEX *lex, select_result *result,
144
144
                   ulong setup_tables_done_option);
145
 
bool mysql_select(Session *thd, Item ***rref_pointer_array,
 
145
bool mysql_select(Session *session, Item ***rref_pointer_array,
146
146
                  TableList *tables, uint32_t wild_num,  List<Item> &list,
147
147
                  COND *conds, uint32_t og_num, order_st *order, order_st *group,
148
148
                  Item *having, order_st *proc_param, uint64_t select_type, 
149
149
                  select_result *result, SELECT_LEX_UNIT *unit, 
150
150
                  SELECT_LEX *select_lex);
151
 
void free_underlaid_joins(Session *thd, SELECT_LEX *select);
152
 
bool mysql_explain_union(Session *thd, SELECT_LEX_UNIT *unit,
 
151
void free_underlaid_joins(Session *session, SELECT_LEX *select);
 
152
bool mysql_explain_union(Session *session, SELECT_LEX_UNIT *unit,
153
153
                         select_result *result);
154
 
int mysql_explain_select(Session *thd, SELECT_LEX *sl, char const *type,
 
154
int mysql_explain_select(Session *session, SELECT_LEX *sl, char const *type,
155
155
                         select_result *result);
156
 
bool mysql_union(Session *thd, LEX *lex, select_result *result,
 
156
bool mysql_union(Session *session, LEX *lex, select_result *result,
157
157
                 SELECT_LEX_UNIT *unit, ulong setup_tables_done_option);
158
 
bool mysql_handle_derived(LEX *lex, bool (*processor)(Session *thd,
 
158
bool mysql_handle_derived(LEX *lex, bool (*processor)(Session *session,
159
159
                                                      LEX *lex,
160
160
                                                      TableList *table));
161
 
bool mysql_derived_prepare(Session *thd, LEX *lex, TableList *t);
162
 
bool mysql_derived_filling(Session *thd, LEX *lex, TableList *t);
163
 
Field *create_tmp_field(Session *thd, Table *table,Item *item, Item::Type type,
 
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
164
                        Item ***copy_func, Field **from_field,
165
165
                        Field **def_field,
166
166
                        bool group, bool modify_item,
167
167
                        bool table_cant_handle_bit_fields,
168
168
                        bool make_copy_field,
169
169
                        uint32_t convert_blob_length);
170
 
void sp_prepare_create_field(Session *thd, Create_field *sql_field);
 
170
void sp_prepare_create_field(Session *session, Create_field *sql_field);
171
171
int prepare_create_field(Create_field *sql_field, 
172
172
                         uint32_t *blob_columns, 
173
173
                         int *timestamps, int *timestamps_with_niladic,
174
174
                         int64_t table_flags);
175
 
bool mysql_create_table(Session *thd,const char *db, const char *table_name,
 
175
bool mysql_create_table(Session *session,const char *db, const char *table_name,
176
176
                        HA_CREATE_INFO *create_info,
177
177
                        Alter_info *alter_info,
178
178
                        bool tmp_table, uint32_t select_field_count);
179
 
bool mysql_create_table_no_lock(Session *thd, const char *db,
 
179
bool mysql_create_table_no_lock(Session *session, const char *db,
180
180
                                const char *table_name,
181
181
                                HA_CREATE_INFO *create_info,
182
182
                                Alter_info *alter_info,
183
183
                                bool tmp_table, uint32_t select_field_count,
184
184
                                bool lock_open_lock);
185
185
 
186
 
bool mysql_alter_table(Session *thd, char *new_db, char *new_name,
 
186
bool mysql_alter_table(Session *session, char *new_db, char *new_name,
187
187
                       HA_CREATE_INFO *create_info,
188
188
                       TableList *table_list,
189
189
                       Alter_info *alter_info,
190
190
                       uint32_t order_num, order_st *order, bool ignore);
191
 
bool mysql_recreate_table(Session *thd, TableList *table_list);
192
 
bool mysql_create_like_table(Session *thd, TableList *table,
 
191
bool mysql_recreate_table(Session *session, TableList *table_list);
 
192
bool mysql_create_like_table(Session *session, TableList *table,
193
193
                             TableList *src_table,
194
194
                             HA_CREATE_INFO *create_info);
195
195
bool mysql_rename_table(handlerton *base, const char *old_db,
196
196
                        const char * old_name, const char *new_db,
197
197
                        const char * new_name, uint32_t flags);
198
 
bool mysql_prepare_update(Session *thd, TableList *table_list,
 
198
bool mysql_prepare_update(Session *session, TableList *table_list,
199
199
                          Item **conds, uint32_t order_num, order_st *order);
200
 
int mysql_update(Session *thd,TableList *tables,List<Item> &fields,
 
200
int mysql_update(Session *session,TableList *tables,List<Item> &fields,
201
201
                 List<Item> &values,COND *conds,
202
202
                 uint32_t order_num, order_st *order, ha_rows limit,
203
203
                 enum enum_duplicates handle_duplicates, bool ignore);
204
 
bool mysql_multi_update(Session *thd, TableList *table_list,
 
204
bool mysql_multi_update(Session *session, TableList *table_list,
205
205
                        List<Item> *fields, List<Item> *values,
206
206
                        COND *conds, uint64_t options,
207
207
                        enum enum_duplicates handle_duplicates, bool ignore,
208
208
                        SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
209
 
bool mysql_prepare_insert(Session *thd, TableList *table_list, Table *table,
 
209
bool mysql_prepare_insert(Session *session, TableList *table_list, Table *table,
210
210
                          List<Item> &fields, List_item *values,
211
211
                          List<Item> &update_fields,
212
212
                          List<Item> &update_values, enum_duplicates duplic,
213
213
                          COND **where, bool select_insert,
214
214
                          bool check_fields, bool abort_on_warning);
215
 
bool mysql_insert(Session *thd,TableList *table,List<Item> &fields,
 
215
bool mysql_insert(Session *session,TableList *table,List<Item> &fields,
216
216
                  List<List_item> &values, List<Item> &update_fields,
217
217
                  List<Item> &update_values, enum_duplicates flag,
218
218
                  bool ignore);
219
 
int check_that_all_fields_are_given_values(Session *thd, Table *entry,
 
219
int check_that_all_fields_are_given_values(Session *session, Table *entry,
220
220
                                           TableList *table_list);
221
221
void prepare_triggers_for_insert_stmt(Table *table);
222
 
int mysql_prepare_delete(Session *thd, TableList *table_list, Item **conds);
223
 
bool mysql_delete(Session *thd, TableList *table_list, COND *conds,
 
222
int mysql_prepare_delete(Session *session, TableList *table_list, Item **conds);
 
223
bool mysql_delete(Session *session, TableList *table_list, COND *conds,
224
224
                  SQL_LIST *order, ha_rows rows, uint64_t options,
225
225
                  bool reset_auto_increment);
226
 
bool mysql_truncate(Session *thd, TableList *table_list, bool dont_send_ok);
227
 
uint32_t create_table_def_key(Session *thd, char *key, TableList *table_list,
 
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
228
                          bool tmp_table);
229
 
TABLE_SHARE *get_table_share(Session *thd, TableList *table_list, char *key,
 
229
TABLE_SHARE *get_table_share(Session *session, TableList *table_list, char *key,
230
230
                             uint32_t key_length, uint32_t db_flags, int *error);
231
231
void release_table_share(TABLE_SHARE *share, enum release_type type);
232
232
TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
233
 
Table *open_ltable(Session *thd, TableList *table_list, thr_lock_type update,
 
233
Table *open_ltable(Session *session, TableList *table_list, thr_lock_type update,
234
234
                   uint32_t lock_flags);
235
 
Table *open_table(Session *thd, TableList *table_list, bool *refresh, uint32_t flags);
236
 
bool name_lock_locked_table(Session *thd, TableList *tables);
237
 
bool reopen_name_locked_table(Session* thd, TableList* table_list, bool link_in);
238
 
Table *table_cache_insert_placeholder(Session *thd, const char *key,
 
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
239
                                      uint32_t key_length);
240
 
bool lock_table_name_if_not_cached(Session *thd, const char *db,
 
240
bool lock_table_name_if_not_cached(Session *session, const char *db,
241
241
                                   const char *table_name, Table **table);
242
 
Table *find_locked_table(Session *thd, const char *db,const char *table_name);
 
242
Table *find_locked_table(Session *session, const char *db,const char *table_name);
243
243
void detach_merge_children(Table *table, bool clear_refs);
244
244
bool fix_merge_after_open(TableList *old_child_list, TableList **old_last,
245
245
                          TableList *new_child_list, TableList **new_last);
246
246
bool reopen_table(Table *table);
247
 
bool reopen_tables(Session *thd,bool get_locks,bool in_refresh);
248
 
void close_data_files_and_morph_locks(Session *thd, const char *db,
 
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
249
                                      const char *table_name);
250
250
void close_handle_and_leave_table_as_lock(Table *table);
251
 
bool open_new_frm(Session *thd, TABLE_SHARE *share, const char *alias,
 
251
bool open_new_frm(Session *session, TABLE_SHARE *share, const char *alias,
252
252
                  uint32_t db_stat, uint32_t prgflag,
253
253
                  uint32_t ha_open_flags, Table *outparam,
254
254
                  TableList *table_desc, MEM_ROOT *mem_root);
255
 
bool wait_for_tables(Session *thd);
 
255
bool wait_for_tables(Session *session);
256
256
bool table_is_used(Table *table, bool wait_for_name_lock);
257
 
Table *drop_locked_tables(Session *thd,const char *db, const char *table_name);
258
 
void abort_locked_tables(Session *thd,const char *db, const char *table_name);
259
 
void execute_init_command(Session *thd, sys_var_str *init_command_var,
 
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
260
                          rw_lock_t *var_mutex);
261
261
extern Field *not_found_field;
262
262
extern Field *view_ref_found;
265
265
                                  IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
266
266
                                  IGNORE_EXCEPT_NON_UNIQUE};
267
267
Field *
268
 
find_field_in_tables(Session *thd, Item_ident *item,
 
268
find_field_in_tables(Session *session, Item_ident *item,
269
269
                     TableList *first_table, TableList *last_table,
270
270
                     Item **ref, find_item_error_report_type report_error,
271
271
                     bool check_privileges, bool register_tree_change);
272
272
Field *
273
 
find_field_in_table_ref(Session *thd, TableList *table_list,
 
273
find_field_in_table_ref(Session *session, TableList *table_list,
274
274
                        const char *name, uint32_t length,
275
275
                        const char *item_name, const char *db_name,
276
276
                        const char *table_name, Item **ref,
278
278
                        uint32_t *cached_field_index_ptr,
279
279
                        bool register_tree_change, TableList **actual_table);
280
280
Field *
281
 
find_field_in_table(Session *thd, Table *table, const char *name, uint32_t length,
 
281
find_field_in_table(Session *session, Table *table, const char *name, uint32_t length,
282
282
                    bool allow_rowid, uint32_t *cached_field_index_ptr);
283
283
Field *
284
284
find_field_in_table_sef(Table *table, const char *name);
286
286
                                           bool ignore_stored=true);
287
287
 
288
288
/* sql_do.cc */
289
 
bool mysql_do(Session *thd, List<Item> &values);
 
289
bool mysql_do(Session *session, List<Item> &values);
290
290
 
291
291
/* sql_analyse.h */
292
292
bool append_escaped(String *to_str, String *from_str);
301
301
extern LEX_STRING SLOW_LOG_NAME;
302
302
 
303
303
extern const LEX_STRING partition_keywords[];
304
 
ST_SCHEMA_TABLE *find_schema_table(Session *thd, const char* table_name);
 
304
ST_SCHEMA_TABLE *find_schema_table(Session *session, const char* table_name);
305
305
ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
306
 
int prepare_schema_table(Session *thd, LEX *lex, Table_ident *table_ident,
 
306
int prepare_schema_table(Session *session, LEX *lex, Table_ident *table_ident,
307
307
                         enum enum_schema_tables schema_table_idx);
308
 
int make_schema_select(Session *thd,  SELECT_LEX *sel,
 
308
int make_schema_select(Session *session,  SELECT_LEX *sel,
309
309
                       enum enum_schema_tables schema_table_idx);
310
 
int mysql_schema_table(Session *thd, LEX *lex, TableList *table_list);
 
310
int mysql_schema_table(Session *session, LEX *lex, TableList *table_list);
311
311
bool get_schema_tables_result(JOIN *join,
312
312
                              enum enum_schema_table_state executed_place);
313
313
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
316
316
  !my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X))
317
317
 
318
318
/* sql_handler.cc */
319
 
bool mysql_ha_open(Session *thd, TableList *tables, bool reopen);
320
 
bool mysql_ha_close(Session *thd, TableList *tables);
 
319
bool mysql_ha_open(Session *session, TableList *tables, bool reopen);
 
320
bool mysql_ha_close(Session *session, TableList *tables);
321
321
bool mysql_ha_read(Session *, TableList *,enum enum_ha_read_modes,char *,
322
322
                   List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
323
 
void mysql_ha_flush(Session *thd);
324
 
void mysql_ha_rm_tables(Session *thd, TableList *tables, bool is_locked);
325
 
void mysql_ha_cleanup(Session *thd);
 
323
void mysql_ha_flush(Session *session);
 
324
void mysql_ha_rm_tables(Session *session, TableList *tables, bool is_locked);
 
325
void mysql_ha_cleanup(Session *session);
326
326
 
327
327
/* sql_base.cc */
328
328
#define TMP_TABLE_KEY_EXTRA 8
329
329
void set_item_name(Item *item,char *pos,uint32_t length);
330
 
bool add_field_to_list(Session *thd, LEX_STRING *field_name, enum enum_field_types type,
 
330
bool add_field_to_list(Session *session, LEX_STRING *field_name, enum enum_field_types type,
331
331
                       char *length, char *decimal,
332
332
                       uint32_t type_modifier,
333
333
                       enum column_format_type column_format,
336
336
                       char *change, List<String> *interval_list,
337
337
                       const CHARSET_INFO * const cs,
338
338
                       virtual_column_info *vcol_info);
339
 
Create_field * new_create_field(Session *thd, char *field_name, enum_field_types type,
 
339
Create_field * new_create_field(Session *session, char *field_name, enum_field_types type,
340
340
                                char *length, char *decimals,
341
341
                                uint32_t type_modifier, 
342
342
                                Item *default_value, Item *on_update_value,
344
344
                                List<String> *interval_list, CHARSET_INFO *cs,
345
345
                                virtual_column_info *vcol_info);
346
346
void store_position_for_column(const char *name);
347
 
bool add_to_list(Session *thd, SQL_LIST &list,Item *group,bool asc);
348
 
bool push_new_name_resolution_context(Session *thd,
 
347
bool add_to_list(Session *session, SQL_LIST &list,Item *group,bool asc);
 
348
bool push_new_name_resolution_context(Session *session,
349
349
                                      TableList *left_op,
350
350
                                      TableList *right_op);
351
351
void add_join_on(TableList *b,Item *expr);
352
352
void add_join_natural(TableList *a,TableList *b,List<String> *using_fields,
353
353
                      SELECT_LEX *lex);
354
 
bool add_proc_to_list(Session *thd, Item *item);
355
 
void unlink_open_table(Session *thd, Table *find, bool unlock);
356
 
void drop_open_table(Session *thd, Table *table, const char *db_name,
 
354
bool add_proc_to_list(Session *session, Item *item);
 
355
void unlink_open_table(Session *session, Table *find, bool unlock);
 
356
void drop_open_table(Session *session, Table *table, const char *db_name,
357
357
                     const char *table_name);
358
358
void update_non_unique_table_error(TableList *update,
359
359
                                   const char *operation,
395
395
                          enum_resolution_type *resolution);
396
396
bool get_key_map_from_key_list(key_map *map, Table *table,
397
397
                               List<String> *index_list);
398
 
bool insert_fields(Session *thd, Name_resolution_context *context,
 
398
bool insert_fields(Session *session, Name_resolution_context *context,
399
399
                   const char *db_name, const char *table_name,
400
400
                   List_iterator<Item> *it, bool any_privileges);
401
 
bool setup_tables(Session *thd, Name_resolution_context *context,
 
401
bool setup_tables(Session *session, Name_resolution_context *context,
402
402
                  List<TableList> *from_clause, TableList *tables,
403
403
                  TableList **leaves, bool select_insert);
404
 
bool setup_tables_and_check_access(Session *thd, 
 
404
bool setup_tables_and_check_access(Session *session, 
405
405
                                   Name_resolution_context *context,
406
406
                                   List<TableList> *from_clause, 
407
407
                                   TableList *tables, 
408
408
                                   TableList **leaves, 
409
409
                                   bool select_insert);
410
 
int setup_wild(Session *thd, TableList *tables, List<Item> &fields,
 
410
int setup_wild(Session *session, TableList *tables, List<Item> &fields,
411
411
               List<Item> *sum_func_list, uint32_t wild_num);
412
 
bool setup_fields(Session *thd, Item** ref_pointer_array,
 
412
bool setup_fields(Session *session, Item** ref_pointer_array,
413
413
                  List<Item> &item, enum_mark_columns mark_used_columns,
414
414
                  List<Item> *sum_func_list, bool allow_sum_func);
415
 
inline bool setup_fields_with_no_wrap(Session *thd, Item **ref_pointer_array,
 
415
inline bool setup_fields_with_no_wrap(Session *session, Item **ref_pointer_array,
416
416
                                      List<Item> &item,
417
417
                                      enum_mark_columns mark_used_columns,
418
418
                                      List<Item> *sum_func_list,
419
419
                                      bool allow_sum_func)
420
420
{
421
421
  bool res;
422
 
  res= setup_fields(thd, ref_pointer_array, item, mark_used_columns, sum_func_list,
 
422
  res= setup_fields(session, ref_pointer_array, item, mark_used_columns, sum_func_list,
423
423
                    allow_sum_func);
424
424
  return res;
425
425
}
426
 
int setup_conds(Session *thd, TableList *tables, TableList *leaves,
 
426
int setup_conds(Session *session, TableList *tables, TableList *leaves,
427
427
                COND **conds);
428
428
int setup_ftfuncs(SELECT_LEX* select);
429
 
int init_ftfuncs(Session *thd, SELECT_LEX* select, bool no_order);
430
 
void wait_for_condition(Session *thd, pthread_mutex_t *mutex,
 
429
int init_ftfuncs(Session *session, SELECT_LEX* select, bool no_order);
 
430
void wait_for_condition(Session *session, pthread_mutex_t *mutex,
431
431
                        pthread_cond_t *cond);
432
 
int open_tables(Session *thd, TableList **tables, uint32_t *counter, uint32_t flags);
 
432
int open_tables(Session *session, TableList **tables, uint32_t *counter, uint32_t flags);
433
433
/* open_and_lock_tables with optional derived handling */
434
 
int open_and_lock_tables_derived(Session *thd, TableList *tables, bool derived);
 
434
int open_and_lock_tables_derived(Session *session, TableList *tables, bool derived);
435
435
/* simple open_and_lock_tables without derived handling */
436
 
inline int simple_open_n_lock_tables(Session *thd, TableList *tables)
 
436
inline int simple_open_n_lock_tables(Session *session, TableList *tables)
437
437
{
438
 
  return open_and_lock_tables_derived(thd, tables, false);
 
438
  return open_and_lock_tables_derived(session, tables, false);
439
439
}
440
440
/* open_and_lock_tables with derived handling */
441
 
inline int open_and_lock_tables(Session *thd, TableList *tables)
 
441
inline int open_and_lock_tables(Session *session, TableList *tables)
442
442
{
443
 
  return open_and_lock_tables_derived(thd, tables, true);
 
443
  return open_and_lock_tables_derived(session, tables, true);
444
444
}
445
445
/* simple open_and_lock_tables without derived handling for single table */
446
 
Table *open_n_lock_single_table(Session *thd, TableList *table_l,
 
446
Table *open_n_lock_single_table(Session *session, TableList *table_l,
447
447
                                thr_lock_type lock_type);
448
 
bool open_normal_and_derived_tables(Session *thd, TableList *tables, uint32_t flags);
449
 
int lock_tables(Session *thd, TableList *tables, uint32_t counter, bool *need_reopen);
450
 
int decide_logging_format(Session *thd, TableList *tables);
451
 
Table *open_temporary_table(Session *thd, const char *path, const char *db,
 
448
bool open_normal_and_derived_tables(Session *session, TableList *tables, uint32_t flags);
 
449
int lock_tables(Session *session, TableList *tables, uint32_t counter, bool *need_reopen);
 
450
int decide_logging_format(Session *session, TableList *tables);
 
451
Table *open_temporary_table(Session *session, const char *path, const char *db,
452
452
                            const char *table_name, bool link_in_list,
453
453
                            open_table_mode open_mode);
454
454
bool rm_temporary_table(handlerton *base, char *path, bool frm_only);
455
455
void free_io_cache(Table *entry);
456
456
void intern_close_table(Table *entry);
457
 
bool close_thread_table(Session *thd, Table **table_ptr);
458
 
void close_temporary_tables(Session *thd);
459
 
void close_tables_for_reopen(Session *thd, TableList **tables);
 
457
bool close_thread_table(Session *session, Table **table_ptr);
 
458
void close_temporary_tables(Session *session);
 
459
void close_tables_for_reopen(Session *session, TableList **tables);
460
460
TableList *find_table_in_list(TableList *table,
461
461
                               TableList *TableList::*link,
462
462
                               const char *db_name,
463
463
                               const char *table_name);
464
 
TableList *unique_table(Session *thd, TableList *table, TableList *table_list,
 
464
TableList *unique_table(Session *session, TableList *table, TableList *table_list,
465
465
                         bool check_alias);
466
 
Table *find_temporary_table(Session *thd, const char *db, const char *table_name);
467
 
Table *find_temporary_table(Session *thd, TableList *table_list);
468
 
int drop_temporary_table(Session *thd, TableList *table_list);
469
 
void close_temporary_table(Session *thd, Table *table, bool free_share,
 
466
Table *find_temporary_table(Session *session, const char *db, const char *table_name);
 
467
Table *find_temporary_table(Session *session, TableList *table_list);
 
468
int drop_temporary_table(Session *session, TableList *table_list);
 
469
void close_temporary_table(Session *session, Table *table, bool free_share,
470
470
                           bool delete_table);
471
471
void close_temporary(Table *table, bool free_share, bool delete_table);
472
 
bool rename_temporary_table(Session* thd, Table *table, const char *new_db,
 
472
bool rename_temporary_table(Session* session, Table *table, const char *new_db,
473
473
                            const char *table_name);
474
474
void remove_db_from_cache(const char *db);
475
475
void flush_tables();
481
481
#define RTFC_OWNED_BY_Session_FLAG      0x0001
482
482
#define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
483
483
#define RTFC_CHECK_KILLED_FLAG      0x0004
484
 
bool remove_table_from_cache(Session *thd, const char *db, const char *table,
 
484
bool remove_table_from_cache(Session *session, const char *db, const char *table,
485
485
                             uint32_t flags);
486
486
 
487
487
#define NORMAL_PART_NAME 0
495
495
#define WFRM_PACK_FRM 4
496
496
#define WFRM_KEEP_SHARE 8
497
497
 
498
 
bool close_cached_tables(Session *thd, TableList *tables, bool have_lock,
 
498
bool close_cached_tables(Session *session, TableList *tables, bool have_lock,
499
499
                         bool wait_for_refresh, bool wait_for_placeholders);
500
 
bool close_cached_connection_tables(Session *thd, bool wait_for_refresh,
 
500
bool close_cached_connection_tables(Session *session, bool wait_for_refresh,
501
501
                                    LEX_STRING *connect_string,
502
502
                                    bool have_lock= false);
503
503
void copy_field_from_tmp_record(Field *field,int offset);
504
 
bool fill_record(Session * thd, List<Item> &fields, List<Item> &values, bool ignore_errors);
505
 
bool fill_record(Session *thd, Field **field, List<Item> &values, bool ignore_errors);
506
 
OPEN_TableList *list_open_tables(Session *thd, const char *db, const char *wild);
 
504
bool fill_record(Session * session, List<Item> &fields, List<Item> &values, bool ignore_errors);
 
505
bool fill_record(Session *session, Field **field, List<Item> &values, bool ignore_errors);
 
506
OPEN_TableList *list_open_tables(Session *session, const char *db, const char *wild);
507
507
 
508
508
inline TableList *find_table_in_global_list(TableList *table,
509
509
                                             const char *db_name,
526
526
bool eval_const_cond(COND *cond);
527
527
 
528
528
/* sql_load.cc */
529
 
int mysql_load(Session *thd, sql_exchange *ex, TableList *table_list,
 
529
int mysql_load(Session *session, sql_exchange *ex, TableList *table_list,
530
530
                List<Item> &fields_vars, List<Item> &set_fields,
531
531
                List<Item> &set_values_list,
532
532
                enum enum_duplicates handle_duplicates, bool ignore,
533
533
                bool local_file);
534
 
int write_record(Session *thd, Table *table, COPY_INFO *info);
 
534
int write_record(Session *session, Table *table, COPY_INFO *info);
535
535
 
536
536
 
537
537
/* sql_test.cc */
563
563
 
564
564
/* mysqld.cc */
565
565
extern void MYSQLerror(const char*);
566
 
void refresh_status(Session *thd);
 
566
void refresh_status(Session *session);
567
567
bool mysql_rm_tmp_tables(void);
568
 
void handle_connection_in_main_thread(Session *thd);
569
 
void create_thread_to_handle_connection(Session *thd);
570
 
void unlink_thd(Session *thd);
571
 
bool one_thread_per_connection_end(Session *thd, bool put_in_cache);
 
568
void handle_connection_in_main_thread(Session *session);
 
569
void create_thread_to_handle_connection(Session *session);
 
570
void unlink_session(Session *session);
 
571
bool one_thread_per_connection_end(Session *session, bool put_in_cache);
572
572
void flush_thread_cache();
573
573
 
574
574
/* item_func.cc */
595
595
bool my_database_names_init(void);
596
596
void my_database_names_free(void);
597
597
bool check_db_dir_existence(const char *db_name);
598
 
bool load_db_opt(Session *thd, const char *path, HA_CREATE_INFO *create);
599
 
bool load_db_opt_by_name(Session *thd, const char *db_name,
 
598
bool load_db_opt(Session *session, const char *path, HA_CREATE_INFO *create);
 
599
bool load_db_opt_by_name(Session *session, const char *db_name,
600
600
                         HA_CREATE_INFO *db_create_info);
601
 
const CHARSET_INFO *get_default_db_collation(Session *thd, const char *db_name);
 
601
const CHARSET_INFO *get_default_db_collation(Session *session, const char *db_name);
602
602
bool my_dbopt_init(void);
603
603
void my_dbopt_cleanup(void);
604
604
extern int creating_database; // How many database locks are made
632
632
extern const double log_10[309];
633
633
extern uint64_t log_10_int[20];
634
634
extern uint64_t keybuff_size;
635
 
extern uint64_t thd_startup_options;
 
635
extern uint64_t session_startup_options;
636
636
extern ulong thread_id;
637
637
extern ulong binlog_cache_use, binlog_cache_disk_use;
638
638
extern ulong aborted_threads,aborted_connects;
742
742
 
743
743
extern pthread_t signal_thread;
744
744
 
745
 
DRIZZLE_LOCK *mysql_lock_tables(Session *thd, Table **table, uint32_t count,
 
745
DRIZZLE_LOCK *mysql_lock_tables(Session *session, Table **table, uint32_t count,
746
746
                              uint32_t flags, bool *need_reopen);
747
747
/* mysql_lock_tables() and open_table() flags bits */
748
748
#define DRIZZLE_LOCK_IGNORE_GLOBAL_READ_LOCK      0x0001
752
752
#define DRIZZLE_LOCK_IGNORE_GLOBAL_READ_ONLY      0x0010
753
753
#define DRIZZLE_LOCK_PERF_SCHEMA                  0x0020
754
754
 
755
 
void mysql_unlock_tables(Session *thd, DRIZZLE_LOCK *sql_lock);
756
 
void mysql_unlock_read_tables(Session *thd, DRIZZLE_LOCK *sql_lock);
757
 
void mysql_unlock_some_tables(Session *thd, Table **table,uint32_t count);
758
 
void mysql_lock_remove(Session *thd, DRIZZLE_LOCK *locked,Table *table,
 
755
void mysql_unlock_tables(Session *session, DRIZZLE_LOCK *sql_lock);
 
756
void mysql_unlock_read_tables(Session *session, DRIZZLE_LOCK *sql_lock);
 
757
void mysql_unlock_some_tables(Session *session, Table **table,uint32_t count);
 
758
void mysql_lock_remove(Session *session, DRIZZLE_LOCK *locked,Table *table,
759
759
                       bool always_unlock);
760
 
void mysql_lock_abort(Session *thd, Table *table, bool upgrade_lock);
761
 
void mysql_lock_downgrade_write(Session *thd, Table *table,
 
760
void mysql_lock_abort(Session *session, Table *table, bool upgrade_lock);
 
761
void mysql_lock_downgrade_write(Session *session, Table *table,
762
762
                                thr_lock_type new_lock_type);
763
 
bool mysql_lock_abort_for_thread(Session *thd, Table *table);
 
763
bool mysql_lock_abort_for_thread(Session *session, Table *table);
764
764
DRIZZLE_LOCK *mysql_lock_merge(DRIZZLE_LOCK *a,DRIZZLE_LOCK *b);
765
 
TableList *mysql_lock_have_duplicate(Session *thd, TableList *needle,
 
765
TableList *mysql_lock_have_duplicate(Session *session, TableList *needle,
766
766
                                      TableList *haystack);
767
 
bool lock_global_read_lock(Session *thd);
768
 
void unlock_global_read_lock(Session *thd);
769
 
bool wait_if_global_read_lock(Session *thd, bool abort_on_refresh,
 
767
bool lock_global_read_lock(Session *session);
 
768
void unlock_global_read_lock(Session *session);
 
769
bool wait_if_global_read_lock(Session *session, bool abort_on_refresh,
770
770
                              bool is_not_commit);
771
 
void start_waiting_global_read_lock(Session *thd);
772
 
bool make_global_read_lock_block_commit(Session *thd);
 
771
void start_waiting_global_read_lock(Session *session);
 
772
bool make_global_read_lock_block_commit(Session *session);
773
773
bool set_protect_against_global_read_lock(void);
774
774
void unset_protect_against_global_read_lock(void);
775
775
void broadcast_refresh(void);
776
 
int try_transactional_lock(Session *thd, TableList *table_list);
777
 
int check_transactional_lock(Session *thd, TableList *table_list);
778
 
int set_handler_table_locks(Session *thd, TableList *table_list,
 
776
int try_transactional_lock(Session *session, TableList *table_list);
 
777
int check_transactional_lock(Session *session, TableList *table_list);
 
778
int set_handler_table_locks(Session *session, TableList *table_list,
779
779
                            bool transactional);
780
780
 
781
781
/* Lock based on name */
782
 
int lock_and_wait_for_table_name(Session *thd, TableList *table_list);
783
 
int lock_table_name(Session *thd, TableList *table_list, bool check_in_use);
784
 
void unlock_table_name(Session *thd, TableList *table_list);
785
 
bool wait_for_locked_table_names(Session *thd, TableList *table_list);
786
 
bool lock_table_names(Session *thd, TableList *table_list);
787
 
void unlock_table_names(Session *thd, TableList *table_list,
 
782
int lock_and_wait_for_table_name(Session *session, TableList *table_list);
 
783
int lock_table_name(Session *session, TableList *table_list, bool check_in_use);
 
784
void unlock_table_name(Session *session, TableList *table_list);
 
785
bool wait_for_locked_table_names(Session *session, TableList *table_list);
 
786
bool lock_table_names(Session *session, TableList *table_list);
 
787
void unlock_table_names(Session *session, TableList *table_list,
788
788
                        TableList *last_table);
789
 
bool lock_table_names_exclusively(Session *thd, TableList *table_list);
790
 
bool is_table_name_exclusively_locked_by_this_thread(Session *thd, 
 
789
bool lock_table_names_exclusively(Session *session, TableList *table_list);
 
790
bool is_table_name_exclusively_locked_by_this_thread(Session *session, 
791
791
                                                     TableList *table_list);
792
 
bool is_table_name_exclusively_locked_by_this_thread(Session *thd, unsigned char *key,
 
792
bool is_table_name_exclusively_locked_by_this_thread(Session *session, unsigned char *key,
793
793
                                                     int key_length);
794
794
 
795
795
 
797
797
 
798
798
void unireg_init(ulong options);
799
799
void unireg_end(void) __attribute__((noreturn));
800
 
bool mysql_create_frm(Session *thd, const char *file_name,
 
800
bool mysql_create_frm(Session *session, const char *file_name,
801
801
                      const char *db, const char *table,
802
802
                      HA_CREATE_INFO *create_info,
803
803
                      List<Create_field> &create_field,
804
804
                      uint32_t key_count,KEY *key_info,handler *db_type);
805
 
int rea_create_table(Session *thd, const char *path,
 
805
int rea_create_table(Session *session, const char *path,
806
806
                     const char *db, const char *table_name,
807
807
                     HA_CREATE_INFO *create_info,
808
808
                     List<Create_field> &create_field,
814
814
/* table.cc */
815
815
TABLE_SHARE *alloc_table_share(TableList *table_list, char *key,
816
816
                               uint32_t key_length);
817
 
void init_tmp_table_share(Session *thd, TABLE_SHARE *share, const char *key,
 
817
void init_tmp_table_share(Session *session, TABLE_SHARE *share, const char *key,
818
818
                          uint32_t key_length,
819
819
                          const char *table_name, const char *path);
820
820
void free_table_share(TABLE_SHARE *share);
821
 
int open_table_def(Session *thd, TABLE_SHARE *share, uint32_t db_flags);
 
821
int open_table_def(Session *session, TABLE_SHARE *share, uint32_t db_flags);
822
822
void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg);
823
 
int open_table_from_share(Session *thd, TABLE_SHARE *share, const char *alias,
 
823
int open_table_from_share(Session *session, TABLE_SHARE *share, const char *alias,
824
824
                          uint32_t db_stat, uint32_t prgflag, uint32_t ha_open_flags,
825
825
                          Table *outparam, open_table_mode open_mode);
826
826
int readfrm(const char *name, unsigned char **data, size_t *length);
833
833
uint32_t convert_month_to_period(uint32_t month);
834
834
void get_date_from_daynr(long daynr,uint32_t *year, uint32_t *month,
835
835
                         uint32_t *day);
836
 
my_time_t TIME_to_timestamp(Session *thd, const DRIZZLE_TIME *t, bool *not_exist);
 
836
my_time_t TIME_to_timestamp(Session *session, const DRIZZLE_TIME *t, bool *not_exist);
837
837
bool str_to_time_with_warn(const char *str,uint32_t length,DRIZZLE_TIME *l_time);
838
838
enum enum_drizzle_timestamp_type str_to_datetime_with_warn(const char *str, uint32_t length,
839
839
                                         DRIZZLE_TIME *l_time, uint32_t flags);
840
840
void localtime_to_TIME(DRIZZLE_TIME *to, struct tm *from);
841
841
void calc_time_from_sec(DRIZZLE_TIME *to, long seconds, long microseconds);
842
842
 
843
 
void make_truncated_value_warning(Session *thd, DRIZZLE_ERROR::enum_warning_level level,
 
843
void make_truncated_value_warning(Session *session, DRIZZLE_ERROR::enum_warning_level level,
844
844
                                  const char *str_val,
845
845
                                  uint32_t str_length, enum enum_drizzle_timestamp_type time_type,
846
846
                                  const char *field_name);
854
854
extern DATE_TIME_FORMAT *date_time_format_make(enum enum_drizzle_timestamp_type format_type,
855
855
                                               const char *format_str,
856
856
                                               uint32_t format_length);
857
 
extern DATE_TIME_FORMAT *date_time_format_copy(Session *thd,
 
857
extern DATE_TIME_FORMAT *date_time_format_copy(Session *session,
858
858
                                               DATE_TIME_FORMAT *format);
859
859
const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
860
860
                                                             enum enum_drizzle_timestamp_type type);
867
867
void make_time(const DATE_TIME_FORMAT *format, const DRIZZLE_TIME *l_time,
868
868
               String *str);
869
869
int my_time_compare(DRIZZLE_TIME *a, DRIZZLE_TIME *b);
870
 
uint64_t get_datetime_value(Session *thd, Item ***item_arg, Item **cache_arg,
 
870
uint64_t get_datetime_value(Session *session, Item ***item_arg, Item **cache_arg,
871
871
                             Item *warn_item, bool *is_null);
872
872
 
873
873
int test_if_number(char *str,int *res,bool allow_wildcards);
874
874
void change_byte(unsigned char *,uint,char,char);
875
 
void init_read_record(READ_RECORD *info, Session *thd, Table *reg_form,
 
875
void init_read_record(READ_RECORD *info, Session *session, Table *reg_form,
876
876
                      SQL_SELECT *select,
877
877
                      int use_record_cache, bool print_errors);
878
 
void init_read_record_idx(READ_RECORD *info, Session *thd, Table *table, 
 
878
void init_read_record_idx(READ_RECORD *info, Session *session, Table *table, 
879
879
                          bool print_error, uint32_t idx);
880
880
void end_read_record(READ_RECORD *info);
881
 
ha_rows filesort(Session *thd, Table *form,struct st_sort_field *sortorder,
 
881
ha_rows filesort(Session *session, Table *form,struct st_sort_field *sortorder,
882
882
                 uint32_t s_length, SQL_SELECT *select,
883
883
                 ha_rows max_rows, bool sort_positions,
884
884
                 ha_rows *examined_rows);
898
898
                     const char *newname);
899
899
ulong next_io_size(ulong pos);
900
900
void append_unescaped(String *res, const char *pos, uint32_t length);
901
 
int create_frm(Session *thd, const char *name, const char *db, const char *table,
 
901
int create_frm(Session *session, const char *name, const char *db, const char *table,
902
902
               uint32_t reclength, unsigned char *fileinfo,
903
903
               HA_CREATE_INFO *create_info, uint32_t keys, KEY *key_info);
904
904
int rename_file_ext(const char * from,const char * to,const char * ext);
923
923
#define NO_FRM_RENAME   (1 << 2)
924
924
 
925
925
/* item_func.cc */
926
 
Item *get_system_var(Session *thd, enum_var_type var_type, LEX_STRING name,
 
926
Item *get_system_var(Session *session, enum_var_type var_type, LEX_STRING name,
927
927
                     LEX_STRING component);
928
 
int get_var_with_binlog(Session *thd, enum_sql_command sql_command,
 
928
int get_var_with_binlog(Session *session, enum_sql_command sql_command,
929
929
                        LEX_STRING &name, user_var_entry **out_entry);
930
930
/* log.cc */
931
931
bool flush_error_log(void);
936
936
 
937
937
/* Some inline functions for more speed */
938
938
 
939
 
inline bool add_item_to_list(Session *thd, Item *item)
940
 
{
941
 
  return thd->lex->current_select->add_item_to_list(thd, item);
942
 
}
943
 
 
944
 
inline bool add_value_to_list(Session *thd, Item *value)
945
 
{
946
 
  return thd->lex->value_list.push_back(value);
947
 
}
948
 
 
949
 
inline bool add_order_to_list(Session *thd, Item *item, bool asc)
950
 
{
951
 
  return thd->lex->current_select->add_order_to_list(thd, item, asc);
952
 
}
953
 
 
954
 
inline bool add_group_to_list(Session *thd, Item *item, bool asc)
955
 
{
956
 
  return thd->lex->current_select->add_group_to_list(thd, item, asc);
 
939
inline bool add_item_to_list(Session *session, Item *item)
 
940
{
 
941
  return session->lex->current_select->add_item_to_list(session, item);
 
942
}
 
943
 
 
944
inline bool add_value_to_list(Session *session, Item *value)
 
945
{
 
946
  return session->lex->value_list.push_back(value);
 
947
}
 
948
 
 
949
inline bool add_order_to_list(Session *session, Item *item, bool asc)
 
950
{
 
951
  return session->lex->current_select->add_order_to_list(session, item, asc);
 
952
}
 
953
 
 
954
inline bool add_group_to_list(Session *session, Item *item, bool asc)
 
955
{
 
956
  return session->lex->current_select->add_group_to_list(session, item, asc);
957
957
}
958
958
 
959
959
inline void mark_as_null_row(Table *table)
1044
1044
 
1045
1045
extern "C" void unireg_abort(int exit_code) __attribute__((noreturn));
1046
1046
void kill_delayed_threads(void);
1047
 
bool check_stack_overrun(Session *thd, long margin, unsigned char *dummy);
 
1047
bool check_stack_overrun(Session *session, long margin, unsigned char *dummy);
1048
1048
 
1049
1049
#endif /* DRIZZLE_SERVER_SERVER_INCLUDES_H */