~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/ha_myisam.h

Reverted 1103

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., 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 */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
 
 
17
#ifndef STORAGE_MYISAM_HA_MYISAM_H
 
18
#define STORAGE_MYISAM_HA_MYISAM_H
 
19
 
 
20
#include <drizzled/handler.h>
 
21
#include <mysys/thr_lock.h>
 
22
 
 
23
/* class for the the myisam handler */
24
24
 
25
25
#include <plugin/myisam/myisam.h>
26
26
 
27
 
class ha_myisam: public drizzled::Cursor
 
27
#define HA_RECOVER_NONE         0       /* No automatic recover */
 
28
#define HA_RECOVER_DEFAULT      1       /* Automatic recover active */
 
29
#define HA_RECOVER_BACKUP       2       /* Make a backupfile on recover */
 
30
#define HA_RECOVER_FORCE        4       /* Recover even if we loose rows */
 
31
#define HA_RECOVER_QUICK        8       /* Don't check rows in data file */
 
32
 
 
33
extern TYPELIB myisam_recover_typelib;
 
34
extern ulong myisam_recover_options;
 
35
 
 
36
#ifdef __cplusplus
 
37
extern "C" {
 
38
#endif
 
39
 
 
40
bool index_cond_func_myisam(void *arg);
 
41
 
 
42
#ifdef __cplusplus
 
43
}
 
44
#endif
 
45
 
 
46
class ha_myisam: public handler
28
47
{
29
48
  MI_INFO *file;
 
49
  uint64_t int_table_flags;
30
50
  char    *data_file_name, *index_file_name;
31
51
  bool can_enable_indexes;
32
 
  bool is_ordered;
33
 
  int repair(drizzled::Session *session, MI_CHECK &param, bool optimize);
 
52
  int repair(Session *session, MI_CHECK &param, bool optimize);
34
53
 
35
54
 public:
36
 
  ha_myisam(drizzled::plugin::StorageEngine &engine,
37
 
            drizzled::Table &table_arg);
 
55
  ha_myisam(StorageEngine *engine, TableShare *table_arg);
38
56
  ~ha_myisam() {}
39
 
  Cursor *clone(drizzled::memory::Root *mem_root);
 
57
  handler *clone(MEM_ROOT *mem_root);
40
58
  const char *index_type(uint32_t key_number);
41
 
  int doStartIndexScan(uint32_t idx, bool sorted);
42
 
  int doEndIndexScan();
 
59
  uint64_t table_flags() const { return int_table_flags; }
 
60
  int index_init(uint32_t idx, bool sorted);
 
61
  int index_end();
 
62
  uint32_t index_flags(uint32_t inx, uint32_t part, bool all_parts) const;
 
63
  uint32_t max_supported_keys()          const { return MI_MAX_KEY; }
 
64
  uint32_t max_supported_key_length()    const { return MI_MAX_KEY_LENGTH; }
 
65
  uint32_t max_supported_key_part_length() const { return MI_MAX_KEY_LENGTH; }
43
66
  uint32_t checksum() const;
44
67
 
45
 
  int doOpen(const drizzled::identifier::Table &identifier, int mode, uint32_t test_if_locked);
 
68
  int open(const char *name, int mode, uint32_t test_if_locked);
46
69
  int close(void);
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);
 
70
  int write_row(unsigned char * buf);
 
71
  int update_row(const unsigned char * old_data, unsigned char * new_data);
 
72
  int delete_row(const unsigned char * buf);
 
73
  int index_read_map(unsigned char *buf, const unsigned char *key, key_part_map keypart_map,
 
74
                     enum ha_rkey_function find_flag);
52
75
  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);
 
76
                         key_part_map keypart_map,
 
77
                         enum ha_rkey_function find_flag);
 
78
  int index_read_last_map(unsigned char *buf, const unsigned char *key, key_part_map keypart_map);
56
79
  int index_next(unsigned char * buf);
57
80
  int index_prev(unsigned char * buf);
58
81
  int index_first(unsigned char * buf);
59
82
  int index_last(unsigned char * buf);
60
83
  int index_next_same(unsigned char *buf, const unsigned char *key, uint32_t keylen);
61
 
  int doStartTableScan(bool scan);
 
84
  int rnd_init(bool scan);
62
85
  int rnd_next(unsigned char *buf);
63
86
  int rnd_pos(unsigned char * buf, unsigned char *pos);
 
87
  int restart_rnd_next(unsigned char *buf, unsigned char *pos);
64
88
  void position(const unsigned char *record);
65
89
  int info(uint);
66
 
  int extra(enum drizzled::ha_extra_function operation);
67
 
  int extra_opt(enum drizzled::ha_extra_function operation, uint32_t cache_size);
 
90
  int extra(enum ha_extra_function operation);
 
91
  int extra_opt(enum ha_extra_function operation, uint32_t cache_size);
68
92
  int reset(void);
69
 
  int external_lock(drizzled::Session *session, int lock_type);
 
93
  int external_lock(Session *session, int lock_type);
70
94
  int delete_all_rows(void);
71
95
  int disable_indexes(uint32_t mode);
72
96
  int enable_indexes(uint32_t mode);
73
97
  int indexes_are_disabled(void);
74
 
  void start_bulk_insert(drizzled::ha_rows rows);
 
98
  void start_bulk_insert(ha_rows rows);
75
99
  int end_bulk_insert();
76
 
  drizzled::ha_rows records_in_range(uint32_t inx, drizzled::key_range *min_key, drizzled::key_range *max_key);
 
100
  ha_rows records_in_range(uint32_t inx, key_range *min_key, key_range *max_key);
 
101
  void update_create_info(HA_CREATE_INFO *create_info);
 
102
  int create(const char *name, Table *form, HA_CREATE_INFO *create_info);
 
103
  THR_LOCK_DATA **store_lock(Session *session, THR_LOCK_DATA **to,
 
104
                             enum thr_lock_type lock_type);
77
105
  virtual void get_auto_increment(uint64_t offset, uint64_t increment,
78
106
                                  uint64_t nb_desired_values,
79
107
                                  uint64_t *first_value,
80
108
                                  uint64_t *nb_reserved_values);
 
109
  int check(Session* session, HA_CHECK_OPT* check_opt);
 
110
  int analyze(Session* session,HA_CHECK_OPT* check_opt);
 
111
  int repair(Session* session, HA_CHECK_OPT* check_opt);
 
112
  bool check_and_repair(Session *session);
 
113
  bool is_crashed() const;
 
114
  bool auto_repair() const { return myisam_recover_options != 0; }
 
115
  int optimize(Session* session, HA_CHECK_OPT* check_opt);
 
116
  int assign_to_keycache(Session* session, HA_CHECK_OPT* check_opt);
81
117
  MI_INFO *file_ptr(void)
82
118
  {
83
119
    return file;
84
120
  }
85
 
  int read_range_first(const drizzled::key_range *start_key, const drizzled::key_range *end_key,
 
121
  int read_range_first(const key_range *start_key, const key_range *end_key,
86
122
                       bool eq_range_arg, bool sorted);
87
123
  int read_range_next();
88
 
  int reset_auto_increment(uint64_t value);
89
 
 
90
 
  virtual bool isOrdered(void)
91
 
  {
92
 
    return false;
93
 
  }
94
 
 
 
124
public:
 
125
  /* Index condition pushdown implementation */
 
126
  Item *idx_cond_push(uint32_t keyno, Item* idx_cond);
95
127
private:
96
 
  drizzled::key_map keys_with_parts;
 
128
  key_map keys_with_parts;
 
129
  friend bool index_cond_func_myisam(void *arg);
97
130
};
98
131
 
99
 
#endif /* PLUGIN_MYISAM_HA_MYISAM_H */
 
132
#endif /* STORAGE_MYISAM_HA_MYISAM_H */