~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/haildb/haildb_engine.h

  • Committer: Monty Taylor
  • Date: 2008-10-30 19:42:06 UTC
  • mto: (520.4.38 devel)
  • mto: This revision was merged to the branch mainline in revision 572.
  • Revision ID: monty@inaugust.com-20081030194206-fzus6yqlw1ekru65
Removed handler from common_includes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
  Copyright (C) 2010 Stewart Smith
3
 
 
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.
8
 
 
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.
13
 
 
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.
17
 
*/
18
 
 
19
 
#ifndef PLUGIN_HAILDB_HAILDB_ENGINE_H
20
 
#define PLUGIN_HAILDB_HAILDB_ENGINE_H
21
 
 
22
 
#include <drizzled/cursor.h>
23
 
#include <drizzled/atomics.h>
24
 
 
25
 
class HailDBTableShare
26
 
{
27
 
public:
28
 
  HailDBTableShare(const char* name, bool hidden_primary_key);
29
 
 
30
 
  drizzled::THR_LOCK lock;
31
 
  int use_count;
32
 
  std::string table_name;
33
 
 
34
 
  drizzled::atomic<uint64_t> auto_increment_value;
35
 
  drizzled::atomic<uint64_t> hidden_pkey_auto_increment_value;
36
 
  bool has_hidden_primary_key;
37
 
};
38
 
 
39
 
class HailDBCursor: public drizzled::Cursor
40
 
{
41
 
public:
42
 
  HailDBCursor(drizzled::plugin::StorageEngine &engine, drizzled::Table &table_arg);
43
 
  ~HailDBCursor()
44
 
  {}
45
 
 
46
 
  /*
47
 
    The name of the index type that will be used for display
48
 
    don't implement this method unless you really have indexes
49
 
  */
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);
53
 
  int close(void);
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);
58
 
  int doEndTableScan();
59
 
  int rnd_pos(unsigned char * buf, unsigned char *pos);
60
 
 
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);
64
 
 
65
 
  int haildb_index_read(unsigned char *buf,
66
 
                        const unsigned char *key_ptr,
67
 
                        uint32_t key_len,
68
 
                        drizzled::ha_rkey_function find_flag,
69
 
                        bool allocate_blobs);
70
 
 
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,
77
 
                            bool allocate_blobs);
78
 
  int index_read_idx_map(unsigned char * buf,
79
 
                         uint32_t index,
80
 
                         const unsigned char * key,
81
 
                         drizzled::key_part_map keypart_map,
82
 
                         drizzled::ha_rkey_function find_flag);
83
 
 
84
 
  int index_next(unsigned char * buf);
85
 
  int doEndIndexScan();
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);
91
 
  double scan_time();
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);
96
 
 
97
 
  HailDBTableShare *get_share(const char *table_name,
98
 
                              bool has_hidden_primary_key,
99
 
                              int *rc);
100
 
  int free_share();
101
 
 
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);
107
 
 
108
 
  uint64_t getInitialAutoIncrementValue();
109
 
  uint64_t getHiddenPrimaryKeyInitialAutoIncrementValue();
110
 
 
111
 
  void get_auto_increment(uint64_t ,
112
 
                          uint64_t ,
113
 
                          uint64_t ,
114
 
                          uint64_t *first_value,
115
 
                          uint64_t *nb_reserved_values);
116
 
 
117
 
  int reset();
118
 
  int analyze(drizzled::Session* session);
119
 
 
120
 
private:
121
 
  ib_id_t table_id;
122
 
  ib_crsr_t cursor;
123
 
  ib_tpl_t tuple;
124
 
  bool advance_cursor;
125
 
  ib_lck_mode_t ib_lock_mode;
126
 
  bool cursor_is_sec_index;
127
 
 
128
 
  bool write_can_replace;
129
 
  uint64_t hidden_autoinc_pkey_position;
130
 
  drizzled::memory::Root *blobroot;
131
 
 
132
 
  bool in_table_scan;
133
 
};
134
 
 
135
 
int get_haildb_system_table_message(const char* table_name, drizzled::message::Table *table_message);
136
 
 
137
 
#endif /* PLUGIN_HAILDB_HAILDB_ENGINE_H */