2
Copyright (C) 2010 Stewart Smith
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
as published by the Free Software Foundation; either version 2
7
of the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
#ifndef PLUGIN_HAILDB_HAILDB_ENGINE_H
20
#define PLUGIN_HAILDB_HAILDB_ENGINE_H
22
#include <drizzled/cursor.h>
23
#include <drizzled/atomics.h>
25
class HailDBTableShare
28
HailDBTableShare(const char* name, bool hidden_primary_key);
30
drizzled::THR_LOCK lock;
32
std::string table_name;
34
drizzled::atomic<uint64_t> auto_increment_value;
35
drizzled::atomic<uint64_t> hidden_pkey_auto_increment_value;
36
bool has_hidden_primary_key;
39
class HailDBCursor: public drizzled::Cursor
42
HailDBCursor(drizzled::plugin::StorageEngine &engine, drizzled::Table &table_arg);
47
The name of the index type that will be used for display
48
don't implement this method unless you really have indexes
50
const char *index_type(uint32_t key_number);
51
uint32_t index_flags(uint32_t inx) const;
52
int open(const char *name, int mode, uint32_t test_if_locked);
54
int external_lock(drizzled::Session* session, int lock_type);
55
int doInsertRecord(unsigned char * buf);
56
int doStartTableScan(bool scan);
57
int rnd_next(unsigned char *buf);
59
int rnd_pos(unsigned char * buf, unsigned char *pos);
61
int doStartIndexScan(uint32_t, bool);
62
int index_read(unsigned char *buf, const unsigned char *key_ptr,
63
uint32_t key_len, drizzled::ha_rkey_function find_flag);
65
int haildb_index_read(unsigned char *buf,
66
const unsigned char *key_ptr,
68
drizzled::ha_rkey_function find_flag,
71
uint32_t calculate_key_len(uint32_t key_position,
72
drizzled::key_part_map keypart_map_arg);
73
int haildb_index_read_map(unsigned char * buf,
74
const unsigned char *key,
75
drizzled::key_part_map keypart_map,
76
drizzled::ha_rkey_function find_flag,
78
int index_read_idx_map(unsigned char * buf,
80
const unsigned char * key,
81
drizzled::key_part_map keypart_map,
82
drizzled::ha_rkey_function find_flag);
84
int index_next(unsigned char * buf);
86
int index_prev(unsigned char * buf);
87
int index_first(unsigned char * buf);
88
int index_last(unsigned char * buf);
89
void position(const unsigned char *record);
90
int info(uint32_t flag);
92
int doDeleteRecord(const unsigned char *);
93
int delete_all_rows(void);
94
int doUpdateRecord(const unsigned char * old_data, unsigned char * new_data);
95
int extra(drizzled::ha_extra_function operation);
97
HailDBTableShare *get_share(const char *table_name,
98
bool has_hidden_primary_key,
102
HailDBTableShare *share;
103
drizzled::THR_LOCK_DATA lock; /* lock for store_lock. this is ass. */
104
drizzled::THR_LOCK_DATA **store_lock(drizzled::Session *,
105
drizzled::THR_LOCK_DATA **to,
106
drizzled::thr_lock_type);
108
uint64_t getInitialAutoIncrementValue();
109
uint64_t getHiddenPrimaryKeyInitialAutoIncrementValue();
111
void get_auto_increment(uint64_t ,
114
uint64_t *first_value,
115
uint64_t *nb_reserved_values);
118
int analyze(drizzled::Session* session);
125
ib_lck_mode_t ib_lock_mode;
126
bool cursor_is_sec_index;
128
bool write_can_replace;
129
uint64_t hidden_autoinc_pkey_position;
130
drizzled::memory::Root *blobroot;
135
int get_haildb_system_table_message(const char* table_name, drizzled::message::Table *table_message);
137
#endif /* PLUGIN_HAILDB_HAILDB_ENGINE_H */