313
313
/* Estimates calculation */
314
314
virtual double scan_time(void)
315
315
{ return uint64_t2double(stats.data_file_length) / IO_SIZE + 2; }
316
virtual double read_time(uint32_t index __attribute__((unused)),
317
uint32_t ranges, ha_rows rows)
316
virtual double read_time(uint32_t, uint32_t ranges, ha_rows rows)
318
317
{ return rows2double(ranges+rows); }
320
319
virtual double index_only_read_time(uint32_t keynr, double records);
446
445
virtual int index_read_idx_map(unsigned char * buf, uint32_t index, const unsigned char * key,
447
446
key_part_map keypart_map,
448
447
enum ha_rkey_function find_flag);
449
virtual int index_next(unsigned char * buf __attribute__((unused)))
450
{ return HA_ERR_WRONG_COMMAND; }
451
virtual int index_prev(unsigned char * buf __attribute__((unused)))
452
{ return HA_ERR_WRONG_COMMAND; }
453
virtual int index_first(unsigned char * buf __attribute__((unused)))
454
{ return HA_ERR_WRONG_COMMAND; }
455
virtual int index_last(unsigned char * buf __attribute__((unused)))
456
{ return HA_ERR_WRONG_COMMAND; }
457
virtual int index_next_same(unsigned char *buf __attribute__((unused)),
458
const unsigned char *key __attribute__((unused)),
459
uint32_t keylen __attribute__((unused)));
448
virtual int index_next(unsigned char *)
449
{ return HA_ERR_WRONG_COMMAND; }
450
virtual int index_prev(unsigned char *)
451
{ return HA_ERR_WRONG_COMMAND; }
452
virtual int index_first(unsigned char *)
453
{ return HA_ERR_WRONG_COMMAND; }
454
virtual int index_last(unsigned char *)
455
{ return HA_ERR_WRONG_COMMAND; }
456
virtual int index_next_same(unsigned char *, const unsigned char *, uint32_t);
462
459
The following functions works like index_read, but it find the last
474
471
virtual int read_range_next();
475
472
int compare_key(key_range *range);
476
473
int compare_key2(key_range *range);
477
virtual int rnd_next(unsigned char *buf __attribute__((unused)))=0;
478
virtual int rnd_pos(unsigned char * buf __attribute__((unused)),
479
unsigned char *pos __attribute__((unused)))=0;
474
virtual int rnd_next(unsigned char *)=0;
475
virtual int rnd_pos(unsigned char *, unsigned char *)=0;
481
477
One has to use this method when to find
482
478
random position by record as the plain
489
485
The following function is only needed for tables that may be temporary
490
486
tables during joins.
492
virtual int restart_rnd_next(unsigned char *buf __attribute__((unused)),
493
unsigned char *pos __attribute__((unused)))
494
{ return HA_ERR_WRONG_COMMAND; }
495
virtual int rnd_same(unsigned char *buf __attribute__((unused)),
496
uint32_t inx __attribute__((unused)))
497
{ return HA_ERR_WRONG_COMMAND; }
498
virtual ha_rows records_in_range(uint32_t inx __attribute__((unused)),
499
key_range *min_key __attribute__((unused)),
500
key_range *max_key __attribute__((unused)))
488
virtual int restart_rnd_next(unsigned char *, unsigned char *)
489
{ return HA_ERR_WRONG_COMMAND; }
490
virtual int rnd_same(unsigned char *, uint32_t)
491
{ return HA_ERR_WRONG_COMMAND; }
492
virtual ha_rows records_in_range(uint32_t, key_range *, key_range *)
501
493
{ return (ha_rows) 10; }
502
494
virtual void position(const unsigned char *record)=0;
503
495
virtual int info(uint)=0; // see my_base.h for full description
504
virtual uint32_t calculate_key_hash_value(Field **field_array __attribute__((unused)))
496
virtual uint32_t calculate_key_hash_value(Field **)
505
497
{ assert(0); return 0; }
506
virtual int extra(enum ha_extra_function operation __attribute__((unused)))
498
virtual int extra(enum ha_extra_function)
508
virtual int extra_opt(enum ha_extra_function operation,
509
uint32_t cache_size __attribute__((unused)))
500
virtual int extra_opt(enum ha_extra_function operation, uint32_t)
510
501
{ return extra(operation); }
531
522
virtual void try_semi_consistent_read(bool) {}
532
523
virtual void unlock_row(void) {}
533
virtual int start_stmt(Session *session __attribute__((unused)),
534
thr_lock_type lock_type __attribute__((unused)))
524
virtual int start_stmt(Session *, thr_lock_type)
536
526
virtual void get_auto_increment(uint64_t offset, uint64_t increment,
537
527
uint64_t nb_desired_values,
557
547
insert_id_for_cur_row;
560
virtual void update_create_info(HA_CREATE_INFO *create_info __attribute__((unused))) {}
550
virtual void update_create_info(HA_CREATE_INFO *) {}
561
551
int check_old_types(void);
562
virtual int assign_to_keycache(Session* session __attribute__((unused)),
563
HA_CHECK_OPT* check_opt __attribute__((unused)))
552
virtual int assign_to_keycache(Session*, HA_CHECK_OPT *)
564
553
{ return HA_ADMIN_NOT_IMPLEMENTED; }
565
554
/* end of the list of admin commands */
567
556
virtual int indexes_are_disabled(void) {return 0;}
568
557
virtual char *update_table_comment(const char * comment)
569
558
{ return (char*) comment;}
570
virtual void append_create_info(String *packet __attribute__((unused)))
559
virtual void append_create_info(String *)
573
562
If index == MAX_KEY then a check for table is made and if index <
579
568
@retval true Foreign key defined on table or index
580
569
@retval false No foreign key defined
582
virtual bool is_fk_defined_on_table_or_index(uint32_t index __attribute__((unused)))
571
virtual bool is_fk_defined_on_table_or_index(uint32_t)
583
572
{ return false; }
584
573
virtual char* get_foreign_key_create_info(void)
585
574
{ return(NULL);} /* gets foreign key create string from InnoDB */
586
575
/** used in ALTER Table; 1 if changing storage engine is allowed */
587
576
virtual bool can_switch_engines(void) { return 1; }
588
577
/** used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */
589
virtual int get_foreign_key_list(Session *session __attribute__((unused)),
590
List<FOREIGN_KEY_INFO> *f_key_list __attribute__((unused)))
578
virtual int get_foreign_key_list(Session *, List<FOREIGN_KEY_INFO> *)
592
580
virtual uint32_t referenced_by_foreign_key() { return 0;}
593
581
virtual void init_table_handle_for_HANDLER()
594
582
{ return; } /* prepare InnoDB for HANDLER */
595
virtual void free_foreign_key_create_info(char* str __attribute__((unused))) {}
583
virtual void free_foreign_key_create_info(char *) {}
596
584
/** The following can be called without an open handler */
597
585
virtual const char *table_type() const =0;
609
597
virtual const char **bas_ext() const =0;
611
virtual int get_default_no_partitions(HA_CREATE_INFO *info __attribute__((unused))) { return 1;}
612
virtual bool get_no_parts(const char *name __attribute__((unused)),
599
virtual int get_default_no_partitions(HA_CREATE_INFO *) { return 1;}
600
virtual bool get_no_parts(const char *, uint32_t *no_parts)
619
606
virtual uint32_t index_flags(uint32_t idx, uint32_t part, bool all_parts) const =0;
621
virtual int add_index(Table *table_arg __attribute__((unused)),
622
KEY *key_info __attribute__((unused)),
623
uint32_t num_of_keys __attribute__((unused)))
624
{ return (HA_ERR_WRONG_COMMAND); }
625
virtual int prepare_drop_index(Table *table_arg __attribute__((unused)),
626
uint32_t *key_num __attribute__((unused)),
627
uint32_t num_of_keys __attribute__((unused)))
628
{ return (HA_ERR_WRONG_COMMAND); }
629
virtual int final_drop_index(Table *table_arg __attribute__((unused)))
608
virtual int add_index(Table *, KEY *, uint32_t)
609
{ return (HA_ERR_WRONG_COMMAND); }
610
virtual int prepare_drop_index(Table *, uint32_t *, uint32_t)
611
{ return (HA_ERR_WRONG_COMMAND); }
612
virtual int final_drop_index(Table *)
630
613
{ return (HA_ERR_WRONG_COMMAND); }
632
615
uint32_t max_record_length() const
646
629
virtual uint32_t max_supported_key_parts(void) const { return MAX_REF_PARTS; }
647
630
virtual uint32_t max_supported_key_length(void) const { return MAX_KEY_LENGTH; }
648
631
virtual uint32_t max_supported_key_part_length(void) const { return 255; }
649
virtual uint32_t min_record_length(uint32_t options __attribute__((unused))) const
632
virtual uint32_t min_record_length(uint32_t) const
652
635
virtual bool low_byte_first(void) const { return 1; }
719
register_query_cache_table(Session *session __attribute__((unused)),
720
char *table_key __attribute__((unused)),
721
uint32_t key_length __attribute__((unused)),
702
register_query_cache_table(Session *, char *, uint32_t,
722
703
qc_engine_callback *engine_callback,
723
uint64_t *engine_data __attribute__((unused)))
725
706
*engine_callback= 0;
774
755
virtual void cond_pop(void) { return; }
777
*idx_cond_push(uint32_t keyno __attribute__((unused)),
778
Item* idx_cond __attribute__((unused)))
757
virtual Item *idx_cond_push(uint32_t, Item *idx_cond)
779
758
{ return idx_cond; }
782
761
Part of old fast alter table, to be depricated
785
check_if_incompatible_data(HA_CREATE_INFO *create_info __attribute__((unused)),
786
uint32_t table_changes __attribute__((unused)))
764
check_if_incompatible_data(HA_CREATE_INFO *, uint32_t)
787
765
{ return COMPATIBLE_DATA_NO; }
789
767
/* On-line ALTER Table interface */
811
789
just changing the frm file) without any change in the handler
815
check_if_supported_alter(Table *altered_table __attribute__((unused)),
816
HA_CREATE_INFO *create_info,
817
HA_ALTER_FLAGS *alter_flags __attribute__((unused)),
818
uint32_t table_changes)
792
virtual int check_if_supported_alter(Table *, HA_CREATE_INFO *create_info,
793
HA_ALTER_FLAGS * alter_flags, uint32_t table_changes)
820
795
if (this->check_if_incompatible_data(create_info, table_changes)
821
796
== COMPATIBLE_DATA_NO)
839
814
@retval error error code passed from storage engine
841
virtual int alter_table_phase1(Session *session __attribute__((unused)),
842
Table *altered_table __attribute__((unused)),
843
HA_CREATE_INFO *create_info __attribute__((unused)),
844
HA_ALTER_INFO *alter_info __attribute__((unused)),
845
HA_ALTER_FLAGS *alter_flags __attribute__((unused)))
816
virtual int alter_table_phase1(Session *, Table *, HA_CREATE_INFO *, HA_ALTER_INFO *,
847
819
return HA_ERR_UNSUPPORTED;
864
836
this call is to be wrapped with a DDL lock. This is currently NOT
867
virtual int alter_table_phase2(Session *session __attribute__((unused)),
868
Table *altered_table __attribute__((unused)),
869
HA_CREATE_INFO *create_info __attribute__((unused)),
870
HA_ALTER_INFO *alter_info __attribute__((unused)),
871
HA_ALTER_FLAGS *alter_flags __attribute__((unused)))
839
virtual int alter_table_phase2(Session *, Table *, HA_CREATE_INFO *, HA_ALTER_INFO *,
873
842
return HA_ERR_UNSUPPORTED;
879
848
@param session The thread handle
880
849
@param table The altered table, re-opened
882
virtual int alter_table_phase3(Session *session __attribute__((unused)),
883
Table *table __attribute__((unused)))
851
virtual int alter_table_phase3(Session *, Table *)
885
853
return HA_ERR_UNSUPPORTED;
916
884
lock conflict with NOWAIT option
917
885
@retval HA_ERR_LOCK_DEADLOCK Deadlock detected
919
virtual int lock_table(Session *session __attribute__((unused)),
920
int lock_type __attribute__((unused)),
921
int lock_timeout __attribute__((unused)))
887
virtual int lock_table(Session *, int, int)
923
889
return HA_ERR_WRONG_COMMAND;
962
928
virtual int open(const char *name, int mode, uint32_t test_if_locked)=0;
963
virtual int index_init(uint32_t idx,
964
bool sorted __attribute__((unused)))
929
virtual int index_init(uint32_t idx, bool)
965
930
{ active_index= idx; return 0; }
966
931
virtual int index_end() { active_index= MAX_KEY; return 0; }
974
939
virtual int rnd_init(bool scan)= 0;
975
940
virtual int rnd_end() { return 0; }
976
virtual int write_row(unsigned char *buf __attribute__((unused)))
978
return HA_ERR_WRONG_COMMAND;
981
virtual int update_row(const unsigned char *old_data __attribute__((unused)),
982
unsigned char *new_data __attribute__((unused)))
984
return HA_ERR_WRONG_COMMAND;
987
virtual int delete_row(const unsigned char *buf __attribute__((unused)))
941
virtual int write_row(unsigned char *)
943
return HA_ERR_WRONG_COMMAND;
946
virtual int update_row(const unsigned char *, unsigned char *)
948
return HA_ERR_WRONG_COMMAND;
951
virtual int delete_row(const unsigned char *)
989
953
return HA_ERR_WRONG_COMMAND;
1018
982
@return non-0 in case of failure, 0 in case of success.
1019
983
When lock_type is F_UNLCK, the return value is ignored.
1021
virtual int external_lock(Session *session __attribute__((unused)),
1022
int lock_type __attribute__((unused)))
985
virtual int external_lock(Session *, int)
1026
989
virtual void release_auto_increment(void) { return; };
1027
990
/** admin commands - called from mysql_admin_table */
1028
virtual int check_for_upgrade(HA_CHECK_OPT *check_opt __attribute__((unused)))
991
virtual int check_for_upgrade(HA_CHECK_OPT *)
1030
virtual int check(Session* session __attribute__((unused)),
1031
HA_CHECK_OPT* check_opt __attribute__((unused)))
993
virtual int check(Session *, HA_CHECK_OPT *)
1032
994
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1036
998
to specify CHECK option to use to call check()
1039
virtual int repair(Session* session __attribute__((unused)),
1040
HA_CHECK_OPT* check_opt __attribute__((unused)))
1001
virtual int repair(Session *, HA_CHECK_OPT *)
1041
1002
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1042
virtual void start_bulk_insert(ha_rows rows __attribute__((unused)))
1003
virtual void start_bulk_insert(ha_rows)
1044
1005
virtual int end_bulk_insert(void) { return 0; }
1045
virtual int index_read(unsigned char * buf __attribute__((unused)),
1046
const unsigned char * key __attribute__((unused)),
1047
uint32_t key_len __attribute__((unused)),
1048
enum ha_rkey_function find_flag __attribute__((unused)))
1006
virtual int index_read(unsigned char *, const unsigned char *,
1007
uint32_t, enum ha_rkey_function)
1049
1008
{ return HA_ERR_WRONG_COMMAND; }
1050
virtual int index_read_last(unsigned char * buf __attribute__((unused)),
1051
const unsigned char * key __attribute__((unused)),
1052
uint32_t key_len __attribute__((unused)))
1009
virtual int index_read_last(unsigned char *, const unsigned char *, uint32_t)
1053
1010
{ return (my_errno= HA_ERR_WRONG_COMMAND); }
1055
1012
This method is similar to update_row, however the handler doesn't need
1064
1021
@retval 0 Bulk delete used by handler
1065
1022
@retval 1 Bulk delete not used, normal operation used
1067
virtual int bulk_update_row(const unsigned char *old_data __attribute__((unused)),
1068
unsigned char *new_data __attribute__((unused)),
1069
uint32_t *dup_key_found __attribute__((unused)))
1024
virtual int bulk_update_row(const unsigned char *, unsigned char *, uint32_t *)
1072
1027
return HA_ERR_WRONG_COMMAND;
1085
1040
is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is
1086
1041
returned by storage engines that don't support this operation.
1088
virtual int reset_auto_increment(uint64_t value __attribute__((unused)))
1043
virtual int reset_auto_increment(uint64_t)
1089
1044
{ return HA_ERR_WRONG_COMMAND; }
1090
virtual int optimize(Session* session __attribute__((unused)),
1091
HA_CHECK_OPT* check_opt __attribute__((unused)))
1092
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1093
virtual int analyze(Session* session __attribute__((unused)),
1094
HA_CHECK_OPT* check_opt __attribute__((unused)))
1095
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1096
virtual bool check_and_repair(Session *session __attribute__((unused)))
1045
virtual int optimize(Session *, HA_CHECK_OPT *)
1046
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1047
virtual int analyze(Session *, HA_CHECK_OPT *)
1048
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1049
virtual bool check_and_repair(Session *)
1097
1050
{ return true; }
1098
virtual int disable_indexes(uint32_t mode __attribute__((unused)))
1099
{ return HA_ERR_WRONG_COMMAND; }
1100
virtual int enable_indexes(uint32_t mode __attribute__((unused)))
1101
{ return HA_ERR_WRONG_COMMAND; }
1102
virtual int discard_or_import_tablespace(bool discard __attribute__((unused)))
1051
virtual int disable_indexes(uint32_t)
1052
{ return HA_ERR_WRONG_COMMAND; }
1053
virtual int enable_indexes(uint32_t)
1054
{ return HA_ERR_WRONG_COMMAND; }
1055
virtual int discard_or_import_tablespace(bool)
1103
1056
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
1104
1057
virtual void prepare_for_alter(void) { return; }
1105
1058
virtual void drop_table(const char *name);
1106
virtual int create(const char *name __attribute__((unused)),
1107
Table *form __attribute__((unused)),
1108
HA_CREATE_INFO *info __attribute__((unused)))=0;
1059
virtual int create(const char *, Table *, HA_CREATE_INFO *)=0;
1110
virtual int create_handler_files(const char *name __attribute__((unused)),
1111
const char *old_name __attribute__((unused)),
1112
int action_flag __attribute__((unused)),
1113
HA_CREATE_INFO *info __attribute__((unused)))
1061
virtual int create_handler_files(const char *, const char *, int, HA_CREATE_INFO *)
1114
1062
{ return false; }