~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/ha_heap.h

  • Committer: Monty Taylor
  • Date: 2009-09-30 07:01:32 UTC
  • mto: This revision was merged to the branch mainline in revision 1184.
  • Revision ID: mordred@inaugust.com-20090930070132-b1ol1xu1rpajdddy
Small namespace cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
/* class for the the heap handler */
19
19
 
20
 
#include <heap.h>
 
20
#ifndef PLUGIN_HEAP_HA_HEAP_H
 
21
#define PLUGIN_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 unsigned char *HEAP_PTR;
 
28
 
21
29
 
22
30
class ha_heap: public handler
23
31
{
24
32
  HP_INFO *file;
25
 
  HP_SHARE *internal_share;
26
33
  key_map btree_keys;
27
34
  /* number of records changed since last statistics update */
28
35
  uint32_t    records_changed;
29
36
  uint32_t    key_stat_version;
30
37
  bool internal_table;
31
38
public:
32
 
  ha_heap(handlerton *hton, TABLE_SHARE *table);
 
39
  ha_heap(drizzled::plugin::StorageEngine *engine, TableShare *table);
33
40
  ~ha_heap() {}
34
41
  handler *clone(MEM_ROOT *mem_root);
35
 
  const char *table_type() const
36
 
  {
37
 
    return "MEMORY";
38
 
  }
39
 
  const char *index_type(uint32_t inx)
40
 
  {
41
 
    return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ?
42
 
            "BTREE" : "HASH");
43
 
  }
 
42
 
 
43
  const char *index_type(uint32_t inx);
44
44
  enum row_type get_row_type() const;
45
 
  const char **bas_ext() const;
46
45
  uint64_t table_flags() const
47
46
  {
48
47
    return (HA_FAST_KEY_READ | HA_NO_BLOBS | HA_NULL_IN_KEY |
49
 
            HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
50
48
            HA_REC_NOT_IN_SEQ | HA_NO_TRANSACTIONS |
51
49
            HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT);
52
50
  }
53
 
  uint32_t index_flags(uint32_t inx, uint32_t part __attribute__((unused)),
54
 
                       bool all_parts __attribute__((unused))) const
55
 
  {
56
 
    return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ?
57
 
            HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE :
58
 
            HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR);
59
 
  }
 
51
  uint32_t index_flags(uint32_t inx, uint32_t part, bool all_parts) const;
60
52
  const key_map *keys_to_use_for_scanning() { return &btree_keys; }
61
53
  uint32_t max_supported_keys()          const { return MAX_KEY; }
62
54
  uint32_t max_supported_key_part_length() const { return MAX_KEY_LENGTH; }
63
55
  double scan_time()
64
56
  { return (double) (stats.records+stats.deleted) / 20.0+10; }
65
 
  double read_time(uint32_t index __attribute__((unused)),
66
 
                   uint32_t ranges __attribute__((unused)),
 
57
  double read_time(uint32_t, uint32_t,
67
58
                   ha_rows rows)
68
59
  { return (double) rows /  20.0+1; }
69
60
 
77
68
                                  uint64_t nb_desired_values,
78
69
                                  uint64_t *first_value,
79
70
                                  uint64_t *nb_reserved_values);
80
 
  int index_read_map(unsigned char * buf, const unsigned char * key, key_part_map keypart_map,
 
71
  int index_read_map(unsigned char * buf, const unsigned char * key,
 
72
                     key_part_map keypart_map,
81
73
                     enum ha_rkey_function find_flag);
82
 
  int index_read_last_map(unsigned char *buf, const unsigned char *key, key_part_map keypart_map);
83
 
  int index_read_idx_map(unsigned char * buf, uint32_t index, const unsigned char * key,
 
74
  int index_read_last_map(unsigned char *buf, const unsigned char *key,
 
75
                          key_part_map keypart_map);
 
76
  int index_read_idx_map(unsigned char * buf, uint32_t index,
 
77
                         const unsigned char * key,
84
78
                         key_part_map keypart_map,
85
79
                         enum ha_rkey_function find_flag);
86
80
  int index_next(unsigned char * buf);
100
94
  int enable_indexes(uint32_t mode);
101
95
  int indexes_are_disabled(void);
102
96
  ha_rows records_in_range(uint32_t inx, key_range *min_key, key_range *max_key);
103
 
  int delete_table(const char *from);
104
97
  void drop_table(const char *name);
105
 
  int rename_table(const char * from, const char * to);
106
 
  int create(const char *name, Table *form, HA_CREATE_INFO *create_info);
107
 
  void update_create_info(HA_CREATE_INFO *create_info);
108
98
 
109
99
  THR_LOCK_DATA **store_lock(Session *session, THR_LOCK_DATA **to,
110
 
                             enum thr_lock_type lock_type);
111
 
  int cmp_ref(const unsigned char *ref1, const unsigned char *ref2)
112
 
  {
113
 
    return memcmp(ref1, ref2, sizeof(HEAP_PTR));
114
 
  }
115
 
  bool check_if_incompatible_data(HA_CREATE_INFO *info, uint32_t table_changes);
 
100
                             enum thr_lock_type lock_type);
 
101
  int cmp_ref(const unsigned char *ref1, const unsigned char *ref2);
116
102
private:
117
103
  void update_key_stats();
118
104
};
 
105
 
 
106
#endif /* PLUGIN_HEAP_HA_HEAP_H */