225
231
Discrete_interval auto_inc_interval_for_cur_row;
227
Cursor(plugin::StorageEngine &engine_arg, Table &share_arg);
228
virtual ~Cursor(void);
229
virtual Cursor *clone(memory::Root *mem_root);
233
handler(handlerton *ht_arg, TABLE_SHARE *share_arg)
234
:table_share(share_arg), table(0),
235
estimation_rows_to_insert(0), ht(ht_arg),
236
ref(0), in_range_check_pushed_down(false),
237
key_used_on_scan(MAX_KEY), active_index(MAX_KEY),
238
ref_length(sizeof(my_off_t)),
240
locked(false), implicit_emptied(0),
241
pushed_cond(0), pushed_idx_cond(NULL), pushed_idx_cond_keyno(MAX_KEY),
242
next_insert_id(0), insert_id_for_cur_row(0)
244
virtual ~handler(void)
246
assert(locked == false);
247
/* TODO: assert(inited == NONE); */
249
virtual handler *clone(MEM_ROOT *mem_root);
250
/** This is called after create to allow us to set up cached variables */
253
cached_table_flags= table_flags();
231
256
/* ha_ methods: pubilc wrappers for private virtual API */
233
int ha_open(const TableIdentifier &identifier, int mode, int test_if_locked);
234
int startIndexScan(uint32_t idx, bool sorted);
236
int startTableScan(bool scan);
258
int ha_open(Table *table, const char *name, int mode, int test_if_locked);
259
int ha_index_init(uint32_t idx, bool sorted);
261
int ha_rnd_init(bool scan);
240
265
/* this is necessary in many places, e.g. in HANDLER command */
241
266
int ha_index_or_rnd_end();
267
Table_flags ha_table_flags() const;
244
270
These functions represent the public interface to *users* of the
245
Cursor class, hence they are *not* virtual. For the inheritance
246
interface, see the (private) functions doInsertRecord(), doUpdateRecord(),
247
and doDeleteRecord() below.
271
handler class, hence they are *not* virtual. For the inheritance
272
interface, see the (private) functions write_row(), update_row(),
273
and delete_row() below.
249
275
int ha_external_lock(Session *session, int lock_type);
250
int insertRecord(unsigned char * buf);
251
int updateRecord(const unsigned char * old_data, unsigned char * new_data);
252
int deleteRecord(const unsigned char * buf);
276
int ha_write_row(unsigned char * buf);
277
int ha_update_row(const unsigned char * old_data, unsigned char * new_data);
278
int ha_delete_row(const unsigned char * buf);
253
279
void ha_release_auto_increment();
281
int ha_check_for_upgrade(HA_CHECK_OPT *check_opt);
255
282
/** to be actually called to get 'check()' functionality*/
256
283
int ha_check(Session *session, HA_CHECK_OPT *check_opt);
284
int ha_repair(Session* session, HA_CHECK_OPT* check_opt);
258
285
void ha_start_bulk_insert(ha_rows rows);
259
286
int ha_end_bulk_insert();
287
int ha_bulk_update_row(const unsigned char *old_data, unsigned char *new_data,
288
uint32_t *dup_key_found);
260
289
int ha_delete_all_rows();
261
290
int ha_reset_auto_increment(uint64_t value);
291
int ha_optimize(Session* session, HA_CHECK_OPT* check_opt);
262
292
int ha_analyze(Session* session, HA_CHECK_OPT* check_opt);
293
bool ha_check_and_repair(Session *session);
264
294
int ha_disable_indexes(uint32_t mode);
265
295
int ha_enable_indexes(uint32_t mode);
266
296
int ha_discard_or_import_tablespace(bool discard);
267
void closeMarkForDelete(const char *name);
297
void ha_prepare_for_alter();
298
int ha_rename_table(const char *from, const char *to);
299
int ha_delete_table(const char *name);
300
void ha_drop_table(const char *name);
302
int ha_create(const char *name, Table *form, HA_CREATE_INFO *info);
304
int ha_create_handler_files(const char *name, const char *old_name,
305
int action_flag, HA_CREATE_INFO *info);
269
307
void adjust_next_insert_id_after_explicit_value(uint64_t nr);
270
308
int update_auto_increment();
309
void print_keydup_error(uint32_t key_nr, const char *msg);
310
virtual void print_error(int error, myf errflag);
311
virtual bool get_error_message(int error, String *buf);
312
uint32_t get_dup_key(int error);
313
virtual void change_table_ptr(Table *table_arg, TABLE_SHARE *share);
272
315
/* Estimates calculation */
273
316
virtual double scan_time(void)
456
570
@retval true Foreign key defined on table or index
457
571
@retval false No foreign key defined
573
virtual bool is_fk_defined_on_table_or_index(uint32_t)
459
575
virtual char* get_foreign_key_create_info(void)
460
{ return NULL;} /* gets foreign key create string from InnoDB */
461
/** used in ALTER Table; if changing storage engine is allowed.
462
e.g. not be allowed if table has foreign key constraints in engine.
464
virtual bool can_switch_engines(void) { return true; }
576
{ return(NULL);} /* gets foreign key create string from InnoDB */
577
/** used in ALTER Table; 1 if changing storage engine is allowed */
578
virtual bool can_switch_engines(void) { return 1; }
465
579
/** used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */
466
virtual int get_foreign_key_list(Session *, List<ForeignKeyInfo> *)
580
virtual int get_foreign_key_list(Session *, List<FOREIGN_KEY_INFO> *)
468
582
virtual uint32_t referenced_by_foreign_key() { return 0;}
583
virtual void init_table_handle_for_HANDLER()
584
{ return; } /* prepare InnoDB for HANDLER */
469
585
virtual void free_foreign_key_create_info(char *) {}
586
/** The following can be called without an open handler */
587
virtual const char *table_type() const =0;
589
If frm_error() is called then we will use this to find out what file
590
extentions exist for the storage engine. This is also used by the default
591
rename_table and delete_table method in handler.cc.
593
For engines that have two file name extentions (separate meta/index file
594
and data file), the order of elements is relevant. First element of engine
595
file name extentions array should be meta/index file extention. Second
596
element - data file extention. This order is assumed by
597
prepare_for_repair() when REPAIR Table ... USE_FRM is issued.
599
virtual const char **bas_ext() const =0;
601
virtual int get_default_no_partitions(HA_CREATE_INFO *) { return 1;}
602
virtual bool get_no_parts(const char *, uint32_t *no_parts)
608
virtual uint32_t index_flags(uint32_t idx, uint32_t part, bool all_parts) const =0;
610
virtual int add_index(Table *, KEY *, uint32_t)
611
{ return (HA_ERR_WRONG_COMMAND); }
612
virtual int prepare_drop_index(Table *, uint32_t *, uint32_t)
613
{ return (HA_ERR_WRONG_COMMAND); }
614
virtual int final_drop_index(Table *)
615
{ return (HA_ERR_WRONG_COMMAND); }
617
uint32_t max_record_length() const
618
{ return cmin((unsigned int)HA_MAX_REC_LENGTH, max_supported_record_length()); }
619
uint32_t max_keys() const
620
{ return cmin((unsigned int)MAX_KEY, max_supported_keys()); }
621
uint32_t max_key_parts() const
622
{ return cmin((unsigned int)MAX_REF_PARTS, max_supported_key_parts()); }
623
uint32_t max_key_length() const
624
{ return cmin((unsigned int)MAX_KEY_LENGTH, max_supported_key_length()); }
625
uint32_t max_key_part_length(void) const
626
{ return cmin((unsigned int)MAX_KEY_LENGTH, max_supported_key_part_length()); }
628
virtual uint32_t max_supported_record_length(void) const
629
{ return HA_MAX_REC_LENGTH; }
630
virtual uint32_t max_supported_keys(void) const { return 0; }
631
virtual uint32_t max_supported_key_parts(void) const { return MAX_REF_PARTS; }
632
virtual uint32_t max_supported_key_length(void) const { return MAX_KEY_LENGTH; }
633
virtual uint32_t max_supported_key_part_length(void) const { return 255; }
635
virtual bool low_byte_first(void) const { return 1; }
636
virtual uint32_t checksum(void) const { return 0; }
637
virtual bool is_crashed(void) const { return 0; }
638
virtual bool auto_repair(void) const { return 0; }
641
#define CHF_CREATE_FLAG 0
642
#define CHF_DELETE_FLAG 1
643
#define CHF_RENAME_FLAG 2
647
@note lock_count() can return > 1 if the table is MERGE or partitioned.
649
virtual uint32_t lock_count(void) const { return 1; }
472
651
Is not invoked for non-transactional temporary tables.
501
679
return memcmp(ref1, ref2, ref_length);
504
virtual bool isOrdered(void)
683
Condition pushdown to storage engines
687
Push condition down to the table handler.
689
@param cond Condition to be pushed. The condition tree must not be
690
modified by the by the caller.
693
The 'remainder' condition that caller must use to filter out records.
694
NULL means the handler will not return rows that do not match the
698
The pushed conditions form a stack (from which one can remove the
699
last pushed condition using cond_pop).
700
The table handler filters out rows using (pushed_cond1 AND pushed_cond2
701
AND ... AND pushed_condN)
702
or less restrictive condition, depending on handler's capabilities.
704
handler->ha_reset() call empties the condition stack.
705
Calls to rnd_init/rnd_end, index_init/index_end etc do not affect the
708
virtual const COND *cond_push(const COND *cond) { return cond; }
711
Pop the top condition from the condition stack of the handler instance.
713
Pops the top if condition stack, if stack is not empty.
715
virtual void cond_pop(void) { return; }
717
virtual Item *idx_cond_push(uint32_t, Item *idx_cond)
721
Part of old fast alter table, to be depricated
724
check_if_incompatible_data(HA_CREATE_INFO *, uint32_t)
725
{ return COMPATIBLE_DATA_NO; }
727
/* On-line ALTER Table interface */
730
Check if a storage engine supports a particular alter table on-line
732
@param altered_table A temporary table show what table is to
734
@param create_info Information from the parsing phase about new
736
@param alter_flags Bitmask that shows what will be changed
737
@param table_changes Shows if table layout has changed (for
738
backwards compatibility with
739
check_if_incompatible_data
741
@retval HA_ALTER_ERROR Unexpected error
742
@retval HA_ALTER_SUPPORTED_WAIT_LOCK Supported, but requires DDL lock
743
@retval HA_ALTER_SUPPORTED_NO_LOCK Supported
744
@retval HA_ALTER_NOT_SUPPORTED Not supported
747
The default implementation is implemented to support fast
748
alter table (storage engines that support some changes by
749
just changing the frm file) without any change in the handler
752
virtual int check_if_supported_alter(Table *, HA_CREATE_INFO *create_info,
753
HA_ALTER_FLAGS * alter_flags, uint32_t table_changes)
755
if (this->check_if_incompatible_data(create_info, table_changes)
756
== COMPATIBLE_DATA_NO)
757
return(HA_ALTER_NOT_SUPPORTED);
758
else if ((*alter_flags & HA_ALTER_STORED_VCOL).is_set())
759
return(HA_ALTER_NOT_SUPPORTED);
761
return(HA_ALTER_SUPPORTED_WAIT_LOCK);
764
Tell storage engine to prepare for the on-line alter table (pre-alter)
766
@param session The thread handle
767
@param altered_table A temporary table show what table is to
769
@param alter_info Storage place for data used during phase1
771
@param alter_flags Bitmask that shows what will be changed
774
@retval error error code passed from storage engine
776
virtual int alter_table_phase1(Session *, Table *, HA_CREATE_INFO *, HA_ALTER_INFO *,
779
return HA_ERR_UNSUPPORTED;
782
Tell storage engine to perform the on-line alter table (alter)
784
@param session The thread handle
785
@param altered_table A temporary table show what table is to
787
@param alter_info Storage place for data used during phase1
789
@param alter_flags Bitmask that shows what will be changed
792
@retval error error code passed from storage engine
795
If check_if_supported_alter returns HA_ALTER_SUPPORTED_WAIT_LOCK
796
this call is to be wrapped with a DDL lock. This is currently NOT
799
virtual int alter_table_phase2(Session *, Table *, HA_CREATE_INFO *, HA_ALTER_INFO *,
802
return HA_ERR_UNSUPPORTED;
805
Tell storage engine that changed frm file is now on disk and table
806
has been re-opened (post-alter)
808
@param session The thread handle
809
@param table The altered table, re-opened
811
virtual int alter_table_phase3(Session *, Table *)
813
return HA_ERR_UNSUPPORTED;
817
use_hidden_primary_key() is called in case of an update/delete when
818
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
819
but we don't have a primary key
821
virtual void use_hidden_primary_key();
826
@param session Thread handle
827
@param lock_type HA_LOCK_IN_SHARE_MODE (F_RDLCK)
828
HA_LOCK_IN_EXCLUSIVE_MODE (F_WRLCK)
829
@param lock_timeout -1 default timeout
831
>0 wait timeout in milliseconds.
834
lock_timeout >0 is not used by MySQL currently. If the storage
835
engine does not support NOWAIT (lock_timeout == 0) it should
836
return an error. But if it does not support WAIT X (lock_timeout
837
>0) it should treat it as lock_timeout == -1 and wait a default
838
(or even hard-coded) timeout.
840
@retval HA_ERR_WRONG_COMMAND Storage engine does not support
842
@retval HA_ERR_UNSUPPORTED Storage engine does not support NOWAIT
843
@retval HA_ERR_LOCK_WAIT_TIMEOUT Lock request timed out or
844
lock conflict with NOWAIT option
845
@retval HA_ERR_LOCK_DEADLOCK Deadlock detected
847
virtual int lock_table(Session *, int, int)
849
return HA_ERR_WRONG_COMMAND;
852
This procedure defines if the storage engine supports virtual columns.
853
Default false means "not supported".
855
virtual bool check_if_supported_virtual_columns(void)
511
859
/* Service methods for use by storage engines. */
512
void ha_statistic_increment(uint64_t system_status_var::*offset) const;
860
void ha_statistic_increment(ulong SSV::*offset) const;
513
861
void **ha_data(Session *) const;
862
Session *ha_session(void) const;
865
Default rename_table() and delete_table() rename/delete files with a
866
given name and extensions from bas_ext().
868
These methods can be overridden, but their default implementation
869
provide useful functionality.
871
virtual int rename_table(const char *from, const char *to);
873
Delete a table in the engine. Called for base as well as temporary
876
virtual int delete_table(const char *name);
516
879
/* Private helpers */
517
inline void setTransactionReadWrite();
880
inline void mark_trx_read_write();
520
883
Low-level primitives for storage engines. These should be
613
1003
virtual int reset_auto_increment(uint64_t)
614
1004
{ return HA_ERR_WRONG_COMMAND; }
616
virtual int analyze(Session *)
617
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1005
virtual int optimize(Session *, HA_CHECK_OPT *)
1006
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1007
virtual int analyze(Session *, HA_CHECK_OPT *)
1008
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1009
virtual bool check_and_repair(Session *)
619
1011
virtual int disable_indexes(uint32_t)
620
1012
{ return HA_ERR_WRONG_COMMAND; }
622
1013
virtual int enable_indexes(uint32_t)
623
1014
{ return HA_ERR_WRONG_COMMAND; }
625
1015
virtual int discard_or_import_tablespace(bool)
626
{ return (errno=HA_ERR_WRONG_COMMAND); }
629
@todo this is just for the HEAP engine, it should
630
be removed at some point in the future (and
631
no new engine should ever use it). Right
632
now HEAP does rely on it, so we cannot remove it.
1016
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
1017
virtual void prepare_for_alter(void) { return; }
634
1018
virtual void drop_table(const char *name);
1019
virtual int create(const char *, Table *, HA_CREATE_INFO *)=0;
1021
virtual int create_handler_files(const char *, const char *, int, HA_CREATE_INFO *)
1028
A Disk-Sweep MRR interface implementation
1030
This implementation makes range (and, in the future, 'ref') scans to read
1031
table rows in disk sweeps.
1033
Currently it is used by MyISAM and InnoDB. Potentially it can be used with
1034
any table handler that has non-clustered indexes and on-disk rows.
1040
typedef void (handler::*range_check_toggle_func_t)(bool on);
1045
handler *h; /* The "owner" handler object. It is used for scanning the index */
1046
Table *table; /* Always equal to h->table */
1049
Secondary handler object. It is used to retrieve full table rows by
1054
/* Buffer to store rowids, or (rowid, range_id) pairs */
1055
unsigned char *rowids_buf;
1056
unsigned char *rowids_buf_cur; /* Current position when reading/writing */
1057
unsigned char *rowids_buf_last; /* When reading: end of used buffer space */
1058
unsigned char *rowids_buf_end; /* End of the buffer */
1060
bool dsmrr_eof; /* true <=> We have reached EOF when reading index tuples */
1062
/* true <=> need range association, buffer holds {rowid, range_id} pairs */
1065
bool use_default_impl; /* true <=> shortcut all calls to default MRR impl */
1067
void init(handler *h_arg, Table *table_arg)
1072
int dsmrr_init(handler *h, KEY *key, RANGE_SEQ_IF *seq_funcs,
1073
void *seq_init_param, uint32_t n_ranges, uint32_t mode,
1074
HANDLER_BUFFER *buf);
1076
int dsmrr_fill_buffer(handler *h);
1077
int dsmrr_next(handler *h, char **range_info);
1079
int dsmrr_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys, uint32_t *bufsz,
1080
uint32_t *flags, COST_VECT *cost);
1082
ha_rows dsmrr_info_const(uint32_t keyno, RANGE_SEQ_IF *seq,
1083
void *seq_init_param, uint32_t n_ranges, uint32_t *bufsz,
1084
uint32_t *flags, COST_VECT *cost);
1086
bool key_uses_partial_cols(uint32_t keyno);
1087
bool choose_mrr_impl(uint32_t keyno, ha_rows rows, uint32_t *flags, uint32_t *bufsz,
1089
bool get_disk_sweep_mrr_cost(uint32_t keynr, ha_rows rows, uint32_t flags,
1090
uint32_t *buffer_size, COST_VECT *cost);
637
1093
extern const char *ha_row_type[];
1094
extern const char *tx_isolation_names[];
1095
extern const char *binlog_format_names[];
1096
extern TYPELIB tx_isolation_typelib;
1097
extern TYPELIB myisam_stats_method_typelib;
1098
extern uint32_t total_ha, total_ha_2pc;
1100
/* Wrapper functions */
1101
#define ha_commit(session) (ha_commit_trans((session), true))
1102
#define ha_rollback(session) (ha_rollback_trans((session), true))
639
1104
/* basic stuff */
640
void ha_init_errors(void);
643
SortField *make_unireg_sortorder(Order *order, uint32_t *length,
644
SortField *sortorder);
1105
int ha_init_errors(void);
1108
int ha_initialize_handlerton(st_plugin_int *plugin);
1109
int ha_finalize_handlerton(st_plugin_int *plugin);
1111
TYPELIB *ha_known_exts(void);
1112
void ha_close_connection(Session* session);
1113
bool ha_flush_logs(handlerton *db_type);
1114
void ha_drop_database(char* path);
1115
int ha_create_table(Session *session, const char *path,
1116
const char *db, const char *table_name,
1117
HA_CREATE_INFO *create_info,
1118
bool update_create_info);
1119
int ha_delete_table(Session *session, const char *path,
1120
const char *db, const char *alias, bool generate_warning);
1122
/* statistics and info */
1123
bool ha_show_status(Session *session, handlerton *db_type, enum ha_stat_type stat);
1125
int ha_find_files(Session *session,const char *db,const char *path,
1126
const char *wild, bool dir, List<LEX_STRING>* files);
1127
int ha_table_exists_in_engine(Session* session, const char* db, const char* name, handlerton **hton= NULL);
1130
extern "C" int ha_init_key_cache(const char *name, KEY_CACHE *key_cache);
1131
int ha_resize_key_cache(KEY_CACHE *key_cache);
1132
int ha_change_key_cache_param(KEY_CACHE *key_cache);
1133
int ha_change_key_cache(KEY_CACHE *old_key_cache, KEY_CACHE *new_key_cache);
1134
int ha_end_key_cache(KEY_CACHE *key_cache);
1136
/* report to InnoDB that control passes to the client */
1137
int ha_release_temporary_latches(Session *session);
1139
/* transactions: interface to handlerton functions */
1140
int ha_start_consistent_snapshot(Session *session);
1141
int ha_commit_or_rollback_by_xid(XID *xid, bool commit);
1142
int ha_commit_one_phase(Session *session, bool all);
1143
int ha_rollback_trans(Session *session, bool all);
1144
int ha_prepare(Session *session);
1145
int ha_recover(HASH *commit_list);
1147
/* transactions: these functions never call handlerton functions directly */
1148
int ha_commit_trans(Session *session, bool all);
1149
int ha_autocommit_or_rollback(Session *session, int error);
1150
int ha_enable_transaction(Session *session, bool on);
1153
int ha_rollback_to_savepoint(Session *session, SAVEPOINT *sv);
1154
int ha_savepoint(Session *session, SAVEPOINT *sv);
1155
int ha_release_savepoint(Session *session, SAVEPOINT *sv);
1157
/* these are called by storage engines */
1158
void trans_register_ha(Session *session, bool all, handlerton *ht);
1160
void table_case_convert(char * name, uint32_t length);
1161
const char *table_case_name(HA_CREATE_INFO *info, const char *name);
1163
extern ulong specialflag;
1164
extern uint32_t lower_case_table_names;
1165
uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length);
1166
uint32_t tablename_to_filename(const char *from, char *to, uint32_t to_length);
1169
bool mysql_ha_open(Session *session, TableList *tables, bool reopen);
1170
bool mysql_ha_close(Session *session, TableList *tables);
1171
bool mysql_ha_read(Session *, TableList *,enum enum_ha_read_modes,char *,
1172
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
1173
void mysql_ha_flush(Session *session);
1174
void mysql_ha_rm_tables(Session *session, TableList *tables, bool is_locked);
1175
void mysql_ha_cleanup(Session *session);
1178
Storage engine has to assume the transaction will end up with 2pc if
1179
- there is more than one 2pc-capable storage engine available
1180
- in the current transaction 2pc was not disabled yet
1182
#define trans_need_2pc(session, all) ((total_ha_2pc > 1) && \
1183
!((all ? &session->transaction.all : &session->transaction.stmt)->no_2pc))
1186
bool mysql_xa_recover(Session *session);
1188
SORT_FIELD * make_unireg_sortorder(order_st *order, uint32_t *length,
1189
SORT_FIELD *sortorder);
645
1190
int setup_order(Session *session, Item **ref_pointer_array, TableList *tables,
646
List<Item> &fields, List <Item> &all_fields, Order *order);
1191
List<Item> &fields, List <Item> &all_fields, order_st *order);
647
1192
int setup_group(Session *session, Item **ref_pointer_array, TableList *tables,
648
List<Item> &fields, List<Item> &all_fields, Order *order,
1193
List<Item> &fields, List<Item> &all_fields, order_st *order,
649
1194
bool *hidden_group_fields);
650
1195
bool fix_inner_refs(Session *session, List<Item> &all_fields, Select_Lex *select,
651
1196
Item **ref_pointer_array);
653
1198
bool handle_select(Session *session, LEX *lex, select_result *result,
654
1199
uint64_t setup_tables_done_option);
1200
bool mysql_select(Session *session, Item ***rref_pointer_array,
1201
TableList *tables, uint32_t wild_num, List<Item> &list,
1202
COND *conds, uint32_t og_num, order_st *order, order_st *group,
1203
Item *having, order_st *proc_param, uint64_t select_type,
1204
select_result *result, Select_Lex_Unit *unit,
1205
Select_Lex *select_lex);
655
1206
void free_underlaid_joins(Session *session, Select_Lex *select);
1207
bool mysql_explain_union(Session *session, Select_Lex_Unit *unit,
1208
select_result *result);
1209
int mysql_explain_select(Session *session, Select_Lex *sl, char const *type,
1210
select_result *result);
1211
bool mysql_union(Session *session, LEX *lex, select_result *result,
1212
Select_Lex_Unit *unit, uint64_t setup_tables_done_option);
657
1213
bool mysql_handle_derived(LEX *lex, bool (*processor)(Session *session,
659
1215
TableList *table));
660
1216
bool mysql_derived_prepare(Session *session, LEX *lex, TableList *t);
661
1217
bool mysql_derived_filling(Session *session, LEX *lex, TableList *t);
662
int prepare_create_field(CreateField *sql_field,
1218
void sp_prepare_create_field(Session *session, Create_field *sql_field);
1219
int prepare_create_field(Create_field *sql_field,
663
1220
uint32_t *blob_columns,
664
int *timestamps, int *timestamps_with_niladic);
666
bool mysql_create_table(Session *session,
667
const TableIdentifier &identifier,
1221
int *timestamps, int *timestamps_with_niladic,
1222
int64_t table_flags);
1223
bool mysql_create_table(Session *session,const char *db, const char *table_name,
668
1224
HA_CREATE_INFO *create_info,
669
message::Table &table_proto,
670
AlterInfo *alter_info,
671
bool tmp_table, uint32_t select_field_count,
672
bool is_if_not_exists);
674
bool mysql_create_table_no_lock(Session *session,
675
const TableIdentifier &identifier,
1225
Alter_info *alter_info,
1226
bool tmp_table, uint32_t select_field_count);
1227
bool mysql_create_table_no_lock(Session *session, const char *db,
1228
const char *table_name,
676
1229
HA_CREATE_INFO *create_info,
677
message::Table &table_proto,
678
AlterInfo *alter_info,
1230
Alter_info *alter_info,
679
1231
bool tmp_table, uint32_t select_field_count,
680
bool is_if_not_exists);
682
bool mysql_create_like_table(Session* session,
683
const TableIdentifier &destination_identifier,
684
TableList* table, TableList* src_table,
685
message::Table &create_table_proto,
686
bool is_if_not_exists,
689
bool mysql_rename_table(Session &session,
690
plugin::StorageEngine *base,
691
const TableIdentifier &old_identifier,
692
const TableIdentifier &new_identifier);
1232
bool lock_open_lock);
1234
bool mysql_alter_table(Session *session, char *new_db, char *new_name,
1235
HA_CREATE_INFO *create_info,
1236
TableList *table_list,
1237
Alter_info *alter_info,
1238
uint32_t order_num, order_st *order, bool ignore);
1239
bool mysql_recreate_table(Session *session, TableList *table_list);
1240
bool mysql_create_like_table(Session *session, TableList *table,
1241
TableList *src_table,
1242
HA_CREATE_INFO *create_info);
1243
bool mysql_rename_table(handlerton *base, const char *old_db,
1244
const char * old_name, const char *new_db,
1245
const char * new_name, uint32_t flags);
694
1246
bool mysql_prepare_update(Session *session, TableList *table_list,
695
Item **conds, uint32_t order_num, Order *order);
1247
Item **conds, uint32_t order_num, order_st *order);
696
1248
int mysql_update(Session *session,TableList *tables,List<Item> &fields,
697
1249
List<Item> &values,COND *conds,
698
uint32_t order_num, Order *order, ha_rows limit,
1250
uint32_t order_num, order_st *order, ha_rows limit,
699
1251
enum enum_duplicates handle_duplicates, bool ignore);
1252
bool mysql_multi_update(Session *session, TableList *table_list,
1253
List<Item> *fields, List<Item> *values,
1254
COND *conds, uint64_t options,
1255
enum enum_duplicates handle_duplicates, bool ignore,
1256
Select_Lex_Unit *unit, Select_Lex *select_lex);
700
1257
bool mysql_prepare_insert(Session *session, TableList *table_list, Table *table,
701
1258
List<Item> &fields, List_item *values,
702
1259
List<Item> &update_fields,
713
1270
bool mysql_delete(Session *session, TableList *table_list, COND *conds,
714
1271
SQL_LIST *order, ha_rows rows, uint64_t options,
715
1272
bool reset_auto_increment);
716
bool mysql_truncate(Session& session, TableList *table_list);
717
TableShare *get_table_share(Session *session, TableList *table_list, char *key,
1273
bool mysql_truncate(Session *session, TableList *table_list, bool dont_send_ok);
1274
uint32_t create_table_def_key(Session *session, char *key, TableList *table_list,
1276
TABLE_SHARE *get_table_share(Session *session, TableList *table_list, char *key,
718
1277
uint32_t key_length, uint32_t db_flags, int *error);
719
TableShare *get_cached_table_share(const char *db, const char *table_name);
1278
void release_table_share(TABLE_SHARE *share, enum release_type type);
1279
TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
1280
Table *open_ltable(Session *session, TableList *table_list, thr_lock_type update,
1281
uint32_t lock_flags);
1282
Table *open_table(Session *session, TableList *table_list, bool *refresh, uint32_t flags);
1283
bool name_lock_locked_table(Session *session, TableList *tables);
720
1284
bool reopen_name_locked_table(Session* session, TableList* table_list, bool link_in);
1285
Table *table_cache_insert_placeholder(Session *session, const char *key,
1286
uint32_t key_length);
1287
bool lock_table_name_if_not_cached(Session *session, const char *db,
1288
const char *table_name, Table **table);
1289
Table *find_locked_table(Session *session, const char *db,const char *table_name);
1290
void detach_merge_children(Table *table, bool clear_refs);
1291
bool fix_merge_after_open(TableList *old_child_list, TableList **old_last,
1292
TableList *new_child_list, TableList **new_last);
1293
bool reopen_table(Table *table);
721
1294
bool reopen_tables(Session *session,bool get_locks,bool in_refresh);
1295
void close_data_files_and_morph_locks(Session *session, const char *db,
1296
const char *table_name);
722
1297
void close_handle_and_leave_table_as_lock(Table *table);
1298
bool open_new_frm(Session *session, TABLE_SHARE *share, const char *alias,
1299
uint32_t db_stat, uint32_t prgflag,
1300
uint32_t ha_open_flags, Table *outparam,
1301
TableList *table_desc, MEM_ROOT *mem_root);
723
1302
bool wait_for_tables(Session *session);
724
1303
bool table_is_used(Table *table, bool wait_for_name_lock);
725
Table *drop_locked_tables(Session *session, const drizzled::TableIdentifier &identifier);
726
void abort_locked_tables(Session *session, const drizzled::TableIdentifier &identifier);
1304
Table *drop_locked_tables(Session *session,const char *db, const char *table_name);
1305
void abort_locked_tables(Session *session,const char *db, const char *table_name);
1306
void execute_init_command(Session *session, sys_var_str *init_command_var,
1307
pthread_rwlock_t *var_mutex);
727
1308
extern Field *not_found_field;
728
1309
extern Field *view_ref_found;