~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/ha_heap.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
 
 
18
 
/* class for the the heap Cursor */
19
 
 
20
 
#ifndef PLUGIN_MEMORY_HA_HEAP_H
21
 
#define PLUGIN_MEMORY_HA_HEAP_H
22
 
 
23
 
#include <drizzled/cursor.h>
24
 
#include <drizzled/thr_lock.h>
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
 
 
17
 
 
18
/* class for the the heap handler */
 
19
 
 
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
25
 
26
26
typedef struct st_heap_info HP_INFO;
 
27
typedef struct st_heap_share HEAP_SHARE;
27
28
typedef unsigned char *HEAP_PTR;
28
29
 
29
30
 
30
 
class ha_heap: public drizzled::Cursor
 
31
class ha_heap: public handler
31
32
{
32
33
  HP_INFO *file;
 
34
  key_map btree_keys;
33
35
  /* number of records changed since last statistics update */
34
36
  uint32_t    records_changed;
35
37
  uint32_t    key_stat_version;
36
38
  bool internal_table;
37
39
public:
38
 
  ha_heap(drizzled::plugin::StorageEngine &engine, drizzled::Table &table);
 
40
  ha_heap(StorageEngine *engine, TableShare *table);
39
41
  ~ha_heap() {}
40
 
  Cursor *clone(drizzled::memory::Root *mem_root);
 
42
  handler *clone(MEM_ROOT *mem_root);
41
43
 
42
44
  const char *index_type(uint32_t inx);
43
 
 
 
45
  enum row_type get_row_type() const;
 
46
  uint64_t table_flags() const
 
47
  {
 
48
    return (HA_FAST_KEY_READ | HA_NO_BLOBS | HA_NULL_IN_KEY |
 
49
            HA_REC_NOT_IN_SEQ | HA_NO_TRANSACTIONS |
 
50
            HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT);
 
51
  }
 
52
  uint32_t index_flags(uint32_t inx, uint32_t part, bool all_parts) const;
 
53
  const key_map *keys_to_use_for_scanning() { return &btree_keys; }
 
54
  uint32_t max_supported_keys()          const { return MAX_KEY; }
 
55
  uint32_t max_supported_key_part_length() const { return MAX_KEY_LENGTH; }
44
56
  double scan_time()
45
57
  { return (double) (stats.records+stats.deleted) / 20.0+10; }
46
58
  double read_time(uint32_t, uint32_t,
47
 
                   drizzled::ha_rows rows)
 
59
                   ha_rows rows)
48
60
  { return (double) rows /  20.0+1; }
49
61
 
50
 
  int doOpen(const drizzled::identifier::Table &identifier, int mode, uint32_t test_if_locked);
 
62
  int open(const char *name, int mode, uint32_t test_if_locked);
51
63
  int close(void);
52
64
  void set_keys_for_scanning(void);
53
 
  int doInsertRecord(unsigned char * buf);
54
 
  int doUpdateRecord(const unsigned char * old_data, unsigned char * new_data);
55
 
  int doDeleteRecord(const unsigned char * buf);
 
65
  int write_row(unsigned char * buf);
 
66
  int update_row(const unsigned char * old_data, unsigned char * new_data);
 
67
  int delete_row(const unsigned char * buf);
56
68
  virtual void get_auto_increment(uint64_t offset, uint64_t increment,
57
69
                                  uint64_t nb_desired_values,
58
70
                                  uint64_t *first_value,
59
71
                                  uint64_t *nb_reserved_values);
60
72
  int index_read_map(unsigned char * buf, const unsigned char * key,
61
 
                     drizzled::key_part_map keypart_map,
62
 
                     enum drizzled::ha_rkey_function find_flag);
 
73
                     key_part_map keypart_map,
 
74
                     enum ha_rkey_function find_flag);
63
75
  int index_read_last_map(unsigned char *buf, const unsigned char *key,
64
 
                          drizzled::key_part_map keypart_map);
 
76
                          key_part_map keypart_map);
65
77
  int index_read_idx_map(unsigned char * buf, uint32_t index,
66
78
                         const unsigned char * key,
67
 
                         drizzled::key_part_map keypart_map,
68
 
                         enum drizzled::ha_rkey_function find_flag);
 
79
                         key_part_map keypart_map,
 
80
                         enum ha_rkey_function find_flag);
69
81
  int index_next(unsigned char * buf);
70
82
  int index_prev(unsigned char * buf);
71
83
  int index_first(unsigned char * buf);
72
84
  int index_last(unsigned char * buf);
73
 
  int doStartTableScan(bool scan);
 
85
  int rnd_init(bool scan);
74
86
  int rnd_next(unsigned char *buf);
75
87
  int rnd_pos(unsigned char * buf, unsigned char *pos);
76
88
  void position(const unsigned char *record);
77
89
  int info(uint);
78
 
  int extra(enum drizzled::ha_extra_function operation);
 
90
  int extra(enum ha_extra_function operation);
79
91
  int reset();
 
92
  int external_lock(Session *session, int lock_type);
80
93
  int delete_all_rows(void);
81
94
  int disable_indexes(uint32_t mode);
82
95
  int enable_indexes(uint32_t mode);
83
96
  int indexes_are_disabled(void);
84
 
  drizzled::ha_rows records_in_range(uint32_t inx,
85
 
                                     drizzled::key_range *min_key,
86
 
                                     drizzled::key_range *max_key);
 
97
  ha_rows records_in_range(uint32_t inx, key_range *min_key, key_range *max_key);
87
98
  void drop_table(const char *name);
 
99
  void update_create_info(HA_CREATE_INFO *create_info);
88
100
 
 
101
  THR_LOCK_DATA **store_lock(Session *session, THR_LOCK_DATA **to,
 
102
                             enum thr_lock_type lock_type);
89
103
  int cmp_ref(const unsigned char *ref1, const unsigned char *ref2);
90
 
  int reset_auto_increment(uint64_t value)
91
 
  {
92
 
    file->getShare()->auto_increment= value;
93
 
    return 0;
94
 
  }
95
104
private:
96
105
  void update_key_stats();
97
106
};
98
107
 
99
 
#endif /* PLUGIN_MEMORY_HA_HEAP_H */
 
108
#endif /* STORAGE_HEAP_HA_HEAP_H */