552
552
void (*close_cursor_read_view)(handlerton *hton, THD *thd, void *read_view);
553
553
handler *(*create)(handlerton *hton, TABLE_SHARE *table, MEM_ROOT *mem_root);
554
554
void (*drop_database)(handlerton *hton, char* path);
555
int (*panic)(handlerton *hton, enum ha_panic_function flag);
556
555
int (*start_consistent_snapshot)(handlerton *hton, THD *thd);
557
556
bool (*flush_logs)(handlerton *hton);
558
557
bool (*show_status)(handlerton *hton, THD *thd, stat_print_fn *print, enum ha_stat_type stat);
559
558
int (*fill_files_table)(handlerton *hton, THD *thd,
560
559
TABLE_LIST *tables,
561
560
class Item *cond);
562
uint32 flags; /* global handler flags */
561
uint32_t flags; /* global handler flags */
563
562
int (*release_temporary_latches)(handlerton *hton, THD *thd);
565
564
int (*discover)(handlerton *hton, THD* thd, const char *db,
1316
1311
/* Estimates calculation */
1317
1312
virtual double scan_time(void)
1318
1313
{ return uint64_t2double(stats.data_file_length) / IO_SIZE + 2; }
1319
virtual double read_time(uint index __attribute__((__unused__)),
1314
virtual double read_time(uint index __attribute__((unused)),
1320
1315
uint ranges, ha_rows rows)
1321
1316
{ return rows2double(ranges+rows); }
1458
1453
virtual int index_read_idx_map(uchar * buf, uint index, const uchar * key,
1459
1454
key_part_map keypart_map,
1460
1455
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__)));
1456
virtual int index_next(uchar * buf __attribute__((unused)))
1457
{ return HA_ERR_WRONG_COMMAND; }
1458
virtual int index_prev(uchar * buf __attribute__((unused)))
1459
{ return HA_ERR_WRONG_COMMAND; }
1460
virtual int index_first(uchar * buf __attribute__((unused)))
1461
{ return HA_ERR_WRONG_COMMAND; }
1462
virtual int index_last(uchar * buf __attribute__((unused)))
1463
{ return HA_ERR_WRONG_COMMAND; }
1464
virtual int index_next_same(uchar *buf __attribute__((unused)),
1465
const uchar *key __attribute__((unused)),
1466
uint keylen __attribute__((unused)));
1474
1469
The following functions works like index_read, but it find the last
1486
1481
virtual int read_range_next();
1487
1482
int compare_key(key_range *range);
1488
1483
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;
1484
virtual int rnd_next(uchar *buf __attribute__((unused)))=0;
1485
virtual int rnd_pos(uchar * buf __attribute__((unused)),
1486
uchar *pos __attribute__((unused)))=0;
1493
1488
One has to use this method when to find
1494
1489
random position by record as the plain
1501
1496
The following function is only needed for tables that may be temporary
1502
1497
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__)))
1499
virtual int restart_rnd_next(uchar *buf __attribute__((unused)),
1500
uchar *pos __attribute__((unused)))
1501
{ return HA_ERR_WRONG_COMMAND; }
1502
virtual int rnd_same(uchar *buf __attribute__((unused)),
1503
uint inx __attribute__((unused)))
1504
{ return HA_ERR_WRONG_COMMAND; }
1505
virtual ha_rows records_in_range(uint inx __attribute__((unused)),
1506
key_range *min_key __attribute__((unused)),
1507
key_range *max_key __attribute__((unused)))
1513
1508
{ return (ha_rows) 10; }
1514
1509
virtual void position(const uchar *record)=0;
1515
1510
virtual int info(uint)=0; // see my_base.h for full description
1516
virtual uint32 calculate_key_hash_value(Field **field_array __attribute__((__unused__)))
1511
virtual uint32_t calculate_key_hash_value(Field **field_array __attribute__((unused)))
1517
1512
{ assert(0); return 0; }
1518
virtual int extra(enum ha_extra_function operation __attribute__((__unused__)))
1513
virtual int extra(enum ha_extra_function operation __attribute__((unused)))
1520
1515
virtual int extra_opt(enum ha_extra_function operation,
1521
uint32_t cache_size __attribute__((__unused__)))
1516
uint32_t cache_size __attribute__((unused)))
1522
1517
{ return extra(operation); }
1543
1538
virtual void try_semi_consistent_read(bool) {}
1544
1539
virtual void unlock_row(void) {}
1545
virtual int start_stmt(THD *thd __attribute__((__unused__)),
1546
thr_lock_type lock_type __attribute__((__unused__)))
1540
virtual int start_stmt(THD *thd __attribute__((unused)),
1541
thr_lock_type lock_type __attribute__((unused)))
1548
1543
virtual void get_auto_increment(uint64_t offset, uint64_t increment,
1549
1544
uint64_t nb_desired_values,
1569
1564
insert_id_for_cur_row;
1572
virtual void update_create_info(HA_CREATE_INFO *create_info __attribute__((__unused__))) {}
1567
virtual void update_create_info(HA_CREATE_INFO *create_info __attribute__((unused))) {}
1573
1568
int check_old_types(void);
1574
virtual int assign_to_keycache(THD* thd __attribute__((__unused__)),
1575
HA_CHECK_OPT* check_opt __attribute__((__unused__)))
1569
virtual int assign_to_keycache(THD* thd __attribute__((unused)),
1570
HA_CHECK_OPT* check_opt __attribute__((unused)))
1576
1571
{ return HA_ADMIN_NOT_IMPLEMENTED; }
1577
1572
/* end of the list of admin commands */
1579
1574
virtual int indexes_are_disabled(void) {return 0;}
1580
1575
virtual char *update_table_comment(const char * comment)
1581
1576
{ return (char*) comment;}
1582
virtual void append_create_info(String *packet __attribute__((__unused__)))
1577
virtual void append_create_info(String *packet __attribute__((unused)))
1585
1580
If index == MAX_KEY then a check for table is made and if index <
1591
1586
@retval true Foreign key defined on table or index
1592
1587
@retval false No foreign key defined
1594
virtual bool is_fk_defined_on_table_or_index(uint index __attribute__((__unused__)))
1589
virtual bool is_fk_defined_on_table_or_index(uint index __attribute__((unused)))
1595
1590
{ return false; }
1596
1591
virtual char* get_foreign_key_create_info(void)
1597
1592
{ return(NULL);} /* gets foreign key create string from InnoDB */
1598
1593
/** used in ALTER TABLE; 1 if changing storage engine is allowed */
1599
1594
virtual bool can_switch_engines(void) { return 1; }
1600
1595
/** 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__)))
1596
virtual int get_foreign_key_list(THD *thd __attribute__((unused)),
1597
List<FOREIGN_KEY_INFO> *f_key_list __attribute__((unused)))
1604
1599
virtual uint referenced_by_foreign_key() { return 0;}
1605
1600
virtual void init_table_handle_for_HANDLER()
1606
1601
{ return; } /* prepare InnoDB for HANDLER */
1607
virtual void free_foreign_key_create_info(char* str __attribute__((__unused__))) {}
1602
virtual void free_foreign_key_create_info(char* str __attribute__((unused))) {}
1608
1603
/** The following can be called without an open handler */
1609
1604
virtual const char *table_type() const =0;
1631
1626
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__)))
1628
virtual int add_index(TABLE *table_arg __attribute__((unused)),
1629
KEY *key_info __attribute__((unused)),
1630
uint num_of_keys __attribute__((unused)))
1631
{ return (HA_ERR_WRONG_COMMAND); }
1632
virtual int prepare_drop_index(TABLE *table_arg __attribute__((unused)),
1633
uint *key_num __attribute__((unused)),
1634
uint num_of_keys __attribute__((unused)))
1635
{ return (HA_ERR_WRONG_COMMAND); }
1636
virtual int final_drop_index(TABLE *table_arg __attribute__((unused)))
1642
1637
{ return (HA_ERR_WRONG_COMMAND); }
1644
1639
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__)),
1726
register_query_cache_table(THD *thd __attribute__((unused)),
1727
char *table_key __attribute__((unused)),
1728
uint key_length __attribute__((unused)),
1734
1729
qc_engine_callback *engine_callback,
1735
uint64_t *engine_data __attribute__((__unused__)))
1730
uint64_t *engine_data __attribute__((unused)))
1737
1732
*engine_callback= 0;
1786
1781
virtual void cond_pop(void) { return; }
1789
*idx_cond_push(uint keyno __attribute__((__unused__)),
1790
Item* idx_cond __attribute__((__unused__)))
1784
*idx_cond_push(uint keyno __attribute__((unused)),
1785
Item* idx_cond __attribute__((unused)))
1791
1786
{ return idx_cond; }
1794
1789
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__)))
1792
check_if_incompatible_data(HA_CREATE_INFO *create_info __attribute__((unused)),
1793
uint table_changes __attribute__((unused)))
1799
1794
{ return COMPATIBLE_DATA_NO; }
1801
1796
/* On-line ALTER TABLE interface */
1824
1819
implementation.
1827
check_if_supported_alter(TABLE *altered_table __attribute__((__unused__)),
1822
check_if_supported_alter(TABLE *altered_table __attribute__((unused)),
1828
1823
HA_CREATE_INFO *create_info,
1829
HA_ALTER_FLAGS *alter_flags __attribute__((__unused__)),
1824
HA_ALTER_FLAGS *alter_flags __attribute__((unused)),
1830
1825
uint table_changes)
1832
1827
if (this->check_if_incompatible_data(create_info, table_changes)
1849
1844
@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__)))
1846
virtual int alter_table_phase1(THD *thd __attribute__((unused)),
1847
TABLE *altered_table __attribute__((unused)),
1848
HA_CREATE_INFO *create_info __attribute__((unused)),
1849
HA_ALTER_INFO *alter_info __attribute__((unused)),
1850
HA_ALTER_FLAGS *alter_flags __attribute__((unused)))
1857
1852
return HA_ERR_UNSUPPORTED;
1874
1869
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__)))
1872
virtual int alter_table_phase2(THD *thd __attribute__((unused)),
1873
TABLE *altered_table __attribute__((unused)),
1874
HA_CREATE_INFO *create_info __attribute__((unused)),
1875
HA_ALTER_INFO *alter_info __attribute__((unused)),
1876
HA_ALTER_FLAGS *alter_flags __attribute__((unused)))
1883
1878
return HA_ERR_UNSUPPORTED;
1889
1884
@param thd The thread handle
1890
1885
@param table The altered table, re-opened
1892
virtual int alter_table_phase3(THD *thd __attribute__((__unused__)),
1893
TABLE *table __attribute__((__unused__)))
1887
virtual int alter_table_phase3(THD *thd __attribute__((unused)),
1888
TABLE *table __attribute__((unused)))
1895
1890
return HA_ERR_UNSUPPORTED;
2030
2025
virtual void release_auto_increment(void) { return; };
2031
2026
/** admin commands - called from mysql_admin_table */
2032
virtual int check_for_upgrade(HA_CHECK_OPT *check_opt __attribute__((__unused__)))
2027
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__)))
2029
virtual int check(THD* thd __attribute__((unused)),
2030
HA_CHECK_OPT* check_opt __attribute__((unused)))
2036
2031
{ return HA_ADMIN_NOT_IMPLEMENTED; }
2040
2035
to specify CHECK option to use to call check()
2041
2036
upon the table.
2043
virtual int repair(THD* thd __attribute__((__unused__)),
2044
HA_CHECK_OPT* check_opt __attribute__((__unused__)))
2038
virtual int repair(THD* thd __attribute__((unused)),
2039
HA_CHECK_OPT* check_opt __attribute__((unused)))
2045
2040
{ return HA_ADMIN_NOT_IMPLEMENTED; }
2046
virtual void start_bulk_insert(ha_rows rows __attribute__((__unused__)))
2041
virtual void start_bulk_insert(ha_rows rows __attribute__((unused)))
2048
2043
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__)))
2044
virtual int index_read(uchar * buf __attribute__((unused)),
2045
const uchar * key __attribute__((unused)),
2046
uint key_len __attribute__((unused)),
2047
enum ha_rkey_function find_flag __attribute__((unused)))
2053
2048
{ 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__)))
2049
virtual int index_read_last(uchar * buf __attribute__((unused)),
2050
const uchar * key __attribute__((unused)),
2051
uint key_len __attribute__((unused)))
2057
2052
{ return (my_errno= HA_ERR_WRONG_COMMAND); }
2059
2054
This method is similar to update_row, however the handler doesn't need
2068
2063
@retval 0 Bulk delete used by handler
2069
2064
@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__)))
2066
virtual int bulk_update_row(const uchar *old_data __attribute__((unused)),
2067
uchar *new_data __attribute__((unused)),
2068
uint *dup_key_found __attribute__((unused)))
2076
2071
return HA_ERR_WRONG_COMMAND;
2089
2084
is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is
2090
2085
returned by storage engines that don't support this operation.
2092
virtual int reset_auto_increment(uint64_t value __attribute__((__unused__)))
2087
virtual int reset_auto_increment(uint64_t value __attribute__((unused)))
2093
2088
{ 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__)))
2089
virtual int optimize(THD* thd __attribute__((unused)),
2090
HA_CHECK_OPT* check_opt __attribute__((unused)))
2091
{ return HA_ADMIN_NOT_IMPLEMENTED; }
2092
virtual int analyze(THD* thd __attribute__((unused)),
2093
HA_CHECK_OPT* check_opt __attribute__((unused)))
2094
{ return HA_ADMIN_NOT_IMPLEMENTED; }
2095
virtual bool check_and_repair(THD *thd __attribute__((unused)))
2101
2096
{ 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__)))
2097
virtual int disable_indexes(uint mode __attribute__((unused)))
2098
{ return HA_ERR_WRONG_COMMAND; }
2099
virtual int enable_indexes(uint mode __attribute__((unused)))
2100
{ return HA_ERR_WRONG_COMMAND; }
2101
virtual int discard_or_import_tablespace(bool discard __attribute__((unused)))
2107
2102
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
2108
2103
virtual void prepare_for_alter(void) { return; }
2109
2104
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;
2105
virtual int create(const char *name __attribute__((unused)),
2106
TABLE *form __attribute__((unused)),
2107
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__)))
2109
virtual int create_handler_files(const char *name __attribute__((unused)),
2110
const char *old_name __attribute__((unused)),
2111
int action_flag __attribute__((unused)),
2112
HA_CREATE_INFO *info __attribute__((unused)))
2118
2113
{ return false; }