~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cursor.h

  • Committer: Eric Day
  • Date: 2009-10-31 21:53:33 UTC
  • mfrom: (1200 staging)
  • mto: This revision was merged to the branch mainline in revision 1202.
  • Revision ID: eday@oddments.org-20091031215333-j94bjoanwmi68p6f
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_HANDLER_H
21
 
#define DRIZZLED_HANDLER_H
 
20
#ifndef DRIZZLED_CURSOR_H
 
21
#define DRIZZLED_CURSOR_H
22
22
 
23
23
#include <drizzled/xid.h>
24
24
#include <drizzled/discrete_interval.h>
25
25
 
26
 
/* Definitions for parameters to do with handler-routines */
 
26
/* Definitions for parameters to do with Cursor-routines */
27
27
 
28
28
#include <mysys/thr_lock.h>
29
29
#include <mysys/hash.h>
39
39
/* Bits to show what an alter table will do */
40
40
#include <drizzled/sql_bitmap.h>
41
41
 
42
 
#include <drizzled/handler.h>
 
42
#include <drizzled/cursor.h>
43
43
 
44
44
#include <bitset>
45
45
#include <algorithm>
57
57
                                      uint64_t *engine_data);
58
58
 
59
59
 
60
 
/* The handler for a table type.  Will be included in the Table structure */
 
60
/* The Cursor for a table type.  Will be included in the Table structure */
61
61
 
62
62
class Table;
63
63
class TableList;
114
114
}
115
115
 
116
116
/**
117
 
  The handler class is the interface for dynamically loadable
 
117
  The Cursor class is the interface for dynamically loadable
118
118
  storage engines. Do not add ifdefs and take care when adding or
119
119
  changing virtual functions to avoid vtable confusion
120
120
 
161
161
  must be set to 0.
162
162
*/
163
163
 
164
 
class handler :public Sql_alloc
 
164
class Cursor :public Sql_alloc
165
165
{
166
166
public:
167
167
  typedef uint64_t Table_flags;
173
173
 
174
174
  ha_rows estimation_rows_to_insert;
175
175
public:
176
 
  drizzled::plugin::StorageEngine *engine;      /* storage engine of this handler */
 
176
  drizzled::plugin::StorageEngine *engine;      /* storage engine of this Cursor */
177
177
  unsigned char *ref;                           /* Pointer to current row */
178
178
  unsigned char *dup_ref;                       /* Pointer to duplicate row */
179
179
 
236
236
  */
237
237
  Discrete_interval auto_inc_interval_for_cur_row;
238
238
 
239
 
  handler(drizzled::plugin::StorageEngine *engine_arg, TableShare *share_arg)
 
239
  Cursor(drizzled::plugin::StorageEngine *engine_arg, TableShare *share_arg)
240
240
    :table_share(share_arg), table(0),
241
241
    estimation_rows_to_insert(0), engine(engine_arg),
242
242
    ref(0), in_range_check_pushed_down(false),
246
246
    locked(false), implicit_emptied(0),
247
247
    next_insert_id(0), insert_id_for_cur_row(0)
248
248
    {}
249
 
  virtual ~handler(void);
250
 
  virtual handler *clone(MEM_ROOT *mem_root);
 
249
  virtual ~Cursor(void);
 
250
  virtual Cursor *clone(MEM_ROOT *mem_root);
251
251
  /** This is called after create to allow us to set up cached variables */
252
252
  void init()
253
253
  {
269
269
 
270
270
  /**
271
271
    These functions represent the public interface to *users* of the
272
 
    handler class, hence they are *not* virtual. For the inheritance
 
272
    Cursor class, hence they are *not* virtual. For the inheritance
273
273
    interface, see the (private) functions write_row(), update_row(),
274
274
    and delete_row() below.
275
275
  */
330
330
  /**
331
331
    This method is used to analyse the error to see whether the error
332
332
    is ignorable or not, certain handlers can have more error that are
333
 
    ignorable than others. E.g. the partition handler can get inserts
 
333
    ignorable than others. E.g. the partition Cursor can get inserts
334
334
    into a range where there is no partition and this is an ignorable
335
335
    error.
336
336
    HA_ERR_FOUND_DUP_UNIQUE is a special case in MyISAM that means the
367
367
  virtual int close(void)=0;
368
368
 
369
369
  /**
370
 
    @retval  0   Bulk update used by handler
 
370
    @retval  0   Bulk update used by Cursor
371
371
    @retval  1   Bulk update not used, normal operation used
372
372
  */
373
373
  virtual bool start_bulk_update() { return 1; }
374
374
  /**
375
 
    @retval  0   Bulk delete used by handler
 
375
    @retval  0   Bulk delete used by Cursor
376
376
    @retval  1   Bulk delete not used, normal operation used
377
377
  */
378
378
  virtual bool start_bulk_delete() { return 1; }
380
380
    After this call all outstanding updates must be performed. The number
381
381
    of duplicate key errors are reported in the duplicate key parameter.
382
382
    It is allowed to continue to the batched update after this call, the
383
 
    handler has to wait until end_bulk_update with changing state.
 
383
    Cursor has to wait until end_bulk_update with changing state.
384
384
 
385
385
    @param    dup_key_found       Number of duplicate keys found
386
386
 
561
561
  { return 0; }
562
562
  virtual uint32_t referenced_by_foreign_key() { return 0;}
563
563
  virtual void free_foreign_key_create_info(char *) {}
564
 
  /** The following can be called without an open handler */
 
564
  /** The following can be called without an open Cursor */
565
565
 
566
566
  virtual uint32_t index_flags(uint32_t idx, uint32_t part, bool all_parts) const =0;
567
567
 
707
707
    Is not invoked for non-transactional temporary tables.
708
708
 
709
709
    Tells the storage engine that we intend to read or write data
710
 
    from the table. This call is prefixed with a call to handler::store_lock()
711
 
    and is invoked only for those handler instances that stored the lock.
 
710
    from the table. This call is prefixed with a call to Cursor::store_lock()
 
711
    and is invoked only for those Cursor instances that stored the lock.
712
712
 
713
713
    Calls to rnd_init/index_init are prefixed with this call. When table
714
714
    IO is complete, we call external_lock(F_UNLCK).
743
743
  virtual int index_read_last(unsigned char *, const unsigned char *, uint32_t)
744
744
   { return (my_errno= HA_ERR_WRONG_COMMAND); }
745
745
  /**
746
 
    This method is similar to update_row, however the handler doesn't need
747
 
    to execute the updates at this point in time. The handler can be certain
 
746
    This method is similar to update_row, however the Cursor doesn't need
 
747
    to execute the updates at this point in time. The Cursor can be certain
748
748
    that another call to bulk_update_row will occur OR a call to
749
749
    exec_bulk_update before the set of updates in this query is concluded.
750
750
 
752
752
    @param    new_data       New record
753
753
    @param    dup_key_found  Number of duplicate keys found
754
754
 
755
 
    @retval  0   Bulk delete used by handler
 
755
    @retval  0   Bulk delete used by Cursor
756
756
    @retval  1   Bulk delete not used, normal operation used
757
757
  */
758
758
  virtual int bulk_update_row(const unsigned char *, unsigned char *, uint32_t *)
762
762
  }
763
763
  /**
764
764
    This is called to delete all rows in a table
765
 
    If the handler don't support this, then this function will
 
765
    If the Cursor don't support this, then this function will
766
766
    return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one
767
767
    by one.
768
768
  */
911
911
bool mysql_delete(Session *session, TableList *table_list, COND *conds,
912
912
                  SQL_LIST *order, ha_rows rows, uint64_t options,
913
913
                  bool reset_auto_increment);
914
 
bool mysql_truncate(Session *session, TableList *table_list, bool dont_send_ok);
 
914
bool mysql_truncate(Session& session, TableList *table_list, bool dont_send_ok);
915
915
TableShare *get_table_share(Session *session, TableList *table_list, char *key,
916
916
                             uint32_t key_length, uint32_t db_flags, int *error);
917
917
TableShare *get_cached_table_share(const char *db, const char *table_name);
952
952
find_field_in_table_sef(Table *table, const char *name);
953
953
 
954
954
 
955
 
#endif /* DRIZZLED_HANDLER_H */
 
955
#endif /* DRIZZLED_CURSOR_H */