2
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; version 2 of the License.
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License
14
along with this program; if not, write to the Free Software
15
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
18
#ifdef USE_PRAGMA_INTERFACE
19
#pragma interface /* gcc class implementation */
22
/* class for the the myisam handler */
25
#include <ft_global.h>
26
#include "handler.h" /* handler */
27
#include "table.h" /* TABLE_SHARE */
30
typedef struct st_ha_create_information HA_CREATE_INFO;
32
#define HA_RECOVER_DEFAULT 1 /* Automatic recover active */
33
#define HA_RECOVER_BACKUP 2 /* Make a backupfile on recover */
34
#define HA_RECOVER_FORCE 4 /* Recover even if we loose rows */
35
#define HA_RECOVER_QUICK 8 /* Don't check rows in data file */
36
#define HA_RECOVER_OFF 16 /* No automatic recover */
38
extern ulong myisam_sort_buffer_size;
39
extern TYPELIB myisam_recover_typelib;
40
extern const char *myisam_recover_names[];
41
extern ulonglong myisam_recover_options;
43
class ha_myisam: public handler
46
ulonglong int_table_flags;
47
char *data_file_name, *index_file_name;
48
bool can_enable_indexes;
49
int repair(THD *thd, MI_CHECK ¶m, bool optimize);
52
ha_myisam(handlerton *hton, TABLE_SHARE *table_arg);
54
handler *clone(const char *name, MEM_ROOT *mem_root);
55
const char *table_type() const { return "MyISAM"; }
56
const char *index_type(uint key_number);
57
const char **bas_ext() const;
58
ulonglong table_flags() const { return int_table_flags; }
59
ulong index_flags(uint inx, uint part, bool all_parts) const
61
return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
62
0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
63
HA_READ_ORDER | HA_KEYREAD_ONLY);
65
uint max_supported_keys() const { return MI_MAX_KEY; }
66
uint max_supported_key_length() const { return MI_MAX_KEY_LENGTH; }
67
uint max_supported_key_part_length() const { return MI_MAX_KEY_LENGTH; }
68
uint checksum() const;
70
int open(const char *name, int mode, uint test_if_locked);
72
int write_row(uchar * buf);
73
int update_row(const uchar * old_data, uchar * new_data);
74
int delete_row(const uchar * buf);
75
int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map,
76
enum ha_rkey_function find_flag);
77
int index_read_idx_map(uchar *buf, uint index, const uchar *key,
78
key_part_map keypart_map,
79
enum ha_rkey_function find_flag);
80
int index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map);
81
int index_next(uchar * buf);
82
int index_prev(uchar * buf);
83
int index_first(uchar * buf);
84
int index_last(uchar * buf);
85
int index_next_same(uchar *buf, const uchar *key, uint keylen);
90
ft_handler->please->reinit_search(ft_handler);
93
FT_INFO *ft_init_ext(uint flags, uint inx,String *key)
95
return ft_init_search(flags,file,inx,
96
(uchar *)key->ptr(), key->length(), key->charset(),
99
int ft_read(uchar *buf);
100
int rnd_init(bool scan);
101
int rnd_next(uchar *buf);
102
int rnd_pos(uchar * buf, uchar *pos);
103
int restart_rnd_next(uchar *buf, uchar *pos);
104
void position(const uchar *record);
106
int extra(enum ha_extra_function operation);
107
int extra_opt(enum ha_extra_function operation, ulong cache_size);
109
int external_lock(THD *thd, int lock_type);
110
int delete_all_rows(void);
112
int reset_auto_increment(ulonglong value);
113
int disable_indexes(uint mode);
114
int enable_indexes(uint mode);
115
int indexes_are_disabled(void);
116
void start_bulk_insert(ha_rows rows);
117
int end_bulk_insert();
118
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
119
void update_create_info(HA_CREATE_INFO *create_info);
120
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
121
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
122
enum thr_lock_type lock_type);
123
virtual void get_auto_increment(ulonglong offset, ulonglong increment,
124
ulonglong nb_desired_values,
125
ulonglong *first_value,
126
ulonglong *nb_reserved_values);
127
int rename_table(const char * from, const char * to);
128
int delete_table(const char *name);
129
int check(THD* thd, HA_CHECK_OPT* check_opt);
130
int analyze(THD* thd,HA_CHECK_OPT* check_opt);
131
int repair(THD* thd, HA_CHECK_OPT* check_opt);
132
bool check_and_repair(THD *thd);
133
bool is_crashed() const;
134
bool auto_repair() const { return myisam_recover_options != HA_RECOVER_OFF; }
135
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
136
int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt);
137
int preload_keys(THD* thd, HA_CHECK_OPT* check_opt);
138
bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes);
139
#ifdef HAVE_QUERY_CACHE
140
my_bool register_query_cache_table(THD *thd, char *table_key,
144
ulonglong *engine_data);
146
MI_INFO *file_ptr(void)