1316
1316
/* Estimates calculation */
1317
1317
virtual double scan_time(void)
1318
1318
{ return uint64_t2double(stats.data_file_length) / IO_SIZE + 2; }
1319
virtual double read_time(uint index __attribute__((__unused__)),
1319
virtual double read_time(uint index __attribute__((unused)),
1320
1320
uint ranges, ha_rows rows)
1321
1321
{ return rows2double(ranges+rows); }
1458
1458
virtual int index_read_idx_map(uchar * buf, uint index, const uchar * key,
1459
1459
key_part_map keypart_map,
1460
1460
enum ha_rkey_function find_flag);
1461
virtual int index_next(uchar * buf __attribute__((__unused__)))
1462
{ return HA_ERR_WRONG_COMMAND; }
1463
virtual int index_prev(uchar * buf __attribute__((__unused__)))
1464
{ return HA_ERR_WRONG_COMMAND; }
1465
virtual int index_first(uchar * buf __attribute__((__unused__)))
1466
{ return HA_ERR_WRONG_COMMAND; }
1467
virtual int index_last(uchar * buf __attribute__((__unused__)))
1468
{ return HA_ERR_WRONG_COMMAND; }
1469
virtual int index_next_same(uchar *buf __attribute__((__unused__)),
1470
const uchar *key __attribute__((__unused__)),
1471
uint keylen __attribute__((__unused__)));
1461
virtual int index_next(uchar * buf __attribute__((unused)))
1462
{ return HA_ERR_WRONG_COMMAND; }
1463
virtual int index_prev(uchar * buf __attribute__((unused)))
1464
{ return HA_ERR_WRONG_COMMAND; }
1465
virtual int index_first(uchar * buf __attribute__((unused)))
1466
{ return HA_ERR_WRONG_COMMAND; }
1467
virtual int index_last(uchar * buf __attribute__((unused)))
1468
{ return HA_ERR_WRONG_COMMAND; }
1469
virtual int index_next_same(uchar *buf __attribute__((unused)),
1470
const uchar *key __attribute__((unused)),
1471
uint keylen __attribute__((unused)));
1474
1474
The following functions works like index_read, but it find the last
1486
1486
virtual int read_range_next();
1487
1487
int compare_key(key_range *range);
1488
1488
int compare_key2(key_range *range);
1489
virtual int rnd_next(uchar *buf __attribute__((__unused__)))=0;
1490
virtual int rnd_pos(uchar * buf __attribute__((__unused__)),
1491
uchar *pos __attribute__((__unused__)))=0;
1489
virtual int rnd_next(uchar *buf __attribute__((unused)))=0;
1490
virtual int rnd_pos(uchar * buf __attribute__((unused)),
1491
uchar *pos __attribute__((unused)))=0;
1493
1493
One has to use this method when to find
1494
1494
random position by record as the plain
1501
1501
The following function is only needed for tables that may be temporary
1502
1502
tables during joins.
1504
virtual int restart_rnd_next(uchar *buf __attribute__((__unused__)),
1505
uchar *pos __attribute__((__unused__)))
1506
{ return HA_ERR_WRONG_COMMAND; }
1507
virtual int rnd_same(uchar *buf __attribute__((__unused__)),
1508
uint inx __attribute__((__unused__)))
1509
{ return HA_ERR_WRONG_COMMAND; }
1510
virtual ha_rows records_in_range(uint inx __attribute__((__unused__)),
1511
key_range *min_key __attribute__((__unused__)),
1512
key_range *max_key __attribute__((__unused__)))
1504
virtual int restart_rnd_next(uchar *buf __attribute__((unused)),
1505
uchar *pos __attribute__((unused)))
1506
{ return HA_ERR_WRONG_COMMAND; }
1507
virtual int rnd_same(uchar *buf __attribute__((unused)),
1508
uint inx __attribute__((unused)))
1509
{ return HA_ERR_WRONG_COMMAND; }
1510
virtual ha_rows records_in_range(uint inx __attribute__((unused)),
1511
key_range *min_key __attribute__((unused)),
1512
key_range *max_key __attribute__((unused)))
1513
1513
{ return (ha_rows) 10; }
1514
1514
virtual void position(const uchar *record)=0;
1515
1515
virtual int info(uint)=0; // see my_base.h for full description
1516
virtual uint32_t calculate_key_hash_value(Field **field_array __attribute__((__unused__)))
1516
virtual uint32_t calculate_key_hash_value(Field **field_array __attribute__((unused)))
1517
1517
{ assert(0); return 0; }
1518
virtual int extra(enum ha_extra_function operation __attribute__((__unused__)))
1518
virtual int extra(enum ha_extra_function operation __attribute__((unused)))
1520
1520
virtual int extra_opt(enum ha_extra_function operation,
1521
uint32_t cache_size __attribute__((__unused__)))
1521
uint32_t cache_size __attribute__((unused)))
1522
1522
{ return extra(operation); }
1543
1543
virtual void try_semi_consistent_read(bool) {}
1544
1544
virtual void unlock_row(void) {}
1545
virtual int start_stmt(THD *thd __attribute__((__unused__)),
1546
thr_lock_type lock_type __attribute__((__unused__)))
1545
virtual int start_stmt(THD *thd __attribute__((unused)),
1546
thr_lock_type lock_type __attribute__((unused)))
1548
1548
virtual void get_auto_increment(uint64_t offset, uint64_t increment,
1549
1549
uint64_t nb_desired_values,
1569
1569
insert_id_for_cur_row;
1572
virtual void update_create_info(HA_CREATE_INFO *create_info __attribute__((__unused__))) {}
1572
virtual void update_create_info(HA_CREATE_INFO *create_info __attribute__((unused))) {}
1573
1573
int check_old_types(void);
1574
virtual int assign_to_keycache(THD* thd __attribute__((__unused__)),
1575
HA_CHECK_OPT* check_opt __attribute__((__unused__)))
1574
virtual int assign_to_keycache(THD* thd __attribute__((unused)),
1575
HA_CHECK_OPT* check_opt __attribute__((unused)))
1576
1576
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1577
1577
/* end of the list of admin commands */
1579
1579
virtual int indexes_are_disabled(void) {return 0;}
1580
1580
virtual char *update_table_comment(const char * comment)
1581
1581
{ return (char*) comment;}
1582
virtual void append_create_info(String *packet __attribute__((__unused__)))
1582
virtual void append_create_info(String *packet __attribute__((unused)))
1585
1585
If index == MAX_KEY then a check for table is made and if index <
1591
1591
@retval true Foreign key defined on table or index
1592
1592
@retval false No foreign key defined
1594
virtual bool is_fk_defined_on_table_or_index(uint index __attribute__((__unused__)))
1594
virtual bool is_fk_defined_on_table_or_index(uint index __attribute__((unused)))
1595
1595
{ return false; }
1596
1596
virtual char* get_foreign_key_create_info(void)
1597
1597
{ return(NULL);} /* gets foreign key create string from InnoDB */
1598
1598
/** used in ALTER TABLE; 1 if changing storage engine is allowed */
1599
1599
virtual bool can_switch_engines(void) { return 1; }
1600
1600
/** used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */
1601
virtual int get_foreign_key_list(THD *thd __attribute__((__unused__)),
1602
List<FOREIGN_KEY_INFO> *f_key_list __attribute__((__unused__)))
1601
virtual int get_foreign_key_list(THD *thd __attribute__((unused)),
1602
List<FOREIGN_KEY_INFO> *f_key_list __attribute__((unused)))
1604
1604
virtual uint referenced_by_foreign_key() { return 0;}
1605
1605
virtual void init_table_handle_for_HANDLER()
1606
1606
{ return; } /* prepare InnoDB for HANDLER */
1607
virtual void free_foreign_key_create_info(char* str __attribute__((__unused__))) {}
1607
virtual void free_foreign_key_create_info(char* str __attribute__((unused))) {}
1608
1608
/** The following can be called without an open handler */
1609
1609
virtual const char *table_type() const =0;
1631
1631
virtual uint32_t index_flags(uint idx, uint part, bool all_parts) const =0;
1633
virtual int add_index(TABLE *table_arg __attribute__((__unused__)),
1634
KEY *key_info __attribute__((__unused__)),
1635
uint num_of_keys __attribute__((__unused__)))
1636
{ return (HA_ERR_WRONG_COMMAND); }
1637
virtual int prepare_drop_index(TABLE *table_arg __attribute__((__unused__)),
1638
uint *key_num __attribute__((__unused__)),
1639
uint num_of_keys __attribute__((__unused__)))
1640
{ return (HA_ERR_WRONG_COMMAND); }
1641
virtual int final_drop_index(TABLE *table_arg __attribute__((__unused__)))
1633
virtual int add_index(TABLE *table_arg __attribute__((unused)),
1634
KEY *key_info __attribute__((unused)),
1635
uint num_of_keys __attribute__((unused)))
1636
{ return (HA_ERR_WRONG_COMMAND); }
1637
virtual int prepare_drop_index(TABLE *table_arg __attribute__((unused)),
1638
uint *key_num __attribute__((unused)),
1639
uint num_of_keys __attribute__((unused)))
1640
{ return (HA_ERR_WRONG_COMMAND); }
1641
virtual int final_drop_index(TABLE *table_arg __attribute__((unused)))
1642
1642
{ return (HA_ERR_WRONG_COMMAND); }
1644
1644
uint max_record_length() const
1731
register_query_cache_table(THD *thd __attribute__((__unused__)),
1732
char *table_key __attribute__((__unused__)),
1733
uint key_length __attribute__((__unused__)),
1731
register_query_cache_table(THD *thd __attribute__((unused)),
1732
char *table_key __attribute__((unused)),
1733
uint key_length __attribute__((unused)),
1734
1734
qc_engine_callback *engine_callback,
1735
uint64_t *engine_data __attribute__((__unused__)))
1735
uint64_t *engine_data __attribute__((unused)))
1737
1737
*engine_callback= 0;
1786
1786
virtual void cond_pop(void) { return; }
1789
*idx_cond_push(uint keyno __attribute__((__unused__)),
1790
Item* idx_cond __attribute__((__unused__)))
1789
*idx_cond_push(uint keyno __attribute__((unused)),
1790
Item* idx_cond __attribute__((unused)))
1791
1791
{ return idx_cond; }
1794
1794
Part of old fast alter table, to be depricated
1797
check_if_incompatible_data(HA_CREATE_INFO *create_info __attribute__((__unused__)),
1798
uint table_changes __attribute__((__unused__)))
1797
check_if_incompatible_data(HA_CREATE_INFO *create_info __attribute__((unused)),
1798
uint table_changes __attribute__((unused)))
1799
1799
{ return COMPATIBLE_DATA_NO; }
1801
1801
/* On-line ALTER TABLE interface */
1824
1824
implementation.
1827
check_if_supported_alter(TABLE *altered_table __attribute__((__unused__)),
1827
check_if_supported_alter(TABLE *altered_table __attribute__((unused)),
1828
1828
HA_CREATE_INFO *create_info,
1829
HA_ALTER_FLAGS *alter_flags __attribute__((__unused__)),
1829
HA_ALTER_FLAGS *alter_flags __attribute__((unused)),
1830
1830
uint table_changes)
1832
1832
if (this->check_if_incompatible_data(create_info, table_changes)
1849
1849
@retval error error code passed from storage engine
1851
virtual int alter_table_phase1(THD *thd __attribute__((__unused__)),
1852
TABLE *altered_table __attribute__((__unused__)),
1853
HA_CREATE_INFO *create_info __attribute__((__unused__)),
1854
HA_ALTER_INFO *alter_info __attribute__((__unused__)),
1855
HA_ALTER_FLAGS *alter_flags __attribute__((__unused__)))
1851
virtual int alter_table_phase1(THD *thd __attribute__((unused)),
1852
TABLE *altered_table __attribute__((unused)),
1853
HA_CREATE_INFO *create_info __attribute__((unused)),
1854
HA_ALTER_INFO *alter_info __attribute__((unused)),
1855
HA_ALTER_FLAGS *alter_flags __attribute__((unused)))
1857
1857
return HA_ERR_UNSUPPORTED;
1874
1874
this call is to be wrapped with a DDL lock. This is currently NOT
1877
virtual int alter_table_phase2(THD *thd __attribute__((__unused__)),
1878
TABLE *altered_table __attribute__((__unused__)),
1879
HA_CREATE_INFO *create_info __attribute__((__unused__)),
1880
HA_ALTER_INFO *alter_info __attribute__((__unused__)),
1881
HA_ALTER_FLAGS *alter_flags __attribute__((__unused__)))
1877
virtual int alter_table_phase2(THD *thd __attribute__((unused)),
1878
TABLE *altered_table __attribute__((unused)),
1879
HA_CREATE_INFO *create_info __attribute__((unused)),
1880
HA_ALTER_INFO *alter_info __attribute__((unused)),
1881
HA_ALTER_FLAGS *alter_flags __attribute__((unused)))
1883
1883
return HA_ERR_UNSUPPORTED;
1889
1889
@param thd The thread handle
1890
1890
@param table The altered table, re-opened
1892
virtual int alter_table_phase3(THD *thd __attribute__((__unused__)),
1893
TABLE *table __attribute__((__unused__)))
1892
virtual int alter_table_phase3(THD *thd __attribute__((unused)),
1893
TABLE *table __attribute__((unused)))
1895
1895
return HA_ERR_UNSUPPORTED;
2030
2030
virtual void release_auto_increment(void) { return; };
2031
2031
/** admin commands - called from mysql_admin_table */
2032
virtual int check_for_upgrade(HA_CHECK_OPT *check_opt __attribute__((__unused__)))
2032
virtual int check_for_upgrade(HA_CHECK_OPT *check_opt __attribute__((unused)))
2034
virtual int check(THD* thd __attribute__((__unused__)),
2035
HA_CHECK_OPT* check_opt __attribute__((__unused__)))
2034
virtual int check(THD* thd __attribute__((unused)),
2035
HA_CHECK_OPT* check_opt __attribute__((unused)))
2036
2036
{ return HA_ADMIN_NOT_IMPLEMENTED; }
2040
2040
to specify CHECK option to use to call check()
2041
2041
upon the table.
2043
virtual int repair(THD* thd __attribute__((__unused__)),
2044
HA_CHECK_OPT* check_opt __attribute__((__unused__)))
2043
virtual int repair(THD* thd __attribute__((unused)),
2044
HA_CHECK_OPT* check_opt __attribute__((unused)))
2045
2045
{ return HA_ADMIN_NOT_IMPLEMENTED; }
2046
virtual void start_bulk_insert(ha_rows rows __attribute__((__unused__)))
2046
virtual void start_bulk_insert(ha_rows rows __attribute__((unused)))
2048
2048
virtual int end_bulk_insert(void) { return 0; }
2049
virtual int index_read(uchar * buf __attribute__((__unused__)),
2050
const uchar * key __attribute__((__unused__)),
2051
uint key_len __attribute__((__unused__)),
2052
enum ha_rkey_function find_flag __attribute__((__unused__)))
2049
virtual int index_read(uchar * buf __attribute__((unused)),
2050
const uchar * key __attribute__((unused)),
2051
uint key_len __attribute__((unused)),
2052
enum ha_rkey_function find_flag __attribute__((unused)))
2053
2053
{ return HA_ERR_WRONG_COMMAND; }
2054
virtual int index_read_last(uchar * buf __attribute__((__unused__)),
2055
const uchar * key __attribute__((__unused__)),
2056
uint key_len __attribute__((__unused__)))
2054
virtual int index_read_last(uchar * buf __attribute__((unused)),
2055
const uchar * key __attribute__((unused)),
2056
uint key_len __attribute__((unused)))
2057
2057
{ return (my_errno= HA_ERR_WRONG_COMMAND); }
2059
2059
This method is similar to update_row, however the handler doesn't need
2068
2068
@retval 0 Bulk delete used by handler
2069
2069
@retval 1 Bulk delete not used, normal operation used
2071
virtual int bulk_update_row(const uchar *old_data __attribute__((__unused__)),
2072
uchar *new_data __attribute__((__unused__)),
2073
uint *dup_key_found __attribute__((__unused__)))
2071
virtual int bulk_update_row(const uchar *old_data __attribute__((unused)),
2072
uchar *new_data __attribute__((unused)),
2073
uint *dup_key_found __attribute__((unused)))
2076
2076
return HA_ERR_WRONG_COMMAND;
2089
2089
is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is
2090
2090
returned by storage engines that don't support this operation.
2092
virtual int reset_auto_increment(uint64_t value __attribute__((__unused__)))
2092
virtual int reset_auto_increment(uint64_t value __attribute__((unused)))
2093
2093
{ return HA_ERR_WRONG_COMMAND; }
2094
virtual int optimize(THD* thd __attribute__((__unused__)),
2095
HA_CHECK_OPT* check_opt __attribute__((__unused__)))
2096
{ return HA_ADMIN_NOT_IMPLEMENTED; }
2097
virtual int analyze(THD* thd __attribute__((__unused__)),
2098
HA_CHECK_OPT* check_opt __attribute__((__unused__)))
2099
{ return HA_ADMIN_NOT_IMPLEMENTED; }
2100
virtual bool check_and_repair(THD *thd __attribute__((__unused__)))
2094
virtual int optimize(THD* thd __attribute__((unused)),
2095
HA_CHECK_OPT* check_opt __attribute__((unused)))
2096
{ return HA_ADMIN_NOT_IMPLEMENTED; }
2097
virtual int analyze(THD* thd __attribute__((unused)),
2098
HA_CHECK_OPT* check_opt __attribute__((unused)))
2099
{ return HA_ADMIN_NOT_IMPLEMENTED; }
2100
virtual bool check_and_repair(THD *thd __attribute__((unused)))
2101
2101
{ return true; }
2102
virtual int disable_indexes(uint mode __attribute__((__unused__)))
2103
{ return HA_ERR_WRONG_COMMAND; }
2104
virtual int enable_indexes(uint mode __attribute__((__unused__)))
2105
{ return HA_ERR_WRONG_COMMAND; }
2106
virtual int discard_or_import_tablespace(bool discard __attribute__((__unused__)))
2102
virtual int disable_indexes(uint mode __attribute__((unused)))
2103
{ return HA_ERR_WRONG_COMMAND; }
2104
virtual int enable_indexes(uint mode __attribute__((unused)))
2105
{ return HA_ERR_WRONG_COMMAND; }
2106
virtual int discard_or_import_tablespace(bool discard __attribute__((unused)))
2107
2107
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
2108
2108
virtual void prepare_for_alter(void) { return; }
2109
2109
virtual void drop_table(const char *name);
2110
virtual int create(const char *name __attribute__((__unused__)),
2111
TABLE *form __attribute__((__unused__)),
2112
HA_CREATE_INFO *info __attribute__((__unused__)))=0;
2110
virtual int create(const char *name __attribute__((unused)),
2111
TABLE *form __attribute__((unused)),
2112
HA_CREATE_INFO *info __attribute__((unused)))=0;
2114
virtual int create_handler_files(const char *name __attribute__((__unused__)),
2115
const char *old_name __attribute__((__unused__)),
2116
int action_flag __attribute__((__unused__)),
2117
HA_CREATE_INFO *info __attribute__((__unused__)))
2114
virtual int create_handler_files(const char *name __attribute__((unused)),
2115
const char *old_name __attribute__((unused)),
2116
int action_flag __attribute__((unused)),
2117
HA_CREATE_INFO *info __attribute__((unused)))
2118
2118
{ return false; }