52
50
#include <drizzled/sql_table.h>
55
int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
56
bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
57
bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
58
bool mysql_change_db(THD *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,
59
57
bool force_switch);
60
bool mysql_opt_change_db(THD *thd,
58
bool mysql_opt_change_db(Session *session,
61
59
const LEX_STRING *new_db_name,
62
60
LEX_STRING *saved_db_name,
64
62
bool *cur_db_changed);
67
void write_bin_log(THD *thd, bool clear_error,
65
void write_bin_log(Session *session, bool clear_error,
68
66
char const *query, ulong query_length);
69
void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, uint16_t flags);
70
void mysql_client_binlog_statement(THD *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);
72
70
/* sql_rename.cc */
73
bool mysql_rename_tables(THD *thd, TableList *table_list, bool silent);
74
bool do_rename(THD *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,
75
73
char *new_table_name, char *new_table_alias,
79
void mysql_parse(THD *thd, const char *inBuf, uint32_t length,
77
void mysql_parse(Session *session, const char *inBuf, uint32_t length,
80
78
const char ** semicolon);
82
bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint32_t length);
80
bool mysql_test_parse_for_slave(Session *session,char *inBuf,uint32_t length);
85
83
bool is_update_query(enum enum_sql_command command);
87
bool alloc_query(THD *thd, const char *packet, uint32_t packet_length);
85
bool alloc_query(Session *session, const char *packet, uint32_t packet_length);
89
void mysql_reset_thd_for_next_command(THD *thd);
87
void mysql_reset_session_for_next_command(Session *session);
91
89
void create_select_for_variable(const char *var_name);
146
123
/* drizzled.cc */
147
124
void kill_mysql(void);
148
void close_connection(THD *thd, uint32_t errcode, bool lock);
125
void close_connection(Session *session, uint32_t errcode, bool lock);
150
127
/* sql_select.cc */
151
Table *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list);
128
Table *create_virtual_tmp_table(Session *session, List<Create_field> &field_list);
154
bool mysql_xa_recover(THD *thd);
131
bool mysql_xa_recover(Session *session);
156
133
SORT_FIELD * make_unireg_sortorder(order_st *order, uint32_t *length,
157
134
SORT_FIELD *sortorder);
158
int setup_order(THD *thd, Item **ref_pointer_array, TableList *tables,
135
int setup_order(Session *session, Item **ref_pointer_array, TableList *tables,
159
136
List<Item> &fields, List <Item> &all_fields, order_st *order);
160
int setup_group(THD *thd, Item **ref_pointer_array, TableList *tables,
137
int setup_group(Session *session, Item **ref_pointer_array, TableList *tables,
161
138
List<Item> &fields, List<Item> &all_fields, order_st *order,
162
139
bool *hidden_group_fields);
163
bool fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
140
bool fix_inner_refs(Session *session, List<Item> &all_fields, SELECT_LEX *select,
164
141
Item **ref_pointer_array);
166
bool handle_select(THD *thd, LEX *lex, select_result *result,
143
bool handle_select(Session *session, LEX *lex, select_result *result,
167
144
ulong setup_tables_done_option);
168
bool mysql_select(THD *thd, Item ***rref_pointer_array,
145
bool mysql_select(Session *session, Item ***rref_pointer_array,
169
146
TableList *tables, uint32_t wild_num, List<Item> &list,
170
147
COND *conds, uint32_t og_num, order_st *order, order_st *group,
171
148
Item *having, order_st *proc_param, uint64_t select_type,
172
149
select_result *result, SELECT_LEX_UNIT *unit,
173
150
SELECT_LEX *select_lex);
174
void free_underlaid_joins(THD *thd, SELECT_LEX *select);
175
bool mysql_explain_union(THD *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,
176
153
select_result *result);
177
int mysql_explain_select(THD *thd, SELECT_LEX *sl, char const *type,
154
int mysql_explain_select(Session *session, SELECT_LEX *sl, char const *type,
178
155
select_result *result);
179
bool mysql_union(THD *thd, LEX *lex, select_result *result,
156
bool mysql_union(Session *session, LEX *lex, select_result *result,
180
157
SELECT_LEX_UNIT *unit, ulong setup_tables_done_option);
181
bool mysql_handle_derived(LEX *lex, bool (*processor)(THD *thd,
158
bool mysql_handle_derived(LEX *lex, bool (*processor)(Session *session,
183
160
TableList *table));
184
bool mysql_derived_prepare(THD *thd, LEX *lex, TableList *t);
185
bool mysql_derived_filling(THD *thd, LEX *lex, TableList *t);
186
Field *create_tmp_field(THD *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,
187
164
Item ***copy_func, Field **from_field,
188
165
Field **def_field,
189
166
bool group, bool modify_item,
190
167
bool table_cant_handle_bit_fields,
191
168
bool make_copy_field,
192
169
uint32_t convert_blob_length);
193
void sp_prepare_create_field(THD *thd, Create_field *sql_field);
170
void sp_prepare_create_field(Session *session, Create_field *sql_field);
194
171
int prepare_create_field(Create_field *sql_field,
195
172
uint32_t *blob_columns,
196
173
int *timestamps, int *timestamps_with_niladic,
197
174
int64_t table_flags);
198
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
175
bool mysql_create_table(Session *session,const char *db, const char *table_name,
199
176
HA_CREATE_INFO *create_info,
200
177
Alter_info *alter_info,
201
178
bool tmp_table, uint32_t select_field_count);
202
bool mysql_create_table_no_lock(THD *thd, const char *db,
179
bool mysql_create_table_no_lock(Session *session, const char *db,
203
180
const char *table_name,
204
181
HA_CREATE_INFO *create_info,
205
182
Alter_info *alter_info,
206
bool tmp_table, uint32_t select_field_count);
183
bool tmp_table, uint32_t select_field_count,
184
bool lock_open_lock);
208
bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
186
bool mysql_alter_table(Session *session, char *new_db, char *new_name,
209
187
HA_CREATE_INFO *create_info,
210
188
TableList *table_list,
211
189
Alter_info *alter_info,
212
190
uint32_t order_num, order_st *order, bool ignore);
213
bool mysql_recreate_table(THD *thd, TableList *table_list);
214
bool mysql_create_like_table(THD *thd, TableList *table,
191
bool mysql_recreate_table(Session *session, TableList *table_list);
192
bool mysql_create_like_table(Session *session, TableList *table,
215
193
TableList *src_table,
216
194
HA_CREATE_INFO *create_info);
217
195
bool mysql_rename_table(handlerton *base, const char *old_db,
218
196
const char * old_name, const char *new_db,
219
197
const char * new_name, uint32_t flags);
220
bool mysql_prepare_update(THD *thd, TableList *table_list,
198
bool mysql_prepare_update(Session *session, TableList *table_list,
221
199
Item **conds, uint32_t order_num, order_st *order);
222
int mysql_update(THD *thd,TableList *tables,List<Item> &fields,
200
int mysql_update(Session *session,TableList *tables,List<Item> &fields,
223
201
List<Item> &values,COND *conds,
224
202
uint32_t order_num, order_st *order, ha_rows limit,
225
203
enum enum_duplicates handle_duplicates, bool ignore);
226
bool mysql_multi_update(THD *thd, TableList *table_list,
204
bool mysql_multi_update(Session *session, TableList *table_list,
227
205
List<Item> *fields, List<Item> *values,
228
206
COND *conds, uint64_t options,
229
207
enum enum_duplicates handle_duplicates, bool ignore,
230
208
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
231
bool mysql_prepare_insert(THD *thd, TableList *table_list, Table *table,
209
bool mysql_prepare_insert(Session *session, TableList *table_list, Table *table,
232
210
List<Item> &fields, List_item *values,
233
211
List<Item> &update_fields,
234
212
List<Item> &update_values, enum_duplicates duplic,
235
213
COND **where, bool select_insert,
236
214
bool check_fields, bool abort_on_warning);
237
bool mysql_insert(THD *thd,TableList *table,List<Item> &fields,
215
bool mysql_insert(Session *session,TableList *table,List<Item> &fields,
238
216
List<List_item> &values, List<Item> &update_fields,
239
217
List<Item> &update_values, enum_duplicates flag,
241
int check_that_all_fields_are_given_values(THD *thd, Table *entry,
219
int check_that_all_fields_are_given_values(Session *session, Table *entry,
242
220
TableList *table_list);
243
221
void prepare_triggers_for_insert_stmt(Table *table);
244
int mysql_prepare_delete(THD *thd, TableList *table_list, Item **conds);
245
bool mysql_delete(THD *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,
246
224
SQL_LIST *order, ha_rows rows, uint64_t options,
247
225
bool reset_auto_increment);
248
bool mysql_truncate(THD *thd, TableList *table_list, bool dont_send_ok);
249
uint32_t create_table_def_key(THD *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,
251
TABLE_SHARE *get_table_share(THD *thd, TableList *table_list, char *key,
229
TABLE_SHARE *get_table_share(Session *session, TableList *table_list, char *key,
252
230
uint32_t key_length, uint32_t db_flags, int *error);
253
231
void release_table_share(TABLE_SHARE *share, enum release_type type);
254
232
TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
255
Table *open_ltable(THD *thd, TableList *table_list, thr_lock_type update,
233
Table *open_ltable(Session *session, TableList *table_list, thr_lock_type update,
256
234
uint32_t lock_flags);
257
Table *open_table(THD *thd, TableList *table_list, bool *refresh, uint32_t flags);
258
bool name_lock_locked_table(THD *thd, TableList *tables);
259
bool reopen_name_locked_table(THD* thd, TableList* table_list, bool link_in);
260
Table *table_cache_insert_placeholder(THD *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,
261
239
uint32_t key_length);
262
bool lock_table_name_if_not_cached(THD *thd, const char *db,
240
bool lock_table_name_if_not_cached(Session *session, const char *db,
263
241
const char *table_name, Table **table);
264
Table *find_locked_table(THD *thd, const char *db,const char *table_name);
242
Table *find_locked_table(Session *session, const char *db,const char *table_name);
265
243
void detach_merge_children(Table *table, bool clear_refs);
266
244
bool fix_merge_after_open(TableList *old_child_list, TableList **old_last,
267
245
TableList *new_child_list, TableList **new_last);
268
246
bool reopen_table(Table *table);
269
bool reopen_tables(THD *thd,bool get_locks,bool in_refresh);
270
void close_data_files_and_morph_locks(THD *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,
271
249
const char *table_name);
272
250
void close_handle_and_leave_table_as_lock(Table *table);
273
bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
251
bool open_new_frm(Session *session, TABLE_SHARE *share, const char *alias,
274
252
uint32_t db_stat, uint32_t prgflag,
275
253
uint32_t ha_open_flags, Table *outparam,
276
254
TableList *table_desc, MEM_ROOT *mem_root);
277
bool wait_for_tables(THD *thd);
255
bool wait_for_tables(Session *session);
278
256
bool table_is_used(Table *table, bool wait_for_name_lock);
279
Table *drop_locked_tables(THD *thd,const char *db, const char *table_name);
280
void abort_locked_tables(THD *thd,const char *db, const char *table_name);
281
void execute_init_command(THD *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,
282
260
rw_lock_t *var_mutex);
283
261
extern Field *not_found_field;
284
262
extern Field *view_ref_found;
336
316
!my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X))
338
318
/* sql_handler.cc */
339
bool mysql_ha_open(THD *thd, TableList *tables, bool reopen);
340
bool mysql_ha_close(THD *thd, TableList *tables);
341
bool mysql_ha_read(THD *, TableList *,enum enum_ha_read_modes,char *,
319
bool mysql_ha_open(Session *session, TableList *tables, bool reopen);
320
bool mysql_ha_close(Session *session, TableList *tables);
321
bool mysql_ha_read(Session *, TableList *,enum enum_ha_read_modes,char *,
342
322
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
343
void mysql_ha_flush(THD *thd);
344
void mysql_ha_rm_tables(THD *thd, TableList *tables, bool is_locked);
345
void mysql_ha_cleanup(THD *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);
347
327
/* sql_base.cc */
348
328
#define TMP_TABLE_KEY_EXTRA 8
349
329
void set_item_name(Item *item,char *pos,uint32_t length);
350
bool add_field_to_list(THD *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,
351
331
char *length, char *decimal,
352
332
uint32_t type_modifier,
353
333
enum column_format_type column_format,
354
334
Item *default_value, Item *on_update_value,
355
335
LEX_STRING *comment,
356
336
char *change, List<String> *interval_list,
357
const CHARSET_INFO * const cs);
358
Create_field * new_create_field(THD *thd, char *field_name, enum_field_types type,
337
const CHARSET_INFO * const cs,
338
virtual_column_info *vcol_info);
339
Create_field * new_create_field(Session *session, char *field_name, enum_field_types type,
359
340
char *length, char *decimals,
360
341
uint32_t type_modifier,
361
342
Item *default_value, Item *on_update_value,
362
343
LEX_STRING *comment, char *change,
363
List<String> *interval_list, CHARSET_INFO *cs);
344
List<String> *interval_list, CHARSET_INFO *cs,
345
virtual_column_info *vcol_info);
364
346
void store_position_for_column(const char *name);
365
bool add_to_list(THD *thd, SQL_LIST &list,Item *group,bool asc);
366
bool push_new_name_resolution_context(THD *thd,
347
bool add_to_list(Session *session, SQL_LIST &list,Item *group,bool asc);
348
bool push_new_name_resolution_context(Session *session,
367
349
TableList *left_op,
368
350
TableList *right_op);
369
351
void add_join_on(TableList *b,Item *expr);
370
352
void add_join_natural(TableList *a,TableList *b,List<String> *using_fields,
371
353
SELECT_LEX *lex);
372
bool add_proc_to_list(THD *thd, Item *item);
373
void unlink_open_table(THD *thd, Table *find, bool unlock);
374
void drop_open_table(THD *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,
375
357
const char *table_name);
376
358
void update_non_unique_table_error(TableList *update,
377
359
const char *operation,
413
395
enum_resolution_type *resolution);
414
396
bool get_key_map_from_key_list(key_map *map, Table *table,
415
397
List<String> *index_list);
416
bool insert_fields(THD *thd, Name_resolution_context *context,
398
bool insert_fields(Session *session, Name_resolution_context *context,
417
399
const char *db_name, const char *table_name,
418
400
List_iterator<Item> *it, bool any_privileges);
419
bool setup_tables(THD *thd, Name_resolution_context *context,
401
bool setup_tables(Session *session, Name_resolution_context *context,
420
402
List<TableList> *from_clause, TableList *tables,
421
403
TableList **leaves, bool select_insert);
422
bool setup_tables_and_check_access(THD *thd,
404
bool setup_tables_and_check_access(Session *session,
423
405
Name_resolution_context *context,
424
406
List<TableList> *from_clause,
425
407
TableList *tables,
426
408
TableList **leaves,
427
409
bool select_insert);
428
int setup_wild(THD *thd, TableList *tables, List<Item> &fields,
410
int setup_wild(Session *session, TableList *tables, List<Item> &fields,
429
411
List<Item> *sum_func_list, uint32_t wild_num);
430
bool setup_fields(THD *thd, Item** ref_pointer_array,
412
bool setup_fields(Session *session, Item** ref_pointer_array,
431
413
List<Item> &item, enum_mark_columns mark_used_columns,
432
414
List<Item> *sum_func_list, bool allow_sum_func);
433
inline bool setup_fields_with_no_wrap(THD *thd, Item **ref_pointer_array,
415
inline bool setup_fields_with_no_wrap(Session *session, Item **ref_pointer_array,
434
416
List<Item> &item,
435
417
enum_mark_columns mark_used_columns,
436
418
List<Item> *sum_func_list,
437
419
bool allow_sum_func)
440
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,
444
int setup_conds(THD *thd, TableList *tables, TableList *leaves,
426
int setup_conds(Session *session, TableList *tables, TableList *leaves,
446
428
int setup_ftfuncs(SELECT_LEX* select);
447
int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
448
void wait_for_condition(THD *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,
449
431
pthread_cond_t *cond);
450
int open_tables(THD *thd, TableList **tables, uint32_t *counter, uint32_t flags);
432
int open_tables(Session *session, TableList **tables, uint32_t *counter, uint32_t flags);
451
433
/* open_and_lock_tables with optional derived handling */
452
int open_and_lock_tables_derived(THD *thd, TableList *tables, bool derived);
434
int open_and_lock_tables_derived(Session *session, TableList *tables, bool derived);
453
435
/* simple open_and_lock_tables without derived handling */
454
inline int simple_open_n_lock_tables(THD *thd, TableList *tables)
436
inline int simple_open_n_lock_tables(Session *session, TableList *tables)
456
return open_and_lock_tables_derived(thd, tables, false);
438
return open_and_lock_tables_derived(session, tables, false);
458
440
/* open_and_lock_tables with derived handling */
459
inline int open_and_lock_tables(THD *thd, TableList *tables)
441
inline int open_and_lock_tables(Session *session, TableList *tables)
461
return open_and_lock_tables_derived(thd, tables, true);
443
return open_and_lock_tables_derived(session, tables, true);
463
445
/* simple open_and_lock_tables without derived handling for single table */
464
Table *open_n_lock_single_table(THD *thd, TableList *table_l,
446
Table *open_n_lock_single_table(Session *session, TableList *table_l,
465
447
thr_lock_type lock_type);
466
bool open_normal_and_derived_tables(THD *thd, TableList *tables, uint32_t flags);
467
int lock_tables(THD *thd, TableList *tables, uint32_t counter, bool *need_reopen);
468
int decide_logging_format(THD *thd, TableList *tables);
469
Table *open_temporary_table(THD *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,
470
452
const char *table_name, bool link_in_list,
471
453
open_table_mode open_mode);
472
454
bool rm_temporary_table(handlerton *base, char *path, bool frm_only);
473
455
void free_io_cache(Table *entry);
474
456
void intern_close_table(Table *entry);
475
bool close_thread_table(THD *thd, Table **table_ptr);
476
void close_temporary_tables(THD *thd);
477
void close_tables_for_reopen(THD *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);
478
460
TableList *find_table_in_list(TableList *table,
479
461
TableList *TableList::*link,
480
462
const char *db_name,
481
463
const char *table_name);
482
TableList *unique_table(THD *thd, TableList *table, TableList *table_list,
464
TableList *unique_table(Session *session, TableList *table, TableList *table_list,
483
465
bool check_alias);
484
Table *find_temporary_table(THD *thd, const char *db, const char *table_name);
485
Table *find_temporary_table(THD *thd, TableList *table_list);
486
int drop_temporary_table(THD *thd, TableList *table_list);
487
void close_temporary_table(THD *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,
488
470
bool delete_table);
489
471
void close_temporary(Table *table, bool free_share, bool delete_table);
490
bool rename_temporary_table(THD* thd, Table *table, const char *new_db,
472
bool rename_temporary_table(Session* session, Table *table, const char *new_db,
491
473
const char *table_name);
492
474
void remove_db_from_cache(const char *db);
493
475
void flush_tables();
773
752
#define DRIZZLE_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0010
774
753
#define DRIZZLE_LOCK_PERF_SCHEMA 0x0020
776
void mysql_unlock_tables(THD *thd, DRIZZLE_LOCK *sql_lock);
777
void mysql_unlock_read_tables(THD *thd, DRIZZLE_LOCK *sql_lock);
778
void mysql_unlock_some_tables(THD *thd, Table **table,uint32_t count);
779
void mysql_lock_remove(THD *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,
780
759
bool always_unlock);
781
void mysql_lock_abort(THD *thd, Table *table, bool upgrade_lock);
782
void mysql_lock_downgrade_write(THD *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,
783
762
thr_lock_type new_lock_type);
784
bool mysql_lock_abort_for_thread(THD *thd, Table *table);
763
bool mysql_lock_abort_for_thread(Session *session, Table *table);
785
764
DRIZZLE_LOCK *mysql_lock_merge(DRIZZLE_LOCK *a,DRIZZLE_LOCK *b);
786
TableList *mysql_lock_have_duplicate(THD *thd, TableList *needle,
765
TableList *mysql_lock_have_duplicate(Session *session, TableList *needle,
787
766
TableList *haystack);
788
bool lock_global_read_lock(THD *thd);
789
void unlock_global_read_lock(THD *thd);
790
bool wait_if_global_read_lock(THD *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,
791
770
bool is_not_commit);
792
void start_waiting_global_read_lock(THD *thd);
793
bool make_global_read_lock_block_commit(THD *thd);
771
void start_waiting_global_read_lock(Session *session);
772
bool make_global_read_lock_block_commit(Session *session);
794
773
bool set_protect_against_global_read_lock(void);
795
774
void unset_protect_against_global_read_lock(void);
796
775
void broadcast_refresh(void);
797
int try_transactional_lock(THD *thd, TableList *table_list);
798
int check_transactional_lock(THD *thd, TableList *table_list);
799
int set_handler_table_locks(THD *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,
800
779
bool transactional);
802
781
/* Lock based on name */
803
int lock_and_wait_for_table_name(THD *thd, TableList *table_list);
804
int lock_table_name(THD *thd, TableList *table_list, bool check_in_use);
805
void unlock_table_name(THD *thd, TableList *table_list);
806
bool wait_for_locked_table_names(THD *thd, TableList *table_list);
807
bool lock_table_names(THD *thd, TableList *table_list);
808
void unlock_table_names(THD *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,
809
788
TableList *last_table);
810
bool lock_table_names_exclusively(THD *thd, TableList *table_list);
811
bool is_table_name_exclusively_locked_by_this_thread(THD *thd,
789
bool lock_table_names_exclusively(Session *session, TableList *table_list);
790
bool is_table_name_exclusively_locked_by_this_thread(Session *session,
812
791
TableList *table_list);
813
bool is_table_name_exclusively_locked_by_this_thread(THD *thd, unsigned char *key,
792
bool is_table_name_exclusively_locked_by_this_thread(Session *session, unsigned char *key,
1062
return true if the table was created explicitly.
1064
inline bool is_user_table(Table * table)
1066
const char *name= table->s->table_name.str;
1067
return strncmp(name, tmp_file_prefix, tmp_file_prefix_length);
1073
This will be slightly slower and perhaps a tiny bit less accurate than
1074
doing it the IEEE754 way but log2() should be available on C99 systems.
1076
static inline double log2(double x)
1078
return (log(x) / M_LN2);
1084
1041
Some functions that are different in the embedded library and the normal
1088
1045
extern "C" void unireg_abort(int exit_code) __attribute__((noreturn));
1089
void kill_delayed_threads(void);
1090
bool check_stack_overrun(THD *thd, long margin, unsigned char *dummy);
1093
* Used by handlers to store things in schema tables
1095
* @TODO These should be placed in an information_schema.h header
1096
* file once the new information schema design is finalized.
1098
#define IS_FILES_FILE_ID 0
1099
#define IS_FILES_FILE_NAME 1
1100
#define IS_FILES_FILE_TYPE 2
1101
#define IS_FILES_TABLESPACE_NAME 3
1102
#define IS_FILES_TABLE_CATALOG 4
1103
#define IS_FILES_TABLE_SCHEMA 5
1104
#define IS_FILES_TABLE_NAME 6
1105
#define IS_FILES_LOGFILE_GROUP_NAME 7
1106
#define IS_FILES_LOGFILE_GROUP_NUMBER 8
1107
#define IS_FILES_ENGINE 9
1108
#define IS_FILES_FULLTEXT_KEYS 10
1109
#define IS_FILES_DELETED_ROWS 11
1110
#define IS_FILES_UPDATE_COUNT 12
1111
#define IS_FILES_FREE_EXTENTS 13
1112
#define IS_FILES_TOTAL_EXTENTS 14
1113
#define IS_FILES_EXTENT_SIZE 15
1114
#define IS_FILES_INITIAL_SIZE 16
1115
#define IS_FILES_MAXIMUM_SIZE 17
1116
#define IS_FILES_AUTOEXTEND_SIZE 18
1117
#define IS_FILES_CREATION_TIME 19
1118
#define IS_FILES_LAST_UPDATE_TIME 20
1119
#define IS_FILES_LAST_ACCESS_TIME 21
1120
#define IS_FILES_RECOVER_TIME 22
1121
#define IS_FILES_TRANSACTION_COUNTER 23
1122
#define IS_FILES_VERSION 24
1123
#define IS_FILES_ROW_FORMAT 25
1124
#define IS_FILES_TABLE_ROWS 26
1125
#define IS_FILES_AVG_ROW_LENGTH 27
1126
#define IS_FILES_DATA_LENGTH 28
1127
#define IS_FILES_MAX_DATA_LENGTH 29
1128
#define IS_FILES_INDEX_LENGTH 30
1129
#define IS_FILES_DATA_FREE 31
1130
#define IS_FILES_CREATE_TIME 32
1131
#define IS_FILES_UPDATE_TIME 33
1132
#define IS_FILES_CHECK_TIME 34
1133
#define IS_FILES_CHECKSUM 35
1134
#define IS_FILES_STATUS 36
1135
#define IS_FILES_EXTRA 37
1046
bool check_stack_overrun(Session *session, long margin, unsigned char *dummy);
1137
1048
#endif /* DRIZZLE_SERVER_SERVER_INCLUDES_H */