~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cursor.h

Merged from myself one more time.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
 
50
50
typedef std::bitset<HA_MAX_ALTER_FLAGS> HA_ALTER_FLAGS;
51
51
 
52
 
extern drizzled::atomic<uint32_t> refresh_version;  /* Increments on each reload */
 
52
extern uint64_t refresh_version;  /* Increments on each reload */
53
53
 
54
54
 
55
55
typedef bool (*qc_engine_callback)(Session *session, char *table_key,
163
163
 
164
164
class Cursor :public Sql_alloc
165
165
{
166
 
public:
167
 
  typedef uint64_t Table_flags;
168
 
 
169
166
protected:
170
167
  TableShare *table_share;   /* The table definition */
171
168
  Table *table;               /* The current open table */
172
 
  Table_flags cached_table_flags;       /* Set on init() and open() */
173
169
 
174
170
  ha_rows estimation_rows_to_insert;
175
171
public:
248
244
    {}
249
245
  virtual ~Cursor(void);
250
246
  virtual Cursor *clone(MEM_ROOT *mem_root);
251
 
  /** This is called after create to allow us to set up cached variables */
252
 
  void init()
253
 
  {
254
 
    cached_table_flags= table_flags();
255
 
  }
256
247
 
257
248
  /* ha_ methods: pubilc wrappers for private virtual API */
258
249
 
265
256
 
266
257
  /* this is necessary in many places, e.g. in HANDLER command */
267
258
  int ha_index_or_rnd_end();
268
 
  Table_flags ha_table_flags() const;
 
259
  drizzled::plugin::StorageEngine::Table_flags ha_table_flags() const;
269
260
 
270
261
  /**
271
262
    These functions represent the public interface to *users* of the
298
289
 
299
290
  void adjust_next_insert_id_after_explicit_value(uint64_t nr);
300
291
  int update_auto_increment();
301
 
  void print_keydup_error(uint32_t key_nr, const char *msg);
302
 
  virtual void print_error(int error, myf errflag);
303
 
  virtual bool get_error_message(int error, String *buf);
304
 
  uint32_t get_dup_key(int error);
305
292
  virtual void change_table_ptr(Table *table_arg, TableShare *share);
306
293
 
307
294
  /* Estimates calculation */
623
610
   return memcmp(ref1, ref2, ref_length);
624
611
 }
625
612
 
626
 
  /**
627
 
    Lock table.
628
 
 
629
 
    @param    session                     Thread handle
630
 
    @param    lock_type               HA_LOCK_IN_SHARE_MODE     (F_RDLCK)
631
 
                                      HA_LOCK_IN_EXCLUSIVE_MODE (F_WRLCK)
632
 
    @param    lock_timeout            -1 default timeout
633
 
                                      0  no wait
634
 
                                      >0 wait timeout in milliseconds.
635
 
 
636
 
   @note
637
 
      lock_timeout >0 is not used by MySQL currently. If the storage
638
 
      engine does not support NOWAIT (lock_timeout == 0) it should
639
 
      return an error. But if it does not support WAIT X (lock_timeout
640
 
      >0) it should treat it as lock_timeout == -1 and wait a default
641
 
      (or even hard-coded) timeout.
642
 
 
643
 
    @retval HA_ERR_WRONG_COMMAND      Storage engine does not support
644
 
                                      lock_table()
645
 
    @retval HA_ERR_UNSUPPORTED        Storage engine does not support NOWAIT
646
 
    @retval HA_ERR_LOCK_WAIT_TIMEOUT  Lock request timed out or
647
 
                                      lock conflict with NOWAIT option
648
 
    @retval HA_ERR_LOCK_DEADLOCK      Deadlock detected
649
 
  */
650
 
  virtual int lock_table(Session *, int, int)
 
613
  virtual bool isOrdered(void)
651
614
  {
652
 
    return HA_ERR_WRONG_COMMAND;
 
615
    return false;
653
616
  }
654
617
 
 
618
 
655
619
protected:
656
620
  /* Service methods for use by storage engines. */
657
621
  void ha_statistic_increment(ulong SSV::*offset) const;
701
665
    by that statement.
702
666
  */
703
667
  virtual int reset() { return 0; }
704
 
  virtual Table_flags table_flags(void) const= 0;
705
668
 
706
669
  /**
707
670
    Is not invoked for non-transactional temporary tables.
776
739
  */
777
740
  virtual int reset_auto_increment(uint64_t)
778
741
  { return HA_ERR_WRONG_COMMAND; }
 
742
 
779
743
  virtual int optimize(Session *, HA_CHECK_OPT *)
780
744
  { return HA_ADMIN_NOT_IMPLEMENTED; }
 
745
 
781
746
  virtual int analyze(Session *, HA_CHECK_OPT *)
782
747
  { return HA_ADMIN_NOT_IMPLEMENTED; }
783
748
 
784
749
  virtual int disable_indexes(uint32_t)
785
750
  { return HA_ERR_WRONG_COMMAND; }
 
751
 
786
752
  virtual int enable_indexes(uint32_t)
787
753
  { return HA_ERR_WRONG_COMMAND; }
 
754
 
788
755
  virtual int discard_or_import_tablespace(bool)
789
756
  { return (my_errno=HA_ERR_WRONG_COMMAND); }
 
757
 
 
758
  /* 
 
759
    @todo this is just for the HEAP engine, it should
 
760
    be removed at some point in the future (and
 
761
    no new engine should ever use it). Right
 
762
    now HEAP does rely on it, so we cannot remove it.
 
763
  */
790
764
  virtual void drop_table(const char *name);
791
765
};
792
766