ha_heap.h
上传用户:tsgydb
上传日期:2007-04-14
资源大小:10674k
文件大小:3k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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; either version 2 of the License, or
  6.    (at your option) any later version.
  7.    
  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.
  12.    
  13.    You should have received a copy of the GNU General Public License
  14.    along with this program; if not, write to the Free Software
  15.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
  16. #ifdef __GNUC__
  17. #pragma interface /* gcc class implementation */
  18. #endif
  19. /* class for the the heap handler */
  20. #include <heap.h>
  21. class ha_heap: public handler
  22. {
  23.   HP_INFO *file;
  24.  public:
  25.   ha_heap(TABLE *table): handler(table), file(0) {}
  26.   ~ha_heap() {}
  27.   const char *table_type() const { return "HEAP"; }
  28.   const char **bas_ext() const;
  29.   ulong option_flag() const
  30.   { return (HA_READ_RND_SAME | HA_NO_INDEX | HA_ONLY_WHOLE_INDEX | 
  31.     HA_WRONG_ASCII_ORDER | HA_KEYPOS_TO_RNDPOS | HA_NO_BLOBS |
  32.     HA_REC_NOT_IN_SEQ); }
  33.   uint max_record_length() const { return HA_MAX_REC_LENGTH; }
  34.   uint max_keys()          const { return MAX_KEY; }
  35.   uint max_key_parts()     const { return MAX_REF_PARTS; }
  36.   uint max_key_length()    const { return HA_MAX_REC_LENGTH; }
  37.   virtual double scan_time() { return (double) (records+deleted) / 20.0+10; }
  38.   virtual double read_time(ha_rows rows) { return (double) rows /  20.0+1; }
  39.   virtual bool fast_key_read() { return 1;}
  40.   int open(const char *name, int mode, uint test_if_locked);
  41.   int close(void);
  42.   int write_row(byte * buf);
  43.   int update_row(const byte * old_data, byte * new_data);
  44.   int delete_row(const byte * buf);
  45.   int index_read(byte * buf, const byte * key,
  46.  uint key_len, enum ha_rkey_function find_flag);
  47.   int index_read_idx(byte * buf, uint idx, const byte * key,
  48.      uint key_len, enum ha_rkey_function find_flag);
  49.   int index_next(byte * buf);
  50.   int index_prev(byte * buf);
  51.   int index_first(byte * buf);
  52.   int index_last(byte * buf);
  53.   int rnd_init(bool scan=1);
  54.   int rnd_next(byte *buf);
  55.   int rnd_pos(byte * buf, byte *pos);
  56.   void position(const byte *record);
  57.   void info(uint);
  58.   int extra(enum ha_extra_function operation);
  59.   int reset(void);
  60.   int external_lock(THD *thd, int lock_type);
  61.   int delete_all_rows(void);
  62.   ha_rows records_in_range(int inx, const byte *start_key,uint start_key_len,
  63.    enum ha_rkey_function start_search_flag,
  64.    const byte *end_key,uint end_key_len,
  65.    enum ha_rkey_function end_search_flag);
  66.   int delete_table(const char *from);
  67.   int rename_table(const char * from, const char * to);
  68.   int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
  69.   THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
  70.      enum thr_lock_type lock_type);
  71. };