00001 /* Copyright (C) 2005 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00016 00017 #ifdef USE_PRAGMA_INTERFACE 00018 #pragma interface /* gcc class implementation */ 00019 #endif 00020 00021 /* 00022 Class definition for the blackhole storage engine 00023 "Dumbest named feature ever" 00024 */ 00025 class ha_blackhole: public handler 00026 { 00027 THR_LOCK_DATA lock; /* MySQL lock */ 00028 THR_LOCK thr_lock; 00029 00030 public: 00031 ha_blackhole(TABLE_SHARE *table_arg); 00032 ~ha_blackhole() 00033 { 00034 } 00035 /* The name that will be used for display purposes */ 00036 const char *table_type() const { return "BLACKHOLE"; } 00037 /* 00038 The name of the index type that will be used for display 00039 don't implement this method unless you really have indexes 00040 */ 00041 const char *index_type(uint key_number); 00042 const char **bas_ext() const; 00043 ulonglong table_flags() const 00044 { 00045 return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | 00046 HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | 00047 HA_FILE_BASED | HA_CAN_GEOMETRY | HA_CAN_INSERT_DELAYED); 00048 } 00049 ulong index_flags(uint inx, uint part, bool all_parts) const 00050 { 00051 return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? 00052 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | 00053 HA_READ_ORDER | HA_KEYREAD_ONLY); 00054 } 00055 /* The following defines can be increased if necessary */ 00056 #define BLACKHOLE_MAX_KEY 64 /* Max allowed keys */ 00057 #define BLACKHOLE_MAX_KEY_SEG 16 /* Max segments for key */ 00058 #define BLACKHOLE_MAX_KEY_LENGTH 1000 00059 uint max_supported_keys() const { return BLACKHOLE_MAX_KEY; } 00060 uint max_supported_key_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } 00061 uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; } 00062 int open(const char *name, int mode, uint test_if_locked); 00063 int close(void); 00064 int write_row(byte * buf); 00065 int rnd_init(bool scan); 00066 int rnd_next(byte *buf); 00067 int rnd_pos(byte * buf, byte *pos); 00068 int index_read(byte * buf, const byte * key, 00069 uint key_len, enum ha_rkey_function find_flag); 00070 int index_read_idx(byte * buf, uint idx, const byte * key, 00071 uint key_len, enum ha_rkey_function find_flag); 00072 int index_read_last(byte * buf, const byte * key, uint key_len); 00073 int index_next(byte * buf); 00074 int index_prev(byte * buf); 00075 int index_first(byte * buf); 00076 int index_last(byte * buf); 00077 void position(const byte *record); 00078 void info(uint flag); 00079 int external_lock(THD *thd, int lock_type); 00080 uint lock_count(void) const; 00081 int create(const char *name, TABLE *table_arg, 00082 HA_CREATE_INFO *create_info); 00083 THR_LOCK_DATA **store_lock(THD *thd, 00084 THR_LOCK_DATA **to, 00085 enum thr_lock_type lock_type); 00086 };
1.4.7

