~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/haildb/haildb_engine.h

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

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
 
#pragma once
20
 
 
21
 
#include <drizzled/cursor.h>
22
 
#include <drizzled/atomics.h>
23
 
 
24
 
class HailDBTableShare
25
 
{
26
 
public:
27
 
  HailDBTableShare(const char* name, bool hidden_primary_key);
28
 
 
29
 
  drizzled::THR_LOCK lock;
30
 
  int use_count;
31
 
  std::string table_name;
32
 
 
33
 
  drizzled::atomic<uint64_t> auto_increment_value;
34
 
  drizzled::atomic<uint64_t> hidden_pkey_auto_increment_value;
35
 
  bool has_hidden_primary_key;
36
 
};
37
 
 
38
 
class HailDBCursor: public drizzled::Cursor
39
 
{
40
 
public:
41
 
  HailDBCursor(drizzled::plugin::StorageEngine &engine, drizzled::Table &table_arg);
42
 
  ~HailDBCursor()
43
 
  {}
44
 
 
45
 
  /*
46
 
    The name of the index type that will be used for display
47
 
    don't implement this method unless you really have indexes
48
 
  */
49
 
  const char *index_type(uint32_t key_number);
50
 
  uint32_t index_flags(uint32_t inx) const;
51
 
  int open(const char *name, int mode, uint32_t test_if_locked);
52
 
  int close(void);
53
 
  int external_lock(drizzled::Session* session, int lock_type);
54
 
  int doInsertRecord(unsigned char * buf);
55
 
  int doStartTableScan(bool scan);
56
 
  int rnd_next(unsigned char *buf);
57
 
  int doEndTableScan();
58
 
  int rnd_pos(unsigned char * buf, unsigned char *pos);
59
 
 
60
 
  int doStartIndexScan(uint32_t, bool);
61
 
  int index_read(unsigned char *buf, const unsigned char *key_ptr,
62
 
                 uint32_t key_len, drizzled::ha_rkey_function find_flag);
63
 
 
64
 
  int haildb_index_read(unsigned char *buf,
65
 
                        const unsigned char *key_ptr,
66
 
                        uint32_t key_len,
67
 
                        drizzled::ha_rkey_function find_flag,
68
 
                        bool allocate_blobs);
69
 
 
70
 
  uint32_t calculate_key_len(uint32_t key_position,
71
 
                             drizzled::key_part_map keypart_map_arg);
72
 
  int haildb_index_read_map(unsigned char * buf,
73
 
                            const unsigned char *key,
74
 
                            drizzled::key_part_map keypart_map,
75
 
                            drizzled::ha_rkey_function find_flag,
76
 
                            bool allocate_blobs);
77
 
  int index_read_idx_map(unsigned char * buf,
78
 
                         uint32_t index,
79
 
                         const unsigned char * key,
80
 
                         drizzled::key_part_map keypart_map,
81
 
                         drizzled::ha_rkey_function find_flag);
82
 
 
83
 
  int index_next(unsigned char * buf);
84
 
  int doEndIndexScan();
85
 
  int index_prev(unsigned char * buf);
86
 
  int index_first(unsigned char * buf);
87
 
  int index_last(unsigned char * buf);
88
 
  void position(const unsigned char *record);
89
 
  int info(uint32_t flag);
90
 
  double scan_time();
91
 
  int doDeleteRecord(const unsigned char *);
92
 
  int delete_all_rows(void);
93
 
  int doUpdateRecord(const unsigned char * old_data, unsigned char * new_data);
94
 
  int extra(drizzled::ha_extra_function operation);
95
 
 
96
 
  HailDBTableShare *get_share(const char *table_name,
97
 
                              bool has_hidden_primary_key,
98
 
                              int *rc);
99
 
  int free_share();
100
 
 
101
 
  HailDBTableShare *share;
102
 
  drizzled::THR_LOCK_DATA lock;  /* lock for store_lock. this is ass. */
103
 
  drizzled::THR_LOCK_DATA **store_lock(drizzled::Session *,
104
 
                                       drizzled::THR_LOCK_DATA **to,
105
 
                                       drizzled::thr_lock_type);
106
 
 
107
 
  uint64_t getInitialAutoIncrementValue();
108
 
  uint64_t getHiddenPrimaryKeyInitialAutoIncrementValue();
109
 
 
110
 
  void get_auto_increment(uint64_t ,
111
 
                          uint64_t ,
112
 
                          uint64_t ,
113
 
                          uint64_t *first_value,
114
 
                          uint64_t *nb_reserved_values);
115
 
 
116
 
  int reset();
117
 
  int analyze(drizzled::Session* session);
118
 
 
119
 
private:
120
 
  ib_id_t table_id;
121
 
  ib_crsr_t cursor;
122
 
  ib_tpl_t tuple;
123
 
  bool advance_cursor;
124
 
  ib_lck_mode_t ib_lock_mode;
125
 
  bool cursor_is_sec_index;
126
 
 
127
 
  bool write_can_replace;
128
 
  uint64_t hidden_autoinc_pkey_position;
129
 
  drizzled::memory::Root *blobroot;
130
 
 
131
 
  bool in_table_scan;
132
 
};
133
 
 
134
 
int get_haildb_system_table_message(const char* table_name, drizzled::message::Table *table_message);
135