~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/ha_myisam.h

  • Committer: Brian Aker
  • Date: 2010-12-18 18:24:57 UTC
  • mfrom: (1999.6.3 trunk)
  • Revision ID: brian@tangent.org-20101218182457-yi1wd0so2hml1k1w
Merge in Lee's copyright header fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
 
 
16
 
 
17
 
#ifdef USE_PRAGMA_INTERFACE
18
 
#pragma interface                       /* gcc class implementation */
19
 
#endif
20
 
 
21
 
/* class for the the myisam handler */
22
 
 
23
 
#include <storage/myisam/myisam.h>
24
 
 
25
 
#define HA_RECOVER_NONE         0       /* No automatic recover */
26
 
#define HA_RECOVER_DEFAULT      1       /* Automatic recover active */
27
 
#define HA_RECOVER_BACKUP       2       /* Make a backupfile on recover */
28
 
#define HA_RECOVER_FORCE        4       /* Recover even if we loose rows */
29
 
#define HA_RECOVER_QUICK        8       /* Don't check rows in data file */
30
 
 
31
 
extern ulong myisam_sort_buffer_size;
32
 
extern TYPELIB myisam_recover_typelib;
33
 
extern ulong myisam_recover_options;
34
 
 
35
 
C_MODE_START
36
 
bool index_cond_func_myisam(void *arg);
37
 
C_MODE_END
38
 
 
39
 
class ha_myisam: public handler
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
15
 
 
16
 
 
17
#ifndef PLUGIN_MYISAM_HA_MYISAM_H
 
18
#define PLUGIN_MYISAM_HA_MYISAM_H
 
19
 
 
20
#include <drizzled/cursor.h>
 
21
#include <drizzled/thr_lock.h>
 
22
 
 
23
/* class for the the myisam Cursor */
 
24
 
 
25
#include <plugin/myisam/myisam.h>
 
26
 
 
27
class ha_myisam: public drizzled::Cursor
40
28
{
41
29
  MI_INFO *file;
42
 
  uint64_t int_table_flags;
43
30
  char    *data_file_name, *index_file_name;
44
31
  bool can_enable_indexes;
45
 
  int repair(THD *thd, MI_CHECK &param, bool optimize);
 
32
  bool is_ordered;
 
33
  int repair(drizzled::Session *session, MI_CHECK &param, bool optimize);
46
34
 
47
35
 public:
48
 
  ha_myisam(handlerton *hton, TABLE_SHARE *table_arg);
 
36
  ha_myisam(drizzled::plugin::StorageEngine &engine,
 
37
            drizzled::Table &table_arg);
49
38
  ~ha_myisam() {}
50
 
  handler *clone(MEM_ROOT *mem_root);
51
 
  const char *table_type() const { return "MyISAM"; }
52
 
  const char *index_type(uint key_number);
53
 
  const char **bas_ext() const;
54
 
  uint64_t table_flags() const { return int_table_flags; }
55
 
  int index_init(uint idx, bool sorted);
56
 
  int index_end();
57
 
  uint32_t index_flags(uint inx, uint part __attribute__((unused)),
58
 
                       bool all_parts __attribute__((unused))) const
59
 
  {
60
 
    return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
61
 
            0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
62
 
            HA_READ_ORDER | HA_KEYREAD_ONLY | 
63
 
            (keys_with_parts.is_set(inx)?0:HA_DO_INDEX_COND_PUSHDOWN));
64
 
  }
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;
 
39
  Cursor *clone(drizzled::memory::Root *mem_root);
 
40
  const char *index_type(uint32_t key_number);
 
41
  int doStartIndexScan(uint32_t idx, bool sorted);
 
42
  int doEndIndexScan();
 
43
  uint32_t checksum() const;
69
44
 
70
 
  int open(const char *name, int mode, uint test_if_locked);
 
45
  int doOpen(const drizzled::TableIdentifier &identifier, int mode, uint32_t test_if_locked);
71
46
  int close(void);
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);
86
 
  int rnd_init(bool scan);
87
 
  int rnd_next(uchar *buf);
88
 
  int rnd_pos(uchar * buf, uchar *pos);
89
 
  int restart_rnd_next(uchar *buf, uchar *pos);
90
 
  void position(const uchar *record);
 
47
  int doInsertRecord(unsigned char * buf);
 
48
  int doUpdateRecord(const unsigned char * old_data, unsigned char * new_data);
 
49
  int doDeleteRecord(const unsigned char * buf);
 
50
  int index_read_map(unsigned char *buf, const unsigned char *key, drizzled::key_part_map keypart_map,
 
51
                     enum drizzled::ha_rkey_function find_flag);
 
52
  int index_read_idx_map(unsigned char *buf, uint32_t index, const unsigned char *key,
 
53
                         drizzled::key_part_map keypart_map,
 
54
                         enum drizzled::ha_rkey_function find_flag);
 
55
  int index_read_last_map(unsigned char *buf, const unsigned char *key, drizzled::key_part_map keypart_map);
 
56
  int index_next(unsigned char * buf);
 
57
  int index_prev(unsigned char * buf);
 
58
  int index_first(unsigned char * buf);
 
59
  int index_last(unsigned char * buf);
 
60
  int index_next_same(unsigned char *buf, const unsigned char *key, uint32_t keylen);
 
61
  int doStartTableScan(bool scan);
 
62
  int rnd_next(unsigned char *buf);
 
63
  int rnd_pos(unsigned char * buf, unsigned char *pos);
 
64
  void position(const unsigned char *record);
91
65
  int info(uint);
92
 
  int extra(enum ha_extra_function operation);
93
 
  int extra_opt(enum ha_extra_function operation, uint32_t cache_size);
 
66
  int extra(enum drizzled::ha_extra_function operation);
 
67
  int extra_opt(enum drizzled::ha_extra_function operation, uint32_t cache_size);
94
68
  int reset(void);
95
 
  int external_lock(THD *thd, int lock_type);
 
69
  int external_lock(drizzled::Session *session, int lock_type);
96
70
  int delete_all_rows(void);
97
 
  int disable_indexes(uint mode);
98
 
  int enable_indexes(uint mode);
 
71
  int disable_indexes(uint32_t mode);
 
72
  int enable_indexes(uint32_t mode);
99
73
  int indexes_are_disabled(void);
100
 
  void start_bulk_insert(ha_rows rows);
 
74
  void start_bulk_insert(drizzled::ha_rows rows);
101
75
  int end_bulk_insert();
102
 
  ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
103
 
  void update_create_info(HA_CREATE_INFO *create_info);
104
 
  int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
105
 
  THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
106
 
                             enum thr_lock_type lock_type);
 
76
  drizzled::ha_rows records_in_range(uint32_t inx, drizzled::key_range *min_key, drizzled::key_range *max_key);
107
77
  virtual void get_auto_increment(uint64_t offset, uint64_t increment,
108
78
                                  uint64_t nb_desired_values,
109
79
                                  uint64_t *first_value,
110
80
                                  uint64_t *nb_reserved_values);
111
 
  int rename_table(const char * from, const char * to);
112
 
  int delete_table(const char *name);
113
 
  int check(THD* thd, HA_CHECK_OPT* check_opt);
114
 
  int analyze(THD* thd,HA_CHECK_OPT* check_opt);
115
 
  int repair(THD* thd, HA_CHECK_OPT* check_opt);
116
 
  bool check_and_repair(THD *thd);
117
 
  bool is_crashed() const;
118
 
  bool auto_repair() const { return myisam_recover_options != 0; }
119
 
  int optimize(THD* thd, HA_CHECK_OPT* check_opt);
120
 
  int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt);
121
 
  bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes);
122
 
#ifdef HAVE_QUERY_CACHE
123
 
  bool register_query_cache_table(THD *thd, char *table_key,
124
 
                                     uint key_length,
125
 
                                     qc_engine_callback
126
 
                                     *engine_callback,
127
 
                                     uint64_t *engine_data);
128
 
#endif
129
81
  MI_INFO *file_ptr(void)
130
82
  {
131
83
    return file;
132
84
  }
133
 
  int read_range_first(const key_range *start_key, const key_range *end_key,
 
85
  int read_range_first(const drizzled::key_range *start_key, const drizzled::key_range *end_key,
134
86
                       bool eq_range_arg, bool sorted);
135
87
  int read_range_next();
136
 
public:
137
 
  /**
138
 
   * Multi Range Read interface
139
 
   */
140
 
  int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
141
 
                            uint n_ranges, uint mode, HANDLER_BUFFER *buf);
142
 
  int multi_range_read_next(char **range_info);
143
 
  ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
144
 
                                      void *seq_init_param, 
145
 
                                      uint n_ranges, uint *bufsz,
146
 
                                      uint *flags, COST_VECT *cost);
147
 
  int multi_range_read_info(uint keyno, uint n_ranges, uint keys,
148
 
                            uint *bufsz, uint *flags, COST_VECT *cost);
149
 
  
150
 
  /* Index condition pushdown implementation */
151
 
  Item *idx_cond_push(uint keyno, Item* idx_cond);
 
88
  int reset_auto_increment(uint64_t value);
 
89
 
 
90
  virtual bool isOrdered(void)
 
91
  {
 
92
    return false;
 
93
  }
 
94
 
152
95
private:
153
 
  DsMrr_impl ds_mrr;
154
 
  key_map keys_with_parts;
155
 
  friend bool index_cond_func_myisam(void *arg);
 
96
  drizzled::key_map keys_with_parts;
156
97
};
157
98
 
 
99
#endif /* PLUGIN_MYISAM_HA_MYISAM_H */