~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/ha_heap.h

  • Committer: Brian Aker
  • Date: 2009-02-12 22:45:08 UTC
  • Revision ID: brian@tangent.org-20090212224508-mrd9jwgn1zjdpqdk
Minor refactoring (we will need to disconnect the code from the include
file).

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
{
39
45
  {
40
46
    return "MEMORY";
41
47
  }
42
 
  const char *index_type(uint32_t inx)
43
 
  {
44
 
    return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ?
45
 
            "BTREE" : "HASH");
46
 
  }
 
48
  const char *index_type(uint32_t inx);
47
49
  enum row_type get_row_type() const;
48
50
  const char **bas_ext() const;
49
51
  uint64_t table_flags() const
53
55
            HA_REC_NOT_IN_SEQ | HA_NO_TRANSACTIONS |
54
56
            HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT);
55
57
  }
56
 
  uint32_t index_flags(uint32_t inx, uint32_t part __attribute__((unused)),
57
 
                       bool all_parts __attribute__((unused))) const
58
 
  {
59
 
    return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ?
60
 
            HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE :
61
 
            HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR);
62
 
  }
 
58
  uint32_t index_flags(uint32_t inx, uint32_t part, bool all_parts) const;
63
59
  const key_map *keys_to_use_for_scanning() { return &btree_keys; }
64
60
  uint32_t max_supported_keys()          const { return MAX_KEY; }
65
61
  uint32_t max_supported_key_part_length() const { return MAX_KEY_LENGTH; }
66
62
  double scan_time()
67
63
  { return (double) (stats.records+stats.deleted) / 20.0+10; }
68
 
  double read_time(uint32_t index __attribute__((unused)),
69
 
                   uint32_t ranges __attribute__((unused)),
 
64
  double read_time(uint32_t, uint32_t,
70
65
                   ha_rows rows)
71
66
  { return (double) rows /  20.0+1; }
72
67
 
80
75
                                  uint64_t nb_desired_values,
81
76
                                  uint64_t *first_value,
82
77
                                  uint64_t *nb_reserved_values);
83
 
  int index_read_map(unsigned char * buf, const unsigned char * key, key_part_map keypart_map,
 
78
  int index_read_map(unsigned char * buf, const unsigned char * key,
 
79
                     key_part_map keypart_map,
84
80
                     enum ha_rkey_function find_flag);
85
 
  int index_read_last_map(unsigned char *buf, const unsigned char *key, key_part_map keypart_map);
86
 
  int index_read_idx_map(unsigned char * buf, uint32_t index, const unsigned char * 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,
87
85
                         key_part_map keypart_map,
88
86
                         enum ha_rkey_function find_flag);
89
87
  int index_next(unsigned char * buf);
97
95
  int info(uint);
98
96
  int extra(enum ha_extra_function operation);
99
97
  int reset();
100
 
  int external_lock(THD *thd, int lock_type);
 
98
  int external_lock(Session *session, int lock_type);
101
99
  int delete_all_rows(void);
102
100
  int disable_indexes(uint32_t mode);
103
101
  int enable_indexes(uint32_t mode);
109
107
  int create(const char *name, Table *form, HA_CREATE_INFO *create_info);
110
108
  void update_create_info(HA_CREATE_INFO *create_info);
111
109
 
112
 
  THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
113
 
                             enum thr_lock_type lock_type);
114
 
  int cmp_ref(const unsigned char *ref1, const unsigned char *ref2)
115
 
  {
116
 
    return memcmp(ref1, ref2, sizeof(HEAP_PTR));
117
 
  }
 
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);
118
113
  bool check_if_incompatible_data(HA_CREATE_INFO *info, uint32_t table_changes);
119
114
private:
120
115
  void update_key_stats();
121
116
};
 
117
 
 
118
#endif /* STORAGE_HEAP_HA_HEAP_H */