230
231
Discrete_interval auto_inc_interval_for_cur_row;
232
Cursor(plugin::StorageEngine &engine_arg, Table &share_arg);
233
virtual ~Cursor(void);
234
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();
236
256
/* ha_ methods: pubilc wrappers for private virtual API */
238
int ha_open(const identifier::Table &identifier, int mode, int test_if_locked);
239
int startIndexScan(uint32_t idx, bool sorted) __attribute__ ((warn_unused_result));
241
int startTableScan(bool scan) __attribute__ ((warn_unused_result));
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);
245
265
/* this is necessary in many places, e.g. in HANDLER command */
246
266
int ha_index_or_rnd_end();
267
Table_flags ha_table_flags() const;
249
270
These functions represent the public interface to *users* of the
250
Cursor class, hence they are *not* virtual. For the inheritance
251
interface, see the (private) functions doInsertRecord(), doUpdateRecord(),
252
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.
254
275
int ha_external_lock(Session *session, int lock_type);
255
int insertRecord(unsigned char * buf) __attribute__ ((warn_unused_result));
256
int updateRecord(const unsigned char * old_data, unsigned char * new_data) __attribute__ ((warn_unused_result));
257
int deleteRecord(const unsigned char * buf) __attribute__ ((warn_unused_result));
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);
258
279
void ha_release_auto_increment();
281
int ha_check_for_upgrade(HA_CHECK_OPT *check_opt);
260
282
/** to be actually called to get 'check()' functionality*/
261
283
int ha_check(Session *session, HA_CHECK_OPT *check_opt);
284
int ha_repair(Session* session, HA_CHECK_OPT* check_opt);
263
285
void ha_start_bulk_insert(ha_rows rows);
264
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);
265
289
int ha_delete_all_rows();
266
290
int ha_reset_auto_increment(uint64_t value);
291
int ha_optimize(Session* session, HA_CHECK_OPT* check_opt);
267
292
int ha_analyze(Session* session, HA_CHECK_OPT* check_opt);
293
bool ha_check_and_repair(Session *session);
269
294
int ha_disable_indexes(uint32_t mode);
270
295
int ha_enable_indexes(uint32_t mode);
271
296
int ha_discard_or_import_tablespace(bool discard);
272
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);
274
307
void adjust_next_insert_id_after_explicit_value(uint64_t nr);
275
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);
277
315
/* Estimates calculation */
278
316
virtual double scan_time(void)
506
682
return memcmp(ref1, ref2, ref_length);
509
virtual bool isOrdered(void)
686
Condition pushdown to storage engines
690
Push condition down to the table handler.
692
@param cond Condition to be pushed. The condition tree must not be
693
modified by the by the caller.
696
The 'remainder' condition that caller must use to filter out records.
697
NULL means the handler will not return rows that do not match the
701
The pushed conditions form a stack (from which one can remove the
702
last pushed condition using cond_pop).
703
The table handler filters out rows using (pushed_cond1 AND pushed_cond2
704
AND ... AND pushed_condN)
705
or less restrictive condition, depending on handler's capabilities.
707
handler->ha_reset() call empties the condition stack.
708
Calls to rnd_init/rnd_end, index_init/index_end etc do not affect the
711
virtual const COND *cond_push(const COND *cond) { return cond; }
714
Pop the top condition from the condition stack of the handler instance.
716
Pops the top if condition stack, if stack is not empty.
718
virtual void cond_pop(void) { return; }
720
virtual Item *idx_cond_push(uint32_t, Item *idx_cond)
724
Part of old fast alter table, to be depricated
727
check_if_incompatible_data(HA_CREATE_INFO *, uint32_t)
728
{ return COMPATIBLE_DATA_NO; }
730
/* On-line ALTER Table interface */
733
Check if a storage engine supports a particular alter table on-line
735
@param altered_table A temporary table show what table is to
737
@param create_info Information from the parsing phase about new
739
@param alter_flags Bitmask that shows what will be changed
740
@param table_changes Shows if table layout has changed (for
741
backwards compatibility with
742
check_if_incompatible_data
744
@retval HA_ALTER_ERROR Unexpected error
745
@retval HA_ALTER_SUPPORTED_WAIT_LOCK Supported, but requires DDL lock
746
@retval HA_ALTER_SUPPORTED_NO_LOCK Supported
747
@retval HA_ALTER_NOT_SUPPORTED Not supported
750
The default implementation is implemented to support fast
751
alter table (storage engines that support some changes by
752
just changing the frm file) without any change in the handler
755
virtual int check_if_supported_alter(Table *, HA_CREATE_INFO *create_info,
756
HA_ALTER_FLAGS * alter_flags, uint32_t table_changes)
758
if (this->check_if_incompatible_data(create_info, table_changes)
759
== COMPATIBLE_DATA_NO)
760
return(HA_ALTER_NOT_SUPPORTED);
761
else if ((*alter_flags & HA_ALTER_STORED_VCOL).is_set())
762
return(HA_ALTER_NOT_SUPPORTED);
764
return(HA_ALTER_SUPPORTED_WAIT_LOCK);
767
Tell storage engine to prepare for the on-line alter table (pre-alter)
769
@param session The thread handle
770
@param altered_table A temporary table show what table is to
772
@param alter_info Storage place for data used during phase1
774
@param alter_flags Bitmask that shows what will be changed
777
@retval error error code passed from storage engine
779
virtual int alter_table_phase1(Session *, Table *, HA_CREATE_INFO *, HA_ALTER_INFO *,
782
return HA_ERR_UNSUPPORTED;
785
Tell storage engine to perform the on-line alter table (alter)
787
@param session The thread handle
788
@param altered_table A temporary table show what table is to
790
@param alter_info Storage place for data used during phase1
792
@param alter_flags Bitmask that shows what will be changed
795
@retval error error code passed from storage engine
798
If check_if_supported_alter returns HA_ALTER_SUPPORTED_WAIT_LOCK
799
this call is to be wrapped with a DDL lock. This is currently NOT
802
virtual int alter_table_phase2(Session *, Table *, HA_CREATE_INFO *, HA_ALTER_INFO *,
805
return HA_ERR_UNSUPPORTED;
808
Tell storage engine that changed frm file is now on disk and table
809
has been re-opened (post-alter)
811
@param session The thread handle
812
@param table The altered table, re-opened
814
virtual int alter_table_phase3(Session *, Table *)
816
return HA_ERR_UNSUPPORTED;
820
use_hidden_primary_key() is called in case of an update/delete when
821
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
822
but we don't have a primary key
824
virtual void use_hidden_primary_key();
829
@param session Thread handle
830
@param lock_type HA_LOCK_IN_SHARE_MODE (F_RDLCK)
831
HA_LOCK_IN_EXCLUSIVE_MODE (F_WRLCK)
832
@param lock_timeout -1 default timeout
834
>0 wait timeout in milliseconds.
837
lock_timeout >0 is not used by MySQL currently. If the storage
838
engine does not support NOWAIT (lock_timeout == 0) it should
839
return an error. But if it does not support WAIT X (lock_timeout
840
>0) it should treat it as lock_timeout == -1 and wait a default
841
(or even hard-coded) timeout.
843
@retval HA_ERR_WRONG_COMMAND Storage engine does not support
845
@retval HA_ERR_UNSUPPORTED Storage engine does not support NOWAIT
846
@retval HA_ERR_LOCK_WAIT_TIMEOUT Lock request timed out or
847
lock conflict with NOWAIT option
848
@retval HA_ERR_LOCK_DEADLOCK Deadlock detected
850
virtual int lock_table(Session *, int, int)
852
return HA_ERR_WRONG_COMMAND;
855
This procedure defines if the storage engine supports virtual columns.
856
Default false means "not supported".
858
virtual bool check_if_supported_virtual_columns(void)
516
862
/* Service methods for use by storage engines. */
517
void ha_statistic_increment(uint64_t system_status_var::*offset) const;
863
void ha_statistic_increment(ulong SSV::*offset) const;
518
864
void **ha_data(Session *) const;
865
Session *ha_session(void) const;
868
Default rename_table() and delete_table() rename/delete files with a
869
given name and extensions from bas_ext().
871
These methods can be overridden, but their default implementation
872
provide useful functionality.
874
virtual int rename_table(const char *from, const char *to);
876
Delete a table in the engine. Called for base as well as temporary
879
virtual int delete_table(const char *name);
521
882
/* Private helpers */
522
inline void setTransactionReadWrite();
883
inline void mark_trx_read_write();
525
886
Low-level primitives for storage engines. These should be
618
1006
virtual int reset_auto_increment(uint64_t)
619
1007
{ return HA_ERR_WRONG_COMMAND; }
621
virtual int analyze(Session *)
622
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1008
virtual int optimize(Session *, HA_CHECK_OPT *)
1009
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1010
virtual int analyze(Session *, HA_CHECK_OPT *)
1011
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1012
virtual bool check_and_repair(Session *)
624
1014
virtual int disable_indexes(uint32_t)
625
1015
{ return HA_ERR_WRONG_COMMAND; }
627
1016
virtual int enable_indexes(uint32_t)
628
1017
{ return HA_ERR_WRONG_COMMAND; }
630
1018
virtual int discard_or_import_tablespace(bool)
631
{ return (errno=HA_ERR_WRONG_COMMAND); }
634
@todo this is just for the HEAP engine, it should
635
be removed at some point in the future (and
636
no new engine should ever use it). Right
637
now HEAP does rely on it, so we cannot remove it.
1019
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
1020
virtual void prepare_for_alter(void) { return; }
639
1021
virtual void drop_table(const char *name);
1022
virtual int create(const char *, Table *, HA_CREATE_INFO *)=0;
1024
virtual int create_handler_files(const char *, const char *, int, HA_CREATE_INFO *)
1031
A Disk-Sweep MRR interface implementation
1033
This implementation makes range (and, in the future, 'ref') scans to read
1034
table rows in disk sweeps.
1036
Currently it is used by MyISAM and InnoDB. Potentially it can be used with
1037
any table handler that has non-clustered indexes and on-disk rows.
1043
typedef void (handler::*range_check_toggle_func_t)(bool on);
1048
handler *h; /* The "owner" handler object. It is used for scanning the index */
1049
Table *table; /* Always equal to h->table */
1052
Secondary handler object. It is used to retrieve full table rows by
1057
/* Buffer to store rowids, or (rowid, range_id) pairs */
1058
unsigned char *rowids_buf;
1059
unsigned char *rowids_buf_cur; /* Current position when reading/writing */
1060
unsigned char *rowids_buf_last; /* When reading: end of used buffer space */
1061
unsigned char *rowids_buf_end; /* End of the buffer */
1063
bool dsmrr_eof; /* true <=> We have reached EOF when reading index tuples */
1065
/* true <=> need range association, buffer holds {rowid, range_id} pairs */
1068
bool use_default_impl; /* true <=> shortcut all calls to default MRR impl */
1070
void init(handler *h_arg, Table *table_arg)
1075
int dsmrr_init(handler *h, KEY *key, RANGE_SEQ_IF *seq_funcs,
1076
void *seq_init_param, uint32_t n_ranges, uint32_t mode,
1077
HANDLER_BUFFER *buf);
1079
int dsmrr_fill_buffer(handler *h);
1080
int dsmrr_next(handler *h, char **range_info);
1082
int dsmrr_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys, uint32_t *bufsz,
1083
uint32_t *flags, COST_VECT *cost);
1085
ha_rows dsmrr_info_const(uint32_t keyno, RANGE_SEQ_IF *seq,
1086
void *seq_init_param, uint32_t n_ranges, uint32_t *bufsz,
1087
uint32_t *flags, COST_VECT *cost);
1089
bool key_uses_partial_cols(uint32_t keyno);
1090
bool choose_mrr_impl(uint32_t keyno, ha_rows rows, uint32_t *flags, uint32_t *bufsz,
1092
bool get_disk_sweep_mrr_cost(uint32_t keynr, ha_rows rows, uint32_t flags,
1093
uint32_t *buffer_size, COST_VECT *cost);
642
1096
extern const char *ha_row_type[];
1097
extern const char *tx_isolation_names[];
1098
extern const char *binlog_format_names[];
1099
extern TYPELIB tx_isolation_typelib;
1100
extern TYPELIB myisam_stats_method_typelib;
1101
extern uint32_t total_ha, total_ha_2pc;
1103
/* Wrapper functions */
1104
#define ha_commit(session) (ha_commit_trans((session), true))
1105
#define ha_rollback(session) (ha_rollback_trans((session), true))
644
1107
/* basic stuff */
645
void ha_init_errors(void);
648
SortField *make_unireg_sortorder(Order *order, uint32_t *length,
649
SortField *sortorder);
1108
int ha_init_errors(void);
1111
int ha_initialize_handlerton(st_plugin_int *plugin);
1112
int ha_finalize_handlerton(st_plugin_int *plugin);
1114
TYPELIB *ha_known_exts(void);
1115
void ha_close_connection(Session* session);
1116
bool ha_flush_logs(handlerton *db_type);
1117
void ha_drop_database(char* path);
1118
int ha_create_table(Session *session, const char *path,
1119
const char *db, const char *table_name,
1120
HA_CREATE_INFO *create_info,
1121
bool update_create_info);
1122
int ha_delete_table(Session *session, const char *path,
1123
const char *db, const char *alias, bool generate_warning);
1125
/* statistics and info */
1126
bool ha_show_status(Session *session, handlerton *db_type, enum ha_stat_type stat);
1128
int ha_find_files(Session *session,const char *db,const char *path,
1129
const char *wild, bool dir, List<LEX_STRING>* files);
1130
int ha_table_exists_in_engine(Session* session, const char* db, const char* name, handlerton **hton= NULL);
1133
extern "C" int ha_init_key_cache(const char *name, KEY_CACHE *key_cache);
1134
int ha_resize_key_cache(KEY_CACHE *key_cache);
1135
int ha_change_key_cache_param(KEY_CACHE *key_cache);
1136
int ha_change_key_cache(KEY_CACHE *old_key_cache, KEY_CACHE *new_key_cache);
1137
int ha_end_key_cache(KEY_CACHE *key_cache);
1139
/* report to InnoDB that control passes to the client */
1140
int ha_release_temporary_latches(Session *session);
1142
/* transactions: interface to handlerton functions */
1143
int ha_start_consistent_snapshot(Session *session);
1144
int ha_commit_or_rollback_by_xid(XID *xid, bool commit);
1145
int ha_commit_one_phase(Session *session, bool all);
1146
int ha_rollback_trans(Session *session, bool all);
1147
int ha_prepare(Session *session);
1148
int ha_recover(HASH *commit_list);
1150
/* transactions: these functions never call handlerton functions directly */
1151
int ha_commit_trans(Session *session, bool all);
1152
int ha_autocommit_or_rollback(Session *session, int error);
1153
int ha_enable_transaction(Session *session, bool on);
1156
int ha_rollback_to_savepoint(Session *session, SAVEPOINT *sv);
1157
int ha_savepoint(Session *session, SAVEPOINT *sv);
1158
int ha_release_savepoint(Session *session, SAVEPOINT *sv);
1160
/* these are called by storage engines */
1161
void trans_register_ha(Session *session, bool all, handlerton *ht);
1163
void table_case_convert(char * name, uint32_t length);
1164
const char *table_case_name(HA_CREATE_INFO *info, const char *name);
1166
extern char reg_ext[FN_EXTLEN];
1167
extern uint32_t reg_ext_length;
1168
extern ulong specialflag;
1169
extern uint32_t lower_case_table_names;
1170
uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length);
1171
uint32_t tablename_to_filename(const char *from, char *to, uint32_t to_length);
1174
bool mysql_ha_open(Session *session, TableList *tables, bool reopen);
1175
bool mysql_ha_close(Session *session, TableList *tables);
1176
bool mysql_ha_read(Session *, TableList *,enum enum_ha_read_modes,char *,
1177
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
1178
void mysql_ha_flush(Session *session);
1179
void mysql_ha_rm_tables(Session *session, TableList *tables, bool is_locked);
1180
void mysql_ha_cleanup(Session *session);
1183
Storage engine has to assume the transaction will end up with 2pc if
1184
- there is more than one 2pc-capable storage engine available
1185
- in the current transaction 2pc was not disabled yet
1187
#define trans_need_2pc(session, all) ((total_ha_2pc > 1) && \
1188
!((all ? &session->transaction.all : &session->transaction.stmt)->no_2pc))
1191
bool mysql_xa_recover(Session *session);
1193
SORT_FIELD * make_unireg_sortorder(order_st *order, uint32_t *length,
1194
SORT_FIELD *sortorder);
650
1195
int setup_order(Session *session, Item **ref_pointer_array, TableList *tables,
651
List<Item> &fields, List <Item> &all_fields, Order *order);
1196
List<Item> &fields, List <Item> &all_fields, order_st *order);
652
1197
int setup_group(Session *session, Item **ref_pointer_array, TableList *tables,
653
List<Item> &fields, List<Item> &all_fields, Order *order,
1198
List<Item> &fields, List<Item> &all_fields, order_st *order,
654
1199
bool *hidden_group_fields);
655
1200
bool fix_inner_refs(Session *session, List<Item> &all_fields, Select_Lex *select,
656
1201
Item **ref_pointer_array);
658
1203
bool handle_select(Session *session, LEX *lex, select_result *result,
659
uint64_t setup_tables_done_option);
1204
ulong setup_tables_done_option);
1205
bool mysql_select(Session *session, Item ***rref_pointer_array,
1206
TableList *tables, uint32_t wild_num, List<Item> &list,
1207
COND *conds, uint32_t og_num, order_st *order, order_st *group,
1208
Item *having, order_st *proc_param, uint64_t select_type,
1209
select_result *result, Select_Lex_Unit *unit,
1210
Select_Lex *select_lex);
660
1211
void free_underlaid_joins(Session *session, Select_Lex *select);
662
bool handle_derived(LEX *lex, bool (*processor)(Session *session,
1212
bool mysql_explain_union(Session *session, Select_Lex_Unit *unit,
1213
select_result *result);
1214
int mysql_explain_select(Session *session, Select_Lex *sl, char const *type,
1215
select_result *result);
1216
bool mysql_union(Session *session, LEX *lex, select_result *result,
1217
Select_Lex_Unit *unit, ulong setup_tables_done_option);
1218
bool mysql_handle_derived(LEX *lex, bool (*processor)(Session *session,
664
1220
TableList *table));
665
bool derived_prepare(Session *session, LEX *lex, TableList *t);
666
bool derived_filling(Session *session, LEX *lex, TableList *t);
667
int prepare_create_field(CreateField *sql_field,
1221
bool mysql_derived_prepare(Session *session, LEX *lex, TableList *t);
1222
bool mysql_derived_filling(Session *session, LEX *lex, TableList *t);
1223
void sp_prepare_create_field(Session *session, Create_field *sql_field);
1224
int prepare_create_field(Create_field *sql_field,
668
1225
uint32_t *blob_columns,
669
int *timestamps, int *timestamps_with_niladic);
671
bool create_table(Session *session,
672
const identifier::Table &identifier,
673
HA_CREATE_INFO *create_info,
674
message::Table &table_proto,
675
AlterInfo *alter_info,
676
bool tmp_table, uint32_t select_field_count,
677
bool is_if_not_exists);
679
bool create_table_no_lock(Session *session,
680
const identifier::Table &identifier,
681
HA_CREATE_INFO *create_info,
682
message::Table &table_proto,
683
AlterInfo *alter_info,
684
bool tmp_table, uint32_t select_field_count,
685
bool is_if_not_exists);
687
bool create_like_table(Session* session,
688
identifier::Table::const_reference destination_identifier,
689
identifier::Table::const_reference source_identifier,
690
message::Table &create_table_proto,
691
bool is_if_not_exists,
694
bool rename_table(Session &session,
695
plugin::StorageEngine *base,
696
const identifier::Table &old_identifier,
697
const identifier::Table &new_identifier);
699
bool prepare_update(Session *session, TableList *table_list,
700
Item **conds, uint32_t order_num, Order *order);
701
int update_query(Session *session,TableList *tables,List<Item> &fields,
1226
int *timestamps, int *timestamps_with_niladic,
1227
int64_t table_flags);
1228
bool mysql_create_table(Session *session,const char *db, const char *table_name,
1229
HA_CREATE_INFO *create_info,
1230
Alter_info *alter_info,
1231
bool tmp_table, uint32_t select_field_count);
1232
bool mysql_create_table_no_lock(Session *session, const char *db,
1233
const char *table_name,
1234
HA_CREATE_INFO *create_info,
1235
Alter_info *alter_info,
1236
bool tmp_table, uint32_t select_field_count,
1237
bool lock_open_lock);
1239
bool mysql_alter_table(Session *session, char *new_db, char *new_name,
1240
HA_CREATE_INFO *create_info,
1241
TableList *table_list,
1242
Alter_info *alter_info,
1243
uint32_t order_num, order_st *order, bool ignore);
1244
bool mysql_recreate_table(Session *session, TableList *table_list);
1245
bool mysql_create_like_table(Session *session, TableList *table,
1246
TableList *src_table,
1247
HA_CREATE_INFO *create_info);
1248
bool mysql_rename_table(handlerton *base, const char *old_db,
1249
const char * old_name, const char *new_db,
1250
const char * new_name, uint32_t flags);
1251
bool mysql_prepare_update(Session *session, TableList *table_list,
1252
Item **conds, uint32_t order_num, order_st *order);
1253
int mysql_update(Session *session,TableList *tables,List<Item> &fields,
702
1254
List<Item> &values,COND *conds,
703
uint32_t order_num, Order *order, ha_rows limit,
1255
uint32_t order_num, order_st *order, ha_rows limit,
704
1256
enum enum_duplicates handle_duplicates, bool ignore);
705
bool prepare_insert(Session *session, TableList *table_list, Table *table,
1257
bool mysql_multi_update(Session *session, TableList *table_list,
1258
List<Item> *fields, List<Item> *values,
1259
COND *conds, uint64_t options,
1260
enum enum_duplicates handle_duplicates, bool ignore,
1261
Select_Lex_Unit *unit, Select_Lex *select_lex);
1262
bool mysql_prepare_insert(Session *session, TableList *table_list, Table *table,
706
1263
List<Item> &fields, List_item *values,
707
1264
List<Item> &update_fields,
708
1265
List<Item> &update_values, enum_duplicates duplic,
709
1266
COND **where, bool select_insert,
710
1267
bool check_fields, bool abort_on_warning);
711
bool insert_query(Session *session,TableList *table,List<Item> &fields,
1268
bool mysql_insert(Session *session,TableList *table,List<Item> &fields,
712
1269
List<List_item> &values, List<Item> &update_fields,
713
1270
List<Item> &update_values, enum_duplicates flag,
715
1272
int check_that_all_fields_are_given_values(Session *session, Table *entry,
716
1273
TableList *table_list);
717
int prepare_delete(Session *session, TableList *table_list, Item **conds);
718
bool delete_query(Session *session, TableList *table_list, COND *conds,
1274
int mysql_prepare_delete(Session *session, TableList *table_list, Item **conds);
1275
bool mysql_delete(Session *session, TableList *table_list, COND *conds,
719
1276
SQL_LIST *order, ha_rows rows, uint64_t options,
720
1277
bool reset_auto_increment);
721
bool truncate(Session& session, TableList *table_list);
722
TableShare *get_table_share(Session *session, TableList *table_list, char *key,
1278
bool mysql_truncate(Session *session, TableList *table_list, bool dont_send_ok);
1279
uint32_t create_table_def_key(Session *session, char *key, TableList *table_list,
1281
TABLE_SHARE *get_table_share(Session *session, TableList *table_list, char *key,
723
1282
uint32_t key_length, uint32_t db_flags, int *error);
724
TableShare *get_cached_table_share(const char *db, const char *table_name);
1283
void release_table_share(TABLE_SHARE *share, enum release_type type);
1284
TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
1285
Table *open_ltable(Session *session, TableList *table_list, thr_lock_type update,
1286
uint32_t lock_flags);
1287
Table *open_table(Session *session, TableList *table_list, bool *refresh, uint32_t flags);
1288
bool name_lock_locked_table(Session *session, TableList *tables);
725
1289
bool reopen_name_locked_table(Session* session, TableList* table_list, bool link_in);
1290
Table *table_cache_insert_placeholder(Session *session, const char *key,
1291
uint32_t key_length);
1292
bool lock_table_name_if_not_cached(Session *session, const char *db,
1293
const char *table_name, Table **table);
1294
Table *find_locked_table(Session *session, const char *db,const char *table_name);
1295
void detach_merge_children(Table *table, bool clear_refs);
1296
bool fix_merge_after_open(TableList *old_child_list, TableList **old_last,
1297
TableList *new_child_list, TableList **new_last);
1298
bool reopen_table(Table *table);
726
1299
bool reopen_tables(Session *session,bool get_locks,bool in_refresh);
1300
void close_data_files_and_morph_locks(Session *session, const char *db,
1301
const char *table_name);
727
1302
void close_handle_and_leave_table_as_lock(Table *table);
1303
bool open_new_frm(Session *session, TABLE_SHARE *share, const char *alias,
1304
uint32_t db_stat, uint32_t prgflag,
1305
uint32_t ha_open_flags, Table *outparam,
1306
TableList *table_desc, MEM_ROOT *mem_root);
728
1307
bool wait_for_tables(Session *session);
729
1308
bool table_is_used(Table *table, bool wait_for_name_lock);
730
Table *drop_locked_tables(Session *session, const drizzled::identifier::Table &identifier);
731
void abort_locked_tables(Session *session, const drizzled::identifier::Table &identifier);
1309
Table *drop_locked_tables(Session *session,const char *db, const char *table_name);
1310
void abort_locked_tables(Session *session,const char *db, const char *table_name);
1311
void execute_init_command(Session *session, sys_var_str *init_command_var,
1312
pthread_rwlock_t *var_mutex);
732
1313
extern Field *not_found_field;
733
1314
extern Field *view_ref_found;