390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
1
by brian
clean slate |
19 |
|
1185
by Brian Aker
Merge Engine changes. |
20 |
#ifndef DRIZZLED_CURSOR_H
|
21 |
#define DRIZZLED_CURSOR_H
|
|
1
by brian
clean slate |
22 |
|
520.4.31
by Monty Taylor
Removed server_id from common_includes. |
23 |
#include <drizzled/xid.h> |
844
by Brian Aker
Added drizzled/discrete_interval.h |
24 |
#include <drizzled/discrete_interval.h> |
1223.4.1
by Brian Aker
Table Identifier patch. |
25 |
#include <drizzled/table_identifier.h> |
520.4.31
by Monty Taylor
Removed server_id from common_includes. |
26 |
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
27 |
/* Definitions for parameters to do with Cursor-routines */
|
1
by brian
clean slate |
28 |
|
520.6.4
by Monty Taylor
Moved thr_lock.h out of common_includes. |
29 |
#include <mysys/thr_lock.h> |
520.8.3
by Monty Taylor
Moved hash back to mysys. |
30 |
#include <mysys/hash.h> |
520.8.5
by Monty Taylor
Removed sql_string and sql_list from common_includes. |
31 |
#include <drizzled/sql_string.h> |
32 |
#include <drizzled/sql_list.h> |
|
960.2.23
by Monty Taylor
Moved handlerton to plugin/storage_engine.h. |
33 |
#include <drizzled/plugin/storage_engine.h> |
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
34 |
#include <drizzled/handler_structs.h> |
35 |
#include <drizzled/ha_statistics.h> |
|
1046.1.8
by Brian Aker
Remove race condition around refresh (aka... multi-thread writeable global |
36 |
#include <drizzled/atomics.h> |
520.6.4
by Monty Taylor
Moved thr_lock.h out of common_includes. |
37 |
|
1008.3.20
by Stewart Smith
Put table_name into table proto in parser, and use that when creating table proto file. |
38 |
#include <drizzled/message/table.pb.h> |
39 |
||
520.6.4
by Monty Taylor
Moved thr_lock.h out of common_includes. |
40 |
/* Bits to show what an alter table will do */
|
41 |
#include <drizzled/sql_bitmap.h> |
|
982.1.9
by Padraig O'Sullivan
Changed HA_ALTER_FLAGS to be of type std::bitset instead of being of type |
42 |
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
43 |
#include <drizzled/cursor.h> |
1109.1.4
by Brian Aker
More Table refactor |
44 |
|
1067.4.4
by Nathan Williams
The rest of the files in the drizzled directory were purged of the cmin macro and replace with std::min (except for the definition in globals.h and 1 usage in stacktrace.cc). |
45 |
#include <bitset> |
46 |
#include <algorithm> |
|
1005.2.6
by Monty Taylor
Re-added bitset<> as a replacement for Bitmap<> |
47 |
|
520.6.4
by Monty Taylor
Moved thr_lock.h out of common_includes. |
48 |
#define HA_MAX_ALTER_FLAGS 40
|
1130.1.5
by Monty Taylor
Split StorageEngine into slot. This completes the plugin-slot-reorg. Woot. |
49 |
|
50 |
||
1005.2.6
by Monty Taylor
Re-added bitset<> as a replacement for Bitmap<> |
51 |
typedef std::bitset<HA_MAX_ALTER_FLAGS> HA_ALTER_FLAGS; |
1
by brian
clean slate |
52 |
|
1220.1.3
by Brian Aker
Remove atomic on refresh (go back to do it via lazy method). |
53 |
extern uint64_t refresh_version; /* Increments on each reload */ |
1046.1.8
by Brian Aker
Remove race condition around refresh (aka... multi-thread writeable global |
54 |
|
1
by brian
clean slate |
55 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
56 |
typedef bool (*qc_engine_callback)(Session *session, char *table_key, |
482
by Brian Aker
Remove uint. |
57 |
uint32_t key_length, |
243.1.1
by Jay Pipes
* Pulled Object_creation_ctx and Default_creation_ctx out of mysql_priv.h |
58 |
uint64_t *engine_data); |
59 |
||
1
by brian
clean slate |
60 |
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
61 |
/* The Cursor for a table type. Will be included in the Table structure */
|
1
by brian
clean slate |
62 |
|
327.1.1
by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure). |
63 |
class Table; |
561.1.3
by Monty Taylor
Split some more things out of common_includes.h. |
64 |
class TableList; |
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
65 |
class TableShare; |
848
by Brian Aker
typdef class removal (just... use the name of the class). |
66 |
class Select_Lex_Unit; |
1
by brian
clean slate |
67 |
struct st_foreign_key_info; |
68 |
typedef struct st_foreign_key_info FOREIGN_KEY_INFO; |
|
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
69 |
struct order_st; |
1
by brian
clean slate |
70 |
|
71 |
class Item; |
|
72 |
struct st_table_log_memory_entry; |
|
73 |
||
575.4.7
by Monty Taylor
More header cleanup. |
74 |
class LEX; |
846
by Brian Aker
Removing on typedeffed class. |
75 |
class Select_Lex; |
1126.3.3
by Jay Pipes
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo. |
76 |
class AlterInfo; |
575.4.7
by Monty Taylor
More header cleanup. |
77 |
class select_result; |
1052.2.3
by Nathan Williams
No actual code changes. Changed Create_field to CreateField to be consistent with coding standards. |
78 |
class CreateField; |
575.4.7
by Monty Taylor
More header cleanup. |
79 |
class sys_var_str; |
80 |
class Item_ident; |
|
81 |
typedef struct st_sort_field SORT_FIELD; |
|
82 |
||
83 |
typedef List<Item> List_item; |
|
84 |
||
1
by brian
clean slate |
85 |
typedef struct st_savepoint SAVEPOINT; |
61
by Brian Aker
Conversion of handler type. |
86 |
extern uint32_t savepoint_alloc_size; |
1
by brian
clean slate |
87 |
extern KEY_CREATE_INFO default_key_create_info; |
88 |
||
89 |
/* Forward declaration for condition pushdown to storage engine */
|
|
90 |
typedef class Item COND; |
|
91 |
||
92 |
typedef struct system_status_var SSV; |
|
93 |
||
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
94 |
class COST_VECT; |
95 |
||
482
by Brian Aker
Remove uint. |
96 |
uint32_t calculate_key_len(Table *, uint, const unsigned char *, key_part_map); |
1
by brian
clean slate |
97 |
/*
|
98 |
bitmap with first N+1 bits set
|
|
99 |
(keypart_map for a key prefix of [0..N] keyparts)
|
|
100 |
*/
|
|
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
101 |
template<class T> |
102 |
inline key_part_map make_keypart_map(T a) |
|
103 |
{
|
|
104 |
return (((key_part_map)2 << a) - 1); |
|
105 |
}
|
|
106 |
||
1
by brian
clean slate |
107 |
/*
|
108 |
bitmap with first N bits set
|
|
109 |
(keypart_map for a key prefix of [0..N-1] keyparts)
|
|
110 |
*/
|
|
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
111 |
template<class T> |
112 |
inline key_part_map make_prev_keypart_map(T a) |
|
113 |
{
|
|
114 |
return (((key_part_map)1 << a) - 1); |
|
115 |
}
|
|
1
by brian
clean slate |
116 |
|
117 |
/**
|
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
118 |
The Cursor class is the interface for dynamically loadable
|
1
by brian
clean slate |
119 |
storage engines. Do not add ifdefs and take care when adding or
|
120 |
changing virtual functions to avoid vtable confusion
|
|
121 |
||
122 |
Functions in this class accept and return table columns data. Two data
|
|
123 |
representation formats are used:
|
|
124 |
1. TableRecordFormat - Used to pass [partial] table records to/from
|
|
125 |
storage engine
|
|
126 |
||
127 |
2. KeyTupleFormat - used to pass index search tuples (aka "keys") to
|
|
1237.9.2
by Padraig O'Sullivan
Moved opt_range.[cc,h] into the optimizer directory and namespace and renamed the files to |
128 |
storage engine. See optimizer/range.cc for description of this format.
|
1
by brian
clean slate |
129 |
|
130 |
TableRecordFormat
|
|
131 |
=================
|
|
132 |
[Warning: this description is work in progress and may be incomplete]
|
|
133 |
The table record is stored in a fixed-size buffer:
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
134 |
|
1
by brian
clean slate |
135 |
record: null_bytes, column1_data, column2_data, ...
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
136 |
|
137 |
The offsets of the parts of the buffer are also fixed: every column has
|
|
1
by brian
clean slate |
138 |
an offset to its column{i}_data, and if it is nullable it also has its own
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
139 |
bit in null_bytes.
|
1
by brian
clean slate |
140 |
|
141 |
The record buffer only includes data about columns that are marked in the
|
|
142 |
relevant column set (table->read_set and/or table->write_set, depending on
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
143 |
the situation).
|
1
by brian
clean slate |
144 |
<not-sure>It could be that it is required that null bits of non-present
|
145 |
columns are set to 1</not-sure>
|
|
146 |
||
147 |
VARIOUS EXCEPTIONS AND SPECIAL CASES
|
|
148 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
149 |
f the table has no nullable columns, then null_bytes is still
|
150 |
present, its length is one byte <not-sure> which must be set to 0xFF
|
|
1
by brian
clean slate |
151 |
at all times. </not-sure>
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
152 |
|
1
by brian
clean slate |
153 |
If the table has columns of type BIT, then certain bits from those columns
|
154 |
may be stored in null_bytes as well. Grep around for Field_bit for
|
|
155 |
details.
|
|
156 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
157 |
For blob columns (see Field_blob), the record buffer stores length of the
|
158 |
data, following by memory pointer to the blob data. The pointer is owned
|
|
1
by brian
clean slate |
159 |
by the storage engine and is valid until the next operation.
|
160 |
||
161 |
If a blob column has NULL value, then its length and blob data pointer
|
|
162 |
must be set to 0.
|
|
163 |
*/
|
|
164 |
||
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
165 |
class Cursor :public Sql_alloc |
1
by brian
clean slate |
166 |
{
|
167 |
protected: |
|
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
168 |
TableShare *table_share; /* The table definition */ |
327.1.1
by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure). |
169 |
Table *table; /* The current open table */ |
1
by brian
clean slate |
170 |
|
171 |
ha_rows estimation_rows_to_insert; |
|
172 |
public: |
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
173 |
drizzled::plugin::StorageEngine *engine; /* storage engine of this Cursor */ |
1233.1.2
by Brian Aker
Move stat read define into engine flags. |
174 |
inline drizzled::plugin::StorageEngine *getEngine() const /* table_type for handler */ |
175 |
{
|
|
176 |
return engine; |
|
177 |
}
|
|
178 |
unsigned char *ref; /* Pointer to current row */ |
|
481
by Brian Aker
Remove all of uchar. |
179 |
unsigned char *dup_ref; /* Pointer to duplicate row */ |
1
by brian
clean slate |
180 |
|
181 |
ha_statistics stats; |
|
182 |
/** MultiRangeRead-related members: */
|
|
183 |
range_seq_t mrr_iter; /* Interator to traverse the range sequence */ |
|
184 |
RANGE_SEQ_IF mrr_funcs; /* Range sequence traversal functions */ |
|
185 |
HANDLER_BUFFER *multi_range_buffer; /* MRR buffer info */ |
|
482
by Brian Aker
Remove uint. |
186 |
uint32_t ranges_in_seq; /* Total number of ranges in the traversed sequence */ |
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
187 |
/* true <=> source MRR ranges and the output are ordered */
|
1
by brian
clean slate |
188 |
bool mrr_is_output_sorted; |
189 |
||
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
190 |
/** true <=> we're currently traversing a range in mrr_cur_range. */
|
1
by brian
clean slate |
191 |
bool mrr_have_range; |
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
192 |
|
193 |
bool eq_range; |
|
194 |
/*
|
|
195 |
true <=> the engine guarantees that returned records are within the range
|
|
196 |
being scanned.
|
|
197 |
*/
|
|
198 |
bool in_range_check_pushed_down; |
|
199 |
||
1
by brian
clean slate |
200 |
/** Current range (the one we're now returning rows from) */
|
201 |
KEY_MULTI_RANGE mrr_cur_range; |
|
202 |
||
203 |
/** The following are for read_range() */
|
|
204 |
key_range save_end_range, *end_range; |
|
205 |
KEY_PART_INFO *range_key_part; |
|
206 |
int key_compare_result_on_equal; |
|
207 |
||
482
by Brian Aker
Remove uint. |
208 |
uint32_t errkey; /* Last dup key */ |
209 |
uint32_t key_used_on_scan; |
|
210 |
uint32_t active_index; |
|
1
by brian
clean slate |
211 |
/** Length of ref (1-8 or the clustered key length) */
|
482
by Brian Aker
Remove uint. |
212 |
uint32_t ref_length; |
1
by brian
clean slate |
213 |
enum {NONE=0, INDEX, RND} inited; |
214 |
bool locked; |
|
215 |
bool implicit_emptied; /* Can be !=0 only if HEAP */ |
|
216 |
||
217 |
/**
|
|
218 |
next_insert_id is the next value which should be inserted into the
|
|
219 |
auto_increment column: in a inserting-multi-row statement (like INSERT
|
|
220 |
SELECT), for the first row where the autoinc value is not specified by the
|
|
221 |
statement, get_auto_increment() called and asked to generate a value,
|
|
222 |
next_insert_id is set to the next value, then for all other rows
|
|
223 |
next_insert_id is used (and increased each time) without calling
|
|
224 |
get_auto_increment().
|
|
225 |
*/
|
|
226 |
uint64_t next_insert_id; |
|
227 |
/**
|
|
228 |
insert id for the current row (*autogenerated*; if not
|
|
229 |
autogenerated, it's 0).
|
|
230 |
At first successful insertion, this variable is stored into
|
|
520.1.21
by Brian Aker
THD -> Session rename |
231 |
Session::first_successful_insert_id_in_cur_stmt.
|
1
by brian
clean slate |
232 |
*/
|
233 |
uint64_t insert_id_for_cur_row; |
|
234 |
/**
|
|
235 |
Interval returned by get_auto_increment() and being consumed by the
|
|
236 |
inserter.
|
|
237 |
*/
|
|
238 |
Discrete_interval auto_inc_interval_for_cur_row; |
|
239 |
||
1208.3.2
by brian
Update for Cursor renaming. |
240 |
Cursor(drizzled::plugin::StorageEngine &engine_arg, TableShare &share_arg) |
241 |
:table_share(&share_arg), table(0), |
|
242 |
estimation_rows_to_insert(0), engine(&engine_arg), |
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
243 |
ref(0), in_range_check_pushed_down(false), |
1
by brian
clean slate |
244 |
key_used_on_scan(MAX_KEY), active_index(MAX_KEY), |
245 |
ref_length(sizeof(my_off_t)), |
|
137
by Brian Aker
Removed dead FT bits. Small refactoring in sql_plugin.cc |
246 |
inited(NONE), |
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
247 |
locked(false), implicit_emptied(0), |
1
by brian
clean slate |
248 |
next_insert_id(0), insert_id_for_cur_row(0) |
249 |
{}
|
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
250 |
virtual ~Cursor(void); |
251 |
virtual Cursor *clone(MEM_ROOT *mem_root); |
|
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
252 |
|
1
by brian
clean slate |
253 |
/* ha_ methods: pubilc wrappers for private virtual API */
|
254 |
||
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
255 |
int ha_open(Table *table, const char *name, int mode, int test_if_locked); |
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
256 |
int ha_index_init(uint32_t idx, bool sorted); |
257 |
int ha_index_end(); |
|
258 |
int ha_rnd_init(bool scan); |
|
259 |
int ha_rnd_end(); |
|
1
by brian
clean slate |
260 |
int ha_reset(); |
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
261 |
|
1
by brian
clean slate |
262 |
/* this is necessary in many places, e.g. in HANDLER command */
|
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
263 |
int ha_index_or_rnd_end(); |
264 |
||
1
by brian
clean slate |
265 |
/**
|
266 |
These functions represent the public interface to *users* of the
|
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
267 |
Cursor class, hence they are *not* virtual. For the inheritance
|
1
by brian
clean slate |
268 |
interface, see the (private) functions write_row(), update_row(),
|
269 |
and delete_row() below.
|
|
270 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
271 |
int ha_external_lock(Session *session, int lock_type); |
481
by Brian Aker
Remove all of uchar. |
272 |
int ha_write_row(unsigned char * buf); |
273 |
int ha_update_row(const unsigned char * old_data, unsigned char * new_data); |
|
274 |
int ha_delete_row(const unsigned char * buf); |
|
1
by brian
clean slate |
275 |
void ha_release_auto_increment(); |
276 |
||
277 |
/** to be actually called to get 'check()' functionality*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
278 |
int ha_check(Session *session, HA_CHECK_OPT *check_opt); |
1063.1.1
by Stewart Smith
remove REPAIR TABLE. Is very useful to have, but should be implemented in a much different way (or external to server). |
279 |
|
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
280 |
void ha_start_bulk_insert(ha_rows rows); |
281 |
int ha_end_bulk_insert(); |
|
481
by Brian Aker
Remove all of uchar. |
282 |
int ha_bulk_update_row(const unsigned char *old_data, unsigned char *new_data, |
482
by Brian Aker
Remove uint. |
283 |
uint32_t *dup_key_found); |
1
by brian
clean slate |
284 |
int ha_delete_all_rows(); |
285 |
int ha_reset_auto_increment(uint64_t value); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
286 |
int ha_analyze(Session* session, HA_CHECK_OPT* check_opt); |
1063.3.1
by Stewart Smith
remove ha_check_and_repair. Engines should take care of this themselves. |
287 |
|
482
by Brian Aker
Remove uint. |
288 |
int ha_disable_indexes(uint32_t mode); |
289 |
int ha_enable_indexes(uint32_t mode); |
|
200
by Brian Aker
my_bool from handler and set_var |
290 |
int ha_discard_or_import_tablespace(bool discard); |
1166.3.2
by Brian Aker
Remove ha_drop_table and modify it just to be a signal for the one case |
291 |
void closeMarkForDelete(const char *name); |
1
by brian
clean slate |
292 |
|
293 |
void adjust_next_insert_id_after_explicit_value(uint64_t nr); |
|
294 |
int update_auto_increment(); |
|
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
295 |
virtual void change_table_ptr(Table *table_arg, TableShare *share); |
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
296 |
|
1
by brian
clean slate |
297 |
/* Estimates calculation */
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
298 |
virtual double scan_time(void) |
151
by Brian Aker
Ulonglong to uint64_t |
299 |
{ return uint64_t2double(stats.data_file_length) / IO_SIZE + 2; } |
645
by Brian Aker
Cleanup unused attribute |
300 |
virtual double read_time(uint32_t, uint32_t ranges, ha_rows rows) |
1
by brian
clean slate |
301 |
{ return rows2double(ranges+rows); } |
302 |
||
482
by Brian Aker
Remove uint. |
303 |
virtual double index_only_read_time(uint32_t keynr, double records); |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
304 |
|
482
by Brian Aker
Remove uint. |
305 |
virtual ha_rows multi_range_read_info_const(uint32_t keyno, RANGE_SEQ_IF *seq, |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
306 |
void *seq_init_param, |
482
by Brian Aker
Remove uint. |
307 |
uint32_t n_ranges, uint32_t *bufsz, |
308 |
uint32_t *flags, COST_VECT *cost); |
|
309 |
virtual int multi_range_read_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys, |
|
310 |
uint32_t *bufsz, uint32_t *flags, COST_VECT *cost); |
|
1
by brian
clean slate |
311 |
virtual int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, |
482
by Brian Aker
Remove uint. |
312 |
uint32_t n_ranges, uint32_t mode, |
1
by brian
clean slate |
313 |
HANDLER_BUFFER *buf); |
314 |
virtual int multi_range_read_next(char **range_info); |
|
315 |
||
316 |
||
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
317 |
virtual const key_map *keys_to_use_for_scanning(); |
318 |
bool has_transactions(); |
|
1
by brian
clean slate |
319 |
|
320 |
/**
|
|
321 |
This method is used to analyse the error to see whether the error
|
|
322 |
is ignorable or not, certain handlers can have more error that are
|
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
323 |
ignorable than others. E.g. the partition Cursor can get inserts
|
1
by brian
clean slate |
324 |
into a range where there is no partition and this is an ignorable
|
325 |
error.
|
|
326 |
HA_ERR_FOUND_DUP_UNIQUE is a special case in MyISAM that means the
|
|
327 |
same thing as HA_ERR_FOUND_DUP_KEY but can in some cases lead to
|
|
328 |
a slightly different error message.
|
|
329 |
*/
|
|
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
330 |
virtual bool is_fatal_error(int error, uint32_t flags); |
1
by brian
clean slate |
331 |
|
332 |
/**
|
|
333 |
Number of rows in table. It will only be called if
|
|
334 |
(table_flags() & (HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT)) != 0
|
|
335 |
*/
|
|
575.1.5
by Monty Taylor
Moved stuff to handlerton.cc |
336 |
virtual ha_rows records(); |
1
by brian
clean slate |
337 |
/**
|
338 |
Return upper bound of current number of records in the table
|
|
339 |
(max. of how many records one will retrieve when doing a full table scan)
|
|
340 |
If upper bound is not known, HA_POS_ERROR should be returned as a max
|
|
341 |
possible upper bound.
|
|
342 |
*/
|
|
343 |
virtual ha_rows estimate_rows_upper_bound() |
|
344 |
{ return stats.records+EXTRA_RECORDS; } |
|
345 |
||
346 |
/**
|
|
347 |
Get the row type from the storage engine. If this method returns
|
|
348 |
ROW_TYPE_NOT_USED, the information in HA_CREATE_INFO should be used.
|
|
349 |
*/
|
|
350 |
virtual enum row_type get_row_type() const { return ROW_TYPE_NOT_USED; } |
|
351 |
||
645
by Brian Aker
Cleanup unused attribute |
352 |
virtual const char *index_type(uint32_t) |
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
353 |
{ assert(0); return "";} |
1
by brian
clean slate |
354 |
|
355 |
||
482
by Brian Aker
Remove uint. |
356 |
uint32_t get_index(void) const { return active_index; } |
1
by brian
clean slate |
357 |
virtual int close(void)=0; |
358 |
||
359 |
/**
|
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
360 |
@retval 0 Bulk update used by Cursor
|
1
by brian
clean slate |
361 |
@retval 1 Bulk update not used, normal operation used
|
362 |
*/
|
|
363 |
virtual bool start_bulk_update() { return 1; } |
|
364 |
/**
|
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
365 |
@retval 0 Bulk delete used by Cursor
|
1
by brian
clean slate |
366 |
@retval 1 Bulk delete not used, normal operation used
|
367 |
*/
|
|
368 |
virtual bool start_bulk_delete() { return 1; } |
|
369 |
/**
|
|
370 |
After this call all outstanding updates must be performed. The number
|
|
371 |
of duplicate key errors are reported in the duplicate key parameter.
|
|
372 |
It is allowed to continue to the batched update after this call, the
|
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
373 |
Cursor has to wait until end_bulk_update with changing state.
|
1
by brian
clean slate |
374 |
|
375 |
@param dup_key_found Number of duplicate keys found
|
|
376 |
||
377 |
@retval 0 Success
|
|
378 |
@retval >0 Error code
|
|
379 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
380 |
virtual int exec_bulk_update(uint32_t *) |
1
by brian
clean slate |
381 |
{
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
382 |
assert(false); |
1
by brian
clean slate |
383 |
return HA_ERR_WRONG_COMMAND; |
384 |
}
|
|
385 |
/**
|
|
386 |
Perform any needed clean-up, no outstanding updates are there at the
|
|
387 |
moment.
|
|
388 |
*/
|
|
389 |
virtual void end_bulk_update() { return; } |
|
390 |
/**
|
|
391 |
Execute all outstanding deletes and close down the bulk delete.
|
|
392 |
||
393 |
@retval 0 Success
|
|
394 |
@retval >0 Error code
|
|
395 |
*/
|
|
396 |
virtual int end_bulk_delete() |
|
397 |
{
|
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
398 |
assert(false); |
1
by brian
clean slate |
399 |
return HA_ERR_WRONG_COMMAND; |
400 |
}
|
|
401 |
/**
|
|
402 |
@brief
|
|
403 |
Positions an index cursor to the index specified in the handle. Fetches the
|
|
404 |
row if available. If the key value is null, begin at the first key of the
|
|
405 |
index.
|
|
406 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
407 |
virtual int index_read_map(unsigned char * buf, const unsigned char * key, |
1
by brian
clean slate |
408 |
key_part_map keypart_map, |
409 |
enum ha_rkey_function find_flag) |
|
410 |
{
|
|
482
by Brian Aker
Remove uint. |
411 |
uint32_t key_len= calculate_key_len(table, active_index, key, keypart_map); |
1
by brian
clean slate |
412 |
return index_read(buf, key, key_len, find_flag); |
413 |
}
|
|
414 |
/**
|
|
415 |
@brief
|
|
416 |
Positions an index cursor to the index specified in the handle. Fetches the
|
|
417 |
row if available. If the key value is null, begin at the first key of the
|
|
418 |
index.
|
|
419 |
*/
|
|
656.1.1
by Monty Taylor
OOOh doggie. Got rid of my_alloca. |
420 |
virtual int index_read_idx_map(unsigned char * buf, uint32_t index, |
421 |
const unsigned char * key, |
|
1
by brian
clean slate |
422 |
key_part_map keypart_map, |
423 |
enum ha_rkey_function find_flag); |
|
645
by Brian Aker
Cleanup unused attribute |
424 |
virtual int index_next(unsigned char *) |
425 |
{ return HA_ERR_WRONG_COMMAND; } |
|
426 |
virtual int index_prev(unsigned char *) |
|
427 |
{ return HA_ERR_WRONG_COMMAND; } |
|
428 |
virtual int index_first(unsigned char *) |
|
429 |
{ return HA_ERR_WRONG_COMMAND; } |
|
430 |
virtual int index_last(unsigned char *) |
|
431 |
{ return HA_ERR_WRONG_COMMAND; } |
|
432 |
virtual int index_next_same(unsigned char *, const unsigned char *, uint32_t); |
|
1
by brian
clean slate |
433 |
/**
|
434 |
@brief
|
|
435 |
The following functions works like index_read, but it find the last
|
|
436 |
row with the current key value or prefix.
|
|
437 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
438 |
virtual int index_read_last_map(unsigned char * buf, const unsigned char * key, |
1
by brian
clean slate |
439 |
key_part_map keypart_map) |
440 |
{
|
|
482
by Brian Aker
Remove uint. |
441 |
uint32_t key_len= calculate_key_len(table, active_index, key, keypart_map); |
1
by brian
clean slate |
442 |
return index_read_last(buf, key, key_len); |
443 |
}
|
|
444 |
virtual int read_range_first(const key_range *start_key, |
|
445 |
const key_range *end_key, |
|
446 |
bool eq_range, bool sorted); |
|
447 |
virtual int read_range_next(); |
|
448 |
int compare_key(key_range *range); |
|
449 |
int compare_key2(key_range *range); |
|
645
by Brian Aker
Cleanup unused attribute |
450 |
virtual int rnd_next(unsigned char *)=0; |
451 |
virtual int rnd_pos(unsigned char *, unsigned char *)=0; |
|
1
by brian
clean slate |
452 |
/**
|
453 |
One has to use this method when to find
|
|
454 |
random position by record as the plain
|
|
455 |
position() call doesn't work for some
|
|
456 |
handlers for random position.
|
|
457 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
458 |
virtual int rnd_pos_by_record(unsigned char *record); |
482
by Brian Aker
Remove uint. |
459 |
virtual int read_first_row(unsigned char *buf, uint32_t primary_key); |
1
by brian
clean slate |
460 |
/**
|
461 |
The following function is only needed for tables that may be temporary
|
|
462 |
tables during joins.
|
|
463 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
464 |
virtual int restart_rnd_next(unsigned char *, unsigned char *) |
465 |
{ return HA_ERR_WRONG_COMMAND; } |
|
466 |
virtual int rnd_same(unsigned char *, uint32_t) |
|
467 |
{ return HA_ERR_WRONG_COMMAND; } |
|
468 |
virtual ha_rows records_in_range(uint32_t, key_range *, key_range *) |
|
1
by brian
clean slate |
469 |
{ return (ha_rows) 10; } |
481
by Brian Aker
Remove all of uchar. |
470 |
virtual void position(const unsigned char *record)=0; |
895
by Brian Aker
Completion (?) of uint conversion. |
471 |
virtual int info(uint32_t)=0; // see my_base.h for full description |
645
by Brian Aker
Cleanup unused attribute |
472 |
virtual uint32_t calculate_key_hash_value(Field **) |
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
473 |
{ assert(0); return 0; } |
645
by Brian Aker
Cleanup unused attribute |
474 |
virtual int extra(enum ha_extra_function) |
1
by brian
clean slate |
475 |
{ return 0; } |
645
by Brian Aker
Cleanup unused attribute |
476 |
virtual int extra_opt(enum ha_extra_function operation, uint32_t) |
1
by brian
clean slate |
477 |
{ return extra(operation); } |
478 |
||
479 |
/**
|
|
480 |
In an UPDATE or DELETE, if the row under the cursor was locked by another
|
|
481 |
transaction, and the engine used an optimistic read of the last
|
|
482 |
committed row value under the cursor, then the engine returns 1 from this
|
|
483 |
function. MySQL must NOT try to update this optimistic value. If the
|
|
484 |
optimistic value does not match the WHERE condition, MySQL can decide to
|
|
485 |
skip over this row. Currently only works for InnoDB. This can be used to
|
|
486 |
avoid unnecessary lock waits.
|
|
487 |
||
488 |
If this method returns nonzero, it will also signal the storage
|
|
489 |
engine that the next read will be a locking re-read of the row.
|
|
490 |
*/
|
|
491 |
virtual bool was_semi_consistent_read() { return 0; } |
|
492 |
/**
|
|
493 |
Tell the engine whether it should avoid unnecessary lock waits.
|
|
494 |
If yes, in an UPDATE or DELETE, if the row under the cursor was locked
|
|
495 |
by another transaction, the engine may try an optimistic read of
|
|
496 |
the last committed row value under the cursor.
|
|
497 |
*/
|
|
498 |
virtual void try_semi_consistent_read(bool) {} |
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
499 |
virtual void unlock_row(void) {} |
645
by Brian Aker
Cleanup unused attribute |
500 |
virtual int start_stmt(Session *, thr_lock_type) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
501 |
{return 0;} |
1
by brian
clean slate |
502 |
virtual void get_auto_increment(uint64_t offset, uint64_t increment, |
503 |
uint64_t nb_desired_values, |
|
504 |
uint64_t *first_value, |
|
505 |
uint64_t *nb_reserved_values); |
|
506 |
void set_next_insert_id(uint64_t id) |
|
507 |
{
|
|
508 |
next_insert_id= id; |
|
509 |
}
|
|
510 |
void restore_auto_increment(uint64_t prev_insert_id) |
|
511 |
{
|
|
512 |
/*
|
|
513 |
Insertion of a row failed, re-use the lastly generated auto_increment
|
|
514 |
id, for the next row. This is achieved by resetting next_insert_id to
|
|
515 |
what it was before the failed insertion (that old value is provided by
|
|
516 |
the caller). If that value was 0, it was the first row of the INSERT;
|
|
517 |
then if insert_id_for_cur_row contains 0 it means no id was generated
|
|
518 |
for this first row, so no id was generated since the INSERT started, so
|
|
519 |
we should set next_insert_id to 0; if insert_id_for_cur_row is not 0, it
|
|
520 |
is the generated id of the first and failed row, so we use it.
|
|
521 |
*/
|
|
522 |
next_insert_id= (prev_insert_id > 0) ? prev_insert_id : |
|
523 |
insert_id_for_cur_row; |
|
524 |
}
|
|
525 |
||
645
by Brian Aker
Cleanup unused attribute |
526 |
virtual void update_create_info(HA_CREATE_INFO *) {} |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
527 |
int check_old_types(void); |
1
by brian
clean slate |
528 |
/* end of the list of admin commands */
|
529 |
||
530 |
virtual int indexes_are_disabled(void) {return 0;} |
|
645
by Brian Aker
Cleanup unused attribute |
531 |
virtual void append_create_info(String *) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
532 |
{}
|
1
by brian
clean slate |
533 |
/**
|
534 |
If index == MAX_KEY then a check for table is made and if index <
|
|
535 |
MAX_KEY then a check is made if the table has foreign keys and if
|
|
536 |
a foreign key uses this index (and thus the index cannot be dropped).
|
|
537 |
||
538 |
@param index Index to check if foreign key uses it
|
|
539 |
||
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
540 |
@retval true Foreign key defined on table or index
|
541 |
@retval false No foreign key defined
|
|
1
by brian
clean slate |
542 |
*/
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
543 |
virtual char* get_foreign_key_create_info(void) |
1019.1.6
by Brian Aker
A number of random cleanups. |
544 |
{ return NULL;} /* gets foreign key create string from InnoDB */ |
1008.3.25
by Stewart Smith
slight semantic improvement in handler::can_switch_engines |
545 |
/** used in ALTER Table; if changing storage engine is allowed.
|
546 |
e.g. not be allowed if table has foreign key constraints in engine.
|
|
547 |
*/
|
|
548 |
virtual bool can_switch_engines(void) { return true; } |
|
1
by brian
clean slate |
549 |
/** used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */
|
645
by Brian Aker
Cleanup unused attribute |
550 |
virtual int get_foreign_key_list(Session *, List<FOREIGN_KEY_INFO> *) |
1
by brian
clean slate |
551 |
{ return 0; } |
482
by Brian Aker
Remove uint. |
552 |
virtual uint32_t referenced_by_foreign_key() { return 0;} |
645
by Brian Aker
Cleanup unused attribute |
553 |
virtual void free_foreign_key_create_info(char *) {} |
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
554 |
/** The following can be called without an open Cursor */
|
1008.3.26
by Stewart Smith
remove handler::table_type() as same information can be retrieved from handler::engine->getName() |
555 |
|
482
by Brian Aker
Remove uint. |
556 |
virtual uint32_t index_flags(uint32_t idx, uint32_t part, bool all_parts) const =0; |
1
by brian
clean slate |
557 |
|
645
by Brian Aker
Cleanup unused attribute |
558 |
virtual int add_index(Table *, KEY *, uint32_t) |
559 |
{ return (HA_ERR_WRONG_COMMAND); } |
|
560 |
virtual int prepare_drop_index(Table *, uint32_t *, uint32_t) |
|
561 |
{ return (HA_ERR_WRONG_COMMAND); } |
|
562 |
virtual int final_drop_index(Table *) |
|
1
by brian
clean slate |
563 |
{ return (HA_ERR_WRONG_COMMAND); } |
564 |
||
1222.1.11
by Brian Aker
Remove dead store_lock() path. |
565 |
virtual bool low_byte_first(void) const { return true; } |
482
by Brian Aker
Remove uint. |
566 |
virtual uint32_t checksum(void) const { return 0; } |
1
by brian
clean slate |
567 |
|
568 |
/**
|
|
569 |
Is not invoked for non-transactional temporary tables.
|
|
570 |
||
571 |
@note store_lock() can return more than one lock if the table is MERGE
|
|
572 |
or partitioned.
|
|
573 |
||
574 |
@note that one can NOT rely on table->in_use in store_lock(). It may
|
|
575 |
refer to a different thread if called from mysql_lock_abort_for_thread().
|
|
576 |
||
577 |
@note If the table is MERGE, store_lock() can return less locks
|
|
578 |
than lock_count() claimed. This can happen when the MERGE children
|
|
579 |
are not attached when this is called from another thread.
|
|
580 |
*/
|
|
1222.1.11
by Brian Aker
Remove dead store_lock() path. |
581 |
virtual THR_LOCK_DATA **store_lock(Session *, |
1
by brian
clean slate |
582 |
THR_LOCK_DATA **to, |
1222.1.11
by Brian Aker
Remove dead store_lock() path. |
583 |
enum thr_lock_type) |
584 |
{
|
|
1222.1.12
by Brian Aker
Fix for Solaris build. |
585 |
assert(0); // Impossible programming situation |
1222.1.11
by Brian Aker
Remove dead store_lock() path. |
586 |
|
587 |
return(to); |
|
588 |
}
|
|
1
by brian
clean slate |
589 |
|
590 |
/*
|
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
591 |
@retval true Primary key (if there is one) is clustered
|
1
by brian
clean slate |
592 |
key covering all fields
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
593 |
@retval false otherwise
|
1
by brian
clean slate |
594 |
*/
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
595 |
virtual bool primary_key_is_clustered() { return false; } |
481
by Brian Aker
Remove all of uchar. |
596 |
virtual int cmp_ref(const unsigned char *ref1, const unsigned char *ref2) |
1
by brian
clean slate |
597 |
{
|
598 |
return memcmp(ref1, ref2, ref_length); |
|
599 |
}
|
|
600 |
||
1220.1.12
by Brian Aker
Small cleanup from something Jay noticed. |
601 |
virtual bool isOrdered(void) |
1
by brian
clean slate |
602 |
{
|
1220.1.12
by Brian Aker
Small cleanup from something Jay noticed. |
603 |
return false; |
1
by brian
clean slate |
604 |
}
|
605 |
||
1220.1.12
by Brian Aker
Small cleanup from something Jay noticed. |
606 |
|
1
by brian
clean slate |
607 |
protected: |
608 |
/* Service methods for use by storage engines. */
|
|
609 |
void ha_statistic_increment(ulong SSV::*offset) const; |
|
520.1.21
by Brian Aker
THD -> Session rename |
610 |
void **ha_data(Session *) const; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
611 |
Session *ha_session(void) const; |
1
by brian
clean slate |
612 |
|
613 |
private: |
|
614 |
/* Private helpers */
|
|
615 |
inline void mark_trx_read_write(); |
|
616 |
private: |
|
617 |
/*
|
|
618 |
Low-level primitives for storage engines. These should be
|
|
619 |
overridden by the storage engine class. To call these methods, use
|
|
620 |
the corresponding 'ha_*' method above.
|
|
621 |
*/
|
|
622 |
||
482
by Brian Aker
Remove uint. |
623 |
virtual int open(const char *name, int mode, uint32_t test_if_locked)=0; |
645
by Brian Aker
Cleanup unused attribute |
624 |
virtual int index_init(uint32_t idx, bool) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
625 |
{ active_index= idx; return 0; } |
1
by brian
clean slate |
626 |
virtual int index_end() { active_index= MAX_KEY; return 0; } |
627 |
/**
|
|
628 |
rnd_init() can be called two times without rnd_end() in between
|
|
629 |
(it only makes sense if scan=1).
|
|
630 |
then the second call should prepare for the new table scan (e.g
|
|
631 |
if rnd_init allocates the cursor, second call should position it
|
|
632 |
to the start of the table, no need to deallocate and allocate it again
|
|
633 |
*/
|
|
634 |
virtual int rnd_init(bool scan)= 0; |
|
635 |
virtual int rnd_end() { return 0; } |
|
645
by Brian Aker
Cleanup unused attribute |
636 |
virtual int write_row(unsigned char *) |
637 |
{
|
|
638 |
return HA_ERR_WRONG_COMMAND; |
|
639 |
}
|
|
640 |
||
641 |
virtual int update_row(const unsigned char *, unsigned char *) |
|
642 |
{
|
|
643 |
return HA_ERR_WRONG_COMMAND; |
|
644 |
}
|
|
645 |
||
646 |
virtual int delete_row(const unsigned char *) |
|
1
by brian
clean slate |
647 |
{
|
648 |
return HA_ERR_WRONG_COMMAND; |
|
649 |
}
|
|
650 |
/**
|
|
651 |
Reset state of file to after 'open'.
|
|
652 |
This function is called after every statement for all tables used
|
|
653 |
by that statement.
|
|
654 |
*/
|
|
655 |
virtual int reset() { return 0; } |
|
656 |
||
657 |
/**
|
|
658 |
Is not invoked for non-transactional temporary tables.
|
|
659 |
||
660 |
Tells the storage engine that we intend to read or write data
|
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
661 |
from the table. This call is prefixed with a call to Cursor::store_lock()
|
662 |
and is invoked only for those Cursor instances that stored the lock.
|
|
1
by brian
clean slate |
663 |
|
664 |
Calls to rnd_init/index_init are prefixed with this call. When table
|
|
665 |
IO is complete, we call external_lock(F_UNLCK).
|
|
666 |
A storage engine writer should expect that each call to
|
|
667 |
::external_lock(F_[RD|WR]LOCK is followed by a call to
|
|
668 |
::external_lock(F_UNLCK). If it is not, it is a bug in MySQL.
|
|
669 |
||
670 |
The name and signature originate from the first implementation
|
|
671 |
in MyISAM, which would call fcntl to set/clear an advisory
|
|
672 |
lock on the data file in this method.
|
|
673 |
||
674 |
@param lock_type F_RDLCK, F_WRLCK, F_UNLCK
|
|
675 |
||
676 |
@return non-0 in case of failure, 0 in case of success.
|
|
677 |
When lock_type is F_UNLCK, the return value is ignored.
|
|
678 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
679 |
virtual int external_lock(Session *, int) |
1
by brian
clean slate |
680 |
{
|
681 |
return 0; |
|
682 |
}
|
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
683 |
virtual void release_auto_increment(void) { return; }; |
1
by brian
clean slate |
684 |
/** admin commands - called from mysql_admin_table */
|
1222.1.10
by Brian Aker
Removes options from DDL left in Cursor for admin operations (they were |
685 |
virtual int check(Session *) |
1
by brian
clean slate |
686 |
{ return HA_ADMIN_NOT_IMPLEMENTED; } |
687 |
||
645
by Brian Aker
Cleanup unused attribute |
688 |
virtual void start_bulk_insert(ha_rows) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
689 |
{}
|
690 |
virtual int end_bulk_insert(void) { return 0; } |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
691 |
virtual int index_read(unsigned char *, const unsigned char *, |
645
by Brian Aker
Cleanup unused attribute |
692 |
uint32_t, enum ha_rkey_function) |
1
by brian
clean slate |
693 |
{ return HA_ERR_WRONG_COMMAND; } |
645
by Brian Aker
Cleanup unused attribute |
694 |
virtual int index_read_last(unsigned char *, const unsigned char *, uint32_t) |
1
by brian
clean slate |
695 |
{ return (my_errno= HA_ERR_WRONG_COMMAND); } |
696 |
/**
|
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
697 |
This method is similar to update_row, however the Cursor doesn't need
|
698 |
to execute the updates at this point in time. The Cursor can be certain
|
|
1
by brian
clean slate |
699 |
that another call to bulk_update_row will occur OR a call to
|
700 |
exec_bulk_update before the set of updates in this query is concluded.
|
|
701 |
||
702 |
@param old_data Old record
|
|
703 |
@param new_data New record
|
|
704 |
@param dup_key_found Number of duplicate keys found
|
|
705 |
||
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
706 |
@retval 0 Bulk delete used by Cursor
|
1
by brian
clean slate |
707 |
@retval 1 Bulk delete not used, normal operation used
|
708 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
709 |
virtual int bulk_update_row(const unsigned char *, unsigned char *, uint32_t *) |
1
by brian
clean slate |
710 |
{
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
711 |
assert(false); |
1
by brian
clean slate |
712 |
return HA_ERR_WRONG_COMMAND; |
713 |
}
|
|
714 |
/**
|
|
715 |
This is called to delete all rows in a table
|
|
1183.1.2
by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted |
716 |
If the Cursor don't support this, then this function will
|
1
by brian
clean slate |
717 |
return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one
|
718 |
by one.
|
|
719 |
*/
|
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
720 |
virtual int delete_all_rows(void) |
1
by brian
clean slate |
721 |
{ return (my_errno=HA_ERR_WRONG_COMMAND); } |
722 |
/**
|
|
723 |
Reset the auto-increment counter to the given value, i.e. the next row
|
|
724 |
inserted will get the given value. This is called e.g. after TRUNCATE
|
|
725 |
is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is
|
|
726 |
returned by storage engines that don't support this operation.
|
|
727 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
728 |
virtual int reset_auto_increment(uint64_t) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
729 |
{ return HA_ERR_WRONG_COMMAND; } |
1220.1.12
by Brian Aker
Small cleanup from something Jay noticed. |
730 |
|
1222.1.10
by Brian Aker
Removes options from DDL left in Cursor for admin operations (they were |
731 |
virtual int analyze(Session *) |
645
by Brian Aker
Cleanup unused attribute |
732 |
{ return HA_ADMIN_NOT_IMPLEMENTED; } |
1063.3.1
by Stewart Smith
remove ha_check_and_repair. Engines should take care of this themselves. |
733 |
|
645
by Brian Aker
Cleanup unused attribute |
734 |
virtual int disable_indexes(uint32_t) |
735 |
{ return HA_ERR_WRONG_COMMAND; } |
|
1220.1.12
by Brian Aker
Small cleanup from something Jay noticed. |
736 |
|
645
by Brian Aker
Cleanup unused attribute |
737 |
virtual int enable_indexes(uint32_t) |
738 |
{ return HA_ERR_WRONG_COMMAND; } |
|
1220.1.12
by Brian Aker
Small cleanup from something Jay noticed. |
739 |
|
645
by Brian Aker
Cleanup unused attribute |
740 |
virtual int discard_or_import_tablespace(bool) |
1
by brian
clean slate |
741 |
{ return (my_errno=HA_ERR_WRONG_COMMAND); } |
1220.1.12
by Brian Aker
Small cleanup from something Jay noticed. |
742 |
|
743 |
/*
|
|
744 |
@todo this is just for the HEAP engine, it should
|
|
745 |
be removed at some point in the future (and
|
|
746 |
no new engine should ever use it). Right
|
|
747 |
now HEAP does rely on it, so we cannot remove it.
|
|
748 |
*/
|
|
1
by brian
clean slate |
749 |
virtual void drop_table(const char *name); |
750 |
};
|
|
751 |
||
752 |
extern const char *ha_row_type[]; |
|
753 |
extern const char *tx_isolation_names[]; |
|
754 |
extern const char *binlog_format_names[]; |
|
755 |
extern TYPELIB tx_isolation_typelib; |
|
61
by Brian Aker
Conversion of handler type. |
756 |
extern uint32_t total_ha, total_ha_2pc; |
1
by brian
clean slate |
757 |
|
758 |
/* Wrapper functions */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
759 |
#define ha_commit(session) (ha_commit_trans((session), true))
|
760 |
#define ha_rollback(session) (ha_rollback_trans((session), true))
|
|
1
by brian
clean slate |
761 |
|
762 |
/* basic stuff */
|
|
763 |
int ha_init_errors(void); |
|
764 |
int ha_init(void); |
|
765 |
int ha_end(void); |
|
971.1.52
by Monty Taylor
Did the finalizers. Renamed plugin_registry. |
766 |
|
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
767 |
/* transactions: interface to plugin::StorageEngine functions */
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
768 |
int ha_commit_one_phase(Session *session, bool all); |
769 |
int ha_rollback_trans(Session *session, bool all); |
|
1
by brian
clean slate |
770 |
|
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
771 |
/* transactions: these functions never call plugin::StorageEngine functions directly */
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
772 |
int ha_commit_trans(Session *session, bool all); |
773 |
int ha_autocommit_or_rollback(Session *session, int error); |
|
774 |
int ha_enable_transaction(Session *session, bool on); |
|
1
by brian
clean slate |
775 |
|
776 |
/* savepoints */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
777 |
int ha_rollback_to_savepoint(Session *session, SAVEPOINT *sv); |
778 |
int ha_savepoint(Session *session, SAVEPOINT *sv); |
|
779 |
int ha_release_savepoint(Session *session, SAVEPOINT *sv); |
|
1
by brian
clean slate |
780 |
|
781 |
/* these are called by storage engines */
|
|
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
782 |
void trans_register_ha(Session *session, bool all, drizzled::plugin::StorageEngine *engine); |
1
by brian
clean slate |
783 |
|
520.6.7
by Monty Taylor
Moved a bunch of crap out of common_includes. |
784 |
uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length); |
1054.2.20
by Monty Taylor
Made tablename_to_filename available across the server now. |
785 |
bool tablename_to_filename(const char *from, char *to, size_t to_length); |
520.6.7
by Monty Taylor
Moved a bunch of crap out of common_includes. |
786 |
|
787 |
||
1
by brian
clean slate |
788 |
/*
|
789 |
Storage engine has to assume the transaction will end up with 2pc if
|
|
790 |
- there is more than one 2pc-capable storage engine available
|
|
791 |
- in the current transaction 2pc was not disabled yet
|
|
792 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
793 |
#define trans_need_2pc(session, all) ((total_ha_2pc > 1) && \
|
794 |
!((all ? &session->transaction.all : &session->transaction.stmt)->no_2pc))
|
|
520.6.4
by Monty Taylor
Moved thr_lock.h out of common_includes. |
795 |
|
575.4.7
by Monty Taylor
More header cleanup. |
796 |
|
797 |
bool mysql_xa_recover(Session *session); |
|
798 |
||
799 |
SORT_FIELD * make_unireg_sortorder(order_st *order, uint32_t *length, |
|
800 |
SORT_FIELD *sortorder); |
|
801 |
int setup_order(Session *session, Item **ref_pointer_array, TableList *tables, |
|
802 |
List<Item> &fields, List <Item> &all_fields, order_st *order); |
|
803 |
int setup_group(Session *session, Item **ref_pointer_array, TableList *tables, |
|
804 |
List<Item> &fields, List<Item> &all_fields, order_st *order, |
|
805 |
bool *hidden_group_fields); |
|
846
by Brian Aker
Removing on typedeffed class. |
806 |
bool fix_inner_refs(Session *session, List<Item> &all_fields, Select_Lex *select, |
575.4.7
by Monty Taylor
More header cleanup. |
807 |
Item **ref_pointer_array); |
808 |
||
809 |
bool handle_select(Session *session, LEX *lex, select_result *result, |
|
892.2.2
by Monty Taylor
More solaris warnings. |
810 |
uint64_t setup_tables_done_option); |
575.4.7
by Monty Taylor
More header cleanup. |
811 |
bool mysql_select(Session *session, Item ***rref_pointer_array, |
812 |
TableList *tables, uint32_t wild_num, List<Item> &list, |
|
813 |
COND *conds, uint32_t og_num, order_st *order, order_st *group, |
|
923.1.10
by Brian Aker
Remove dead code around old procedures. |
814 |
Item *having, uint64_t select_type, |
848
by Brian Aker
typdef class removal (just... use the name of the class). |
815 |
select_result *result, Select_Lex_Unit *unit, |
846
by Brian Aker
Removing on typedeffed class. |
816 |
Select_Lex *select_lex); |
817 |
void free_underlaid_joins(Session *session, Select_Lex *select); |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
818 |
bool mysql_explain_union(Session *session, Select_Lex_Unit *unit, |
575.4.7
by Monty Taylor
More header cleanup. |
819 |
select_result *result); |
846
by Brian Aker
Removing on typedeffed class. |
820 |
int mysql_explain_select(Session *session, Select_Lex *sl, char const *type, |
575.4.7
by Monty Taylor
More header cleanup. |
821 |
select_result *result); |
1008.3.22
by Stewart Smith
s/mysql_union/drizzle_union/ |
822 |
|
575.4.7
by Monty Taylor
More header cleanup. |
823 |
bool mysql_handle_derived(LEX *lex, bool (*processor)(Session *session, |
824 |
LEX *lex, |
|
825 |
TableList *table)); |
|
826 |
bool mysql_derived_prepare(Session *session, LEX *lex, TableList *t); |
|
827 |
bool mysql_derived_filling(Session *session, LEX *lex, TableList *t); |
|
1052.2.3
by Nathan Williams
No actual code changes. Changed Create_field to CreateField to be consistent with coding standards. |
828 |
int prepare_create_field(CreateField *sql_field, |
575.4.7
by Monty Taylor
More header cleanup. |
829 |
uint32_t *blob_columns, |
1233.1.8
by Brian Aker
Final removal table_flag(). |
830 |
int *timestamps, int *timestamps_with_niladic); |
1222.2.3
by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO. |
831 |
|
1223.4.1
by Brian Aker
Table Identifier patch. |
832 |
bool mysql_create_table(Session *session, |
833 |
drizzled::TableIdentifier &identifier, |
|
575.4.7
by Monty Taylor
More header cleanup. |
834 |
HA_CREATE_INFO *create_info, |
1008.3.20
by Stewart Smith
Put table_name into table proto in parser, and use that when creating table proto file. |
835 |
drizzled::message::Table *table_proto, |
1126.3.3
by Jay Pipes
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo. |
836 |
AlterInfo *alter_info, |
1222.2.3
by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO. |
837 |
bool tmp_table, uint32_t select_field_count, |
838 |
bool is_if_not_exists); |
|
839 |
||
1223.4.2
by Brian Aker
Extended mysql_create_table_no_lock to use TableIdentifier |
840 |
bool mysql_create_table_no_lock(Session *session, |
1223.4.3
by Brian Aker
More identifier work. |
841 |
drizzled::TableIdentifier &identifier, |
575.4.7
by Monty Taylor
More header cleanup. |
842 |
HA_CREATE_INFO *create_info, |
1008.3.20
by Stewart Smith
Put table_name into table proto in parser, and use that when creating table proto file. |
843 |
drizzled::message::Table *table_proto, |
1126.3.3
by Jay Pipes
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo. |
844 |
AlterInfo *alter_info, |
1223.4.2
by Brian Aker
Extended mysql_create_table_no_lock to use TableIdentifier |
845 |
bool tmp_table, |
846 |
uint32_t select_field_count, |
|
1222.2.3
by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO. |
847 |
bool is_if_not_exists); |
575.4.7
by Monty Taylor
More header cleanup. |
848 |
|
1172.1.1
by Brian Aker
Add in support for ENGINE= in create table like. |
849 |
bool mysql_create_like_table(Session* session, TableList* table, TableList* src_table, |
850 |
drizzled::message::Table& create_table_proto, |
|
1222.1.9
by Brian Aker
One more bit of HA_CREATE_INFO gone. |
851 |
drizzled::plugin::StorageEngine*, |
1222.1.3
by Brian Aker
Remove used flag for engine. |
852 |
bool is_if_not_exists, |
853 |
bool is_engine_set); |
|
1222.2.3
by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO. |
854 |
|
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
855 |
bool mysql_rename_table(drizzled::plugin::StorageEngine *base, const char *old_db, |
575.4.7
by Monty Taylor
More header cleanup. |
856 |
const char * old_name, const char *new_db, |
857 |
const char * new_name, uint32_t flags); |
|
1222.2.3
by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO. |
858 |
|
575.4.7
by Monty Taylor
More header cleanup. |
859 |
bool mysql_prepare_update(Session *session, TableList *table_list, |
860 |
Item **conds, uint32_t order_num, order_st *order); |
|
861 |
int mysql_update(Session *session,TableList *tables,List<Item> &fields, |
|
862 |
List<Item> &values,COND *conds, |
|
863 |
uint32_t order_num, order_st *order, ha_rows limit, |
|
864 |
enum enum_duplicates handle_duplicates, bool ignore); |
|
865 |
bool mysql_prepare_insert(Session *session, TableList *table_list, Table *table, |
|
866 |
List<Item> &fields, List_item *values, |
|
867 |
List<Item> &update_fields, |
|
868 |
List<Item> &update_values, enum_duplicates duplic, |
|
869 |
COND **where, bool select_insert, |
|
870 |
bool check_fields, bool abort_on_warning); |
|
871 |
bool mysql_insert(Session *session,TableList *table,List<Item> &fields, |
|
872 |
List<List_item> &values, List<Item> &update_fields, |
|
873 |
List<Item> &update_values, enum_duplicates flag, |
|
874 |
bool ignore); |
|
875 |
int check_that_all_fields_are_given_values(Session *session, Table *entry, |
|
876 |
TableList *table_list); |
|
877 |
int mysql_prepare_delete(Session *session, TableList *table_list, Item **conds); |
|
878 |
bool mysql_delete(Session *session, TableList *table_list, COND *conds, |
|
879 |
SQL_LIST *order, ha_rows rows, uint64_t options, |
|
880 |
bool reset_auto_increment); |
|
1208.2.2
by Brian Aker
Merge Truncate patch. This fixes all of the "half setup" of Truncate. Still |
881 |
bool mysql_truncate(Session& session, TableList *table_list); |
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
882 |
TableShare *get_table_share(Session *session, TableList *table_list, char *key, |
575.4.7
by Monty Taylor
More header cleanup. |
883 |
uint32_t key_length, uint32_t db_flags, int *error); |
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
884 |
TableShare *get_cached_table_share(const char *db, const char *table_name); |
575.4.7
by Monty Taylor
More header cleanup. |
885 |
bool reopen_name_locked_table(Session* session, TableList* table_list, bool link_in); |
886 |
Table *table_cache_insert_placeholder(Session *session, const char *key, |
|
887 |
uint32_t key_length); |
|
888 |
bool lock_table_name_if_not_cached(Session *session, const char *db, |
|
889 |
const char *table_name, Table **table); |
|
890 |
bool reopen_table(Table *table); |
|
891 |
bool reopen_tables(Session *session,bool get_locks,bool in_refresh); |
|
892 |
void close_data_files_and_morph_locks(Session *session, const char *db, |
|
893 |
const char *table_name); |
|
894 |
void close_handle_and_leave_table_as_lock(Table *table); |
|
895 |
bool wait_for_tables(Session *session); |
|
896 |
bool table_is_used(Table *table, bool wait_for_name_lock); |
|
897 |
Table *drop_locked_tables(Session *session,const char *db, const char *table_name); |
|
898 |
void abort_locked_tables(Session *session,const char *db, const char *table_name); |
|
899 |
extern Field *not_found_field; |
|
900 |
extern Field *view_ref_found; |
|
901 |
||
902 |
Field * |
|
903 |
find_field_in_tables(Session *session, Item_ident *item, |
|
904 |
TableList *first_table, TableList *last_table, |
|
905 |
Item **ref, find_item_error_report_type report_error, |
|
1113.1.1
by Brian Aker
Dead code removal around LCOV finds. |
906 |
bool register_tree_change); |
575.4.7
by Monty Taylor
More header cleanup. |
907 |
Field * |
908 |
find_field_in_table_ref(Session *session, TableList *table_list, |
|
909 |
const char *name, uint32_t length, |
|
910 |
const char *item_name, const char *db_name, |
|
911 |
const char *table_name, Item **ref, |
|
1113.1.1
by Brian Aker
Dead code removal around LCOV finds. |
912 |
bool allow_rowid, |
575.4.7
by Monty Taylor
More header cleanup. |
913 |
uint32_t *cached_field_index_ptr, |
914 |
bool register_tree_change, TableList **actual_table); |
|
915 |
Field * |
|
916 |
find_field_in_table(Session *session, Table *table, const char *name, uint32_t length, |
|
917 |
bool allow_rowid, uint32_t *cached_field_index_ptr); |
|
918 |
Field * |
|
919 |
find_field_in_table_sef(Table *table, const char *name); |
|
920 |
||
921 |
||
1185
by Brian Aker
Merge Engine changes. |
922 |
#endif /* DRIZZLED_CURSOR_H */ |