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