~stewart/drizzle/embedded-innodb-create-select-transaction-arrgh

« back to all changes in this revision

Viewing changes to storage/blackhole/ha_blackhole.h

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2005 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
#ifdef USE_PRAGMA_INTERFACE
 
17
#pragma interface                       /* gcc class implementation */
 
18
#endif
 
19
 
 
20
/*
 
21
  Shared structure for correct LOCK operation
 
22
*/
 
23
struct st_blackhole_share {
 
24
  THR_LOCK lock;
 
25
  uint use_count;
 
26
  uint table_name_length;
 
27
  char table_name[1];
 
28
};
 
29
 
 
30
 
 
31
/*
 
32
  Class definition for the blackhole storage engine
 
33
  "Dumbest named feature ever"
 
34
*/
 
35
class ha_blackhole: public handler
 
36
{
 
37
  THR_LOCK_DATA lock;      /* MySQL lock */
 
38
  st_blackhole_share *share;
 
39
 
 
40
public:
 
41
  ha_blackhole(handlerton *hton, TABLE_SHARE *table_arg);
 
42
  ~ha_blackhole()
 
43
  {
 
44
  }
 
45
  /* The name that will be used for display purposes */
 
46
  const char *table_type() const { return "BLACKHOLE"; }
 
47
  /*
 
48
    The name of the index type that will be used for display
 
49
    don't implement this method unless you really have indexes
 
50
  */
 
51
  const char *index_type(uint key_number);
 
52
  const char **bas_ext() const;
 
53
  uint64_t table_flags() const
 
54
  {
 
55
    return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
 
56
           HA_BINLOG_STMT_CAPABLE |
 
57
           HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
 
58
           HA_FILE_BASED | HA_CAN_GEOMETRY | HA_CAN_INSERT_DELAYED);
 
59
  }
 
60
  ulong index_flags(uint inx, uint part, bool all_parts) const
 
61
  {
 
62
    return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
 
63
            0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
 
64
            HA_READ_ORDER | HA_KEYREAD_ONLY);
 
65
  }
 
66
  /* The following defines can be increased if necessary */
 
67
#define BLACKHOLE_MAX_KEY       64              /* Max allowed keys */
 
68
#define BLACKHOLE_MAX_KEY_SEG   16              /* Max segments for key */
 
69
#define BLACKHOLE_MAX_KEY_LENGTH 1000
 
70
  uint max_supported_keys()          const { return BLACKHOLE_MAX_KEY; }
 
71
  uint max_supported_key_length()    const { return BLACKHOLE_MAX_KEY_LENGTH; }
 
72
  uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
 
73
  int open(const char *name, int mode, uint test_if_locked);
 
74
  int close(void);
 
75
  int write_row(uchar * buf);
 
76
  int rnd_init(bool scan);
 
77
  int rnd_next(uchar *buf);
 
78
  int rnd_pos(uchar * buf, uchar *pos);
 
79
  int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map,
 
80
                     enum ha_rkey_function find_flag);
 
81
  int index_read_idx_map(uchar * buf, uint idx, const uchar * key,
 
82
                         key_part_map keypart_map,
 
83
                         enum ha_rkey_function find_flag);
 
84
  int index_read_last_map(uchar * buf, const uchar * key, key_part_map keypart_map);
 
85
  int index_next(uchar * buf);
 
86
  int index_prev(uchar * buf);
 
87
  int index_first(uchar * buf);
 
88
  int index_last(uchar * buf);
 
89
  void position(const uchar *record);
 
90
  int info(uint flag);
 
91
  int external_lock(THD *thd, int lock_type);
 
92
  int create(const char *name, TABLE *table_arg,
 
93
             HA_CREATE_INFO *create_info);
 
94
  THR_LOCK_DATA **store_lock(THD *thd,
 
95
                             THR_LOCK_DATA **to,
 
96
                             enum thr_lock_type lock_type);
 
97
};