184
184
TABLE_LIST *table));
185
185
bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *t);
186
186
bool mysql_derived_filling(THD *thd, LEX *lex, TABLE_LIST *t);
187
Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
187
Field *create_tmp_field(THD *thd, Table *table,Item *item, Item::Type type,
188
188
Item ***copy_func, Field **from_field,
189
189
Field **def_field,
190
190
bool group, bool modify_item,
229
229
COND *conds, uint64_t options,
230
230
enum enum_duplicates handle_duplicates, bool ignore,
231
231
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
232
bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
232
bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, Table *table,
233
233
List<Item> &fields, List_item *values,
234
234
List<Item> &update_fields,
235
235
List<Item> &update_values, enum_duplicates duplic,
239
239
List<List_item> &values, List<Item> &update_fields,
240
240
List<Item> &update_values, enum_duplicates flag,
242
int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
242
int check_that_all_fields_are_given_values(THD *thd, Table *entry,
243
243
TABLE_LIST *table_list);
244
void prepare_triggers_for_insert_stmt(TABLE *table);
244
void prepare_triggers_for_insert_stmt(Table *table);
245
245
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
246
246
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
247
247
SQL_LIST *order, ha_rows rows, uint64_t options,
253
253
uint key_length, uint db_flags, int *error);
254
254
void release_table_share(TABLE_SHARE *share, enum release_type type);
255
255
TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
256
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
256
Table *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
257
257
uint lock_flags);
258
TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT* mem,
258
Table *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT* mem,
259
259
bool *refresh, uint flags);
260
260
bool name_lock_locked_table(THD *thd, TABLE_LIST *tables);
261
261
bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in);
262
TABLE *table_cache_insert_placeholder(THD *thd, const char *key,
262
Table *table_cache_insert_placeholder(THD *thd, const char *key,
263
263
uint key_length);
264
264
bool lock_table_name_if_not_cached(THD *thd, const char *db,
265
const char *table_name, TABLE **table);
266
TABLE *find_locked_table(THD *thd, const char *db,const char *table_name);
267
void detach_merge_children(TABLE *table, bool clear_refs);
265
const char *table_name, Table **table);
266
Table *find_locked_table(THD *thd, const char *db,const char *table_name);
267
void detach_merge_children(Table *table, bool clear_refs);
268
268
bool fix_merge_after_open(TABLE_LIST *old_child_list, TABLE_LIST **old_last,
269
269
TABLE_LIST *new_child_list, TABLE_LIST **new_last);
270
bool reopen_table(TABLE *table);
270
bool reopen_table(Table *table);
271
271
bool reopen_tables(THD *thd,bool get_locks,bool in_refresh);
272
272
void close_data_files_and_morph_locks(THD *thd, const char *db,
273
273
const char *table_name);
274
void close_handle_and_leave_table_as_lock(TABLE *table);
274
void close_handle_and_leave_table_as_lock(Table *table);
275
275
bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
276
276
uint db_stat, uint prgflag,
277
uint ha_open_flags, TABLE *outparam,
277
uint ha_open_flags, Table *outparam,
278
278
TABLE_LIST *table_desc, MEM_ROOT *mem_root);
279
279
bool wait_for_tables(THD *thd);
280
bool table_is_used(TABLE *table, bool wait_for_name_lock);
281
TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name);
280
bool table_is_used(Table *table, bool wait_for_name_lock);
281
Table *drop_locked_tables(THD *thd,const char *db, const char *table_name);
282
282
void abort_locked_tables(THD *thd,const char *db, const char *table_name);
283
283
void execute_init_command(THD *thd, sys_var_str *init_command_var,
284
284
rw_lock_t *var_mutex);
302
302
uint *cached_field_index_ptr,
303
303
bool register_tree_change, TABLE_LIST **actual_table);
305
find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
305
find_field_in_table(THD *thd, Table *table, const char *name, uint length,
306
306
bool allow_rowid, uint *cached_field_index_ptr);
308
find_field_in_table_sef(TABLE *table, const char *name);
308
find_field_in_table_sef(Table *table, const char *name);
311
311
bool mysql_do(THD *thd, List<Item> &values);
372
372
void add_join_natural(TABLE_LIST *a,TABLE_LIST *b,List<String> *using_fields,
373
373
SELECT_LEX *lex);
374
374
bool add_proc_to_list(THD *thd, Item *item);
375
void unlink_open_table(THD *thd, TABLE *find, bool unlock);
376
void drop_open_table(THD *thd, TABLE *table, const char *db_name,
375
void unlink_open_table(THD *thd, Table *find, bool unlock);
376
void drop_open_table(THD *thd, Table *table, const char *db_name,
377
377
const char *table_name);
378
378
void update_non_unique_table_error(TABLE_LIST *update,
379
379
const char *operation,
380
380
TABLE_LIST *duplicate);
382
SQL_SELECT *make_select(TABLE *head, table_map const_tables,
382
SQL_SELECT *make_select(Table *head, table_map const_tables,
383
383
table_map read_tables, COND *conds,
384
384
bool allow_null_cond, int *error);
385
385
extern Item **not_found_item;
413
413
Item ** find_item_in_list(Item *item, List<Item> &items, uint *counter,
414
414
find_item_error_report_type report_error,
415
415
enum_resolution_type *resolution);
416
bool get_key_map_from_key_list(key_map *map, TABLE *table,
416
bool get_key_map_from_key_list(key_map *map, Table *table,
417
417
List<String> *index_list);
418
418
bool insert_fields(THD *thd, Name_resolution_context *context,
419
419
const char *db_name, const char *table_name,
463
463
return open_and_lock_tables_derived(thd, tables, true);
465
465
/* simple open_and_lock_tables without derived handling for single table */
466
TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l,
466
Table *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l,
467
467
thr_lock_type lock_type);
468
468
bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags);
469
469
int lock_tables(THD *thd, TABLE_LIST *tables, uint counter, bool *need_reopen);
470
470
int decide_logging_format(THD *thd, TABLE_LIST *tables);
471
TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
471
Table *open_temporary_table(THD *thd, const char *path, const char *db,
472
472
const char *table_name, bool link_in_list,
473
473
open_table_mode open_mode);
474
474
bool rm_temporary_table(handlerton *base, char *path, bool frm_only);
475
void free_io_cache(TABLE *entry);
476
void intern_close_table(TABLE *entry);
477
bool close_thread_table(THD *thd, TABLE **table_ptr);
475
void free_io_cache(Table *entry);
476
void intern_close_table(Table *entry);
477
bool close_thread_table(THD *thd, Table **table_ptr);
478
478
void close_temporary_tables(THD *thd);
479
479
void close_tables_for_reopen(THD *thd, TABLE_LIST **tables);
480
480
TABLE_LIST *find_table_in_list(TABLE_LIST *table,
483
483
const char *table_name);
484
484
TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
485
485
bool check_alias);
486
TABLE *find_temporary_table(THD *thd, const char *db, const char *table_name);
487
TABLE *find_temporary_table(THD *thd, TABLE_LIST *table_list);
486
Table *find_temporary_table(THD *thd, const char *db, const char *table_name);
487
Table *find_temporary_table(THD *thd, TABLE_LIST *table_list);
488
488
int drop_temporary_table(THD *thd, TABLE_LIST *table_list);
489
void close_temporary_table(THD *thd, TABLE *table, bool free_share,
489
void close_temporary_table(THD *thd, Table *table, bool free_share,
490
490
bool delete_table);
491
void close_temporary(TABLE *table, bool free_share, bool delete_table);
492
bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
491
void close_temporary(Table *table, bool free_share, bool delete_table);
492
bool rename_temporary_table(THD* thd, Table *table, const char *new_db,
493
493
const char *table_name);
494
494
void remove_db_from_cache(const char *db);
495
495
void flush_tables();
571
571
void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
572
572
uint16_t key_length);
573
573
void key_zero_nulls(uchar *tuple, KEY *key_info);
574
bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);
575
void key_unpack(String *to,TABLE *form,uint index);
576
bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields);
574
bool key_cmp_if_same(Table *form,const uchar *key,uint index,uint key_length);
575
void key_unpack(String *to,Table *form,uint index);
576
bool is_key_used(Table *table, uint idx, const MY_BITMAP *fields);
577
577
int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length);
578
578
extern "C" int key_rec_cmp(void *key_info, uchar *a, uchar *b);
781
781
void mysql_unlock_tables(THD *thd, DRIZZLE_LOCK *sql_lock);
782
782
void mysql_unlock_read_tables(THD *thd, DRIZZLE_LOCK *sql_lock);
783
void mysql_unlock_some_tables(THD *thd, TABLE **table,uint count);
784
void mysql_lock_remove(THD *thd, DRIZZLE_LOCK *locked,TABLE *table,
783
void mysql_unlock_some_tables(THD *thd, Table **table,uint count);
784
void mysql_lock_remove(THD *thd, DRIZZLE_LOCK *locked,Table *table,
785
785
bool always_unlock);
786
void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock);
787
void mysql_lock_downgrade_write(THD *thd, TABLE *table,
786
void mysql_lock_abort(THD *thd, Table *table, bool upgrade_lock);
787
void mysql_lock_downgrade_write(THD *thd, Table *table,
788
788
thr_lock_type new_lock_type);
789
bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
789
bool mysql_lock_abort_for_thread(THD *thd, Table *table);
790
790
DRIZZLE_LOCK *mysql_lock_merge(DRIZZLE_LOCK *a,DRIZZLE_LOCK *b);
791
791
TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,
792
792
TABLE_LIST *haystack);
848
848
void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg);
849
849
int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
850
850
uint db_stat, uint prgflag, uint ha_open_flags,
851
TABLE *outparam, open_table_mode open_mode);
851
Table *outparam, open_table_mode open_mode);
852
852
int readfrm(const char *name, uchar **data, size_t *length);
853
853
int writefrm(const char* name, const uchar* data, size_t len);
854
int closefrm(TABLE *table, bool free_share);
854
int closefrm(Table *table, bool free_share);
855
855
int read_string(File file, uchar* *to, size_t length);
856
void free_blobs(TABLE *table);
856
void free_blobs(Table *table);
857
857
int set_zone(int nr,int min_zone,int max_zone);
858
858
ulong convert_period_to_month(ulong period);
859
859
ulong convert_month_to_period(ulong month);
899
899
int test_if_number(char *str,int *res,bool allow_wildcards);
900
900
void change_byte(uchar *,uint,char,char);
901
void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
901
void init_read_record(READ_RECORD *info, THD *thd, Table *reg_form,
902
902
SQL_SELECT *select,
903
903
int use_record_cache, bool print_errors);
904
void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
904
void init_read_record_idx(READ_RECORD *info, THD *thd, Table *table,
905
905
bool print_error, uint idx);
906
906
void end_read_record(READ_RECORD *info);
907
ha_rows filesort(THD *thd, TABLE *form,struct st_sort_field *sortorder,
907
ha_rows filesort(THD *thd, Table *form,struct st_sort_field *sortorder,
908
908
uint s_length, SQL_SELECT *select,
909
909
ha_rows max_rows, bool sort_positions,
910
910
ha_rows *examined_rows);
911
void filesort_free_buffers(TABLE *table, bool full);
911
void filesort_free_buffers(Table *table, bool full);
912
912
void change_double_for_sort(double nr,uchar *to);
913
913
double my_double_round(double value, int64_t dec, bool dec_unsigned,
1024
1024
clean/setup table fields and map.
1026
@param table TABLE structure pointer (which should be setup)
1027
@param table_list TABLE_LIST structure pointer (owner of TABLE)
1026
@param table Table structure pointer (which should be setup)
1027
@param table_list TABLE_LIST structure pointer (owner of Table)
1028
1028
@param tablenr table number
1030
inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr)
1030
inline void setup_table_map(Table *table, TABLE_LIST *table_list, uint tablenr)
1032
1032
table->used_fields= 0;
1033
1033
table->const_table= 0;