~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/ha_heap.h

Moved the last of the libdrizzleclient calls into Protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
 
17
 
#ifdef USE_PRAGMA_INTERFACE
18
 
#pragma interface                       /* gcc class implementation */
19
 
#endif
20
17
 
21
18
/* class for the the heap handler */
22
19
 
23
 
#include <heap.h>
 
20
#ifndef STORAGE_HEAP_HA_HEAP_H
 
21
#define STORAGE_HEAP_HA_HEAP_H
 
22
 
 
23
#include <drizzled/handler.h>
 
24
#include <mysys/thr_lock.h>
 
25
 
 
26
typedef struct st_heap_info HP_INFO;
 
27
typedef struct st_heap_share HEAP_SHARE;
 
28
typedef unsigned char *HEAP_PTR;
 
29
 
24
30
 
25
31
class ha_heap: public handler
26
32
{
28
34
  HP_SHARE *internal_share;
29
35
  key_map btree_keys;
30
36
  /* number of records changed since last statistics update */
31
 
  uint    records_changed;
32
 
  uint    key_stat_version;
 
37
  uint32_t    records_changed;
 
38
  uint32_t    key_stat_version;
33
39
  bool internal_table;
34
40
public:
35
 
  ha_heap(handlerton *hton, TABLE_SHARE *table);
 
41
  ha_heap(StorageEngine *engine, TABLE_SHARE *table);
36
42
  ~ha_heap() {}
37
43
  handler *clone(MEM_ROOT *mem_root);
38
44
  const char *table_type() const
39
45
  {
40
 
    return (table->in_use->variables.sql_mode & MODE_MYSQL323) ?
41
 
           "HEAP" : "MEMORY";
42
 
  }
43
 
  const char *index_type(uint inx)
44
 
  {
45
 
    return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ?
46
 
            "BTREE" : "HASH");
47
 
  }
 
46
    return "MEMORY";
 
47
  }
 
48
  const char *index_type(uint32_t inx);
48
49
  enum row_type get_row_type() const;
49
50
  const char **bas_ext() const;
50
51
  uint64_t table_flags() const
51
52
  {
52
53
    return (HA_FAST_KEY_READ | HA_NO_BLOBS | HA_NULL_IN_KEY |
53
54
            HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
54
 
            HA_REC_NOT_IN_SEQ | HA_CAN_INSERT_DELAYED | HA_NO_TRANSACTIONS |
 
55
            HA_REC_NOT_IN_SEQ | HA_NO_TRANSACTIONS |
55
56
            HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT);
56
57
  }
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_BTREE) ?
61
 
            HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE :
62
 
            HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR);
63
 
  }
 
58
  uint32_t index_flags(uint32_t inx, uint32_t part, bool all_parts) const;
64
59
  const key_map *keys_to_use_for_scanning() { return &btree_keys; }
65
 
  uint max_supported_keys()          const { return MAX_KEY; }
66
 
  uint max_supported_key_part_length() const { return MAX_KEY_LENGTH; }
 
60
  uint32_t max_supported_keys()          const { return MAX_KEY; }
 
61
  uint32_t max_supported_key_part_length() const { return MAX_KEY_LENGTH; }
67
62
  double scan_time()
68
63
  { return (double) (stats.records+stats.deleted) / 20.0+10; }
69
 
  double read_time(uint index __attribute__((unused)),
70
 
                   uint ranges __attribute__((unused)),
 
64
  double read_time(uint32_t, uint32_t,
71
65
                   ha_rows rows)
72
66
  { return (double) rows /  20.0+1; }
73
67
 
74
 
  int open(const char *name, int mode, uint test_if_locked);
 
68
  int open(const char *name, int mode, uint32_t test_if_locked);
75
69
  int close(void);
76
70
  void set_keys_for_scanning(void);
77
 
  int write_row(uchar * buf);
78
 
  int update_row(const uchar * old_data, uchar * new_data);
79
 
  int delete_row(const uchar * buf);
 
71
  int write_row(unsigned char * buf);
 
72
  int update_row(const unsigned char * old_data, unsigned char * new_data);
 
73
  int delete_row(const unsigned char * buf);
80
74
  virtual void get_auto_increment(uint64_t offset, uint64_t increment,
81
75
                                  uint64_t nb_desired_values,
82
76
                                  uint64_t *first_value,
83
77
                                  uint64_t *nb_reserved_values);
84
 
  int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map,
 
78
  int index_read_map(unsigned char * buf, const unsigned char * key,
 
79
                     key_part_map keypart_map,
85
80
                     enum ha_rkey_function find_flag);
86
 
  int index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map);
87
 
  int index_read_idx_map(uchar * buf, uint index, const uchar * key,
 
81
  int index_read_last_map(unsigned char *buf, const unsigned char *key,
 
82
                          key_part_map keypart_map);
 
83
  int index_read_idx_map(unsigned char * buf, uint32_t index,
 
84
                         const unsigned char * key,
88
85
                         key_part_map keypart_map,
89
86
                         enum ha_rkey_function find_flag);
90
 
  int index_next(uchar * buf);
91
 
  int index_prev(uchar * buf);
92
 
  int index_first(uchar * buf);
93
 
  int index_last(uchar * buf);
 
87
  int index_next(unsigned char * buf);
 
88
  int index_prev(unsigned char * buf);
 
89
  int index_first(unsigned char * buf);
 
90
  int index_last(unsigned char * buf);
94
91
  int rnd_init(bool scan);
95
 
  int rnd_next(uchar *buf);
96
 
  int rnd_pos(uchar * buf, uchar *pos);
97
 
  void position(const uchar *record);
 
92
  int rnd_next(unsigned char *buf);
 
93
  int rnd_pos(unsigned char * buf, unsigned char *pos);
 
94
  void position(const unsigned char *record);
98
95
  int info(uint);
99
96
  int extra(enum ha_extra_function operation);
100
97
  int reset();
101
 
  int external_lock(THD *thd, int lock_type);
 
98
  int external_lock(Session *session, int lock_type);
102
99
  int delete_all_rows(void);
103
 
  int disable_indexes(uint mode);
104
 
  int enable_indexes(uint mode);
 
100
  int disable_indexes(uint32_t mode);
 
101
  int enable_indexes(uint32_t mode);
105
102
  int indexes_are_disabled(void);
106
 
  ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
 
103
  ha_rows records_in_range(uint32_t inx, key_range *min_key, key_range *max_key);
107
104
  int delete_table(const char *from);
108
105
  void drop_table(const char *name);
109
106
  int rename_table(const char * from, const char * to);
110
 
  int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
 
107
  int create(const char *name, Table *form, HA_CREATE_INFO *create_info);
111
108
  void update_create_info(HA_CREATE_INFO *create_info);
112
109
 
113
 
  THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
114
 
                             enum thr_lock_type lock_type);
115
 
  int cmp_ref(const uchar *ref1, const uchar *ref2)
116
 
  {
117
 
    return memcmp(ref1, ref2, sizeof(HEAP_PTR));
118
 
  }
119
 
  bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes);
 
110
  THR_LOCK_DATA **store_lock(Session *session, THR_LOCK_DATA **to,
 
111
                             enum thr_lock_type lock_type);
 
112
  int cmp_ref(const unsigned char *ref1, const unsigned char *ref2);
 
113
  bool check_if_incompatible_data(HA_CREATE_INFO *info, uint32_t table_changes);
120
114
private:
121
115
  void update_key_stats();
122
116
};
 
117
 
 
118
#endif /* STORAGE_HEAP_HA_HEAP_H */