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