~drizzle-trunk/drizzle/development

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>
1660.1.1 by Brian Aker
Merge in move identifier work.
25
#include <drizzled/identifier.h>
1802.16.11 by Padraig O'Sullivan
Remove cpp and header file with MyBitmap class and associated functions. No longer needed.
26
#include <drizzled/definitions.h>
27
#include <drizzled/key_map.h>
520.4.31 by Monty Taylor
Removed server_id from common_includes.
28
1183.1.2 by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted
29
/* Definitions for parameters to do with Cursor-routines */
1 by brian
clean slate
30
1241.9.43 by Monty Taylor
Merged trunk. Also renamed thr_lock. Doh. I hate it when I do both.
31
#include <drizzled/thr_lock.h>
520.8.5 by Monty Taylor
Removed sql_string and sql_list from common_includes.
32
#include <drizzled/sql_string.h>
33
#include <drizzled/sql_list.h>
960.2.23 by Monty Taylor
Moved handlerton to plugin/storage_engine.h.
34
#include <drizzled/plugin/storage_engine.h>
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
35
#include <drizzled/handler_structs.h>
36
#include <drizzled/ha_statistics.h>
1046.1.8 by Brian Aker
Remove race condition around refresh (aka... multi-thread writeable global
37
#include <drizzled/atomics.h>
520.6.4 by Monty Taylor
Moved thr_lock.h out of common_includes.
38
1008.3.20 by Stewart Smith
Put table_name into table proto in parser, and use that when creating table proto file.
39
#include <drizzled/message/table.pb.h>
40
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).
41
#include <bitset>
42
#include <algorithm>
1005.2.6 by Monty Taylor
Re-added bitset<> as a replacement for Bitmap<>
43
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
44
namespace drizzled
45
{
46
520.6.4 by Monty Taylor
Moved thr_lock.h out of common_includes.
47
#define HA_MAX_ALTER_FLAGS 40
1130.1.5 by Monty Taylor
Split StorageEngine into slot. This completes the plugin-slot-reorg. Woot.
48
1005.2.6 by Monty Taylor
Re-added bitset<> as a replacement for Bitmap<>
49
typedef std::bitset<HA_MAX_ALTER_FLAGS> HA_ALTER_FLAGS;
1 by brian
clean slate
50
1220.1.3 by Brian Aker
Remove atomic on refresh (go back to do it via lazy method).
51
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
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;
1455.6.1 by Yanbo Wu
convert st_foreign_key_info to class ForeignKeyInfo
57
class ForeignKeyInfo;
584.1.13 by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes.
58
struct order_st;
1 by brian
clean slate
59
60
class Item;
61
575.4.7 by Monty Taylor
More header cleanup.
62
class LEX;
846 by Brian Aker
Removing on typedeffed class.
63
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.
64
class AlterInfo;
575.4.7 by Monty Taylor
More header cleanup.
65
class select_result;
1052.2.3 by Nathan Williams
No actual code changes. Changed Create_field to CreateField to be consistent with coding standards.
66
class CreateField;
575.4.7 by Monty Taylor
More header cleanup.
67
class sys_var_str;
68
class Item_ident;
69
70
typedef List<Item> List_item;
1 by brian
clean slate
71
extern KEY_CREATE_INFO default_key_create_info;
72
73
/* Forward declaration for condition pushdown to storage engine */
74
typedef class Item COND;
75
1273.16.8 by Brian Aker
Remove typedef.
76
typedef struct system_status_var system_status_var;
1 by brian
clean slate
77
1336.3.1 by Djellel E. Difallah
Cleanup & Encapsulate the COST_VECT class, and remove ./drizzled/cursor.h self include
78
namespace optimizer
79
{
1336.3.2 by Djellel E. Difallah
rename class COST_VECT to CostVector and move it to ./drizzled/optimizer directory
80
  class CostVector;
1336.3.1 by Djellel E. Difallah
Cleanup & Encapsulate the COST_VECT class, and remove ./drizzled/cursor.h self include
81
}
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
82
1 by brian
clean slate
83
/*
84
  bitmap with first N+1 bits set
85
  (keypart_map for a key prefix of [0..N] keyparts)
86
*/
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
87
template<class T>
88
inline key_part_map make_keypart_map(T a)
89
{
90
  return (((key_part_map)2 << a) - 1);
91
}
92
1 by brian
clean slate
93
/*
94
  bitmap with first N bits set
95
  (keypart_map for a key prefix of [0..N-1] keyparts)
96
*/
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
97
template<class T>
98
inline key_part_map make_prev_keypart_map(T a)
99
{
100
  return (((key_part_map)1 << a) - 1);
101
}
1 by brian
clean slate
102
103
/**
1183.1.2 by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted
104
  The Cursor class is the interface for dynamically loadable
1 by brian
clean slate
105
  storage engines. Do not add ifdefs and take care when adding or
106
  changing virtual functions to avoid vtable confusion
107
108
  Functions in this class accept and return table columns data. Two data
109
  representation formats are used:
110
  1. TableRecordFormat - Used to pass [partial] table records to/from
111
     storage engine
112
113
  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
114
     storage engine. See optimizer/range.cc for description of this format.
1 by brian
clean slate
115
116
  TableRecordFormat
117
  =================
118
  [Warning: this description is work in progress and may be incomplete]
119
  The table record is stored in a fixed-size buffer:
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
120
1 by brian
clean slate
121
    record: null_bytes, column1_data, column2_data, ...
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
122
123
  The offsets of the parts of the buffer are also fixed: every column has
1 by brian
clean slate
124
  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:
125
  bit in null_bytes.
1 by brian
clean slate
126
127
  The record buffer only includes data about columns that are marked in the
128
  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:
129
  the situation).
1 by brian
clean slate
130
  <not-sure>It could be that it is required that null bits of non-present
131
  columns are set to 1</not-sure>
132
133
  VARIOUS EXCEPTIONS AND SPECIAL CASES
134
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
135
  f the table has no nullable columns, then null_bytes is still
136
  present, its length is one byte <not-sure> which must be set to 0xFF
1 by brian
clean slate
137
  at all times. </not-sure>
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
138
139
  For blob columns (see Field_blob), the record buffer stores length of the
140
  data, following by memory pointer to the blob data. The pointer is owned
1 by brian
clean slate
141
  by the storage engine and is valid until the next operation.
142
143
  If a blob column has NULL value, then its length and blob data pointer
144
  must be set to 0.
145
*/
1680.6.1 by Brian Aker
Remove call for using special new for a cursor.
146
class Cursor
1 by brian
clean slate
147
{
148
protected:
1000.1.3 by Brian Aker
Renamed TABLE_SHARE to TableShare
149
  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).
150
  Table *table;               /* The current open table */
1 by brian
clean slate
151
152
  ha_rows estimation_rows_to_insert;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
153
  plugin::StorageEngine *engine;      /* storage engine of this Cursor */
1506 by Brian Aker
encapsulate engine inside of cursor.
154
public:
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
155
  inline plugin::StorageEngine *getEngine() const	/* table_type for handler */
1233.1.2 by Brian Aker
Move stat read define into engine flags.
156
  {
157
    return engine;
158
  }
159
  unsigned char *ref;				/* Pointer to current row */
481 by Brian Aker
Remove all of uchar.
160
  unsigned char *dup_ref;			/* Pointer to duplicate row */
1 by brian
clean slate
161
1532.1.15 by Brian Aker
Partial encapsulation of TableShare from Table.
162
  TableShare *getShare() const
163
  {
164
    return table_share;
165
  }
166
1 by brian
clean slate
167
  ha_statistics stats;
168
  /** MultiRangeRead-related members: */
169
  range_seq_t mrr_iter;    /* Interator to traverse the range sequence */
170
  RANGE_SEQ_IF mrr_funcs;  /* Range sequence traversal functions */
1682.1.1 by Stewart Smith
remove the unused HANDLER_BUFFER struct, typedef and members that were unused
171
482 by Brian Aker
Remove uint.
172
  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
173
  /* true <=> source MRR ranges and the output are ordered */
1 by brian
clean slate
174
  bool mrr_is_output_sorted;
175
51.1.77 by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols
176
  /** true <=> we're currently traversing a range in mrr_cur_range. */
1 by brian
clean slate
177
  bool mrr_have_range;
1030.1.1 by Brian Aker
Straighten out structures (remove some some dead bits).
178
179
  bool eq_range;
180
1 by brian
clean slate
181
  /** Current range (the one we're now returning rows from) */
182
  KEY_MULTI_RANGE mrr_cur_range;
183
184
  /** The following are for read_range() */
185
  key_range save_end_range, *end_range;
1534 by Brian Aker
Remove of KeyPartInfo
186
  KeyPartInfo *range_key_part;
1 by brian
clean slate
187
  int key_compare_result_on_equal;
188
482 by Brian Aker
Remove uint.
189
  uint32_t errkey;				/* Last dup key */
190
  uint32_t key_used_on_scan;
191
  uint32_t active_index;
1 by brian
clean slate
192
  /** Length of ref (1-8 or the clustered key length) */
482 by Brian Aker
Remove uint.
193
  uint32_t ref_length;
1 by brian
clean slate
194
  enum {NONE=0, INDEX, RND} inited;
195
  bool locked;
196
197
  /**
198
    next_insert_id is the next value which should be inserted into the
199
    auto_increment column: in a inserting-multi-row statement (like INSERT
200
    SELECT), for the first row where the autoinc value is not specified by the
201
    statement, get_auto_increment() called and asked to generate a value,
202
    next_insert_id is set to the next value, then for all other rows
203
    next_insert_id is used (and increased each time) without calling
204
    get_auto_increment().
205
  */
206
  uint64_t next_insert_id;
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
207
  uint64_t getNextInsertId()
208
  {
209
    return next_insert_id;
210
  }
211
1 by brian
clean slate
212
  /**
213
    insert id for the current row (*autogenerated*; if not
214
    autogenerated, it's 0).
215
    At first successful insertion, this variable is stored into
520.1.21 by Brian Aker
THD -> Session rename
216
    Session::first_successful_insert_id_in_cur_stmt.
1 by brian
clean slate
217
  */
218
  uint64_t insert_id_for_cur_row;
219
  /**
220
    Interval returned by get_auto_increment() and being consumed by the
221
    inserter.
222
  */
223
  Discrete_interval auto_inc_interval_for_cur_row;
224
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
225
  Cursor(plugin::StorageEngine &engine_arg, TableShare &share_arg);
1183.1.2 by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted
226
  virtual ~Cursor(void);
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
227
  virtual Cursor *clone(memory::Root *mem_root);
575.1.4 by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h.
228
1 by brian
clean slate
229
  /* ha_ methods: pubilc wrappers for private virtual API */
230
1749.3.9 by Brian Aker
Remove table name from ha_open (we modified this a while ago to just use
231
  int ha_open(const TableIdentifier &identifier, Table *table, int mode, int test_if_locked);
1491.1.6 by Jay Pipes
Cursor::ha_index_init() -> Cursor::startIndexScan(). Cursor::ha_index_end() -> Cursor::endIndexScan()
232
  int startIndexScan(uint32_t idx, bool sorted);
233
  int endIndexScan();
1491.1.10 by Jay Pipes
ha_rnd_init -> startTableScan, rnd_init -> doStartTableScan, ha_rnd_end -> endTableScan, rnd_end -> doEndTableScan
234
  int startTableScan(bool scan);
235
  int endTableScan();
1 by brian
clean slate
236
  int ha_reset();
575.1.4 by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h.
237
1 by brian
clean slate
238
  /* 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.
239
  int ha_index_or_rnd_end();
240
1 by brian
clean slate
241
  /**
242
    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
243
    Cursor class, hence they are *not* virtual. For the inheritance
1491.1.3 by Jay Pipes
Cursor::update_row() changed to doUpdateRecord() and updateRecord()
244
    interface, see the (private) functions doInsertRecord(), doUpdateRecord(),
1491.1.4 by Jay Pipes
delete_row() is now deleteRecord() and doDeleteRecord() in Cursor
245
    and doDeleteRecord() below.
1 by brian
clean slate
246
  */
520.1.22 by Brian Aker
Second pass of thd cleanup
247
  int ha_external_lock(Session *session, int lock_type);
1491.1.2 by Jay Pipes
Cursor::write_row() -> Cursor::doInsertRecord(). Cursor::ha_write_row() -> Cursor::insertRecord()
248
  int insertRecord(unsigned char * buf);
1491.1.3 by Jay Pipes
Cursor::update_row() changed to doUpdateRecord() and updateRecord()
249
  int updateRecord(const unsigned char * old_data, unsigned char * new_data);
1491.1.4 by Jay Pipes
delete_row() is now deleteRecord() and doDeleteRecord() in Cursor
250
  int deleteRecord(const unsigned char * buf);
1 by brian
clean slate
251
  void ha_release_auto_increment();
252
253
  /** to be actually called to get 'check()' functionality*/
520.1.22 by Brian Aker
Second pass of thd cleanup
254
  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).
255
575.1.4 by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h.
256
  void ha_start_bulk_insert(ha_rows rows);
257
  int ha_end_bulk_insert();
1 by brian
clean slate
258
  int ha_delete_all_rows();
259
  int ha_reset_auto_increment(uint64_t value);
520.1.22 by Brian Aker
Second pass of thd cleanup
260
  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.
261
482 by Brian Aker
Remove uint.
262
  int ha_disable_indexes(uint32_t mode);
263
  int ha_enable_indexes(uint32_t mode);
200 by Brian Aker
my_bool from handler and set_var
264
  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
265
  void closeMarkForDelete(const char *name);
1 by brian
clean slate
266
267
  void adjust_next_insert_id_after_explicit_value(uint64_t nr);
268
  int update_auto_increment();
1000.1.3 by Brian Aker
Renamed TABLE_SHARE to TableShare
269
  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.
270
1 by brian
clean slate
271
  /* Estimates calculation */
53.2.32 by Monty Taylor
First large swath at getting handler stuff clean.
272
  virtual double scan_time(void)
151 by Brian Aker
Ulonglong to uint64_t
273
  { return uint64_t2double(stats.data_file_length) / IO_SIZE + 2; }
645 by Brian Aker
Cleanup unused attribute
274
  virtual double read_time(uint32_t, uint32_t ranges, ha_rows rows)
1 by brian
clean slate
275
  { return rows2double(ranges+rows); }
276
482 by Brian Aker
Remove uint.
277
  virtual double index_only_read_time(uint32_t keynr, double records);
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
278
482 by Brian Aker
Remove uint.
279
  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:
280
                                              void *seq_init_param,
482 by Brian Aker
Remove uint.
281
                                              uint32_t n_ranges, uint32_t *bufsz,
1336.3.2 by Djellel E. Difallah
rename class COST_VECT to CostVector and move it to ./drizzled/optimizer directory
282
                                              uint32_t *flags, optimizer::CostVector *cost);
482 by Brian Aker
Remove uint.
283
  virtual int multi_range_read_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys,
1336.3.2 by Djellel E. Difallah
rename class COST_VECT to CostVector and move it to ./drizzled/optimizer directory
284
                                    uint32_t *bufsz, uint32_t *flags, optimizer::CostVector *cost);
1 by brian
clean slate
285
  virtual int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
1491 by Brian Aker
Remove call bits in dead mrr caller.
286
                                    uint32_t n_ranges, uint32_t mode);
1 by brian
clean slate
287
  virtual int multi_range_read_next(char **range_info);
288
289
575.1.4 by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h.
290
  virtual const key_map *keys_to_use_for_scanning();
291
  bool has_transactions();
1 by brian
clean slate
292
293
  /**
294
    This method is used to analyse the error to see whether the error
295
    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
296
    ignorable than others. E.g. the partition Cursor can get inserts
1 by brian
clean slate
297
    into a range where there is no partition and this is an ignorable
298
    error.
299
    HA_ERR_FOUND_DUP_UNIQUE is a special case in MyISAM that means the
300
    same thing as HA_ERR_FOUND_DUP_KEY but can in some cases lead to
301
    a slightly different error message.
302
  */
575.1.4 by Monty Taylor
Moved implementation of some methods into handler.cc from handler.h.
303
  virtual bool is_fatal_error(int error, uint32_t flags);
1 by brian
clean slate
304
305
  /**
306
    Number of rows in table. It will only be called if
307
    (table_flags() & (HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT)) != 0
308
  */
575.1.5 by Monty Taylor
Moved stuff to handlerton.cc
309
  virtual ha_rows records();
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
310
  virtual uint64_t tableSize();
311
  virtual uint64_t rowSize();
1 by brian
clean slate
312
  /**
313
    Return upper bound of current number of records in the table
314
    (max. of how many records one will retrieve when doing a full table scan)
315
    If upper bound is not known, HA_POS_ERROR should be returned as a max
316
    possible upper bound.
317
  */
318
  virtual ha_rows estimate_rows_upper_bound()
319
  { return stats.records+EXTRA_RECORDS; }
320
645 by Brian Aker
Cleanup unused attribute
321
  virtual const char *index_type(uint32_t)
51.1.77 by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols
322
  { assert(0); return "";}
1 by brian
clean slate
323
324
482 by Brian Aker
Remove uint.
325
  uint32_t get_index(void) const { return active_index; }
1 by brian
clean slate
326
  virtual int close(void)=0;
327
328
  /**
329
     @brief
330
     Positions an index cursor to the index specified in the handle. Fetches the
331
     row if available. If the key value is null, begin at the first key of the
332
     index.
333
  */
1483 by Brian Aker
Small change to move over call to cursor API.
334
  virtual int index_read_map(unsigned char * buf, const unsigned char *key,
1 by brian
clean slate
335
                             key_part_map keypart_map,
336
                             enum ha_rkey_function find_flag)
337
  {
1483 by Brian Aker
Small change to move over call to cursor API.
338
    uint32_t key_len= calculate_key_len(active_index, keypart_map);
1 by brian
clean slate
339
    return  index_read(buf, key, key_len, find_flag);
340
  }
341
  /**
342
     @brief
343
     Positions an index cursor to the index specified in the handle. Fetches the
344
     row if available. If the key value is null, begin at the first key of the
345
     index.
346
  */
656.1.1 by Monty Taylor
OOOh doggie. Got rid of my_alloca.
347
  virtual int index_read_idx_map(unsigned char * buf, uint32_t index,
348
                                 const unsigned char * key,
1 by brian
clean slate
349
                                 key_part_map keypart_map,
350
                                 enum ha_rkey_function find_flag);
645 by Brian Aker
Cleanup unused attribute
351
  virtual int index_next(unsigned char *)
352
   { return  HA_ERR_WRONG_COMMAND; }
353
  virtual int index_prev(unsigned char *)
354
   { return  HA_ERR_WRONG_COMMAND; }
355
  virtual int index_first(unsigned char *)
356
   { return  HA_ERR_WRONG_COMMAND; }
357
  virtual int index_last(unsigned char *)
358
   { return  HA_ERR_WRONG_COMMAND; }
359
  virtual int index_next_same(unsigned char *, const unsigned char *, uint32_t);
1483 by Brian Aker
Small change to move over call to cursor API.
360
361
private:
362
  uint32_t calculate_key_len(uint32_t key_position, key_part_map keypart_map_arg);
363
public:
364
1 by brian
clean slate
365
  /**
366
     @brief
367
     The following functions works like index_read, but it find the last
368
     row with the current key value or prefix.
369
  */
481 by Brian Aker
Remove all of uchar.
370
  virtual int index_read_last_map(unsigned char * buf, const unsigned char * key,
1 by brian
clean slate
371
                                  key_part_map keypart_map)
372
  {
1483 by Brian Aker
Small change to move over call to cursor API.
373
    uint32_t key_len= calculate_key_len(active_index, keypart_map);
1 by brian
clean slate
374
    return index_read_last(buf, key, key_len);
375
  }
376
  virtual int read_range_first(const key_range *start_key,
377
                               const key_range *end_key,
378
                               bool eq_range, bool sorted);
379
  virtual int read_range_next();
380
  int compare_key(key_range *range);
645 by Brian Aker
Cleanup unused attribute
381
  virtual int rnd_next(unsigned char *)=0;
382
  virtual int rnd_pos(unsigned char *, unsigned char *)=0;
482 by Brian Aker
Remove uint.
383
  virtual int read_first_row(unsigned char *buf, uint32_t primary_key);
645 by Brian Aker
Cleanup unused attribute
384
  virtual int rnd_same(unsigned char *, uint32_t)
385
    { return HA_ERR_WRONG_COMMAND; }
386
  virtual ha_rows records_in_range(uint32_t, key_range *, key_range *)
1 by brian
clean slate
387
    { return (ha_rows) 10; }
481 by Brian Aker
Remove all of uchar.
388
  virtual void position(const unsigned char *record)=0;
895 by Brian Aker
Completion (?) of uint conversion.
389
  virtual int info(uint32_t)=0; // see my_base.h for full description
645 by Brian Aker
Cleanup unused attribute
390
  virtual uint32_t calculate_key_hash_value(Field **)
51.1.77 by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols
391
  { assert(0); return 0; }
645 by Brian Aker
Cleanup unused attribute
392
  virtual int extra(enum ha_extra_function)
1 by brian
clean slate
393
  { return 0; }
645 by Brian Aker
Cleanup unused attribute
394
  virtual int extra_opt(enum ha_extra_function operation, uint32_t)
1 by brian
clean slate
395
  { return extra(operation); }
396
397
  /**
398
    In an UPDATE or DELETE, if the row under the cursor was locked by another
399
    transaction, and the engine used an optimistic read of the last
400
    committed row value under the cursor, then the engine returns 1 from this
401
    function. MySQL must NOT try to update this optimistic value. If the
402
    optimistic value does not match the WHERE condition, MySQL can decide to
403
    skip over this row. Currently only works for InnoDB. This can be used to
404
    avoid unnecessary lock waits.
405
406
    If this method returns nonzero, it will also signal the storage
407
    engine that the next read will be a locking re-read of the row.
408
  */
409
  virtual bool was_semi_consistent_read() { return 0; }
410
  /**
411
    Tell the engine whether it should avoid unnecessary lock waits.
412
    If yes, in an UPDATE or DELETE, if the row under the cursor was locked
413
    by another transaction, the engine may try an optimistic read of
414
    the last committed row value under the cursor.
415
  */
416
  virtual void try_semi_consistent_read(bool) {}
53.2.32 by Monty Taylor
First large swath at getting handler stuff clean.
417
  virtual void unlock_row(void) {}
1 by brian
clean slate
418
  virtual void get_auto_increment(uint64_t offset, uint64_t increment,
419
                                  uint64_t nb_desired_values,
420
                                  uint64_t *first_value,
1377.7.2 by Stewart Smith
make get_auto_increment pure virtual and force engines not supporting auto_increment to be explicit about it
421
                                  uint64_t *nb_reserved_values)= 0;
1377.7.1 by Stewart Smith
remove default get_auto_increment() implementation from Cursor. It's not safe when you don't have full table locks (it does a read of the MAX value for the column and then allocates after that). Instead leave a empty implementation that engines supporting auto_increment should implement.
422
1 by brian
clean slate
423
  void set_next_insert_id(uint64_t id)
424
  {
425
    next_insert_id= id;
426
  }
427
  void restore_auto_increment(uint64_t prev_insert_id)
428
  {
429
    /*
430
      Insertion of a row failed, re-use the lastly generated auto_increment
431
      id, for the next row. This is achieved by resetting next_insert_id to
432
      what it was before the failed insertion (that old value is provided by
433
      the caller). If that value was 0, it was the first row of the INSERT;
434
      then if insert_id_for_cur_row contains 0 it means no id was generated
435
      for this first row, so no id was generated since the INSERT started, so
436
      we should set next_insert_id to 0; if insert_id_for_cur_row is not 0, it
437
      is the generated id of the first and failed row, so we use it.
438
    */
439
    next_insert_id= (prev_insert_id > 0) ? prev_insert_id :
440
      insert_id_for_cur_row;
441
  }
442
443
  /* end of the list of admin commands */
444
445
  virtual int indexes_are_disabled(void) {return 0;}
645 by Brian Aker
Cleanup unused attribute
446
  virtual void append_create_info(String *)
53.2.32 by Monty Taylor
First large swath at getting handler stuff clean.
447
  {}
1 by brian
clean slate
448
  /**
449
      If index == MAX_KEY then a check for table is made and if index <
450
      MAX_KEY then a check is made if the table has foreign keys and if
451
      a foreign key uses this index (and thus the index cannot be dropped).
452
453
    @param  index            Index to check if foreign key uses it
454
51.1.77 by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols
455
    @retval   true            Foreign key defined on table or index
456
    @retval   false           No foreign key defined
1 by brian
clean slate
457
  */
53.2.32 by Monty Taylor
First large swath at getting handler stuff clean.
458
  virtual char* get_foreign_key_create_info(void)
1019.1.6 by Brian Aker
A number of random cleanups.
459
  { return NULL;}  /* gets foreign key create string from InnoDB */
1008.3.25 by Stewart Smith
slight semantic improvement in handler::can_switch_engines
460
  /** used in ALTER Table; if changing storage engine is allowed.
461
      e.g. not be allowed if table has foreign key constraints in engine.
462
   */
463
  virtual bool can_switch_engines(void) { return true; }
1 by brian
clean slate
464
  /** used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */
1455.6.1 by Yanbo Wu
convert st_foreign_key_info to class ForeignKeyInfo
465
  virtual int get_foreign_key_list(Session *, List<ForeignKeyInfo> *)
1 by brian
clean slate
466
  { return 0; }
482 by Brian Aker
Remove uint.
467
  virtual uint32_t referenced_by_foreign_key() { return 0;}
645 by Brian Aker
Cleanup unused attribute
468
  virtual void free_foreign_key_create_info(char *) {}
1 by brian
clean slate
469
470
  /**
471
    Is not invoked for non-transactional temporary tables.
472
473
    @note store_lock() can return more than one lock if the table is MERGE
474
    or partitioned.
475
476
    @note that one can NOT rely on table->in_use in store_lock().  It may
477
    refer to a different thread if called from mysql_lock_abort_for_thread().
478
479
    @note If the table is MERGE, store_lock() can return less locks
480
    than lock_count() claimed. This can happen when the MERGE children
481
    are not attached when this is called from another thread.
482
  */
1222.1.11 by Brian Aker
Remove dead store_lock() path.
483
  virtual THR_LOCK_DATA **store_lock(Session *,
1 by brian
clean slate
484
                                     THR_LOCK_DATA **to,
1222.1.11 by Brian Aker
Remove dead store_lock() path.
485
                                     enum thr_lock_type)
486
  {
1222.1.12 by Brian Aker
Fix for Solaris build.
487
    assert(0); // Impossible programming situation
1222.1.11 by Brian Aker
Remove dead store_lock() path.
488
489
    return(to);
490
  }
1 by brian
clean slate
491
492
 /*
51.1.77 by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols
493
   @retval true   Primary key (if there is one) is clustered
1 by brian
clean slate
494
                  key covering all fields
51.1.77 by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols
495
   @retval false  otherwise
1 by brian
clean slate
496
 */
51.1.77 by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols
497
 virtual bool primary_key_is_clustered() { return false; }
481 by Brian Aker
Remove all of uchar.
498
 virtual int cmp_ref(const unsigned char *ref1, const unsigned char *ref2)
1 by brian
clean slate
499
 {
500
   return memcmp(ref1, ref2, ref_length);
501
 }
502
1220.1.12 by Brian Aker
Small cleanup from something Jay noticed.
503
  virtual bool isOrdered(void)
1 by brian
clean slate
504
  {
1220.1.12 by Brian Aker
Small cleanup from something Jay noticed.
505
    return false;
1 by brian
clean slate
506
  }
507
1220.1.12 by Brian Aker
Small cleanup from something Jay noticed.
508
1 by brian
clean slate
509
protected:
510
  /* Service methods for use by storage engines. */
1561.3.12 by Joe Daly
add missing header file, and change ha_statistic_increment from ulong to uint64_t
511
  void ha_statistic_increment(uint64_t system_status_var::*offset) const;
520.1.21 by Brian Aker
THD -> Session rename
512
  void **ha_data(Session *) const;
1 by brian
clean slate
513
514
private:
515
  /* Private helpers */
1273.1.12 by Jay Pipes
Cleanup style and documentation for ResourceContext and setTransactionReadWrite
516
  inline void setTransactionReadWrite();
1 by brian
clean slate
517
private:
518
  /*
519
    Low-level primitives for storage engines.  These should be
520
    overridden by the storage engine class. To call these methods, use
521
    the corresponding 'ha_*' method above.
522
  */
523
1633.4.2 by Brian Aker
Merge up changes to ha_innodb
524
  virtual int open(const char *, int , uint32_t ) { assert(0); return -1; };
1626.3.3 by Brian Aker
Additional checks on path.
525
  virtual int doOpen(const TableIdentifier &identifier, int mode, uint32_t test_if_locked);
1491.1.6 by Jay Pipes
Cursor::ha_index_init() -> Cursor::startIndexScan(). Cursor::ha_index_end() -> Cursor::endIndexScan()
526
  virtual int doStartIndexScan(uint32_t idx, bool)
53.2.32 by Monty Taylor
First large swath at getting handler stuff clean.
527
  { active_index= idx; return 0; }
1491.1.6 by Jay Pipes
Cursor::ha_index_init() -> Cursor::startIndexScan(). Cursor::ha_index_end() -> Cursor::endIndexScan()
528
  virtual int doEndIndexScan() { active_index= MAX_KEY; return 0; }
1 by brian
clean slate
529
  /**
1491.1.10 by Jay Pipes
ha_rnd_init -> startTableScan, rnd_init -> doStartTableScan, ha_rnd_end -> endTableScan, rnd_end -> doEndTableScan
530
    doStartTableScan() can be called two times without doEndTableScan() in between
1 by brian
clean slate
531
    (it only makes sense if scan=1).
532
    then the second call should prepare for the new table scan (e.g
533
    if rnd_init allocates the cursor, second call should position it
534
    to the start of the table, no need to deallocate and allocate it again
535
  */
1491.1.10 by Jay Pipes
ha_rnd_init -> startTableScan, rnd_init -> doStartTableScan, ha_rnd_end -> endTableScan, rnd_end -> doEndTableScan
536
  virtual int doStartTableScan(bool scan)= 0;
537
  virtual int doEndTableScan() { return 0; }
1491.1.2 by Jay Pipes
Cursor::write_row() -> Cursor::doInsertRecord(). Cursor::ha_write_row() -> Cursor::insertRecord()
538
  virtual int doInsertRecord(unsigned char *)
645 by Brian Aker
Cleanup unused attribute
539
  {
540
    return HA_ERR_WRONG_COMMAND;
541
  }
542
1491.1.3 by Jay Pipes
Cursor::update_row() changed to doUpdateRecord() and updateRecord()
543
  virtual int doUpdateRecord(const unsigned char *, unsigned char *)
645 by Brian Aker
Cleanup unused attribute
544
  {
545
    return HA_ERR_WRONG_COMMAND;
546
  }
547
1491.1.4 by Jay Pipes
delete_row() is now deleteRecord() and doDeleteRecord() in Cursor
548
  virtual int doDeleteRecord(const unsigned char *)
1 by brian
clean slate
549
  {
550
    return HA_ERR_WRONG_COMMAND;
551
  }
552
  /**
553
    Reset state of file to after 'open'.
554
    This function is called after every statement for all tables used
555
    by that statement.
556
  */
557
  virtual int reset() { return 0; }
558
559
  /**
560
    Is not invoked for non-transactional temporary tables.
561
562
    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
563
    from the table. This call is prefixed with a call to Cursor::store_lock()
564
    and is invoked only for those Cursor instances that stored the lock.
1 by brian
clean slate
565
566
    Calls to rnd_init/index_init are prefixed with this call. When table
567
    IO is complete, we call external_lock(F_UNLCK).
568
    A storage engine writer should expect that each call to
569
    ::external_lock(F_[RD|WR]LOCK is followed by a call to
570
    ::external_lock(F_UNLCK). If it is not, it is a bug in MySQL.
571
572
    The name and signature originate from the first implementation
573
    in MyISAM, which would call fcntl to set/clear an advisory
574
    lock on the data file in this method.
575
576
    @param   lock_type    F_RDLCK, F_WRLCK, F_UNLCK
577
578
    @return  non-0 in case of failure, 0 in case of success.
579
    When lock_type is F_UNLCK, the return value is ignored.
580
  */
645 by Brian Aker
Cleanup unused attribute
581
  virtual int external_lock(Session *, int)
1 by brian
clean slate
582
  {
583
    return 0;
584
  }
53.2.32 by Monty Taylor
First large swath at getting handler stuff clean.
585
  virtual void release_auto_increment(void) { return; };
1 by brian
clean slate
586
  /** 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
587
  virtual int check(Session *)
1 by brian
clean slate
588
  { return HA_ADMIN_NOT_IMPLEMENTED; }
589
645 by Brian Aker
Cleanup unused attribute
590
  virtual void start_bulk_insert(ha_rows)
53.2.32 by Monty Taylor
First large swath at getting handler stuff clean.
591
  {}
592
  virtual int end_bulk_insert(void) { return 0; }
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
593
  virtual int index_read(unsigned char *, const unsigned char *,
645 by Brian Aker
Cleanup unused attribute
594
                         uint32_t, enum ha_rkey_function)
1 by brian
clean slate
595
   { return  HA_ERR_WRONG_COMMAND; }
645 by Brian Aker
Cleanup unused attribute
596
  virtual int index_read_last(unsigned char *, const unsigned char *, uint32_t)
1241.9.57 by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined.
597
   { return (errno= HA_ERR_WRONG_COMMAND); }
1 by brian
clean slate
598
  /**
599
    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
600
    If the Cursor don't support this, then this function will
1 by brian
clean slate
601
    return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one
602
    by one.
603
  */
53.2.32 by Monty Taylor
First large swath at getting handler stuff clean.
604
  virtual int delete_all_rows(void)
1241.9.57 by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined.
605
  { return (errno=HA_ERR_WRONG_COMMAND); }
1 by brian
clean slate
606
  /**
607
    Reset the auto-increment counter to the given value, i.e. the next row
608
    inserted will get the given value. This is called e.g. after TRUNCATE
609
    is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is
610
    returned by storage engines that don't support this operation.
611
  */
645 by Brian Aker
Cleanup unused attribute
612
  virtual int reset_auto_increment(uint64_t)
53.2.32 by Monty Taylor
First large swath at getting handler stuff clean.
613
  { return HA_ERR_WRONG_COMMAND; }
1220.1.12 by Brian Aker
Small cleanup from something Jay noticed.
614
1222.1.10 by Brian Aker
Removes options from DDL left in Cursor for admin operations (they were
615
  virtual int analyze(Session *)
645 by Brian Aker
Cleanup unused attribute
616
  { return HA_ADMIN_NOT_IMPLEMENTED; }
1063.3.1 by Stewart Smith
remove ha_check_and_repair. Engines should take care of this themselves.
617
645 by Brian Aker
Cleanup unused attribute
618
  virtual int disable_indexes(uint32_t)
619
  { return HA_ERR_WRONG_COMMAND; }
1220.1.12 by Brian Aker
Small cleanup from something Jay noticed.
620
645 by Brian Aker
Cleanup unused attribute
621
  virtual int enable_indexes(uint32_t)
622
  { return HA_ERR_WRONG_COMMAND; }
1220.1.12 by Brian Aker
Small cleanup from something Jay noticed.
623
645 by Brian Aker
Cleanup unused attribute
624
  virtual int discard_or_import_tablespace(bool)
1241.9.57 by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined.
625
  { return (errno=HA_ERR_WRONG_COMMAND); }
1220.1.12 by Brian Aker
Small cleanup from something Jay noticed.
626
627
  /* 
628
    @todo this is just for the HEAP engine, it should
629
    be removed at some point in the future (and
630
    no new engine should ever use it). Right
631
    now HEAP does rely on it, so we cannot remove it.
632
  */
1 by brian
clean slate
633
  virtual void drop_table(const char *name);
634
};
635
636
extern const char *ha_row_type[];
637
638
/* basic stuff */
1271.7.22 by Monty Taylor
Cleaned up merge errors.
639
void ha_init_errors(void);
971.1.52 by Monty Taylor
Did the finalizers. Renamed plugin_registry.
640
1711.6.1 by Brian Aker
Style on structure cleanup
641
class SortField;
642
SortField *make_unireg_sortorder(order_st *order, uint32_t *length,
643
                                 SortField *sortorder);
575.4.7 by Monty Taylor
More header cleanup.
644
int setup_order(Session *session, Item **ref_pointer_array, TableList *tables,
645
                List<Item> &fields, List <Item> &all_fields, order_st *order);
646
int setup_group(Session *session, Item **ref_pointer_array, TableList *tables,
647
                List<Item> &fields, List<Item> &all_fields, order_st *order,
648
                bool *hidden_group_fields);
846 by Brian Aker
Removing on typedeffed class.
649
bool fix_inner_refs(Session *session, List<Item> &all_fields, Select_Lex *select,
575.4.7 by Monty Taylor
More header cleanup.
650
                    Item **ref_pointer_array);
651
652
bool handle_select(Session *session, LEX *lex, select_result *result,
892.2.2 by Monty Taylor
More solaris warnings.
653
                   uint64_t setup_tables_done_option);
846 by Brian Aker
Removing on typedeffed class.
654
void free_underlaid_joins(Session *session, Select_Lex *select);
1008.3.22 by Stewart Smith
s/mysql_union/drizzle_union/
655
575.4.7 by Monty Taylor
More header cleanup.
656
bool mysql_handle_derived(LEX *lex, bool (*processor)(Session *session,
657
                                                      LEX *lex,
658
                                                      TableList *table));
659
bool mysql_derived_prepare(Session *session, LEX *lex, TableList *t);
660
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.
661
int prepare_create_field(CreateField *sql_field,
575.4.7 by Monty Taylor
More header cleanup.
662
                         uint32_t *blob_columns,
1233.1.8 by Brian Aker
Final removal table_flag().
663
                         int *timestamps, int *timestamps_with_niladic);
1222.2.3 by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO.
664
1223.4.1 by Brian Aker
Table Identifier patch.
665
bool mysql_create_table(Session *session,
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
666
                        TableIdentifier &identifier,
575.4.7 by Monty Taylor
More header cleanup.
667
                        HA_CREATE_INFO *create_info,
1320.1.2 by Brian Aker
More reference counting.
668
                        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.
669
                        AlterInfo *alter_info,
1222.2.3 by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO.
670
                        bool tmp_table, uint32_t select_field_count,
671
                        bool is_if_not_exists);
672
1223.4.2 by Brian Aker
Extended mysql_create_table_no_lock to use TableIdentifier
673
bool mysql_create_table_no_lock(Session *session,
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
674
                                TableIdentifier &identifier,
575.4.7 by Monty Taylor
More header cleanup.
675
                                HA_CREATE_INFO *create_info,
1320.1.1 by Brian Aker
Light cleanup for references.
676
                                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.
677
                                AlterInfo *alter_info,
1372.1.2 by Brian Aker
Rework to remove goto in the create table path.
678
                                bool tmp_table, uint32_t select_field_count,
1222.2.3 by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO.
679
                                bool is_if_not_exists);
575.4.7 by Monty Taylor
More header cleanup.
680
1320.1.2 by Brian Aker
More reference counting.
681
bool mysql_create_like_table(Session* session,
1340.1.1 by Brian Aker
Length usage of identifier down the tree.
682
                             TableIdentifier &destination_identifier,
1320.1.2 by Brian Aker
More reference counting.
683
                             TableList* table, TableList* src_table,
684
                             message::Table &create_table_proto,
1222.1.3 by Brian Aker
Remove used flag for engine.
685
                             bool is_if_not_exists,
686
                             bool is_engine_set);
1222.2.3 by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO.
687
1578.4.11 by Brian Aker
PAss through the code removing current_session
688
bool mysql_rename_table(Session &session,
689
                        plugin::StorageEngine *base,
1389 by Brian Aker
Large reord in ALTER TABLE for RENAME.
690
                        TableIdentifier &old_identifier,
1481 by Brian Aker
Remove dead code.
691
                        TableIdentifier &new_identifier);
1222.2.3 by Brian Aker
Remove a few more options, from options in HA_CREATE_INFO.
692
575.4.7 by Monty Taylor
More header cleanup.
693
bool mysql_prepare_update(Session *session, TableList *table_list,
694
                          Item **conds, uint32_t order_num, order_st *order);
695
int mysql_update(Session *session,TableList *tables,List<Item> &fields,
696
                 List<Item> &values,COND *conds,
697
                 uint32_t order_num, order_st *order, ha_rows limit,
698
                 enum enum_duplicates handle_duplicates, bool ignore);
699
bool mysql_prepare_insert(Session *session, TableList *table_list, Table *table,
700
                          List<Item> &fields, List_item *values,
701
                          List<Item> &update_fields,
702
                          List<Item> &update_values, enum_duplicates duplic,
703
                          COND **where, bool select_insert,
704
                          bool check_fields, bool abort_on_warning);
705
bool mysql_insert(Session *session,TableList *table,List<Item> &fields,
706
                  List<List_item> &values, List<Item> &update_fields,
707
                  List<Item> &update_values, enum_duplicates flag,
708
                  bool ignore);
709
int check_that_all_fields_are_given_values(Session *session, Table *entry,
710
                                           TableList *table_list);
711
int mysql_prepare_delete(Session *session, TableList *table_list, Item **conds);
712
bool mysql_delete(Session *session, TableList *table_list, COND *conds,
713
                  SQL_LIST *order, ha_rows rows, uint64_t options,
714
                  bool reset_auto_increment);
1208.2.2 by Brian Aker
Merge Truncate patch. This fixes all of the "half setup" of Truncate. Still
715
bool mysql_truncate(Session& session, TableList *table_list);
1000.1.3 by Brian Aker
Renamed TABLE_SHARE to TableShare
716
TableShare *get_table_share(Session *session, TableList *table_list, char *key,
575.4.7 by Monty Taylor
More header cleanup.
717
                             uint32_t key_length, uint32_t db_flags, int *error);
1000.1.3 by Brian Aker
Renamed TABLE_SHARE to TableShare
718
TableShare *get_cached_table_share(const char *db, const char *table_name);
575.4.7 by Monty Taylor
More header cleanup.
719
bool reopen_name_locked_table(Session* session, TableList* table_list, bool link_in);
720
bool reopen_tables(Session *session,bool get_locks,bool in_refresh);
721
void close_handle_and_leave_table_as_lock(Table *table);
722
bool wait_for_tables(Session *session);
723
bool table_is_used(Table *table, bool wait_for_name_lock);
1669 by Brian Aker
This patch turns the table_cache into boost::unordered_multimap.
724
Table *drop_locked_tables(Session *session, const drizzled::TableIdentifier &identifier);
725
void abort_locked_tables(Session *session, const drizzled::TableIdentifier &identifier);
575.4.7 by Monty Taylor
More header cleanup.
726
extern Field *not_found_field;
727
extern Field *view_ref_found;
728
729
Field *
730
find_field_in_tables(Session *session, Item_ident *item,
731
                     TableList *first_table, TableList *last_table,
732
                     Item **ref, find_item_error_report_type report_error,
1113.1.1 by Brian Aker
Dead code removal around LCOV finds.
733
                     bool register_tree_change);
575.4.7 by Monty Taylor
More header cleanup.
734
Field *
735
find_field_in_table_ref(Session *session, TableList *table_list,
736
                        const char *name, uint32_t length,
737
                        const char *item_name, const char *db_name,
738
                        const char *table_name, Item **ref,
1113.1.1 by Brian Aker
Dead code removal around LCOV finds.
739
                        bool allow_rowid,
575.4.7 by Monty Taylor
More header cleanup.
740
                        uint32_t *cached_field_index_ptr,
741
                        bool register_tree_change, TableList **actual_table);
742
Field *
743
find_field_in_table(Session *session, Table *table, const char *name, uint32_t length,
744
                    bool allow_rowid, uint32_t *cached_field_index_ptr);
745
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
746
} /* namespace drizzled */
575.4.7 by Monty Taylor
More header cleanup.
747
1185 by Brian Aker
Merge Engine changes.
748
#endif /* DRIZZLED_CURSOR_H */