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 |
|
520.6.4
by Monty Taylor
Moved thr_lock.h out of common_includes. |
20 |
#ifndef DRIZZLED_HANDLER_H
|
21 |
#define DRIZZLED_HANDLER_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> |
520.4.31
by Monty Taylor
Removed server_id from common_includes. |
25 |
|
1
by brian
clean slate |
26 |
/* Definitions for parameters to do with handler-routines */
|
27 |
||
992.1.25
by Monty Taylor
Moved myisam to new plugin system. |
28 |
#include <plugin/myisam/keycache.h> |
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> |
|
520.6.4
by Monty Taylor
Moved thr_lock.h out of common_includes. |
36 |
|
37 |
/* Bits to show what an alter table will do */
|
|
38 |
#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 |
39 |
|
1005.2.6
by Monty Taylor
Re-added bitset<> as a replacement for Bitmap<> |
40 |
#include<bitset> |
41 |
||
520.6.4
by Monty Taylor
Moved thr_lock.h out of common_includes. |
42 |
#define HA_MAX_ALTER_FLAGS 40
|
1005.2.6
by Monty Taylor
Re-added bitset<> as a replacement for Bitmap<> |
43 |
typedef std::bitset<HA_MAX_ALTER_FLAGS> HA_ALTER_FLAGS; |
1
by brian
clean slate |
44 |
|
45 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
46 |
typedef bool (*qc_engine_callback)(Session *session, char *table_key, |
482
by Brian Aker
Remove uint. |
47 |
uint32_t key_length, |
243.1.1
by Jay Pipes
* Pulled Object_creation_ctx and Default_creation_ctx out of mysql_priv.h |
48 |
uint64_t *engine_data); |
49 |
||
1
by brian
clean slate |
50 |
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
51 |
/* The handler for a table type. Will be included in the Table structure */
|
1
by brian
clean slate |
52 |
|
327.1.1
by Brian Aker
First pass in encapsulating table (it is now an object, no longer a structure). |
53 |
class Table; |
561.1.3
by Monty Taylor
Split some more things out of common_includes.h. |
54 |
class TableList; |
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
55 |
class TableShare; |
848
by Brian Aker
typdef class removal (just... use the name of the class). |
56 |
class Select_Lex_Unit; |
1
by brian
clean slate |
57 |
struct st_foreign_key_info; |
58 |
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. |
59 |
struct order_st; |
1
by brian
clean slate |
60 |
|
61 |
class Item; |
|
62 |
struct st_table_log_memory_entry; |
|
63 |
||
575.4.7
by Monty Taylor
More header cleanup. |
64 |
class LEX; |
846
by Brian Aker
Removing on typedeffed class. |
65 |
class Select_Lex; |
575.4.7
by Monty Taylor
More header cleanup. |
66 |
class Alter_info; |
67 |
class select_result; |
|
68 |
class Create_field; |
|
69 |
class sys_var_str; |
|
70 |
class Item_ident; |
|
71 |
typedef struct st_sort_field SORT_FIELD; |
|
72 |
||
73 |
typedef List<Item> List_item; |
|
74 |
||
1
by brian
clean slate |
75 |
typedef struct st_savepoint SAVEPOINT; |
61
by Brian Aker
Conversion of handler type. |
76 |
extern uint32_t savepoint_alloc_size; |
1
by brian
clean slate |
77 |
extern KEY_CREATE_INFO default_key_create_info; |
78 |
||
79 |
/* Forward declaration for condition pushdown to storage engine */
|
|
80 |
typedef class Item COND; |
|
81 |
||
82 |
typedef struct system_status_var SSV; |
|
83 |
||
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
84 |
class COST_VECT; |
85 |
||
482
by Brian Aker
Remove uint. |
86 |
uint16_t &mrr_persistent_flag_storage(range_seq_t seq, uint32_t idx); |
87 |
char* &mrr_get_ptr_by_idx(range_seq_t seq, uint32_t idx); |
|
1
by brian
clean slate |
88 |
|
482
by Brian Aker
Remove uint. |
89 |
uint32_t calculate_key_len(Table *, uint, const unsigned char *, key_part_map); |
1
by brian
clean slate |
90 |
/*
|
91 |
bitmap with first N+1 bits set
|
|
92 |
(keypart_map for a key prefix of [0..N] keyparts)
|
|
93 |
*/
|
|
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
94 |
template<class T> |
95 |
inline key_part_map make_keypart_map(T a) |
|
96 |
{
|
|
97 |
return (((key_part_map)2 << a) - 1); |
|
98 |
}
|
|
99 |
||
1
by brian
clean slate |
100 |
/*
|
101 |
bitmap with first N bits set
|
|
102 |
(keypart_map for a key prefix of [0..N-1] keyparts)
|
|
103 |
*/
|
|
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
104 |
template<class T> |
105 |
inline key_part_map make_prev_keypart_map(T a) |
|
106 |
{
|
|
107 |
return (((key_part_map)1 << a) - 1); |
|
108 |
}
|
|
1
by brian
clean slate |
109 |
|
110 |
/**
|
|
111 |
The handler class is the interface for dynamically loadable
|
|
112 |
storage engines. Do not add ifdefs and take care when adding or
|
|
113 |
changing virtual functions to avoid vtable confusion
|
|
114 |
||
115 |
Functions in this class accept and return table columns data. Two data
|
|
116 |
representation formats are used:
|
|
117 |
1. TableRecordFormat - Used to pass [partial] table records to/from
|
|
118 |
storage engine
|
|
119 |
||
120 |
2. KeyTupleFormat - used to pass index search tuples (aka "keys") to
|
|
121 |
storage engine. See opt_range.cc for description of this format.
|
|
122 |
||
123 |
TableRecordFormat
|
|
124 |
=================
|
|
125 |
[Warning: this description is work in progress and may be incomplete]
|
|
126 |
The table record is stored in a fixed-size buffer:
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
127 |
|
1
by brian
clean slate |
128 |
record: null_bytes, column1_data, column2_data, ...
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
129 |
|
130 |
The offsets of the parts of the buffer are also fixed: every column has
|
|
1
by brian
clean slate |
131 |
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: |
132 |
bit in null_bytes.
|
1
by brian
clean slate |
133 |
|
134 |
The record buffer only includes data about columns that are marked in the
|
|
135 |
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: |
136 |
the situation).
|
1
by brian
clean slate |
137 |
<not-sure>It could be that it is required that null bits of non-present
|
138 |
columns are set to 1</not-sure>
|
|
139 |
||
140 |
VARIOUS EXCEPTIONS AND SPECIAL CASES
|
|
141 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
142 |
f the table has no nullable columns, then null_bytes is still
|
143 |
present, its length is one byte <not-sure> which must be set to 0xFF
|
|
1
by brian
clean slate |
144 |
at all times. </not-sure>
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
145 |
|
1
by brian
clean slate |
146 |
If the table has columns of type BIT, then certain bits from those columns
|
147 |
may be stored in null_bytes as well. Grep around for Field_bit for
|
|
148 |
details.
|
|
149 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
150 |
For blob columns (see Field_blob), the record buffer stores length of the
|
151 |
data, following by memory pointer to the blob data. The pointer is owned
|
|
1
by brian
clean slate |
152 |
by the storage engine and is valid until the next operation.
|
153 |
||
154 |
If a blob column has NULL value, then its length and blob data pointer
|
|
155 |
must be set to 0.
|
|
156 |
*/
|
|
157 |
||
158 |
class handler :public Sql_alloc |
|
159 |
{
|
|
160 |
public: |
|
161 |
typedef uint64_t Table_flags; |
|
796
by Brian Aker
Test case fixes + TABLE_CACHE to class (will rename in manner which is NOT |
162 |
|
1
by brian
clean slate |
163 |
protected: |
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
164 |
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). |
165 |
Table *table; /* The current open table */ |
1
by brian
clean slate |
166 |
Table_flags cached_table_flags; /* Set on init() and open() */ |
167 |
||
168 |
ha_rows estimation_rows_to_insert; |
|
169 |
public: |
|
960.2.37
by Monty Taylor
More naming fixes. |
170 |
StorageEngine *engine; /* storage engine of this handler */ |
171 |
unsigned char *ref; /* Pointer to current row */ |
|
481
by Brian Aker
Remove all of uchar. |
172 |
unsigned char *dup_ref; /* Pointer to duplicate row */ |
1
by brian
clean slate |
173 |
|
174 |
ha_statistics stats; |
|
175 |
/** MultiRangeRead-related members: */
|
|
176 |
range_seq_t mrr_iter; /* Interator to traverse the range sequence */ |
|
177 |
RANGE_SEQ_IF mrr_funcs; /* Range sequence traversal functions */ |
|
178 |
HANDLER_BUFFER *multi_range_buffer; /* MRR buffer info */ |
|
482
by Brian Aker
Remove uint. |
179 |
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 |
180 |
/* true <=> source MRR ranges and the output are ordered */
|
1
by brian
clean slate |
181 |
bool mrr_is_output_sorted; |
182 |
||
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
183 |
/** true <=> we're currently traversing a range in mrr_cur_range. */
|
1
by brian
clean slate |
184 |
bool mrr_have_range; |
185 |
/** Current range (the one we're now returning rows from) */
|
|
186 |
KEY_MULTI_RANGE mrr_cur_range; |
|
187 |
||
188 |
/** The following are for read_range() */
|
|
189 |
key_range save_end_range, *end_range; |
|
190 |
KEY_PART_INFO *range_key_part; |
|
191 |
int key_compare_result_on_equal; |
|
192 |
bool eq_range; |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
193 |
/*
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
194 |
true <=> the engine guarantees that returned records are within the range
|
1
by brian
clean slate |
195 |
being scanned.
|
196 |
*/
|
|
197 |
bool in_range_check_pushed_down; |
|
198 |
||
482
by Brian Aker
Remove uint. |
199 |
uint32_t errkey; /* Last dup key */ |
200 |
uint32_t key_used_on_scan; |
|
201 |
uint32_t active_index; |
|
1
by brian
clean slate |
202 |
/** Length of ref (1-8 or the clustered key length) */
|
482
by Brian Aker
Remove uint. |
203 |
uint32_t ref_length; |
1
by brian
clean slate |
204 |
enum {NONE=0, INDEX, RND} inited; |
205 |
bool locked; |
|
206 |
bool implicit_emptied; /* Can be !=0 only if HEAP */ |
|
207 |
const Item *pushed_cond; |
|
208 |
||
209 |
Item *pushed_idx_cond; |
|
482
by Brian Aker
Remove uint. |
210 |
uint32_t pushed_idx_cond_keyno; /* The index which the above condition is for */ |
1
by brian
clean slate |
211 |
|
212 |
/**
|
|
213 |
next_insert_id is the next value which should be inserted into the
|
|
214 |
auto_increment column: in a inserting-multi-row statement (like INSERT
|
|
215 |
SELECT), for the first row where the autoinc value is not specified by the
|
|
216 |
statement, get_auto_increment() called and asked to generate a value,
|
|
217 |
next_insert_id is set to the next value, then for all other rows
|
|
218 |
next_insert_id is used (and increased each time) without calling
|
|
219 |
get_auto_increment().
|
|
220 |
*/
|
|
221 |
uint64_t next_insert_id; |
|
222 |
/**
|
|
223 |
insert id for the current row (*autogenerated*; if not
|
|
224 |
autogenerated, it's 0).
|
|
225 |
At first successful insertion, this variable is stored into
|
|
520.1.21
by Brian Aker
THD -> Session rename |
226 |
Session::first_successful_insert_id_in_cur_stmt.
|
1
by brian
clean slate |
227 |
*/
|
228 |
uint64_t insert_id_for_cur_row; |
|
229 |
/**
|
|
230 |
Interval returned by get_auto_increment() and being consumed by the
|
|
231 |
inserter.
|
|
232 |
*/
|
|
233 |
Discrete_interval auto_inc_interval_for_cur_row; |
|
234 |
||
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
235 |
handler(StorageEngine *engine_arg, TableShare *share_arg) |
1
by brian
clean slate |
236 |
:table_share(share_arg), table(0), |
960.2.37
by Monty Taylor
More naming fixes. |
237 |
estimation_rows_to_insert(0), engine(engine_arg), |
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
238 |
ref(0), in_range_check_pushed_down(false), |
1
by brian
clean slate |
239 |
key_used_on_scan(MAX_KEY), active_index(MAX_KEY), |
240 |
ref_length(sizeof(my_off_t)), |
|
137
by Brian Aker
Removed dead FT bits. Small refactoring in sql_plugin.cc |
241 |
inited(NONE), |
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
242 |
locked(false), implicit_emptied(0), |
1
by brian
clean slate |
243 |
pushed_cond(0), pushed_idx_cond(NULL), pushed_idx_cond_keyno(MAX_KEY), |
244 |
next_insert_id(0), insert_id_for_cur_row(0) |
|
245 |
{}
|
|
246 |
virtual ~handler(void) |
|
247 |
{
|
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
248 |
assert(locked == false); |
249 |
/* TODO: assert(inited == NONE); */
|
|
1
by brian
clean slate |
250 |
}
|
251 |
virtual handler *clone(MEM_ROOT *mem_root); |
|
252 |
/** This is called after create to allow us to set up cached variables */
|
|
253 |
void init() |
|
254 |
{
|
|
255 |
cached_table_flags= table_flags(); |
|
256 |
}
|
|
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
257 |
|
1
by brian
clean slate |
258 |
/* ha_ methods: pubilc wrappers for private virtual API */
|
259 |
||
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
260 |
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. |
261 |
int ha_index_init(uint32_t idx, bool sorted); |
262 |
int ha_index_end(); |
|
263 |
int ha_rnd_init(bool scan); |
|
264 |
int ha_rnd_end(); |
|
1
by brian
clean slate |
265 |
int ha_reset(); |
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
266 |
|
1
by brian
clean slate |
267 |
/* 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. |
268 |
int ha_index_or_rnd_end(); |
269 |
Table_flags ha_table_flags() const; |
|
270 |
||
1
by brian
clean slate |
271 |
/**
|
272 |
These functions represent the public interface to *users* of the
|
|
273 |
handler class, hence they are *not* virtual. For the inheritance
|
|
274 |
interface, see the (private) functions write_row(), update_row(),
|
|
275 |
and delete_row() below.
|
|
276 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
277 |
int ha_external_lock(Session *session, int lock_type); |
481
by Brian Aker
Remove all of uchar. |
278 |
int ha_write_row(unsigned char * buf); |
279 |
int ha_update_row(const unsigned char * old_data, unsigned char * new_data); |
|
280 |
int ha_delete_row(const unsigned char * buf); |
|
1
by brian
clean slate |
281 |
void ha_release_auto_increment(); |
282 |
||
283 |
int ha_check_for_upgrade(HA_CHECK_OPT *check_opt); |
|
284 |
/** to be actually called to get 'check()' functionality*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
285 |
int ha_check(Session *session, HA_CHECK_OPT *check_opt); |
286 |
int ha_repair(Session* session, HA_CHECK_OPT* check_opt); |
|
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
287 |
void ha_start_bulk_insert(ha_rows rows); |
288 |
int ha_end_bulk_insert(); |
|
481
by Brian Aker
Remove all of uchar. |
289 |
int ha_bulk_update_row(const unsigned char *old_data, unsigned char *new_data, |
482
by Brian Aker
Remove uint. |
290 |
uint32_t *dup_key_found); |
1
by brian
clean slate |
291 |
int ha_delete_all_rows(); |
292 |
int ha_reset_auto_increment(uint64_t value); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
293 |
int ha_optimize(Session* session, HA_CHECK_OPT* check_opt); |
294 |
int ha_analyze(Session* session, HA_CHECK_OPT* check_opt); |
|
295 |
bool ha_check_and_repair(Session *session); |
|
482
by Brian Aker
Remove uint. |
296 |
int ha_disable_indexes(uint32_t mode); |
297 |
int ha_enable_indexes(uint32_t mode); |
|
200
by Brian Aker
my_bool from handler and set_var |
298 |
int ha_discard_or_import_tablespace(bool discard); |
1
by brian
clean slate |
299 |
void ha_prepare_for_alter(); |
300 |
int ha_rename_table(const char *from, const char *to); |
|
301 |
int ha_delete_table(const char *name); |
|
302 |
void ha_drop_table(const char *name); |
|
303 |
||
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
304 |
int ha_create(const char *name, Table *form, HA_CREATE_INFO *info); |
1
by brian
clean slate |
305 |
|
306 |
int ha_create_handler_files(const char *name, const char *old_name, |
|
307 |
int action_flag, HA_CREATE_INFO *info); |
|
308 |
||
309 |
void adjust_next_insert_id_after_explicit_value(uint64_t nr); |
|
310 |
int update_auto_increment(); |
|
482
by Brian Aker
Remove uint. |
311 |
void print_keydup_error(uint32_t key_nr, const char *msg); |
1
by brian
clean slate |
312 |
virtual void print_error(int error, myf errflag); |
313 |
virtual bool get_error_message(int error, String *buf); |
|
482
by Brian Aker
Remove uint. |
314 |
uint32_t get_dup_key(int error); |
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
315 |
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. |
316 |
|
1
by brian
clean slate |
317 |
/* Estimates calculation */
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
318 |
virtual double scan_time(void) |
151
by Brian Aker
Ulonglong to uint64_t |
319 |
{ return uint64_t2double(stats.data_file_length) / IO_SIZE + 2; } |
645
by Brian Aker
Cleanup unused attribute |
320 |
virtual double read_time(uint32_t, uint32_t ranges, ha_rows rows) |
1
by brian
clean slate |
321 |
{ return rows2double(ranges+rows); } |
322 |
||
482
by Brian Aker
Remove uint. |
323 |
virtual double index_only_read_time(uint32_t keynr, double records); |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
324 |
|
482
by Brian Aker
Remove uint. |
325 |
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: |
326 |
void *seq_init_param, |
482
by Brian Aker
Remove uint. |
327 |
uint32_t n_ranges, uint32_t *bufsz, |
328 |
uint32_t *flags, COST_VECT *cost); |
|
329 |
virtual int multi_range_read_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys, |
|
330 |
uint32_t *bufsz, uint32_t *flags, COST_VECT *cost); |
|
1
by brian
clean slate |
331 |
virtual int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, |
482
by Brian Aker
Remove uint. |
332 |
uint32_t n_ranges, uint32_t mode, |
1
by brian
clean slate |
333 |
HANDLER_BUFFER *buf); |
334 |
virtual int multi_range_read_next(char **range_info); |
|
335 |
||
336 |
||
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
337 |
virtual const key_map *keys_to_use_for_scanning(); |
338 |
bool has_transactions(); |
|
1
by brian
clean slate |
339 |
|
340 |
/**
|
|
341 |
This method is used to analyse the error to see whether the error
|
|
342 |
is ignorable or not, certain handlers can have more error that are
|
|
343 |
ignorable than others. E.g. the partition handler can get inserts
|
|
344 |
into a range where there is no partition and this is an ignorable
|
|
345 |
error.
|
|
346 |
HA_ERR_FOUND_DUP_UNIQUE is a special case in MyISAM that means the
|
|
347 |
same thing as HA_ERR_FOUND_DUP_KEY but can in some cases lead to
|
|
348 |
a slightly different error message.
|
|
349 |
*/
|
|
575.1.4
by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h. |
350 |
virtual bool is_fatal_error(int error, uint32_t flags); |
1
by brian
clean slate |
351 |
|
352 |
/**
|
|
353 |
Number of rows in table. It will only be called if
|
|
354 |
(table_flags() & (HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT)) != 0
|
|
355 |
*/
|
|
575.1.5
by Monty Taylor
Moved stuff to handlerton.cc |
356 |
virtual ha_rows records(); |
1
by brian
clean slate |
357 |
/**
|
358 |
Return upper bound of current number of records in the table
|
|
359 |
(max. of how many records one will retrieve when doing a full table scan)
|
|
360 |
If upper bound is not known, HA_POS_ERROR should be returned as a max
|
|
361 |
possible upper bound.
|
|
362 |
*/
|
|
363 |
virtual ha_rows estimate_rows_upper_bound() |
|
364 |
{ return stats.records+EXTRA_RECORDS; } |
|
365 |
||
366 |
/**
|
|
367 |
Get the row type from the storage engine. If this method returns
|
|
368 |
ROW_TYPE_NOT_USED, the information in HA_CREATE_INFO should be used.
|
|
369 |
*/
|
|
370 |
virtual enum row_type get_row_type() const { return ROW_TYPE_NOT_USED; } |
|
371 |
||
645
by Brian Aker
Cleanup unused attribute |
372 |
virtual const char *index_type(uint32_t) |
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
373 |
{ assert(0); return "";} |
1
by brian
clean slate |
374 |
|
375 |
||
482
by Brian Aker
Remove uint. |
376 |
uint32_t get_index(void) const { return active_index; } |
1
by brian
clean slate |
377 |
virtual int close(void)=0; |
378 |
||
379 |
/**
|
|
380 |
@retval 0 Bulk update used by handler
|
|
381 |
@retval 1 Bulk update not used, normal operation used
|
|
382 |
*/
|
|
383 |
virtual bool start_bulk_update() { return 1; } |
|
384 |
/**
|
|
385 |
@retval 0 Bulk delete used by handler
|
|
386 |
@retval 1 Bulk delete not used, normal operation used
|
|
387 |
*/
|
|
388 |
virtual bool start_bulk_delete() { return 1; } |
|
389 |
/**
|
|
390 |
After this call all outstanding updates must be performed. The number
|
|
391 |
of duplicate key errors are reported in the duplicate key parameter.
|
|
392 |
It is allowed to continue to the batched update after this call, the
|
|
393 |
handler has to wait until end_bulk_update with changing state.
|
|
394 |
||
395 |
@param dup_key_found Number of duplicate keys found
|
|
396 |
||
397 |
@retval 0 Success
|
|
398 |
@retval >0 Error code
|
|
399 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
400 |
virtual int exec_bulk_update(uint32_t *) |
1
by brian
clean slate |
401 |
{
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
402 |
assert(false); |
1
by brian
clean slate |
403 |
return HA_ERR_WRONG_COMMAND; |
404 |
}
|
|
405 |
/**
|
|
406 |
Perform any needed clean-up, no outstanding updates are there at the
|
|
407 |
moment.
|
|
408 |
*/
|
|
409 |
virtual void end_bulk_update() { return; } |
|
410 |
/**
|
|
411 |
Execute all outstanding deletes and close down the bulk delete.
|
|
412 |
||
413 |
@retval 0 Success
|
|
414 |
@retval >0 Error code
|
|
415 |
*/
|
|
416 |
virtual int end_bulk_delete() |
|
417 |
{
|
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
418 |
assert(false); |
1
by brian
clean slate |
419 |
return HA_ERR_WRONG_COMMAND; |
420 |
}
|
|
421 |
/**
|
|
422 |
@brief
|
|
423 |
Positions an index cursor to the index specified in the handle. Fetches the
|
|
424 |
row if available. If the key value is null, begin at the first key of the
|
|
425 |
index.
|
|
426 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
427 |
virtual int index_read_map(unsigned char * buf, const unsigned char * key, |
1
by brian
clean slate |
428 |
key_part_map keypart_map, |
429 |
enum ha_rkey_function find_flag) |
|
430 |
{
|
|
482
by Brian Aker
Remove uint. |
431 |
uint32_t key_len= calculate_key_len(table, active_index, key, keypart_map); |
1
by brian
clean slate |
432 |
return index_read(buf, key, key_len, find_flag); |
433 |
}
|
|
434 |
/**
|
|
435 |
@brief
|
|
436 |
Positions an index cursor to the index specified in the handle. Fetches the
|
|
437 |
row if available. If the key value is null, begin at the first key of the
|
|
438 |
index.
|
|
439 |
*/
|
|
656.1.1
by Monty Taylor
OOOh doggie. Got rid of my_alloca. |
440 |
virtual int index_read_idx_map(unsigned char * buf, uint32_t index, |
441 |
const unsigned char * key, |
|
1
by brian
clean slate |
442 |
key_part_map keypart_map, |
443 |
enum ha_rkey_function find_flag); |
|
645
by Brian Aker
Cleanup unused attribute |
444 |
virtual int index_next(unsigned char *) |
445 |
{ return HA_ERR_WRONG_COMMAND; } |
|
446 |
virtual int index_prev(unsigned char *) |
|
447 |
{ return HA_ERR_WRONG_COMMAND; } |
|
448 |
virtual int index_first(unsigned char *) |
|
449 |
{ return HA_ERR_WRONG_COMMAND; } |
|
450 |
virtual int index_last(unsigned char *) |
|
451 |
{ return HA_ERR_WRONG_COMMAND; } |
|
452 |
virtual int index_next_same(unsigned char *, const unsigned char *, uint32_t); |
|
1
by brian
clean slate |
453 |
/**
|
454 |
@brief
|
|
455 |
The following functions works like index_read, but it find the last
|
|
456 |
row with the current key value or prefix.
|
|
457 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
458 |
virtual int index_read_last_map(unsigned char * buf, const unsigned char * key, |
1
by brian
clean slate |
459 |
key_part_map keypart_map) |
460 |
{
|
|
482
by Brian Aker
Remove uint. |
461 |
uint32_t key_len= calculate_key_len(table, active_index, key, keypart_map); |
1
by brian
clean slate |
462 |
return index_read_last(buf, key, key_len); |
463 |
}
|
|
464 |
virtual int read_range_first(const key_range *start_key, |
|
465 |
const key_range *end_key, |
|
466 |
bool eq_range, bool sorted); |
|
467 |
virtual int read_range_next(); |
|
468 |
int compare_key(key_range *range); |
|
469 |
int compare_key2(key_range *range); |
|
645
by Brian Aker
Cleanup unused attribute |
470 |
virtual int rnd_next(unsigned char *)=0; |
471 |
virtual int rnd_pos(unsigned char *, unsigned char *)=0; |
|
1
by brian
clean slate |
472 |
/**
|
473 |
One has to use this method when to find
|
|
474 |
random position by record as the plain
|
|
475 |
position() call doesn't work for some
|
|
476 |
handlers for random position.
|
|
477 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
478 |
virtual int rnd_pos_by_record(unsigned char *record); |
482
by Brian Aker
Remove uint. |
479 |
virtual int read_first_row(unsigned char *buf, uint32_t primary_key); |
1
by brian
clean slate |
480 |
/**
|
481 |
The following function is only needed for tables that may be temporary
|
|
482 |
tables during joins.
|
|
483 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
484 |
virtual int restart_rnd_next(unsigned char *, unsigned char *) |
485 |
{ return HA_ERR_WRONG_COMMAND; } |
|
486 |
virtual int rnd_same(unsigned char *, uint32_t) |
|
487 |
{ return HA_ERR_WRONG_COMMAND; } |
|
488 |
virtual ha_rows records_in_range(uint32_t, key_range *, key_range *) |
|
1
by brian
clean slate |
489 |
{ return (ha_rows) 10; } |
481
by Brian Aker
Remove all of uchar. |
490 |
virtual void position(const unsigned char *record)=0; |
895
by Brian Aker
Completion (?) of uint conversion. |
491 |
virtual int info(uint32_t)=0; // see my_base.h for full description |
645
by Brian Aker
Cleanup unused attribute |
492 |
virtual uint32_t calculate_key_hash_value(Field **) |
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
493 |
{ assert(0); return 0; } |
645
by Brian Aker
Cleanup unused attribute |
494 |
virtual int extra(enum ha_extra_function) |
1
by brian
clean slate |
495 |
{ return 0; } |
645
by Brian Aker
Cleanup unused attribute |
496 |
virtual int extra_opt(enum ha_extra_function operation, uint32_t) |
1
by brian
clean slate |
497 |
{ return extra(operation); } |
498 |
||
499 |
/**
|
|
500 |
In an UPDATE or DELETE, if the row under the cursor was locked by another
|
|
501 |
transaction, and the engine used an optimistic read of the last
|
|
502 |
committed row value under the cursor, then the engine returns 1 from this
|
|
503 |
function. MySQL must NOT try to update this optimistic value. If the
|
|
504 |
optimistic value does not match the WHERE condition, MySQL can decide to
|
|
505 |
skip over this row. Currently only works for InnoDB. This can be used to
|
|
506 |
avoid unnecessary lock waits.
|
|
507 |
||
508 |
If this method returns nonzero, it will also signal the storage
|
|
509 |
engine that the next read will be a locking re-read of the row.
|
|
510 |
*/
|
|
511 |
virtual bool was_semi_consistent_read() { return 0; } |
|
512 |
/**
|
|
513 |
Tell the engine whether it should avoid unnecessary lock waits.
|
|
514 |
If yes, in an UPDATE or DELETE, if the row under the cursor was locked
|
|
515 |
by another transaction, the engine may try an optimistic read of
|
|
516 |
the last committed row value under the cursor.
|
|
517 |
*/
|
|
518 |
virtual void try_semi_consistent_read(bool) {} |
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
519 |
virtual void unlock_row(void) {} |
645
by Brian Aker
Cleanup unused attribute |
520 |
virtual int start_stmt(Session *, thr_lock_type) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
521 |
{return 0;} |
1
by brian
clean slate |
522 |
virtual void get_auto_increment(uint64_t offset, uint64_t increment, |
523 |
uint64_t nb_desired_values, |
|
524 |
uint64_t *first_value, |
|
525 |
uint64_t *nb_reserved_values); |
|
526 |
void set_next_insert_id(uint64_t id) |
|
527 |
{
|
|
528 |
next_insert_id= id; |
|
529 |
}
|
|
530 |
void restore_auto_increment(uint64_t prev_insert_id) |
|
531 |
{
|
|
532 |
/*
|
|
533 |
Insertion of a row failed, re-use the lastly generated auto_increment
|
|
534 |
id, for the next row. This is achieved by resetting next_insert_id to
|
|
535 |
what it was before the failed insertion (that old value is provided by
|
|
536 |
the caller). If that value was 0, it was the first row of the INSERT;
|
|
537 |
then if insert_id_for_cur_row contains 0 it means no id was generated
|
|
538 |
for this first row, so no id was generated since the INSERT started, so
|
|
539 |
we should set next_insert_id to 0; if insert_id_for_cur_row is not 0, it
|
|
540 |
is the generated id of the first and failed row, so we use it.
|
|
541 |
*/
|
|
542 |
next_insert_id= (prev_insert_id > 0) ? prev_insert_id : |
|
543 |
insert_id_for_cur_row; |
|
544 |
}
|
|
545 |
||
645
by Brian Aker
Cleanup unused attribute |
546 |
virtual void update_create_info(HA_CREATE_INFO *) {} |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
547 |
int check_old_types(void); |
645
by Brian Aker
Cleanup unused attribute |
548 |
virtual int assign_to_keycache(Session*, HA_CHECK_OPT *) |
1
by brian
clean slate |
549 |
{ return HA_ADMIN_NOT_IMPLEMENTED; } |
550 |
/* end of the list of admin commands */
|
|
551 |
||
552 |
virtual int indexes_are_disabled(void) {return 0;} |
|
553 |
virtual char *update_table_comment(const char * comment) |
|
554 |
{ return (char*) comment;} |
|
645
by Brian Aker
Cleanup unused attribute |
555 |
virtual void append_create_info(String *) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
556 |
{}
|
1
by brian
clean slate |
557 |
/**
|
558 |
If index == MAX_KEY then a check for table is made and if index <
|
|
559 |
MAX_KEY then a check is made if the table has foreign keys and if
|
|
560 |
a foreign key uses this index (and thus the index cannot be dropped).
|
|
561 |
||
562 |
@param index Index to check if foreign key uses it
|
|
563 |
||
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
564 |
@retval true Foreign key defined on table or index
|
565 |
@retval false No foreign key defined
|
|
1
by brian
clean slate |
566 |
*/
|
645
by Brian Aker
Cleanup unused attribute |
567 |
virtual bool is_fk_defined_on_table_or_index(uint32_t) |
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
568 |
{ return false; } |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
569 |
virtual char* get_foreign_key_create_info(void) |
1019.1.6
by Brian Aker
A number of random cleanups. |
570 |
{ return NULL;} /* gets foreign key create string from InnoDB */ |
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
571 |
/** used in ALTER Table; 1 if changing storage engine is allowed */
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
572 |
virtual bool can_switch_engines(void) { return 1; } |
1
by brian
clean slate |
573 |
/** used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */
|
645
by Brian Aker
Cleanup unused attribute |
574 |
virtual int get_foreign_key_list(Session *, List<FOREIGN_KEY_INFO> *) |
1
by brian
clean slate |
575 |
{ return 0; } |
482
by Brian Aker
Remove uint. |
576 |
virtual uint32_t referenced_by_foreign_key() { return 0;} |
1
by brian
clean slate |
577 |
virtual void init_table_handle_for_HANDLER() |
578 |
{ return; } /* prepare InnoDB for HANDLER */ |
|
645
by Brian Aker
Cleanup unused attribute |
579 |
virtual void free_foreign_key_create_info(char *) {} |
1
by brian
clean slate |
580 |
/** The following can be called without an open handler */
|
581 |
virtual const char *table_type() const =0; |
|
582 |
/**
|
|
583 |
If frm_error() is called then we will use this to find out what file
|
|
584 |
extentions exist for the storage engine. This is also used by the default
|
|
585 |
rename_table and delete_table method in handler.cc.
|
|
586 |
||
587 |
For engines that have two file name extentions (separate meta/index file
|
|
588 |
and data file), the order of elements is relevant. First element of engine
|
|
589 |
file name extentions array should be meta/index file extention. Second
|
|
590 |
element - data file extention. This order is assumed by
|
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
591 |
prepare_for_repair() when REPAIR Table ... USE_FRM is issued.
|
1
by brian
clean slate |
592 |
*/
|
593 |
virtual const char **bas_ext() const =0; |
|
594 |
||
482
by Brian Aker
Remove uint. |
595 |
virtual uint32_t index_flags(uint32_t idx, uint32_t part, bool all_parts) const =0; |
1
by brian
clean slate |
596 |
|
645
by Brian Aker
Cleanup unused attribute |
597 |
virtual int add_index(Table *, KEY *, uint32_t) |
598 |
{ return (HA_ERR_WRONG_COMMAND); } |
|
599 |
virtual int prepare_drop_index(Table *, uint32_t *, uint32_t) |
|
600 |
{ return (HA_ERR_WRONG_COMMAND); } |
|
601 |
virtual int final_drop_index(Table *) |
|
1
by brian
clean slate |
602 |
{ return (HA_ERR_WRONG_COMMAND); } |
603 |
||
482
by Brian Aker
Remove uint. |
604 |
uint32_t max_record_length() const |
398.1.4
by Monty Taylor
Renamed max/min. |
605 |
{ return cmin((unsigned int)HA_MAX_REC_LENGTH, max_supported_record_length()); } |
482
by Brian Aker
Remove uint. |
606 |
uint32_t max_keys() const |
398.1.4
by Monty Taylor
Renamed max/min. |
607 |
{ return cmin((unsigned int)MAX_KEY, max_supported_keys()); } |
482
by Brian Aker
Remove uint. |
608 |
uint32_t max_key_parts() const |
398.1.4
by Monty Taylor
Renamed max/min. |
609 |
{ return cmin((unsigned int)MAX_REF_PARTS, max_supported_key_parts()); } |
482
by Brian Aker
Remove uint. |
610 |
uint32_t max_key_length() const |
398.1.4
by Monty Taylor
Renamed max/min. |
611 |
{ return cmin((unsigned int)MAX_KEY_LENGTH, max_supported_key_length()); } |
482
by Brian Aker
Remove uint. |
612 |
uint32_t max_key_part_length(void) const |
398.1.4
by Monty Taylor
Renamed max/min. |
613 |
{ return cmin((unsigned int)MAX_KEY_LENGTH, max_supported_key_part_length()); } |
1
by brian
clean slate |
614 |
|
482
by Brian Aker
Remove uint. |
615 |
virtual uint32_t max_supported_record_length(void) const |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
616 |
{ return HA_MAX_REC_LENGTH; } |
482
by Brian Aker
Remove uint. |
617 |
virtual uint32_t max_supported_keys(void) const { return 0; } |
618 |
virtual uint32_t max_supported_key_parts(void) const { return MAX_REF_PARTS; } |
|
619 |
virtual uint32_t max_supported_key_length(void) const { return MAX_KEY_LENGTH; } |
|
620 |
virtual uint32_t max_supported_key_part_length(void) const { return 255; } |
|
1
by brian
clean slate |
621 |
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
622 |
virtual bool low_byte_first(void) const { return 1; } |
482
by Brian Aker
Remove uint. |
623 |
virtual uint32_t checksum(void) const { return 0; } |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
624 |
virtual bool is_crashed(void) const { return 0; } |
625 |
virtual bool auto_repair(void) const { return 0; } |
|
1
by brian
clean slate |
626 |
|
627 |
||
628 |
#define CHF_CREATE_FLAG 0
|
|
629 |
#define CHF_DELETE_FLAG 1
|
|
630 |
#define CHF_RENAME_FLAG 2
|
|
631 |
||
632 |
||
633 |
/**
|
|
634 |
@note lock_count() can return > 1 if the table is MERGE or partitioned.
|
|
635 |
*/
|
|
482
by Brian Aker
Remove uint. |
636 |
virtual uint32_t lock_count(void) const { return 1; } |
1
by brian
clean slate |
637 |
/**
|
638 |
Is not invoked for non-transactional temporary tables.
|
|
639 |
||
640 |
@note store_lock() can return more than one lock if the table is MERGE
|
|
641 |
or partitioned.
|
|
642 |
||
643 |
@note that one can NOT rely on table->in_use in store_lock(). It may
|
|
644 |
refer to a different thread if called from mysql_lock_abort_for_thread().
|
|
645 |
||
646 |
@note If the table is MERGE, store_lock() can return less locks
|
|
647 |
than lock_count() claimed. This can happen when the MERGE children
|
|
648 |
are not attached when this is called from another thread.
|
|
649 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
650 |
virtual THR_LOCK_DATA **store_lock(Session *session, |
1
by brian
clean slate |
651 |
THR_LOCK_DATA **to, |
652 |
enum thr_lock_type lock_type)=0; |
|
653 |
||
654 |
/*
|
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
655 |
@retval true Primary key (if there is one) is clustered
|
1
by brian
clean slate |
656 |
key covering all fields
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
657 |
@retval false otherwise
|
1
by brian
clean slate |
658 |
*/
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
659 |
virtual bool primary_key_is_clustered() { return false; } |
481
by Brian Aker
Remove all of uchar. |
660 |
virtual int cmp_ref(const unsigned char *ref1, const unsigned char *ref2) |
1
by brian
clean slate |
661 |
{
|
662 |
return memcmp(ref1, ref2, ref_length); |
|
663 |
}
|
|
664 |
||
665 |
/*
|
|
666 |
Condition pushdown to storage engines
|
|
667 |
*/
|
|
668 |
||
669 |
/**
|
|
670 |
Push condition down to the table handler.
|
|
671 |
||
672 |
@param cond Condition to be pushed. The condition tree must not be
|
|
673 |
modified by the by the caller.
|
|
674 |
||
675 |
@return
|
|
676 |
The 'remainder' condition that caller must use to filter out records.
|
|
677 |
NULL means the handler will not return rows that do not match the
|
|
678 |
passed condition.
|
|
679 |
||
680 |
@note
|
|
681 |
The pushed conditions form a stack (from which one can remove the
|
|
682 |
last pushed condition using cond_pop).
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
683 |
The table handler filters out rows using (pushed_cond1 AND pushed_cond2
|
1
by brian
clean slate |
684 |
AND ... AND pushed_condN)
|
685 |
or less restrictive condition, depending on handler's capabilities.
|
|
686 |
||
687 |
handler->ha_reset() call empties the condition stack.
|
|
688 |
Calls to rnd_init/rnd_end, index_init/index_end etc do not affect the
|
|
689 |
condition stack.
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
690 |
*/
|
1
by brian
clean slate |
691 |
virtual const COND *cond_push(const COND *cond) { return cond; } |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
692 |
|
1
by brian
clean slate |
693 |
/**
|
694 |
Pop the top condition from the condition stack of the handler instance.
|
|
695 |
||
696 |
Pops the top if condition stack, if stack is not empty.
|
|
697 |
*/
|
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
698 |
virtual void cond_pop(void) { return; } |
1
by brian
clean slate |
699 |
|
645
by Brian Aker
Cleanup unused attribute |
700 |
virtual Item *idx_cond_push(uint32_t, Item *idx_cond) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
701 |
{ return idx_cond; } |
1
by brian
clean slate |
702 |
|
703 |
/**
|
|
704 |
Lock table.
|
|
705 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
706 |
@param session Thread handle
|
1
by brian
clean slate |
707 |
@param lock_type HA_LOCK_IN_SHARE_MODE (F_RDLCK)
|
708 |
HA_LOCK_IN_EXCLUSIVE_MODE (F_WRLCK)
|
|
709 |
@param lock_timeout -1 default timeout
|
|
710 |
0 no wait
|
|
711 |
>0 wait timeout in milliseconds.
|
|
712 |
||
713 |
@note
|
|
714 |
lock_timeout >0 is not used by MySQL currently. If the storage
|
|
715 |
engine does not support NOWAIT (lock_timeout == 0) it should
|
|
716 |
return an error. But if it does not support WAIT X (lock_timeout
|
|
717 |
>0) it should treat it as lock_timeout == -1 and wait a default
|
|
718 |
(or even hard-coded) timeout.
|
|
719 |
||
720 |
@retval HA_ERR_WRONG_COMMAND Storage engine does not support
|
|
721 |
lock_table()
|
|
722 |
@retval HA_ERR_UNSUPPORTED Storage engine does not support NOWAIT
|
|
723 |
@retval HA_ERR_LOCK_WAIT_TIMEOUT Lock request timed out or
|
|
724 |
lock conflict with NOWAIT option
|
|
725 |
@retval HA_ERR_LOCK_DEADLOCK Deadlock detected
|
|
726 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
727 |
virtual int lock_table(Session *, int, int) |
1
by brian
clean slate |
728 |
{
|
729 |
return HA_ERR_WRONG_COMMAND; |
|
730 |
}
|
|
731 |
||
732 |
protected: |
|
733 |
/* Service methods for use by storage engines. */
|
|
734 |
void ha_statistic_increment(ulong SSV::*offset) const; |
|
520.1.21
by Brian Aker
THD -> Session rename |
735 |
void **ha_data(Session *) const; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
736 |
Session *ha_session(void) const; |
1
by brian
clean slate |
737 |
|
738 |
/**
|
|
739 |
Default rename_table() and delete_table() rename/delete files with a
|
|
740 |
given name and extensions from bas_ext().
|
|
741 |
||
742 |
These methods can be overridden, but their default implementation
|
|
743 |
provide useful functionality.
|
|
744 |
*/
|
|
745 |
virtual int rename_table(const char *from, const char *to); |
|
746 |
/**
|
|
747 |
Delete a table in the engine. Called for base as well as temporary
|
|
748 |
tables.
|
|
749 |
*/
|
|
750 |
virtual int delete_table(const char *name); |
|
751 |
||
752 |
private: |
|
753 |
/* Private helpers */
|
|
754 |
inline void mark_trx_read_write(); |
|
755 |
private: |
|
756 |
/*
|
|
757 |
Low-level primitives for storage engines. These should be
|
|
758 |
overridden by the storage engine class. To call these methods, use
|
|
759 |
the corresponding 'ha_*' method above.
|
|
760 |
*/
|
|
761 |
||
482
by Brian Aker
Remove uint. |
762 |
virtual int open(const char *name, int mode, uint32_t test_if_locked)=0; |
645
by Brian Aker
Cleanup unused attribute |
763 |
virtual int index_init(uint32_t idx, bool) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
764 |
{ active_index= idx; return 0; } |
1
by brian
clean slate |
765 |
virtual int index_end() { active_index= MAX_KEY; return 0; } |
766 |
/**
|
|
767 |
rnd_init() can be called two times without rnd_end() in between
|
|
768 |
(it only makes sense if scan=1).
|
|
769 |
then the second call should prepare for the new table scan (e.g
|
|
770 |
if rnd_init allocates the cursor, second call should position it
|
|
771 |
to the start of the table, no need to deallocate and allocate it again
|
|
772 |
*/
|
|
773 |
virtual int rnd_init(bool scan)= 0; |
|
774 |
virtual int rnd_end() { return 0; } |
|
645
by Brian Aker
Cleanup unused attribute |
775 |
virtual int write_row(unsigned char *) |
776 |
{
|
|
777 |
return HA_ERR_WRONG_COMMAND; |
|
778 |
}
|
|
779 |
||
780 |
virtual int update_row(const unsigned char *, unsigned char *) |
|
781 |
{
|
|
782 |
return HA_ERR_WRONG_COMMAND; |
|
783 |
}
|
|
784 |
||
785 |
virtual int delete_row(const unsigned char *) |
|
1
by brian
clean slate |
786 |
{
|
787 |
return HA_ERR_WRONG_COMMAND; |
|
788 |
}
|
|
789 |
/**
|
|
790 |
Reset state of file to after 'open'.
|
|
791 |
This function is called after every statement for all tables used
|
|
792 |
by that statement.
|
|
793 |
*/
|
|
794 |
virtual int reset() { return 0; } |
|
795 |
virtual Table_flags table_flags(void) const= 0; |
|
796 |
||
797 |
/**
|
|
798 |
Is not invoked for non-transactional temporary tables.
|
|
799 |
||
800 |
Tells the storage engine that we intend to read or write data
|
|
801 |
from the table. This call is prefixed with a call to handler::store_lock()
|
|
802 |
and is invoked only for those handler instances that stored the lock.
|
|
803 |
||
804 |
Calls to rnd_init/index_init are prefixed with this call. When table
|
|
805 |
IO is complete, we call external_lock(F_UNLCK).
|
|
806 |
A storage engine writer should expect that each call to
|
|
807 |
::external_lock(F_[RD|WR]LOCK is followed by a call to
|
|
808 |
::external_lock(F_UNLCK). If it is not, it is a bug in MySQL.
|
|
809 |
||
810 |
The name and signature originate from the first implementation
|
|
811 |
in MyISAM, which would call fcntl to set/clear an advisory
|
|
812 |
lock on the data file in this method.
|
|
813 |
||
814 |
@param lock_type F_RDLCK, F_WRLCK, F_UNLCK
|
|
815 |
||
816 |
@return non-0 in case of failure, 0 in case of success.
|
|
817 |
When lock_type is F_UNLCK, the return value is ignored.
|
|
818 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
819 |
virtual int external_lock(Session *, int) |
1
by brian
clean slate |
820 |
{
|
821 |
return 0; |
|
822 |
}
|
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
823 |
virtual void release_auto_increment(void) { return; }; |
1
by brian
clean slate |
824 |
/** admin commands - called from mysql_admin_table */
|
645
by Brian Aker
Cleanup unused attribute |
825 |
virtual int check_for_upgrade(HA_CHECK_OPT *) |
1
by brian
clean slate |
826 |
{ return 0; } |
645
by Brian Aker
Cleanup unused attribute |
827 |
virtual int check(Session *, HA_CHECK_OPT *) |
1
by brian
clean slate |
828 |
{ return HA_ADMIN_NOT_IMPLEMENTED; } |
829 |
||
830 |
/**
|
|
831 |
In this method check_opt can be modified
|
|
832 |
to specify CHECK option to use to call check()
|
|
833 |
upon the table.
|
|
834 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
835 |
virtual int repair(Session *, HA_CHECK_OPT *) |
1
by brian
clean slate |
836 |
{ return HA_ADMIN_NOT_IMPLEMENTED; } |
645
by Brian Aker
Cleanup unused attribute |
837 |
virtual void start_bulk_insert(ha_rows) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
838 |
{}
|
839 |
virtual int end_bulk_insert(void) { return 0; } |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
840 |
virtual int index_read(unsigned char *, const unsigned char *, |
645
by Brian Aker
Cleanup unused attribute |
841 |
uint32_t, enum ha_rkey_function) |
1
by brian
clean slate |
842 |
{ return HA_ERR_WRONG_COMMAND; } |
645
by Brian Aker
Cleanup unused attribute |
843 |
virtual int index_read_last(unsigned char *, const unsigned char *, uint32_t) |
1
by brian
clean slate |
844 |
{ return (my_errno= HA_ERR_WRONG_COMMAND); } |
845 |
/**
|
|
846 |
This method is similar to update_row, however the handler doesn't need
|
|
847 |
to execute the updates at this point in time. The handler can be certain
|
|
848 |
that another call to bulk_update_row will occur OR a call to
|
|
849 |
exec_bulk_update before the set of updates in this query is concluded.
|
|
850 |
||
851 |
@param old_data Old record
|
|
852 |
@param new_data New record
|
|
853 |
@param dup_key_found Number of duplicate keys found
|
|
854 |
||
855 |
@retval 0 Bulk delete used by handler
|
|
856 |
@retval 1 Bulk delete not used, normal operation used
|
|
857 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
858 |
virtual int bulk_update_row(const unsigned char *, unsigned char *, uint32_t *) |
1
by brian
clean slate |
859 |
{
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
860 |
assert(false); |
1
by brian
clean slate |
861 |
return HA_ERR_WRONG_COMMAND; |
862 |
}
|
|
863 |
/**
|
|
864 |
This is called to delete all rows in a table
|
|
865 |
If the handler don't support this, then this function will
|
|
866 |
return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one
|
|
867 |
by one.
|
|
868 |
*/
|
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
869 |
virtual int delete_all_rows(void) |
1
by brian
clean slate |
870 |
{ return (my_errno=HA_ERR_WRONG_COMMAND); } |
871 |
/**
|
|
872 |
Reset the auto-increment counter to the given value, i.e. the next row
|
|
873 |
inserted will get the given value. This is called e.g. after TRUNCATE
|
|
874 |
is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is
|
|
875 |
returned by storage engines that don't support this operation.
|
|
876 |
*/
|
|
645
by Brian Aker
Cleanup unused attribute |
877 |
virtual int reset_auto_increment(uint64_t) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
878 |
{ return HA_ERR_WRONG_COMMAND; } |
645
by Brian Aker
Cleanup unused attribute |
879 |
virtual int optimize(Session *, HA_CHECK_OPT *) |
880 |
{ return HA_ADMIN_NOT_IMPLEMENTED; } |
|
881 |
virtual int analyze(Session *, HA_CHECK_OPT *) |
|
882 |
{ return HA_ADMIN_NOT_IMPLEMENTED; } |
|
883 |
virtual bool check_and_repair(Session *) |
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
884 |
{ return true; } |
645
by Brian Aker
Cleanup unused attribute |
885 |
virtual int disable_indexes(uint32_t) |
886 |
{ return HA_ERR_WRONG_COMMAND; } |
|
887 |
virtual int enable_indexes(uint32_t) |
|
888 |
{ return HA_ERR_WRONG_COMMAND; } |
|
889 |
virtual int discard_or_import_tablespace(bool) |
|
1
by brian
clean slate |
890 |
{ return (my_errno=HA_ERR_WRONG_COMMAND); } |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
891 |
virtual void prepare_for_alter(void) { return; } |
1
by brian
clean slate |
892 |
virtual void drop_table(const char *name); |
645
by Brian Aker
Cleanup unused attribute |
893 |
virtual int create(const char *, Table *, HA_CREATE_INFO *)=0; |
1
by brian
clean slate |
894 |
|
645
by Brian Aker
Cleanup unused attribute |
895 |
virtual int create_handler_files(const char *, const char *, int, HA_CREATE_INFO *) |
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
896 |
{ return false; } |
1
by brian
clean slate |
897 |
};
|
898 |
||
899 |
||
900 |
||
901 |
/**
|
|
902 |
A Disk-Sweep MRR interface implementation
|
|
903 |
||
904 |
This implementation makes range (and, in the future, 'ref') scans to read
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
905 |
table rows in disk sweeps.
|
906 |
||
1
by brian
clean slate |
907 |
Currently it is used by MyISAM and InnoDB. Potentially it can be used with
|
908 |
any table handler that has non-clustered indexes and on-disk rows.
|
|
909 |
*/
|
|
910 |
||
911 |
class DsMrr_impl |
|
912 |
{
|
|
913 |
public: |
|
914 |
typedef void (handler::*range_check_toggle_func_t)(bool on); |
|
915 |
||
916 |
DsMrr_impl() |
|
917 |
: h2(NULL) {}; |
|
918 |
||
919 |
handler *h; /* The "owner" handler object. It is used for scanning the index */ |
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
920 |
Table *table; /* Always equal to h->table */ |
1
by brian
clean slate |
921 |
private: |
922 |
/*
|
|
923 |
Secondary handler object. It is used to retrieve full table rows by
|
|
924 |
calling rnd_pos().
|
|
925 |
*/
|
|
926 |
handler *h2; |
|
927 |
||
928 |
/* Buffer to store rowids, or (rowid, range_id) pairs */
|
|
481
by Brian Aker
Remove all of uchar. |
929 |
unsigned char *rowids_buf; |
930 |
unsigned char *rowids_buf_cur; /* Current position when reading/writing */ |
|
931 |
unsigned char *rowids_buf_last; /* When reading: end of used buffer space */ |
|
932 |
unsigned char *rowids_buf_end; /* End of the buffer */ |
|
1
by brian
clean slate |
933 |
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
934 |
bool dsmrr_eof; /* true <=> We have reached EOF when reading index tuples */ |
1
by brian
clean slate |
935 |
|
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
936 |
/* true <=> need range association, buffer holds {rowid, range_id} pairs */
|
1
by brian
clean slate |
937 |
bool is_mrr_assoc; |
938 |
||
51.1.77
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
939 |
bool use_default_impl; /* true <=> shortcut all calls to default MRR impl */ |
1
by brian
clean slate |
940 |
public: |
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
941 |
void init(handler *h_arg, Table *table_arg) |
1
by brian
clean slate |
942 |
{
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
943 |
h= h_arg; |
1
by brian
clean slate |
944 |
table= table_arg; |
945 |
}
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
946 |
int dsmrr_init(handler *h, KEY *key, RANGE_SEQ_IF *seq_funcs, |
947 |
void *seq_init_param, uint32_t n_ranges, uint32_t mode, |
|
1
by brian
clean slate |
948 |
HANDLER_BUFFER *buf); |
949 |
void dsmrr_close(); |
|
950 |
int dsmrr_fill_buffer(handler *h); |
|
951 |
int dsmrr_next(handler *h, char **range_info); |
|
952 |
||
482
by Brian Aker
Remove uint. |
953 |
int dsmrr_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys, uint32_t *bufsz, |
954 |
uint32_t *flags, COST_VECT *cost); |
|
1
by brian
clean slate |
955 |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
956 |
ha_rows dsmrr_info_const(uint32_t keyno, RANGE_SEQ_IF *seq, |
482
by Brian Aker
Remove uint. |
957 |
void *seq_init_param, uint32_t n_ranges, uint32_t *bufsz, |
958 |
uint32_t *flags, COST_VECT *cost); |
|
1
by brian
clean slate |
959 |
private: |
482
by Brian Aker
Remove uint. |
960 |
bool key_uses_partial_cols(uint32_t keyno); |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
961 |
bool choose_mrr_impl(uint32_t keyno, ha_rows rows, uint32_t *flags, uint32_t *bufsz, |
1
by brian
clean slate |
962 |
COST_VECT *cost); |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
963 |
bool get_disk_sweep_mrr_cost(uint32_t keynr, ha_rows rows, uint32_t flags, |
482
by Brian Aker
Remove uint. |
964 |
uint32_t *buffer_size, COST_VECT *cost); |
1
by brian
clean slate |
965 |
};
|
966 |
||
967 |
extern const char *ha_row_type[]; |
|
968 |
extern const char *tx_isolation_names[]; |
|
969 |
extern const char *binlog_format_names[]; |
|
970 |
extern TYPELIB tx_isolation_typelib; |
|
971 |
extern TYPELIB myisam_stats_method_typelib; |
|
61
by Brian Aker
Conversion of handler type. |
972 |
extern uint32_t total_ha, total_ha_2pc; |
1
by brian
clean slate |
973 |
|
974 |
/* Wrapper functions */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
975 |
#define ha_commit(session) (ha_commit_trans((session), true))
|
976 |
#define ha_rollback(session) (ha_rollback_trans((session), true))
|
|
1
by brian
clean slate |
977 |
|
978 |
/* basic stuff */
|
|
979 |
int ha_init_errors(void); |
|
980 |
int ha_init(void); |
|
981 |
int ha_end(void); |
|
971.1.52
by Monty Taylor
Did the finalizers. Renamed plugin_registry. |
982 |
|
971.1.46
by Monty Taylor
Made plugin registration go through Plugin_registry. |
983 |
void add_storage_engine(StorageEngine *engine); |
971.1.52
by Monty Taylor
Did the finalizers. Renamed plugin_registry. |
984 |
void remove_storage_engine(StorageEngine *engine); |
1
by brian
clean slate |
985 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
986 |
void ha_close_connection(Session* session); |
960.2.24
by Monty Taylor
Changed handlerton to StorageEngine. |
987 |
bool ha_flush_logs(StorageEngine *db_type); |
1
by brian
clean slate |
988 |
void ha_drop_database(char* path); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
989 |
int ha_create_table(Session *session, const char *path, |
1
by brian
clean slate |
990 |
const char *db, const char *table_name, |
991 |
HA_CREATE_INFO *create_info, |
|
992 |
bool update_create_info); |
|
590.1.7
by Stewart Smith
remove mysql_frm_type |
993 |
int ha_delete_table(Session *session, const char *path, |
1
by brian
clean slate |
994 |
const char *db, const char *alias, bool generate_warning); |
995 |
||
996 |
/* statistics and info */
|
|
960.2.24
by Monty Taylor
Changed handlerton to StorageEngine. |
997 |
bool ha_show_status(Session *session, StorageEngine *db_type, enum ha_stat_type stat); |
1
by brian
clean slate |
998 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
999 |
int ha_find_files(Session *session,const char *db,const char *path, |
1
by brian
clean slate |
1000 |
const char *wild, bool dir, List<LEX_STRING>* files); |
960.2.26
by Monty Taylor
Rename hton to engine. |
1001 |
int ha_table_exists_in_engine(Session* session, const char* db, const char* name, StorageEngine **engine= NULL); |
1
by brian
clean slate |
1002 |
|
1003 |
/* key cache */
|
|
1004 |
extern "C" int ha_init_key_cache(const char *name, KEY_CACHE *key_cache); |
|
1005 |
int ha_resize_key_cache(KEY_CACHE *key_cache); |
|
1006 |
int ha_change_key_cache_param(KEY_CACHE *key_cache); |
|
1007 |
int ha_change_key_cache(KEY_CACHE *old_key_cache, KEY_CACHE *new_key_cache); |
|
1008 |
int ha_end_key_cache(KEY_CACHE *key_cache); |
|
1009 |
||
1010 |
/* report to InnoDB that control passes to the client */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1011 |
int ha_release_temporary_latches(Session *session); |
1
by brian
clean slate |
1012 |
|
960.2.24
by Monty Taylor
Changed handlerton to StorageEngine. |
1013 |
/* transactions: interface to StorageEngine functions */
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1014 |
int ha_start_consistent_snapshot(Session *session); |
1
by brian
clean slate |
1015 |
int ha_commit_or_rollback_by_xid(XID *xid, bool commit); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
1016 |
int ha_commit_one_phase(Session *session, bool all); |
1017 |
int ha_rollback_trans(Session *session, bool all); |
|
1018 |
int ha_prepare(Session *session); |
|
1
by brian
clean slate |
1019 |
int ha_recover(HASH *commit_list); |
1020 |
||
960.2.24
by Monty Taylor
Changed handlerton to StorageEngine. |
1021 |
/* transactions: these functions never call StorageEngine functions directly */
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1022 |
int ha_commit_trans(Session *session, bool all); |
1023 |
int ha_autocommit_or_rollback(Session *session, int error); |
|
1024 |
int ha_enable_transaction(Session *session, bool on); |
|
1
by brian
clean slate |
1025 |
|
1026 |
/* savepoints */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1027 |
int ha_rollback_to_savepoint(Session *session, SAVEPOINT *sv); |
1028 |
int ha_savepoint(Session *session, SAVEPOINT *sv); |
|
1029 |
int ha_release_savepoint(Session *session, SAVEPOINT *sv); |
|
1
by brian
clean slate |
1030 |
|
1031 |
/* these are called by storage engines */
|
|
960.2.37
by Monty Taylor
More naming fixes. |
1032 |
void trans_register_ha(Session *session, bool all, StorageEngine *engine); |
1
by brian
clean slate |
1033 |
|
520.6.7
by Monty Taylor
Moved a bunch of crap out of common_includes. |
1034 |
void table_case_convert(char * name, uint32_t length); |
1035 |
const char *table_case_name(HA_CREATE_INFO *info, const char *name); |
|
1036 |
||
1037 |
extern ulong specialflag; |
|
1038 |
extern uint32_t lower_case_table_names; |
|
1039 |
uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length); |
|
1040 |
uint32_t tablename_to_filename(const char *from, char *to, uint32_t to_length); |
|
1041 |
||
1042 |
||
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
1043 |
bool mysql_ha_open(Session *session, TableList *tables, bool reopen); |
1044 |
bool mysql_ha_close(Session *session, TableList *tables); |
|
1045 |
bool mysql_ha_read(Session *, TableList *,enum enum_ha_read_modes,char *, |
|
1046 |
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows); |
|
1047 |
void mysql_ha_flush(Session *session); |
|
1048 |
void mysql_ha_rm_tables(Session *session, TableList *tables, bool is_locked); |
|
1049 |
void mysql_ha_cleanup(Session *session); |
|
1050 |
||
1
by brian
clean slate |
1051 |
/*
|
1052 |
Storage engine has to assume the transaction will end up with 2pc if
|
|
1053 |
- there is more than one 2pc-capable storage engine available
|
|
1054 |
- in the current transaction 2pc was not disabled yet
|
|
1055 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1056 |
#define trans_need_2pc(session, all) ((total_ha_2pc > 1) && \
|
1057 |
!((all ? &session->transaction.all : &session->transaction.stmt)->no_2pc))
|
|
520.6.4
by Monty Taylor
Moved thr_lock.h out of common_includes. |
1058 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1059 |
|
1060 |
bool mysql_xa_recover(Session *session); |
|
1061 |
||
1062 |
SORT_FIELD * make_unireg_sortorder(order_st *order, uint32_t *length, |
|
1063 |
SORT_FIELD *sortorder); |
|
1064 |
int setup_order(Session *session, Item **ref_pointer_array, TableList *tables, |
|
1065 |
List<Item> &fields, List <Item> &all_fields, order_st *order); |
|
1066 |
int setup_group(Session *session, Item **ref_pointer_array, TableList *tables, |
|
1067 |
List<Item> &fields, List<Item> &all_fields, order_st *order, |
|
1068 |
bool *hidden_group_fields); |
|
846
by Brian Aker
Removing on typedeffed class. |
1069 |
bool fix_inner_refs(Session *session, List<Item> &all_fields, Select_Lex *select, |
575.4.7
by Monty Taylor
More header cleanup. |
1070 |
Item **ref_pointer_array); |
1071 |
||
1072 |
bool handle_select(Session *session, LEX *lex, select_result *result, |
|
892.2.2
by Monty Taylor
More solaris warnings. |
1073 |
uint64_t setup_tables_done_option); |
575.4.7
by Monty Taylor
More header cleanup. |
1074 |
bool mysql_select(Session *session, Item ***rref_pointer_array, |
1075 |
TableList *tables, uint32_t wild_num, List<Item> &list, |
|
1076 |
COND *conds, uint32_t og_num, order_st *order, order_st *group, |
|
923.1.10
by Brian Aker
Remove dead code around old procedures. |
1077 |
Item *having, uint64_t select_type, |
848
by Brian Aker
typdef class removal (just... use the name of the class). |
1078 |
select_result *result, Select_Lex_Unit *unit, |
846
by Brian Aker
Removing on typedeffed class. |
1079 |
Select_Lex *select_lex); |
1080 |
void free_underlaid_joins(Session *session, Select_Lex *select); |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
1081 |
bool mysql_explain_union(Session *session, Select_Lex_Unit *unit, |
575.4.7
by Monty Taylor
More header cleanup. |
1082 |
select_result *result); |
846
by Brian Aker
Removing on typedeffed class. |
1083 |
int mysql_explain_select(Session *session, Select_Lex *sl, char const *type, |
575.4.7
by Monty Taylor
More header cleanup. |
1084 |
select_result *result); |
1085 |
bool mysql_union(Session *session, LEX *lex, select_result *result, |
|
892.2.4
by Monty Taylor
Fixed more warnings. |
1086 |
Select_Lex_Unit *unit, uint64_t setup_tables_done_option); |
575.4.7
by Monty Taylor
More header cleanup. |
1087 |
bool mysql_handle_derived(LEX *lex, bool (*processor)(Session *session, |
1088 |
LEX *lex, |
|
1089 |
TableList *table)); |
|
1090 |
bool mysql_derived_prepare(Session *session, LEX *lex, TableList *t); |
|
1091 |
bool mysql_derived_filling(Session *session, LEX *lex, TableList *t); |
|
1092 |
void sp_prepare_create_field(Session *session, Create_field *sql_field); |
|
1093 |
int prepare_create_field(Create_field *sql_field, |
|
1094 |
uint32_t *blob_columns, |
|
1095 |
int *timestamps, int *timestamps_with_niladic, |
|
1096 |
int64_t table_flags); |
|
1097 |
bool mysql_create_table(Session *session,const char *db, const char *table_name, |
|
1098 |
HA_CREATE_INFO *create_info, |
|
1099 |
Alter_info *alter_info, |
|
1100 |
bool tmp_table, uint32_t select_field_count); |
|
1101 |
bool mysql_create_table_no_lock(Session *session, const char *db, |
|
1102 |
const char *table_name, |
|
1103 |
HA_CREATE_INFO *create_info, |
|
1104 |
Alter_info *alter_info, |
|
1105 |
bool tmp_table, uint32_t select_field_count, |
|
1106 |
bool lock_open_lock); |
|
1107 |
||
1108 |
bool mysql_alter_table(Session *session, char *new_db, char *new_name, |
|
1109 |
HA_CREATE_INFO *create_info, |
|
1110 |
TableList *table_list, |
|
1111 |
Alter_info *alter_info, |
|
1112 |
uint32_t order_num, order_st *order, bool ignore); |
|
1113 |
bool mysql_recreate_table(Session *session, TableList *table_list); |
|
1114 |
bool mysql_create_like_table(Session *session, TableList *table, |
|
1115 |
TableList *src_table, |
|
1116 |
HA_CREATE_INFO *create_info); |
|
960.2.24
by Monty Taylor
Changed handlerton to StorageEngine. |
1117 |
bool mysql_rename_table(StorageEngine *base, const char *old_db, |
575.4.7
by Monty Taylor
More header cleanup. |
1118 |
const char * old_name, const char *new_db, |
1119 |
const char * new_name, uint32_t flags); |
|
1120 |
bool mysql_prepare_update(Session *session, TableList *table_list, |
|
1121 |
Item **conds, uint32_t order_num, order_st *order); |
|
1122 |
int mysql_update(Session *session,TableList *tables,List<Item> &fields, |
|
1123 |
List<Item> &values,COND *conds, |
|
1124 |
uint32_t order_num, order_st *order, ha_rows limit, |
|
1125 |
enum enum_duplicates handle_duplicates, bool ignore); |
|
1126 |
bool mysql_multi_update(Session *session, TableList *table_list, |
|
1127 |
List<Item> *fields, List<Item> *values, |
|
1128 |
COND *conds, uint64_t options, |
|
1129 |
enum enum_duplicates handle_duplicates, bool ignore, |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
1130 |
Select_Lex_Unit *unit, Select_Lex *select_lex); |
575.4.7
by Monty Taylor
More header cleanup. |
1131 |
bool mysql_prepare_insert(Session *session, TableList *table_list, Table *table, |
1132 |
List<Item> &fields, List_item *values, |
|
1133 |
List<Item> &update_fields, |
|
1134 |
List<Item> &update_values, enum_duplicates duplic, |
|
1135 |
COND **where, bool select_insert, |
|
1136 |
bool check_fields, bool abort_on_warning); |
|
1137 |
bool mysql_insert(Session *session,TableList *table,List<Item> &fields, |
|
1138 |
List<List_item> &values, List<Item> &update_fields, |
|
1139 |
List<Item> &update_values, enum_duplicates flag, |
|
1140 |
bool ignore); |
|
1141 |
int check_that_all_fields_are_given_values(Session *session, Table *entry, |
|
1142 |
TableList *table_list); |
|
1143 |
int mysql_prepare_delete(Session *session, TableList *table_list, Item **conds); |
|
1144 |
bool mysql_delete(Session *session, TableList *table_list, COND *conds, |
|
1145 |
SQL_LIST *order, ha_rows rows, uint64_t options, |
|
1146 |
bool reset_auto_increment); |
|
1147 |
bool mysql_truncate(Session *session, TableList *table_list, bool dont_send_ok); |
|
1019
by Brian Aker
Remove the need for TMP_TABLE_KEY_EXTRA (we don't replicate temp tables). |
1148 |
uint32_t create_table_def_key(char *key, TableList *table_list); |
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
1149 |
TableShare *get_table_share(Session *session, TableList *table_list, char *key, |
575.4.7
by Monty Taylor
More header cleanup. |
1150 |
uint32_t key_length, uint32_t db_flags, int *error); |
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
1151 |
void release_table_share(TableShare *share, enum release_type type); |
1152 |
TableShare *get_cached_table_share(const char *db, const char *table_name); |
|
575.4.7
by Monty Taylor
More header cleanup. |
1153 |
Table *open_ltable(Session *session, TableList *table_list, thr_lock_type update, |
1154 |
uint32_t lock_flags); |
|
1155 |
Table *open_table(Session *session, TableList *table_list, bool *refresh, uint32_t flags); |
|
1156 |
bool name_lock_locked_table(Session *session, TableList *tables); |
|
1157 |
bool reopen_name_locked_table(Session* session, TableList* table_list, bool link_in); |
|
1158 |
Table *table_cache_insert_placeholder(Session *session, const char *key, |
|
1159 |
uint32_t key_length); |
|
1160 |
bool lock_table_name_if_not_cached(Session *session, const char *db, |
|
1161 |
const char *table_name, Table **table); |
|
1162 |
Table *find_locked_table(Session *session, const char *db,const char *table_name); |
|
1163 |
void detach_merge_children(Table *table, bool clear_refs); |
|
1164 |
bool fix_merge_after_open(TableList *old_child_list, TableList **old_last, |
|
1165 |
TableList *new_child_list, TableList **new_last); |
|
1166 |
bool reopen_table(Table *table); |
|
1167 |
bool reopen_tables(Session *session,bool get_locks,bool in_refresh); |
|
1168 |
void close_data_files_and_morph_locks(Session *session, const char *db, |
|
1169 |
const char *table_name); |
|
1170 |
void close_handle_and_leave_table_as_lock(Table *table); |
|
1000.1.3
by Brian Aker
Renamed TABLE_SHARE to TableShare |
1171 |
bool open_new_frm(Session *session, TableShare *share, const char *alias, |
575.4.7
by Monty Taylor
More header cleanup. |
1172 |
uint32_t db_stat, uint32_t prgflag, |
1173 |
uint32_t ha_open_flags, Table *outparam, |
|
1174 |
TableList *table_desc, MEM_ROOT *mem_root); |
|
1175 |
bool wait_for_tables(Session *session); |
|
1176 |
bool table_is_used(Table *table, bool wait_for_name_lock); |
|
1177 |
Table *drop_locked_tables(Session *session,const char *db, const char *table_name); |
|
1178 |
void abort_locked_tables(Session *session,const char *db, const char *table_name); |
|
1179 |
extern Field *not_found_field; |
|
1180 |
extern Field *view_ref_found; |
|
1181 |
||
1182 |
Field * |
|
1183 |
find_field_in_tables(Session *session, Item_ident *item, |
|
1184 |
TableList *first_table, TableList *last_table, |
|
1185 |
Item **ref, find_item_error_report_type report_error, |
|
1186 |
bool check_privileges, bool register_tree_change); |
|
1187 |
Field * |
|
1188 |
find_field_in_table_ref(Session *session, TableList *table_list, |
|
1189 |
const char *name, uint32_t length, |
|
1190 |
const char *item_name, const char *db_name, |
|
1191 |
const char *table_name, Item **ref, |
|
1192 |
bool check_privileges, bool allow_rowid, |
|
1193 |
uint32_t *cached_field_index_ptr, |
|
1194 |
bool register_tree_change, TableList **actual_table); |
|
1195 |
Field * |
|
1196 |
find_field_in_table(Session *session, Table *table, const char *name, uint32_t length, |
|
1197 |
bool allow_rowid, uint32_t *cached_field_index_ptr); |
|
1198 |
Field * |
|
1199 |
find_field_in_table_sef(Table *table, const char *name); |
|
1200 |
int update_virtual_fields_marked_for_write(Table *table, |
|
1201 |
bool ignore_stored=true); |
|
1202 |
||
1203 |
||
520.6.4
by Monty Taylor
Moved thr_lock.h out of common_includes. |
1204 |
#endif /* DRIZZLED_HANDLER_H */ |