445
445
typedef struct st_table_share TABLE_SHARE;
446
446
struct st_foreign_key_info;
447
447
typedef struct st_foreign_key_info FOREIGN_KEY_INFO;
448
typedef bool (stat_print_fn)(THD *thd, const char *type, uint type_len,
449
const char *file, uint file_len,
450
const char *status, uint status_len);
448
typedef bool (stat_print_fn)(THD *thd, const char *type, uint32_t type_len,
449
const char *file, uint32_t file_len,
450
const char *status, uint32_t status_len);
451
451
enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
452
452
extern st_plugin_int *hton2plugin[MAX_HA];
524
524
int (*commit)(handlerton *hton, THD *thd, bool all);
525
525
int (*rollback)(handlerton *hton, THD *thd, bool all);
526
526
int (*prepare)(handlerton *hton, THD *thd, bool all);
527
int (*recover)(handlerton *hton, XID *xid_list, uint len);
527
int (*recover)(handlerton *hton, XID *xid_list, uint32_t len);
528
528
int (*commit_by_xid)(handlerton *hton, XID *xid);
529
529
int (*rollback_by_xid)(handlerton *hton, XID *xid);
530
530
void *(*create_cursor_read_view)(handlerton *hton, THD *thd);
742
742
uint32_t block_size;
743
743
handlerton *db_type;
744
744
enum row_type row_type;
745
uint null_bits; /* NULL bits at start of record */
746
uint options; /* OR of HA_CREATE_ options */
747
uint extra_size; /* length of extra data segment */
745
uint32_t null_bits; /* NULL bits at start of record */
746
uint32_t options; /* OR of HA_CREATE_ options */
747
uint32_t extra_size; /* length of extra data segment */
748
748
bool table_existed; /* 1 in create if table existed */
749
749
bool frm_only; /* 1 if no ha_create_table() */
750
750
bool varchar; /* 1 if table has a VARCHAR */
792
792
TABLEOP_HOOKS() {}
793
793
virtual ~TABLEOP_HOOKS() {}
795
inline void prelock(Table **tables, uint count)
795
inline void prelock(Table **tables, uint32_t count)
797
797
do_prelock(tables, count);
800
inline int postlock(Table **tables, uint count)
800
inline int postlock(Table **tables, uint32_t count)
802
802
return do_postlock(tables, count);
805
805
/* Function primitive that is called prior to locking tables */
806
806
virtual void do_prelock(Table **tables __attribute__((unused)),
807
uint count __attribute__((unused)))
807
uint32_t count __attribute__((unused)))
809
809
/* Default is to do nothing */
891
891
0 - Ok, the range structure filled with info about the next range
892
892
1 - No more ranges
894
uint (*next) (range_seq_t seq, KEY_MULTI_RANGE *range);
894
uint32_t (*next) (range_seq_t seq, KEY_MULTI_RANGE *range);
897
uint16_t &mrr_persistent_flag_storage(range_seq_t seq, uint idx);
898
char* &mrr_get_ptr_by_idx(range_seq_t seq, uint idx);
897
uint16_t &mrr_persistent_flag_storage(range_seq_t seq, uint32_t idx);
898
char* &mrr_get_ptr_by_idx(range_seq_t seq, uint32_t idx);
1132
1132
bool in_range_check_pushed_down;
1134
uint errkey; /* Last dup key */
1135
uint key_used_on_scan;
1134
uint32_t errkey; /* Last dup key */
1135
uint32_t key_used_on_scan;
1136
uint32_t active_index;
1137
1137
/** Length of ref (1-8 or the clustered key length) */
1138
uint32_t ref_length;
1139
1139
enum {NONE=0, INDEX, RND} inited;
1141
1141
bool implicit_emptied; /* Can be !=0 only if HEAP */
1142
1142
const Item *pushed_cond;
1144
1144
Item *pushed_idx_cond;
1145
uint pushed_idx_cond_keyno; /* The index which the above condition is for */
1145
uint32_t pushed_idx_cond_keyno; /* The index which the above condition is for */
1148
1148
next_insert_id is the next value which should be inserted into the
1255
1255
return end_bulk_insert();
1257
1257
int ha_bulk_update_row(const unsigned char *old_data, unsigned char *new_data,
1258
uint *dup_key_found);
1258
uint32_t *dup_key_found);
1259
1259
int ha_delete_all_rows();
1260
1260
int ha_reset_auto_increment(uint64_t value);
1261
1261
int ha_optimize(THD* thd, HA_CHECK_OPT* check_opt);
1262
1262
int ha_analyze(THD* thd, HA_CHECK_OPT* check_opt);
1263
1263
bool ha_check_and_repair(THD *thd);
1264
int ha_disable_indexes(uint mode);
1265
int ha_enable_indexes(uint mode);
1264
int ha_disable_indexes(uint32_t mode);
1265
int ha_enable_indexes(uint32_t mode);
1266
1266
int ha_discard_or_import_tablespace(bool discard);
1267
1267
void ha_prepare_for_alter();
1268
1268
int ha_rename_table(const char *from, const char *to);
1277
1277
void adjust_next_insert_id_after_explicit_value(uint64_t nr);
1278
1278
int update_auto_increment();
1279
void print_keydup_error(uint key_nr, const char *msg);
1279
void print_keydup_error(uint32_t key_nr, const char *msg);
1280
1280
virtual void print_error(int error, myf errflag);
1281
1281
virtual bool get_error_message(int error, String *buf);
1282
uint get_dup_key(int error);
1282
uint32_t get_dup_key(int error);
1283
1283
virtual void change_table_ptr(Table *table_arg, TABLE_SHARE *share)
1285
1285
table= table_arg;
1288
1288
/* Estimates calculation */
1289
1289
virtual double scan_time(void)
1290
1290
{ return uint64_t2double(stats.data_file_length) / IO_SIZE + 2; }
1291
virtual double read_time(uint index __attribute__((unused)),
1292
uint ranges, ha_rows rows)
1291
virtual double read_time(uint32_t index __attribute__((unused)),
1292
uint32_t ranges, ha_rows rows)
1293
1293
{ return rows2double(ranges+rows); }
1295
virtual double index_only_read_time(uint keynr, double records);
1295
virtual double index_only_read_time(uint32_t keynr, double records);
1297
virtual ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
1297
virtual ha_rows multi_range_read_info_const(uint32_t keyno, RANGE_SEQ_IF *seq,
1298
1298
void *seq_init_param,
1299
uint n_ranges, uint *bufsz,
1300
uint *flags, COST_VECT *cost);
1301
virtual int multi_range_read_info(uint keyno, uint n_ranges, uint keys,
1302
uint *bufsz, uint *flags, COST_VECT *cost);
1299
uint32_t n_ranges, uint32_t *bufsz,
1300
uint32_t *flags, COST_VECT *cost);
1301
virtual int multi_range_read_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys,
1302
uint32_t *bufsz, uint32_t *flags, COST_VECT *cost);
1303
1303
virtual int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
1304
uint n_ranges, uint mode,
1304
uint32_t n_ranges, uint32_t mode,
1305
1305
HANDLER_BUFFER *buf);
1306
1306
virtual int multi_range_read_next(char **range_info);
1418
1418
key_part_map keypart_map,
1419
1419
enum ha_rkey_function find_flag)
1421
uint key_len= calculate_key_len(table, active_index, key, keypart_map);
1421
uint32_t key_len= calculate_key_len(table, active_index, key, keypart_map);
1422
1422
return index_read(buf, key, key_len, find_flag);
1427
1427
row if available. If the key value is null, begin at the first key of the
1430
virtual int index_read_idx_map(unsigned char * buf, uint index, const unsigned char * key,
1430
virtual int index_read_idx_map(unsigned char * buf, uint32_t index, const unsigned char * key,
1431
1431
key_part_map keypart_map,
1432
1432
enum ha_rkey_function find_flag);
1433
1433
virtual int index_next(unsigned char * buf __attribute__((unused)))
1449
1449
virtual int index_read_last_map(unsigned char * buf, const unsigned char * key,
1450
1450
key_part_map keypart_map)
1452
uint key_len= calculate_key_len(table, active_index, key, keypart_map);
1452
uint32_t key_len= calculate_key_len(table, active_index, key, keypart_map);
1453
1453
return index_read_last(buf, key, key_len);
1455
1455
virtual int read_range_first(const key_range *start_key,
1477
1477
unsigned char *pos __attribute__((unused)))
1478
1478
{ return HA_ERR_WRONG_COMMAND; }
1479
1479
virtual int rnd_same(unsigned char *buf __attribute__((unused)),
1480
uint inx __attribute__((unused)))
1480
uint32_t inx __attribute__((unused)))
1481
1481
{ return HA_ERR_WRONG_COMMAND; }
1482
virtual ha_rows records_in_range(uint inx __attribute__((unused)),
1482
virtual ha_rows records_in_range(uint32_t inx __attribute__((unused)),
1483
1483
key_range *min_key __attribute__((unused)),
1484
1484
key_range *max_key __attribute__((unused)))
1485
1485
{ return (ha_rows) 10; }
1595
1595
virtual int get_default_no_partitions(HA_CREATE_INFO *info __attribute__((unused))) { return 1;}
1596
1596
virtual bool get_no_parts(const char *name __attribute__((unused)),
1603
virtual uint32_t index_flags(uint idx, uint part, bool all_parts) const =0;
1603
virtual uint32_t index_flags(uint32_t idx, uint32_t part, bool all_parts) const =0;
1605
1605
virtual int add_index(Table *table_arg __attribute__((unused)),
1606
1606
KEY *key_info __attribute__((unused)),
1607
uint num_of_keys __attribute__((unused)))
1607
uint32_t num_of_keys __attribute__((unused)))
1608
1608
{ return (HA_ERR_WRONG_COMMAND); }
1609
1609
virtual int prepare_drop_index(Table *table_arg __attribute__((unused)),
1610
uint *key_num __attribute__((unused)),
1611
uint num_of_keys __attribute__((unused)))
1610
uint32_t *key_num __attribute__((unused)),
1611
uint32_t num_of_keys __attribute__((unused)))
1612
1612
{ return (HA_ERR_WRONG_COMMAND); }
1613
1613
virtual int final_drop_index(Table *table_arg __attribute__((unused)))
1614
1614
{ return (HA_ERR_WRONG_COMMAND); }
1616
uint max_record_length() const
1616
uint32_t max_record_length() const
1617
1617
{ return cmin((unsigned int)HA_MAX_REC_LENGTH, max_supported_record_length()); }
1618
uint max_keys() const
1618
uint32_t max_keys() const
1619
1619
{ return cmin((unsigned int)MAX_KEY, max_supported_keys()); }
1620
uint max_key_parts() const
1620
uint32_t max_key_parts() const
1621
1621
{ return cmin((unsigned int)MAX_REF_PARTS, max_supported_key_parts()); }
1622
uint max_key_length() const
1622
uint32_t max_key_length() const
1623
1623
{ return cmin((unsigned int)MAX_KEY_LENGTH, max_supported_key_length()); }
1624
uint max_key_part_length(void) const
1624
uint32_t max_key_part_length(void) const
1625
1625
{ return cmin((unsigned int)MAX_KEY_LENGTH, max_supported_key_part_length()); }
1627
virtual uint max_supported_record_length(void) const
1627
virtual uint32_t max_supported_record_length(void) const
1628
1628
{ return HA_MAX_REC_LENGTH; }
1629
virtual uint max_supported_keys(void) const { return 0; }
1630
virtual uint max_supported_key_parts(void) const { return MAX_REF_PARTS; }
1631
virtual uint max_supported_key_length(void) const { return MAX_KEY_LENGTH; }
1632
virtual uint max_supported_key_part_length(void) const { return 255; }
1633
virtual uint min_record_length(uint options __attribute__((unused))) const
1629
virtual uint32_t max_supported_keys(void) const { return 0; }
1630
virtual uint32_t max_supported_key_parts(void) const { return MAX_REF_PARTS; }
1631
virtual uint32_t max_supported_key_length(void) const { return MAX_KEY_LENGTH; }
1632
virtual uint32_t max_supported_key_part_length(void) const { return 255; }
1633
virtual uint32_t min_record_length(uint32_t options __attribute__((unused))) const
1636
1636
virtual bool low_byte_first(void) const { return 1; }
1637
virtual uint checksum(void) const { return 0; }
1637
virtual uint32_t checksum(void) const { return 0; }
1638
1638
virtual bool is_crashed(void) const { return 0; }
1639
1639
virtual bool auto_repair(void) const { return 0; }
1935
1935
the corresponding 'ha_*' method above.
1938
virtual int open(const char *name, int mode, uint test_if_locked)=0;
1939
virtual int index_init(uint idx,
1938
virtual int open(const char *name, int mode, uint32_t test_if_locked)=0;
1939
virtual int index_init(uint32_t idx,
1940
1940
bool sorted __attribute__((unused)))
1941
1941
{ active_index= idx; return 0; }
1942
1942
virtual int index_end() { active_index= MAX_KEY; return 0; }
2020
2020
virtual int end_bulk_insert(void) { return 0; }
2021
2021
virtual int index_read(unsigned char * buf __attribute__((unused)),
2022
2022
const unsigned char * key __attribute__((unused)),
2023
uint key_len __attribute__((unused)),
2023
uint32_t key_len __attribute__((unused)),
2024
2024
enum ha_rkey_function find_flag __attribute__((unused)))
2025
2025
{ return HA_ERR_WRONG_COMMAND; }
2026
2026
virtual int index_read_last(unsigned char * buf __attribute__((unused)),
2027
2027
const unsigned char * key __attribute__((unused)),
2028
uint key_len __attribute__((unused)))
2028
uint32_t key_len __attribute__((unused)))
2029
2029
{ return (my_errno= HA_ERR_WRONG_COMMAND); }
2031
2031
This method is similar to update_row, however the handler doesn't need
2071
2071
{ return HA_ADMIN_NOT_IMPLEMENTED; }
2072
2072
virtual bool check_and_repair(THD *thd __attribute__((unused)))
2073
2073
{ return true; }
2074
virtual int disable_indexes(uint mode __attribute__((unused)))
2074
virtual int disable_indexes(uint32_t mode __attribute__((unused)))
2075
2075
{ return HA_ERR_WRONG_COMMAND; }
2076
virtual int enable_indexes(uint mode __attribute__((unused)))
2076
virtual int enable_indexes(uint32_t mode __attribute__((unused)))
2077
2077
{ return HA_ERR_WRONG_COMMAND; }
2078
2078
virtual int discard_or_import_tablespace(bool discard __attribute__((unused)))
2079
2079
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
2138
2138
table= table_arg;
2140
2140
int dsmrr_init(handler *h, KEY *key, RANGE_SEQ_IF *seq_funcs,
2141
void *seq_init_param, uint n_ranges, uint mode,
2141
void *seq_init_param, uint32_t n_ranges, uint32_t mode,
2142
2142
HANDLER_BUFFER *buf);
2143
2143
void dsmrr_close();
2144
2144
int dsmrr_fill_buffer(handler *h);
2145
2145
int dsmrr_next(handler *h, char **range_info);
2147
int dsmrr_info(uint keyno, uint n_ranges, uint keys, uint *bufsz,
2148
uint *flags, COST_VECT *cost);
2147
int dsmrr_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys, uint32_t *bufsz,
2148
uint32_t *flags, COST_VECT *cost);
2150
ha_rows dsmrr_info_const(uint keyno, RANGE_SEQ_IF *seq,
2151
void *seq_init_param, uint n_ranges, uint *bufsz,
2152
uint *flags, COST_VECT *cost);
2150
ha_rows dsmrr_info_const(uint32_t keyno, RANGE_SEQ_IF *seq,
2151
void *seq_init_param, uint32_t n_ranges, uint32_t *bufsz,
2152
uint32_t *flags, COST_VECT *cost);
2154
bool key_uses_partial_cols(uint keyno);
2155
bool choose_mrr_impl(uint keyno, ha_rows rows, uint *flags, uint *bufsz,
2154
bool key_uses_partial_cols(uint32_t keyno);
2155
bool choose_mrr_impl(uint32_t keyno, ha_rows rows, uint32_t *flags, uint32_t *bufsz,
2156
2156
COST_VECT *cost);
2157
bool get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags,
2158
uint *buffer_size, COST_VECT *cost);
2157
bool get_disk_sweep_mrr_cost(uint32_t keynr, ha_rows rows, uint32_t flags,
2158
uint32_t *buffer_size, COST_VECT *cost);
2161
2161
extern const char *ha_row_type[];