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

« back to all changes in this revision

Viewing changes to plugin/embedded_innodb/embedded_innodb_engine.h

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

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_EMBEDDED_INNODB_EMBEDDED_INNODB_ENGINE_H
 
20
#define PLUGIN_EMBEDDED_INNODB_EMBEDDED_INNODB_ENGINE_H
 
21
 
 
22
#include <drizzled/cursor.h>
 
23
#include <drizzled/atomics.h>
 
24
 
 
25
class EmbeddedInnoDBTableShare
 
26
{
 
27
public:
 
28
  EmbeddedInnoDBTableShare(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 EmbeddedInnoDBCursor: public drizzled::Cursor
 
40
{
 
41
public:
 
42
  EmbeddedInnoDBCursor(drizzled::plugin::StorageEngine &engine, drizzled::TableShare &table_arg);
 
43
  ~EmbeddedInnoDBCursor()
 
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 innodb_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 innodb_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
  EmbeddedInnoDBTableShare *get_share(const char *table_name,
 
98
                                      bool has_hidden_primary_key,
 
99
                                      int *rc);
 
100
  int free_share();
 
101
 
 
102
  EmbeddedInnoDBTableShare *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
 
 
119
private:
 
120
  ib_crsr_t cursor;
 
121
  ib_tpl_t tuple;
 
122
  bool advance_cursor;
 
123
  ib_lck_mode_t ib_lock_mode;
 
124
  int previous_error;
 
125
 
 
126
  bool write_can_replace;
 
127
  uint64_t hidden_autoinc_pkey_position;
 
128
  drizzled::memory::Root *blobroot;
 
129
 
 
130
  bool in_table_scan;
 
131
};
 
132
 
 
133
int get_innodb_system_table_message(const char* table_name, drizzled::message::Table *table_message);
 
134
 
 
135
 
 
136
#endif /* PLUGIN_EMBEDDED_INNODB_EMBEDDED_INNODB_ENGINE_H */