~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/ha_heap.h

  • Committer: Monty Taylor
  • Date: 2008-07-02 14:35:48 UTC
  • mto: This revision was merged to the branch mainline in revision 51.
  • Revision ID: monty@inaugust.com-20080702143548-onj30ry0sugr01uw
Removed all references to THREAD.

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