~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
1802.10.2 by Monty Taylor
Update all of the copyright headers to include the correct address.
14
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
1 by brian
clean slate
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
1183.1.2 by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted
20
#include <drizzled/cursor.h>
1241.9.43 by Monty Taylor
Merged trunk. Also renamed thr_lock. Doh. I hate it when I do both.
21
#include <drizzled/thr_lock.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.
22
23
#define BLACKHOLE_MAX_KEY	64		/* Max allowed keys */
24
#define BLACKHOLE_MAX_KEY_LENGTH 1000
25
1 by brian
clean slate
26
/*
27
  Shared structure for correct LOCK operation
28
*/
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
29
class BlackholeShare
30
{
31
  BlackholeShare();
32
  BlackholeShare(const BlackholeShare &);
33
  BlackholeShare& operator=(const BlackholeShare &);
34
public:
35
  explicit BlackholeShare(const std::string table_name_arg);
36
  ~BlackholeShare();
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
37
  drizzled::THR_LOCK lock;
482 by Brian Aker
Remove uint.
38
  uint32_t use_count;
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
39
  const std::string table_name;
1 by brian
clean slate
40
};
41
42
43
/*
44
  Class definition for the blackhole storage engine
45
  "Dumbest named feature ever"
46
*/
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
47
class ha_blackhole: public drizzled::Cursor
1 by brian
clean slate
48
{
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
49
  drizzled::THR_LOCK_DATA lock;      /* MySQL lock */
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
50
  BlackholeShare *share;
1 by brian
clean slate
51
52
public:
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
53
  ha_blackhole(drizzled::plugin::StorageEngine &engine,
1869.1.4 by Brian Aker
TableShare is no longer in the house (i.e. we no longer directly have a copy
54
               drizzled::Table &table_arg);
1 by brian
clean slate
55
  ~ha_blackhole()
1103.5.1 by Toru Maesaka
Updated Blackhole to work with the current SE interface
56
  {}
1008.3.26 by Stewart Smith
remove handler::table_type() as same information can be retrieved from handler::engine->getName()
57
1 by brian
clean slate
58
  /*
59
    The name of the index type that will be used for display
60
    don't implement this method unless you really have indexes
61
  */
482 by Brian Aker
Remove uint.
62
  const char *index_type(uint32_t key_number);
1235.1.12 by Brian Aker
Clean up index interface before moving to SE.
63
  uint32_t index_flags(uint32_t inx) const;
482 by Brian Aker
Remove uint.
64
  int open(const char *name, int mode, uint32_t test_if_locked);
1 by brian
clean slate
65
  int close(void);
1491.1.2 by Jay Pipes
Cursor::write_row() -> Cursor::doInsertRecord(). Cursor::ha_write_row() -> Cursor::insertRecord()
66
  int doInsertRecord(unsigned char * buf);
1491.1.10 by Jay Pipes
ha_rnd_init -> startTableScan, rnd_init -> doStartTableScan, ha_rnd_end -> endTableScan, rnd_end -> doEndTableScan
67
  int doStartTableScan(bool scan);
481 by Brian Aker
Remove all of uchar.
68
  int rnd_next(unsigned char *buf);
69
  int rnd_pos(unsigned char * buf, unsigned char *pos);
1240.2.3 by Monty Taylor
Fixed blackhole crashses on Spare - made Blackhole follow the pattern of CSV and Archive.
70
  BlackholeShare *get_share(const char *table_name);
71
  void free_share();
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
72
  int index_read_map(unsigned char * buf, const unsigned char * key,
73
                     drizzled::key_part_map keypart_map,
74
                     drizzled::ha_rkey_function find_flag);
482 by Brian Aker
Remove uint.
75
  int index_read_idx_map(unsigned char * buf, uint32_t idx, const unsigned char * key,
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
76
                         drizzled::key_part_map keypart_map,
77
                         drizzled::ha_rkey_function find_flag);
78
  int index_read_last_map(unsigned char * buf, const unsigned char * key,
79
                          drizzled::key_part_map keypart_map);
481 by Brian Aker
Remove all of uchar.
80
  int index_next(unsigned char * buf);
81
  int index_prev(unsigned char * buf);
82
  int index_first(unsigned char * buf);
83
  int index_last(unsigned char * buf);
84
  void position(const unsigned char *record);
482 by Brian Aker
Remove uint.
85
  int info(uint32_t flag);
1377.7.2 by Stewart Smith
make get_auto_increment pure virtual and force engines not supporting auto_increment to be explicit about it
86
87
  void get_auto_increment(uint64_t, uint64_t,
88
                          uint64_t,
89
                          uint64_t *,
90
                          uint64_t *)
91
  {}
92
1 by brian
clean slate
93
};
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.
94
1122.2.10 by Monty Taylor
Fixed all of the include guards.
95
#endif /* PLUGIN_BLACKHOLE_HA_BLACKHOLE_H */