~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/* Copyright (C) 2000-2006 MySQL AB
2
3
   This program is free software; you can redistribute it and/or modify
4
   it under the terms of the GNU General Public License as published by
5
   the Free Software Foundation; version 2 of the License.
6
7
   This program is distributed in the hope that it will be useful,
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
   GNU General Public License for more details.
11
12
   You should have received a copy of the GNU General Public License
13
   along with this program; if not, write to the Free Software
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
16
17
18
/* class for the the heap handler */
19
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
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>
685.1.3 by Monty Taylor
Turned off stdinc - and then fixed the carnage.
25
26
typedef struct st_heap_info HP_INFO;
27
typedef struct st_heap_share HEAP_SHARE;
28
typedef unsigned char *HEAP_PTR;
29
1 by brian
clean slate
30
31
class ha_heap: public handler
32
{
33
  HP_INFO *file;
34
  key_map btree_keys;
35
  /* number of records changed since last statistics update */
482 by Brian Aker
Remove uint.
36
  uint32_t    records_changed;
37
  uint32_t    key_stat_version;
280 by Brian Aker
Removed my_bool from heap engine.
38
  bool internal_table;
1 by brian
clean slate
39
public:
1000.1.3 by Brian Aker
Renamed TABLE_SHARE to TableShare
40
  ha_heap(StorageEngine *engine, TableShare *table);
1 by brian
clean slate
41
  ~ha_heap() {}
42
  handler *clone(MEM_ROOT *mem_root);
1008.3.26 by Stewart Smith
remove handler::table_type() as same information can be retrieved from handler::engine->getName()
43
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
44
  const char *index_type(uint32_t inx);
244.1.1 by Harrison Fisk
Port Ebay/Google memory storage engine variable width columns.
45
  enum row_type get_row_type() const;
1 by brian
clean slate
46
  uint64_t table_flags() const
47
  {
48
    return (HA_FAST_KEY_READ | HA_NO_BLOBS | HA_NULL_IN_KEY |
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
49
            HA_REC_NOT_IN_SEQ | HA_NO_TRANSACTIONS |
1 by brian
clean slate
50
            HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT);
51
  }
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
52
  uint32_t index_flags(uint32_t inx, uint32_t part, bool all_parts) const;
1 by brian
clean slate
53
  const key_map *keys_to_use_for_scanning() { return &btree_keys; }
482 by Brian Aker
Remove uint.
54
  uint32_t max_supported_keys()          const { return MAX_KEY; }
55
  uint32_t max_supported_key_part_length() const { return MAX_KEY_LENGTH; }
1 by brian
clean slate
56
  double scan_time()
57
  { return (double) (stats.records+stats.deleted) / 20.0+10; }
653 by Brian Aker
More solaris bits
58
  double read_time(uint32_t, uint32_t,
77.1.7 by Monty Taylor
Heap builds clean.
59
                   ha_rows rows)
1 by brian
clean slate
60
  { return (double) rows /  20.0+1; }
61
482 by Brian Aker
Remove uint.
62
  int open(const char *name, int mode, uint32_t test_if_locked);
1 by brian
clean slate
63
  int close(void);
64
  void set_keys_for_scanning(void);
481 by Brian Aker
Remove all of uchar.
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);
1 by brian
clean slate
68
  virtual void get_auto_increment(uint64_t offset, uint64_t increment,
69
                                  uint64_t nb_desired_values,
70
                                  uint64_t *first_value,
71
                                  uint64_t *nb_reserved_values);
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
72
  int index_read_map(unsigned char * buf, const unsigned char * key,
73
                     key_part_map keypart_map,
1 by brian
clean slate
74
                     enum ha_rkey_function find_flag);
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
75
  int index_read_last_map(unsigned char *buf, const unsigned char *key,
76
                          key_part_map keypart_map);
77
  int index_read_idx_map(unsigned char * buf, uint32_t index,
78
                         const unsigned char * key,
1 by brian
clean slate
79
                         key_part_map keypart_map,
80
                         enum ha_rkey_function find_flag);
481 by Brian Aker
Remove all of uchar.
81
  int index_next(unsigned char * buf);
82
  int index_prev(unsigned char * buf);
83
  int index_first(unsigned char * buf);
84
  int index_last(unsigned char * buf);
1 by brian
clean slate
85
  int rnd_init(bool scan);
481 by Brian Aker
Remove all of uchar.
86
  int rnd_next(unsigned char *buf);
87
  int rnd_pos(unsigned char * buf, unsigned char *pos);
88
  void position(const unsigned char *record);
1 by brian
clean slate
89
  int info(uint);
90
  int extra(enum ha_extra_function operation);
91
  int reset();
520.1.22 by Brian Aker
Second pass of thd cleanup
92
  int external_lock(Session *session, int lock_type);
1 by brian
clean slate
93
  int delete_all_rows(void);
482 by Brian Aker
Remove uint.
94
  int disable_indexes(uint32_t mode);
95
  int enable_indexes(uint32_t mode);
1 by brian
clean slate
96
  int indexes_are_disabled(void);
482 by Brian Aker
Remove uint.
97
  ha_rows records_in_range(uint32_t inx, key_range *min_key, key_range *max_key);
1 by brian
clean slate
98
  void drop_table(const char *name);
99
  void update_create_info(HA_CREATE_INFO *create_info);
100
520.1.22 by Brian Aker
Second pass of thd cleanup
101
  THR_LOCK_DATA **store_lock(Session *session, THR_LOCK_DATA **to,
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
102
                             enum thr_lock_type lock_type);
685.1.3 by Monty Taylor
Turned off stdinc - and then fixed the carnage.
103
  int cmp_ref(const unsigned char *ref1, const unsigned char *ref2);
1 by brian
clean slate
104
private:
105
  void update_key_stats();
106
};
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
107
108
#endif /* STORAGE_HEAP_HA_HEAP_H */