mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / blackhole / ha_blackhole.h
blob6ed7cbbc23547d804ba6757d03f94d9a44757a1b
1 /*
2 Copyright (c) 2005-2007 MySQL AB, 2008 Sun Microsystems, Inc.
3 Use is subject to license terms.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifdef USE_PRAGMA_INTERFACE
20 #pragma interface /* gcc class implementation */
21 #endif
24 Shared structure for correct LOCK operation
26 struct st_blackhole_share {
27 THR_LOCK lock;
28 uint use_count;
29 uint table_name_length;
30 char table_name[1];
35 Class definition for the blackhole storage engine
36 "Dumbest named feature ever"
38 class ha_blackhole: public handler
40 THR_LOCK_DATA lock; /* MySQL lock */
41 st_blackhole_share *share;
43 public:
44 ha_blackhole(handlerton *hton, TABLE_SHARE *table_arg);
45 ~ha_blackhole()
48 /* The name that will be used for display purposes */
49 const char *table_type() const { return "BLACKHOLE"; }
51 The name of the index type that will be used for display
52 don't implement this method unless you really have indexes
54 const char *index_type(uint key_number);
55 const char **bas_ext() const;
56 ulonglong table_flags() const
58 return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
59 HA_BINLOG_STMT_CAPABLE | HA_BINLOG_ROW_CAPABLE |
60 HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
61 HA_FILE_BASED | HA_CAN_GEOMETRY | HA_CAN_INSERT_DELAYED);
63 ulong index_flags(uint inx, uint part, bool all_parts) const
65 return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
66 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
67 HA_READ_ORDER | HA_KEYREAD_ONLY);
69 /* The following defines can be increased if necessary */
70 #define BLACKHOLE_MAX_KEY 64 /* Max allowed keys */
71 #define BLACKHOLE_MAX_KEY_SEG 16 /* Max segments for key */
72 #define BLACKHOLE_MAX_KEY_LENGTH 1000
73 uint max_supported_keys() const { return BLACKHOLE_MAX_KEY; }
74 uint max_supported_key_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
75 uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
76 int open(const char *name, int mode, uint test_if_locked);
77 int close(void);
78 int rnd_init(bool scan);
79 int rnd_next(uchar *buf);
80 int rnd_pos(uchar * buf, uchar *pos);
81 int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map,
82 enum ha_rkey_function find_flag);
83 int index_read_idx_map(uchar * buf, uint idx, const uchar * key,
84 key_part_map keypart_map,
85 enum ha_rkey_function find_flag);
86 int index_read_last_map(uchar * buf, const uchar * key, key_part_map keypart_map);
87 int index_next(uchar * buf);
88 int index_prev(uchar * buf);
89 int index_first(uchar * buf);
90 int index_last(uchar * buf);
91 void position(const uchar *record);
92 int info(uint flag);
93 int external_lock(THD *thd, int lock_type);
94 int create(const char *name, TABLE *table_arg,
95 HA_CREATE_INFO *create_info);
96 THR_LOCK_DATA **store_lock(THD *thd,
97 THR_LOCK_DATA **to,
98 enum thr_lock_type lock_type);
99 private:
100 virtual int write_row(uchar *buf);
101 virtual int update_row(const uchar *old_data, uchar *new_data);
102 virtual int delete_row(const uchar *buf);