You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
3.3 KiB

  1. /* Copyright (C) 2005 MySQL AB
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  12. #ifdef USE_PRAGMA_INTERFACE
  13. #pragma interface /* gcc class implementation */
  14. #endif
  15. /*
  16. Class definition for the blackhole storage engine
  17. "Dumbest named feature ever"
  18. */
  19. class ha_blackhole: public handler
  20. {
  21. THR_LOCK_DATA lock; /* MySQL lock */
  22. THR_LOCK thr_lock;
  23. public:
  24. ha_blackhole(TABLE *table_arg);
  25. ~ha_blackhole()
  26. {
  27. }
  28. /* The name that will be used for display purposes */
  29. const char *table_type() const { return "BLACKHOLE"; }
  30. /*
  31. The name of the index type that will be used for display
  32. don't implement this method unless you really have indexes
  33. */
  34. const char *index_type(uint key_number);
  35. const char **bas_ext() const;
  36. ulong table_flags() const
  37. {
  38. return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
  39. HA_DUPP_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
  40. HA_FILE_BASED | HA_CAN_GEOMETRY | HA_READ_RND_SAME |
  41. HA_CAN_INSERT_DELAYED);
  42. }
  43. ulong index_flags(uint inx, uint part, bool all_parts) const
  44. {
  45. return ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
  46. 0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
  47. HA_READ_ORDER | HA_KEYREAD_ONLY);
  48. }
  49. /* The following defines can be increased if necessary */
  50. #define BLACKHOLE_MAX_KEY 64 /* Max allowed keys */
  51. #define BLACKHOLE_MAX_KEY_SEG 16 /* Max segments for key */
  52. #define BLACKHOLE_MAX_KEY_LENGTH 1000
  53. uint max_supported_keys() const { return BLACKHOLE_MAX_KEY; }
  54. uint max_supported_key_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
  55. uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
  56. int open(const char *name, int mode, uint test_if_locked);
  57. int close(void);
  58. int write_row(byte * buf);
  59. int rnd_init(bool scan);
  60. int rnd_next(byte *buf);
  61. int rnd_pos(byte * buf, byte *pos);
  62. int index_read(byte * buf, const byte * key,
  63. uint key_len, enum ha_rkey_function find_flag);
  64. int index_read_idx(byte * buf, uint idx, const byte * key,
  65. uint key_len, enum ha_rkey_function find_flag);
  66. int index_read_last(byte * buf, const byte * key, uint key_len);
  67. int index_next(byte * buf);
  68. int index_prev(byte * buf);
  69. int index_first(byte * buf);
  70. int index_last(byte * buf);
  71. void position(const byte *record);
  72. int info(uint flag);
  73. int external_lock(THD *thd, int lock_type);
  74. uint lock_count(void) const;
  75. int create(const char *name, TABLE *table_arg,
  76. HA_CREATE_INFO *create_info);
  77. THR_LOCK_DATA **store_lock(THD *thd,
  78. THR_LOCK_DATA **to,
  79. enum thr_lock_type lock_type);
  80. };