~drizzle-trunk/drizzle/development

1 by brian
clean slate
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
1122.2.10 by Monty Taylor
Fixed all of the include guards.
17
#ifndef PLUGIN_BLACKHOLE_HA_BLACKHOLE_H
18
#define PLUGIN_BLACKHOLE_HA_BLACKHOLE_H
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
19
20
#include <drizzled/handler.h>
21
#include <mysys/thr_lock.h>
22
23
#define BLACKHOLE_MAX_KEY	64		/* Max allowed keys */
24
#define BLACKHOLE_MAX_KEY_SEG	16		/* Max segments for key */
25
#define BLACKHOLE_MAX_KEY_LENGTH 1000
26
1 by brian
clean slate
27
/*
28
  Shared structure for correct LOCK operation
29
*/
30
struct st_blackhole_share {
31
  THR_LOCK lock;
482 by Brian Aker
Remove uint.
32
  uint32_t use_count;
33
  uint32_t table_name_length;
1 by brian
clean slate
34
  char table_name[1];
35
};
36
37
38
/*
39
  Class definition for the blackhole storage engine
40
  "Dumbest named feature ever"
41
*/
42
class ha_blackhole: public handler
43
{
44
  THR_LOCK_DATA lock;      /* MySQL lock */
45
  st_blackhole_share *share;
46
47
public:
1000.1.3 by Brian Aker
Renamed TABLE_SHARE to TableShare
48
  ha_blackhole(StorageEngine *engine, TableShare *table_arg);
1 by brian
clean slate
49
  ~ha_blackhole()
1103.5.1 by Toru Maesaka
Updated Blackhole to work with the current SE interface
50
  {}
1008.3.26 by Stewart Smith
remove handler::table_type() as same information can be retrieved from handler::engine->getName()
51
1 by brian
clean slate
52
  /*
53
    The name of the index type that will be used for display
54
    don't implement this method unless you really have indexes
55
  */
482 by Brian Aker
Remove uint.
56
  const char *index_type(uint32_t key_number);
1 by brian
clean slate
57
  uint64_t table_flags() const
58
  {
1103.5.1 by Toru Maesaka
Updated Blackhole to work with the current SE interface
59
    return(HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY);
1 by brian
clean slate
60
  }
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
61
  uint32_t index_flags(uint32_t inx, uint32_t part, bool all_parts) const;
1 by brian
clean slate
62
  /* The following defines can be increased if necessary */
482 by Brian Aker
Remove uint.
63
  uint32_t max_supported_keys()          const { return BLACKHOLE_MAX_KEY; }
64
  uint32_t max_supported_key_length()    const { return BLACKHOLE_MAX_KEY_LENGTH; }
65
  uint32_t max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
66
  int open(const char *name, int mode, uint32_t test_if_locked);
1 by brian
clean slate
67
  int close(void);
481 by Brian Aker
Remove all of uchar.
68
  int write_row(unsigned char * buf);
1 by brian
clean slate
69
  int rnd_init(bool scan);
481 by Brian Aker
Remove all of uchar.
70
  int rnd_next(unsigned char *buf);
71
  int rnd_pos(unsigned char * buf, unsigned char *pos);
72
  int index_read_map(unsigned char * buf, const unsigned char * key, key_part_map keypart_map,
1 by brian
clean slate
73
                     enum ha_rkey_function find_flag);
482 by Brian Aker
Remove uint.
74
  int index_read_idx_map(unsigned char * buf, uint32_t idx, const unsigned char * key,
1 by brian
clean slate
75
                         key_part_map keypart_map,
76
                         enum ha_rkey_function find_flag);
481 by Brian Aker
Remove all of uchar.
77
  int index_read_last_map(unsigned char * buf, const unsigned char * key, key_part_map keypart_map);
78
  int index_next(unsigned char * buf);
79
  int index_prev(unsigned char * buf);
80
  int index_first(unsigned char * buf);
81
  int index_last(unsigned char * buf);
82
  void position(const unsigned char *record);
482 by Brian Aker
Remove uint.
83
  int info(uint32_t flag);
520.1.22 by Brian Aker
Second pass of thd cleanup
84
  int external_lock(Session *session, int lock_type);
85
  THR_LOCK_DATA **store_lock(Session *session,
1 by brian
clean slate
86
                             THR_LOCK_DATA **to,
87
                             enum thr_lock_type lock_type);
88
};
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
89
1122.2.10 by Monty Taylor
Fixed all of the include guards.
90
#endif /* PLUGIN_BLACKHOLE_HA_BLACKHOLE_H */