~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cursor.h

  • Committer: Olaf van der Spek
  • Date: 2011-02-12 18:24:24 UTC
  • mto: (2167.1.2 build) (2172.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2168.
  • Revision ID: olafvdspek@gmail.com-20110212182424-kgnm9osi7qo97at2
casts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
22
22
 
23
23
#include <drizzled/xid.h>
24
24
#include <drizzled/discrete_interval.h>
25
 
#include <drizzled/table_identifier.h>
 
25
#include <drizzled/identifier.h>
 
26
#include <drizzled/definitions.h>
 
27
#include <drizzled/key_map.h>
26
28
 
27
29
/* Definitions for parameters to do with Cursor-routines */
28
30
 
36
38
 
37
39
#include <drizzled/message/table.pb.h>
38
40
 
39
 
/* Bits to show what an alter table will do */
40
 
#include <drizzled/sql_bitmap.h>
41
 
 
42
41
#include <bitset>
43
42
#include <algorithm>
44
43
 
 
44
#include "drizzled/visibility.h"
 
45
 
45
46
namespace drizzled
46
47
{
47
48
 
48
49
#define HA_MAX_ALTER_FLAGS 40
49
50
 
50
 
 
51
51
typedef std::bitset<HA_MAX_ALTER_FLAGS> HA_ALTER_FLAGS;
52
52
 
53
53
extern uint64_t refresh_version;  /* Increments on each reload */
54
54
 
55
 
 
56
 
typedef bool (*qc_engine_callback)(Session *session, char *table_key,
57
 
                                      uint32_t key_length,
58
 
                                      uint64_t *engine_data);
59
 
 
60
 
 
61
 
/* The Cursor for a table type.  Will be included in the Table structure */
62
 
 
63
55
class Table;
64
56
class TableList;
65
57
class TableShare;
66
58
class Select_Lex_Unit;
67
 
struct st_foreign_key_info;
68
 
typedef struct st_foreign_key_info FOREIGN_KEY_INFO;
69
 
struct order_st;
 
59
class ForeignKeyInfo;
 
60
struct Order;
70
61
 
71
62
class Item;
72
 
struct st_table_log_memory_entry;
73
63
 
74
64
class LEX;
75
65
class Select_Lex;
78
68
class CreateField;
79
69
class sys_var_str;
80
70
class Item_ident;
81
 
typedef struct st_sort_field SORT_FIELD;
82
71
 
83
72
typedef List<Item> List_item;
84
73
extern KEY_CREATE_INFO default_key_create_info;
93
82
  class CostVector;
94
83
}
95
84
 
96
 
uint32_t calculate_key_len(Table *, uint, const unsigned char *, key_part_map);
97
85
/*
98
86
  bitmap with first N+1 bits set
99
87
  (keypart_map for a key prefix of [0..N] keyparts)
150
138
  present, its length is one byte <not-sure> which must be set to 0xFF
151
139
  at all times. </not-sure>
152
140
 
153
 
  If the table has columns of type BIT, then certain bits from those columns
154
 
  may be stored in null_bytes as well. Grep around for Field_bit for
155
 
  details.
156
 
 
157
141
  For blob columns (see Field_blob), the record buffer stores length of the
158
142
  data, following by memory pointer to the blob data. The pointer is owned
159
143
  by the storage engine and is valid until the next operation.
161
145
  If a blob column has NULL value, then its length and blob data pointer
162
146
  must be set to 0.
163
147
*/
164
 
 
165
 
class Cursor :public memory::SqlAlloc
 
148
class DRIZZLED_API Cursor
166
149
{
 
150
  friend class SEAPITesterCursor;
 
151
  Table &table;               /* The current open table */
 
152
  plugin::StorageEngine &engine;      /* storage engine of this Cursor */
 
153
 
167
154
protected:
168
 
  TableShare *table_share;   /* The table definition */
169
 
  Table *table;               /* The current open table */
170
 
 
171
155
  ha_rows estimation_rows_to_insert;
 
156
 
172
157
public:
173
 
  plugin::StorageEngine *engine;      /* storage engine of this Cursor */
174
158
  inline plugin::StorageEngine *getEngine() const       /* table_type for handler */
175
159
  {
176
 
    return engine;
 
160
    return &engine;
177
161
  }
178
162
  unsigned char *ref;                           /* Pointer to current row */
179
163
  unsigned char *dup_ref;                       /* Pointer to duplicate row */
180
164
 
 
165
  TableShare *getShare();
 
166
 
 
167
  Table *getTable() const
 
168
  {
 
169
    return &table;
 
170
  }
 
171
 
181
172
  ha_statistics stats;
182
173
  /** MultiRangeRead-related members: */
183
174
  range_seq_t mrr_iter;    /* Interator to traverse the range sequence */
184
175
  RANGE_SEQ_IF mrr_funcs;  /* Range sequence traversal functions */
185
 
  HANDLER_BUFFER *multi_range_buffer; /* MRR buffer info */
 
176
 
186
177
  uint32_t ranges_in_seq; /* Total number of ranges in the traversed sequence */
187
178
  /* true <=> source MRR ranges and the output are ordered */
188
179
  bool mrr_is_output_sorted;
191
182
  bool mrr_have_range;
192
183
 
193
184
  bool eq_range;
194
 
  /*
195
 
    true <=> the engine guarantees that returned records are within the range
196
 
    being scanned.
197
 
  */
198
 
  bool in_range_check_pushed_down;
199
185
 
200
186
  /** Current range (the one we're now returning rows from) */
201
187
  KEY_MULTI_RANGE mrr_cur_range;
202
188
 
203
189
  /** The following are for read_range() */
204
190
  key_range save_end_range, *end_range;
205
 
  KEY_PART_INFO *range_key_part;
 
191
  KeyPartInfo *range_key_part;
206
192
  int key_compare_result_on_equal;
207
193
 
208
194
  uint32_t errkey;                              /* Last dup key */
212
198
  uint32_t ref_length;
213
199
  enum {NONE=0, INDEX, RND} inited;
214
200
  bool locked;
215
 
  bool implicit_emptied;                /* Can be !=0 only if HEAP */
216
201
 
217
202
  /**
218
203
    next_insert_id is the next value which should be inserted into the
230
215
  }
231
216
 
232
217
  /**
 
218
    Used by SHOW TABLE STATUS to get the current auto_inc from the engine
 
219
  */
 
220
  uint64_t getAutoIncrement()
 
221
  {
 
222
    return stats.auto_increment_value;
 
223
  }
 
224
 
 
225
  /**
233
226
    insert id for the current row (*autogenerated*; if not
234
227
    autogenerated, it's 0).
235
228
    At first successful insertion, this variable is stored into
242
235
  */
243
236
  Discrete_interval auto_inc_interval_for_cur_row;
244
237
 
245
 
  Cursor(plugin::StorageEngine &engine_arg, TableShare &share_arg);
 
238
  Cursor(plugin::StorageEngine &engine_arg, Table &share_arg);
246
239
  virtual ~Cursor(void);
247
240
  virtual Cursor *clone(memory::Root *mem_root);
248
241
 
249
242
  /* ha_ methods: pubilc wrappers for private virtual API */
250
243
 
251
 
  int ha_open(Table *table, const char *name, int mode, int test_if_locked);
252
 
  int ha_index_init(uint32_t idx, bool sorted);
253
 
  int ha_index_end();
254
 
  int ha_rnd_init(bool scan);
255
 
  int ha_rnd_end();
 
244
  int ha_open(const identifier::Table &identifier, int mode, int test_if_locked);
 
245
  int startIndexScan(uint32_t idx, bool sorted) __attribute__ ((warn_unused_result));
 
246
  int endIndexScan();
 
247
  int startTableScan(bool scan) __attribute__ ((warn_unused_result));
 
248
  int endTableScan();
256
249
  int ha_reset();
257
250
 
258
251
  /* this is necessary in many places, e.g. in HANDLER command */
261
254
  /**
262
255
    These functions represent the public interface to *users* of the
263
256
    Cursor class, hence they are *not* virtual. For the inheritance
264
 
    interface, see the (private) functions write_row(), update_row(),
265
 
    and delete_row() below.
 
257
    interface, see the (private) functions doInsertRecord(), doUpdateRecord(),
 
258
    and doDeleteRecord() below.
266
259
  */
267
260
  int ha_external_lock(Session *session, int lock_type);
268
 
  int ha_write_row(unsigned char * buf);
269
 
  int ha_update_row(const unsigned char * old_data, unsigned char * new_data);
270
 
  int ha_delete_row(const unsigned char * buf);
 
261
  int insertRecord(unsigned char * buf) __attribute__ ((warn_unused_result));
 
262
  int updateRecord(const unsigned char * old_data, unsigned char * new_data) __attribute__ ((warn_unused_result));
 
263
  int deleteRecord(const unsigned char * buf) __attribute__ ((warn_unused_result));
271
264
  void ha_release_auto_increment();
272
265
 
273
266
  /** to be actually called to get 'check()' functionality*/
286
279
 
287
280
  void adjust_next_insert_id_after_explicit_value(uint64_t nr);
288
281
  int update_auto_increment();
289
 
  virtual void change_table_ptr(Table *table_arg, TableShare *share);
290
282
 
291
283
  /* Estimates calculation */
292
284
  virtual double scan_time(void)
293
 
  { return uint64_t2double(stats.data_file_length) / IO_SIZE + 2; }
 
285
  { return static_cast<double>(stats.data_file_length) / IO_SIZE + 2; }
294
286
  virtual double read_time(uint32_t, uint32_t ranges, ha_rows rows)
295
 
  { return rows2double(ranges+rows); }
 
287
  { return ranges + rows; }
296
288
 
297
289
  virtual double index_only_read_time(uint32_t keynr, double records);
298
290
 
303
295
  virtual int multi_range_read_info(uint32_t keyno, uint32_t n_ranges, uint32_t keys,
304
296
                                    uint32_t *bufsz, uint32_t *flags, optimizer::CostVector *cost);
305
297
  virtual int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
306
 
                                    uint32_t n_ranges, uint32_t mode,
307
 
                                    HANDLER_BUFFER *buf);
 
298
                                    uint32_t n_ranges, uint32_t mode);
308
299
  virtual int multi_range_read_next(char **range_info);
309
300
 
310
301
 
339
330
  virtual ha_rows estimate_rows_upper_bound()
340
331
  { return stats.records+EXTRA_RECORDS; }
341
332
 
342
 
  /**
343
 
    Get the row type from the storage engine.  If this method returns
344
 
    ROW_TYPE_NOT_USED, the information in HA_CREATE_INFO should be used.
345
 
  */
346
 
  virtual enum row_type get_row_type() const { return ROW_TYPE_NOT_USED; }
347
 
 
348
333
  virtual const char *index_type(uint32_t)
349
334
  { assert(0); return "";}
350
335
 
358
343
     row if available. If the key value is null, begin at the first key of the
359
344
     index.
360
345
  */
361
 
  virtual int index_read_map(unsigned char * buf, const unsigned char * key,
 
346
  virtual int index_read_map(unsigned char * buf, const unsigned char *key,
362
347
                             key_part_map keypart_map,
363
348
                             enum ha_rkey_function find_flag)
364
349
  {
365
 
    uint32_t key_len= calculate_key_len(table, active_index, key, keypart_map);
 
350
    uint32_t key_len= calculate_key_len(active_index, keypart_map);
366
351
    return  index_read(buf, key, key_len, find_flag);
367
352
  }
368
353
  /**
375
360
                                 const unsigned char * key,
376
361
                                 key_part_map keypart_map,
377
362
                                 enum ha_rkey_function find_flag);
378
 
  virtual int index_next(unsigned char *)
 
363
  virtual int index_next(unsigned char *) __attribute__ ((warn_unused_result))
379
364
   { return  HA_ERR_WRONG_COMMAND; }
380
365
  virtual int index_prev(unsigned char *)
381
366
   { return  HA_ERR_WRONG_COMMAND; }
384
369
  virtual int index_last(unsigned char *)
385
370
   { return  HA_ERR_WRONG_COMMAND; }
386
371
  virtual int index_next_same(unsigned char *, const unsigned char *, uint32_t);
 
372
 
 
373
private:
 
374
  uint32_t calculate_key_len(uint32_t key_position, key_part_map keypart_map_arg);
 
375
public:
 
376
 
387
377
  /**
388
378
     @brief
389
379
     The following functions works like index_read, but it find the last
392
382
  virtual int index_read_last_map(unsigned char * buf, const unsigned char * key,
393
383
                                  key_part_map keypart_map)
394
384
  {
395
 
    uint32_t key_len= calculate_key_len(table, active_index, key, keypart_map);
 
385
    uint32_t key_len= calculate_key_len(active_index, keypart_map);
396
386
    return index_read_last(buf, key, key_len);
397
387
  }
398
388
  virtual int read_range_first(const key_range *start_key,
400
390
                               bool eq_range, bool sorted);
401
391
  virtual int read_range_next();
402
392
  int compare_key(key_range *range);
403
 
  int compare_key2(key_range *range);
404
393
  virtual int rnd_next(unsigned char *)=0;
405
394
  virtual int rnd_pos(unsigned char *, unsigned char *)=0;
406
 
  /**
407
 
    One has to use this method when to find
408
 
    random position by record as the plain
409
 
    position() call doesn't work for some
410
 
    handlers for random position.
411
 
  */
412
 
  virtual int rnd_pos_by_record(unsigned char *record);
413
395
  virtual int read_first_row(unsigned char *buf, uint32_t primary_key);
414
 
  /**
415
 
    The following function is only needed for tables that may be temporary
416
 
    tables during joins.
417
 
  */
418
 
  virtual int restart_rnd_next(unsigned char *, unsigned char *)
419
 
    { return HA_ERR_WRONG_COMMAND; }
420
396
  virtual int rnd_same(unsigned char *, uint32_t)
421
397
    { return HA_ERR_WRONG_COMMAND; }
422
398
  virtual ha_rows records_in_range(uint32_t, key_range *, key_range *)
476
452
      insert_id_for_cur_row;
477
453
  }
478
454
 
479
 
  virtual void update_create_info(HA_CREATE_INFO *) {}
480
 
  int check_old_types(void);
481
455
  /* end of the list of admin commands */
482
456
 
483
457
  virtual int indexes_are_disabled(void) {return 0;}
500
474
   */
501
475
  virtual bool can_switch_engines(void) { return true; }
502
476
  /** used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */
503
 
  virtual int get_foreign_key_list(Session *, List<FOREIGN_KEY_INFO> *)
 
477
  virtual int get_foreign_key_list(Session *, List<ForeignKeyInfo> *)
504
478
  { return 0; }
505
479
  virtual uint32_t referenced_by_foreign_key() { return 0;}
506
480
  virtual void free_foreign_key_create_info(char *) {}
507
 
  /** The following can be called without an open Cursor */
508
 
 
509
 
  virtual int add_index(Table *, KEY *, uint32_t)
510
 
  { return (HA_ERR_WRONG_COMMAND); }
511
 
  virtual int prepare_drop_index(Table *, uint32_t *, uint32_t)
512
 
  { return (HA_ERR_WRONG_COMMAND); }
513
 
  virtual int final_drop_index(Table *)
514
 
  { return (HA_ERR_WRONG_COMMAND); }
515
 
 
516
 
  virtual uint32_t checksum(void) const { return 0; }
517
481
 
518
482
  /**
519
483
    Is not invoked for non-transactional temporary tables.
522
486
    or partitioned.
523
487
 
524
488
    @note that one can NOT rely on table->in_use in store_lock().  It may
525
 
    refer to a different thread if called from mysql_lock_abort_for_thread().
 
489
    refer to a different thread if called from abortLockForThread().
526
490
 
527
491
    @note If the table is MERGE, store_lock() can return less locks
528
492
    than lock_count() claimed. This can happen when the MERGE children
556
520
 
557
521
protected:
558
522
  /* Service methods for use by storage engines. */
559
 
  void ha_statistic_increment(ulong system_status_var::*offset) const;
 
523
  void ha_statistic_increment(uint64_t system_status_var::*offset) const;
560
524
  void **ha_data(Session *) const;
561
 
  Session *ha_session(void) const;
562
525
 
563
526
private:
564
527
  /* Private helpers */
570
533
    the corresponding 'ha_*' method above.
571
534
  */
572
535
 
573
 
  virtual int open(const char *name, int mode, uint32_t test_if_locked)=0;
574
 
  virtual int index_init(uint32_t idx, bool)
 
536
  virtual int open(const char *, int , uint32_t ) { assert(0); return -1; }
 
537
  virtual int doOpen(const identifier::Table &identifier, int mode, uint32_t test_if_locked);
 
538
  virtual int doStartIndexScan(uint32_t idx, bool)
575
539
  { active_index= idx; return 0; }
576
 
  virtual int index_end() { active_index= MAX_KEY; return 0; }
 
540
  virtual int doEndIndexScan() { active_index= MAX_KEY; return 0; }
577
541
  /**
578
 
    rnd_init() can be called two times without rnd_end() in between
 
542
    doStartTableScan() can be called two times without doEndTableScan() in between
579
543
    (it only makes sense if scan=1).
580
544
    then the second call should prepare for the new table scan (e.g
581
545
    if rnd_init allocates the cursor, second call should position it
582
546
    to the start of the table, no need to deallocate and allocate it again
583
547
  */
584
 
  virtual int rnd_init(bool scan)= 0;
585
 
  virtual int rnd_end() { return 0; }
586
 
  virtual int write_row(unsigned char *)
587
 
  {
588
 
    return HA_ERR_WRONG_COMMAND;
589
 
  }
590
 
 
591
 
  virtual int update_row(const unsigned char *, unsigned char *)
592
 
  {
593
 
    return HA_ERR_WRONG_COMMAND;
594
 
  }
595
 
 
596
 
  virtual int delete_row(const unsigned char *)
 
548
  virtual int doStartTableScan(bool scan) __attribute__ ((warn_unused_result)) = 0;
 
549
  virtual int doEndTableScan() { return 0; }
 
550
  virtual int doInsertRecord(unsigned char *)
 
551
  {
 
552
    return HA_ERR_WRONG_COMMAND;
 
553
  }
 
554
 
 
555
  virtual int doUpdateRecord(const unsigned char *, unsigned char *)
 
556
  {
 
557
    return HA_ERR_WRONG_COMMAND;
 
558
  }
 
559
 
 
560
  virtual int doDeleteRecord(const unsigned char *)
597
561
  {
598
562
    return HA_ERR_WRONG_COMMAND;
599
563
  }
630
594
  {
631
595
    return 0;
632
596
  }
633
 
  virtual void release_auto_increment(void) { return; };
 
597
  virtual void release_auto_increment(void) { return; }
634
598
  /** admin commands - called from mysql_admin_table */
635
599
  virtual int check(Session *)
636
600
  { return HA_ADMIN_NOT_IMPLEMENTED; }
686
650
/* basic stuff */
687
651
void ha_init_errors(void);
688
652
 
689
 
SORT_FIELD * make_unireg_sortorder(order_st *order, uint32_t *length,
690
 
                                   SORT_FIELD *sortorder);
 
653
class SortField;
 
654
SortField *make_unireg_sortorder(Order *order, uint32_t *length,
 
655
                                 SortField *sortorder);
691
656
int setup_order(Session *session, Item **ref_pointer_array, TableList *tables,
692
 
                List<Item> &fields, List <Item> &all_fields, order_st *order);
 
657
                List<Item> &fields, List <Item> &all_fields, Order *order);
693
658
int setup_group(Session *session, Item **ref_pointer_array, TableList *tables,
694
 
                List<Item> &fields, List<Item> &all_fields, order_st *order,
 
659
                List<Item> &fields, List<Item> &all_fields, Order *order,
695
660
                bool *hidden_group_fields);
696
661
bool fix_inner_refs(Session *session, List<Item> &all_fields, Select_Lex *select,
697
662
                    Item **ref_pointer_array);
700
665
                   uint64_t setup_tables_done_option);
701
666
void free_underlaid_joins(Session *session, Select_Lex *select);
702
667
 
703
 
bool mysql_handle_derived(LEX *lex, bool (*processor)(Session *session,
 
668
bool handle_derived(LEX *lex, bool (*processor)(Session *session,
704
669
                                                      LEX *lex,
705
670
                                                      TableList *table));
706
 
bool mysql_derived_prepare(Session *session, LEX *lex, TableList *t);
707
 
bool mysql_derived_filling(Session *session, LEX *lex, TableList *t);
 
671
bool derived_prepare(Session *session, LEX *lex, TableList *t);
 
672
bool derived_filling(Session *session, LEX *lex, TableList *t);
708
673
int prepare_create_field(CreateField *sql_field,
709
674
                         uint32_t *blob_columns,
710
675
                         int *timestamps, int *timestamps_with_niladic);
711
676
 
712
 
bool mysql_create_table(Session *session,
713
 
                        TableIdentifier &identifier,
714
 
                        HA_CREATE_INFO *create_info,
715
 
                        message::Table &table_proto,
716
 
                        AlterInfo *alter_info,
717
 
                        bool tmp_table, uint32_t select_field_count,
718
 
                        bool is_if_not_exists);
719
 
 
720
 
bool mysql_create_table_no_lock(Session *session,
721
 
                                TableIdentifier &identifier,
722
 
                                HA_CREATE_INFO *create_info,
723
 
                                message::Table &table_proto,
724
 
                                AlterInfo *alter_info,
725
 
                                bool tmp_table, uint32_t select_field_count,
726
 
                                bool is_if_not_exists);
727
 
 
728
 
bool mysql_create_like_table(Session* session,
729
 
                             TableIdentifier &destination_identifier,
730
 
                             TableList* table, TableList* src_table,
731
 
                             message::Table &create_table_proto,
732
 
                             bool is_if_not_exists,
733
 
                             bool is_engine_set);
734
 
 
735
 
bool mysql_rename_table(plugin::StorageEngine *base,
736
 
                        TableIdentifier &old_identifier,
737
 
                        TableIdentifier &new_identifier,
738
 
                        uint32_t flags);
739
 
 
740
 
bool mysql_prepare_update(Session *session, TableList *table_list,
741
 
                          Item **conds, uint32_t order_num, order_st *order);
742
 
int mysql_update(Session *session,TableList *tables,List<Item> &fields,
 
677
bool create_table(Session *session,
 
678
                  const identifier::Table &identifier,
 
679
                  HA_CREATE_INFO *create_info,
 
680
                  message::Table &table_proto,
 
681
                  AlterInfo *alter_info,
 
682
                  bool tmp_table, uint32_t select_field_count,
 
683
                  bool is_if_not_exists);
 
684
 
 
685
bool create_table_no_lock(Session *session,
 
686
                          const identifier::Table &identifier,
 
687
                          HA_CREATE_INFO *create_info,
 
688
                          message::Table &table_proto,
 
689
                          AlterInfo *alter_info,
 
690
                          bool tmp_table, uint32_t select_field_count,
 
691
                          bool is_if_not_exists);
 
692
 
 
693
bool create_like_table(Session* session,
 
694
                       identifier::Table::const_reference destination_identifier,
 
695
                       identifier::Table::const_reference source_identifier,
 
696
                       message::Table &create_table_proto,
 
697
                       bool is_if_not_exists,
 
698
                       bool is_engine_set);
 
699
 
 
700
bool rename_table(Session &session,
 
701
                        plugin::StorageEngine *base,
 
702
                        const identifier::Table &old_identifier,
 
703
                        const identifier::Table &new_identifier);
 
704
 
 
705
bool prepare_update(Session *session, TableList *table_list,
 
706
                          Item **conds, uint32_t order_num, Order *order);
 
707
int update_query(Session *session,TableList *tables,List<Item> &fields,
743
708
                 List<Item> &values,COND *conds,
744
 
                 uint32_t order_num, order_st *order, ha_rows limit,
 
709
                 uint32_t order_num, Order *order, ha_rows limit,
745
710
                 enum enum_duplicates handle_duplicates, bool ignore);
746
 
bool mysql_prepare_insert(Session *session, TableList *table_list, Table *table,
 
711
bool prepare_insert(Session *session, TableList *table_list, Table *table,
747
712
                          List<Item> &fields, List_item *values,
748
713
                          List<Item> &update_fields,
749
714
                          List<Item> &update_values, enum_duplicates duplic,
750
715
                          COND **where, bool select_insert,
751
716
                          bool check_fields, bool abort_on_warning);
752
 
bool mysql_insert(Session *session,TableList *table,List<Item> &fields,
 
717
bool insert_query(Session *session,TableList *table,List<Item> &fields,
753
718
                  List<List_item> &values, List<Item> &update_fields,
754
719
                  List<Item> &update_values, enum_duplicates flag,
755
720
                  bool ignore);
756
721
int check_that_all_fields_are_given_values(Session *session, Table *entry,
757
722
                                           TableList *table_list);
758
 
int mysql_prepare_delete(Session *session, TableList *table_list, Item **conds);
759
 
bool mysql_delete(Session *session, TableList *table_list, COND *conds,
 
723
int prepare_delete(Session *session, TableList *table_list, Item **conds);
 
724
bool delete_query(Session *session, TableList *table_list, COND *conds,
760
725
                  SQL_LIST *order, ha_rows rows, uint64_t options,
761
726
                  bool reset_auto_increment);
762
 
bool mysql_truncate(Session& session, TableList *table_list);
 
727
bool truncate(Session& session, TableList *table_list);
763
728
TableShare *get_table_share(Session *session, TableList *table_list, char *key,
764
729
                             uint32_t key_length, uint32_t db_flags, int *error);
765
730
TableShare *get_cached_table_share(const char *db, const char *table_name);
766
731
bool reopen_name_locked_table(Session* session, TableList* table_list, bool link_in);
767
 
Table *table_cache_insert_placeholder(Session *session, const char *key,
768
 
                                      uint32_t key_length);
769
 
bool lock_table_name_if_not_cached(Session *session, const char *db,
770
 
                                   const char *table_name, Table **table);
771
 
bool reopen_table(Table *table);
772
732
bool reopen_tables(Session *session,bool get_locks,bool in_refresh);
773
 
void close_data_files_and_morph_locks(Session *session, const char *db,
774
 
                                      const char *table_name);
775
733
void close_handle_and_leave_table_as_lock(Table *table);
776
734
bool wait_for_tables(Session *session);
777
735
bool table_is_used(Table *table, bool wait_for_name_lock);
778
 
Table *drop_locked_tables(Session *session,const char *db, const char *table_name);
779
 
void abort_locked_tables(Session *session,const char *db, const char *table_name);
 
736
Table *drop_locked_tables(Session *session, const drizzled::identifier::Table &identifier);
 
737
void abort_locked_tables(Session *session, const drizzled::identifier::Table &identifier);
780
738
extern Field *not_found_field;
781
739
extern Field *view_ref_found;
782
740