~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cursor.h

  • Committer: Brian Aker
  • Date: 2010-10-21 08:55:44 UTC
  • mto: (1866.1.1 merge)
  • mto: This revision was merged to the branch mainline in revision 1867.
  • Revision ID: brian@tangent.org-20101021085544-chpce06zm4tdaqdi
This creates a function for seeing which catalog you are in. It also
refactors some of the functions to be in the utility_function collect.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
class TableShare;
56
56
class Select_Lex_Unit;
57
57
class ForeignKeyInfo;
58
 
struct Order;
 
58
struct order_st;
59
59
 
60
60
class Item;
61
61
 
145
145
*/
146
146
class Cursor
147
147
{
148
 
  Table &table;               /* The current open table */
149
 
  plugin::StorageEngine &engine;      /* storage engine of this Cursor */
 
148
protected:
 
149
  TableShare *table_share;   /* The table definition */
 
150
  Table *table;               /* The current open table */
150
151
 
151
 
protected:
152
152
  ha_rows estimation_rows_to_insert;
153
 
 
 
153
  plugin::StorageEngine *engine;      /* storage engine of this Cursor */
154
154
public:
155
155
  inline plugin::StorageEngine *getEngine() const       /* table_type for handler */
156
156
  {
157
 
    return &engine;
 
157
    return engine;
158
158
  }
159
159
  unsigned char *ref;                           /* Pointer to current row */
160
160
  unsigned char *dup_ref;                       /* Pointer to duplicate row */
161
161
 
162
 
  TableShare *getShare();
163
 
 
164
 
  Table *getTable() const
 
162
  TableShare *getShare() const
165
163
  {
166
 
    return &table;
 
164
    return table_share;
167
165
  }
168
166
 
169
167
  ha_statistics stats;
224
222
  */
225
223
  Discrete_interval auto_inc_interval_for_cur_row;
226
224
 
227
 
  Cursor(plugin::StorageEngine &engine_arg, Table &share_arg);
 
225
  Cursor(plugin::StorageEngine &engine_arg, TableShare &share_arg);
228
226
  virtual ~Cursor(void);
229
227
  virtual Cursor *clone(memory::Root *mem_root);
230
228
 
231
229
  /* ha_ methods: pubilc wrappers for private virtual API */
232
230
 
233
 
  int ha_open(const TableIdentifier &identifier, int mode, int test_if_locked);
 
231
  int ha_open(const TableIdentifier &identifier, Table *table, int mode, int test_if_locked);
234
232
  int startIndexScan(uint32_t idx, bool sorted);
235
233
  int endIndexScan();
236
234
  int startTableScan(bool scan);
268
266
 
269
267
  void adjust_next_insert_id_after_explicit_value(uint64_t nr);
270
268
  int update_auto_increment();
 
269
  virtual void change_table_ptr(Table *table_arg, TableShare *share);
271
270
 
272
271
  /* Estimates calculation */
273
272
  virtual double scan_time(void)
475
474
    or partitioned.
476
475
 
477
476
    @note that one can NOT rely on table->in_use in store_lock().  It may
478
 
    refer to a different thread if called from abortLockForThread().
 
477
    refer to a different thread if called from mysql_lock_abort_for_thread().
479
478
 
480
479
    @note If the table is MERGE, store_lock() can return less locks
481
480
    than lock_count() claimed. This can happen when the MERGE children
522
521
    the corresponding 'ha_*' method above.
523
522
  */
524
523
 
525
 
  virtual int open(const char *, int , uint32_t ) { assert(0); return -1; }
 
524
  virtual int open(const char *, int , uint32_t ) { assert(0); return -1; };
526
525
  virtual int doOpen(const TableIdentifier &identifier, int mode, uint32_t test_if_locked);
527
526
  virtual int doStartIndexScan(uint32_t idx, bool)
528
527
  { active_index= idx; return 0; }
583
582
  {
584
583
    return 0;
585
584
  }
586
 
  virtual void release_auto_increment(void) { return; }
 
585
  virtual void release_auto_increment(void) { return; };
587
586
  /** admin commands - called from mysql_admin_table */
588
587
  virtual int check(Session *)
589
588
  { return HA_ADMIN_NOT_IMPLEMENTED; }
640
639
void ha_init_errors(void);
641
640
 
642
641
class SortField;
643
 
SortField *make_unireg_sortorder(Order *order, uint32_t *length,
 
642
SortField *make_unireg_sortorder(order_st *order, uint32_t *length,
644
643
                                 SortField *sortorder);
645
644
int setup_order(Session *session, Item **ref_pointer_array, TableList *tables,
646
 
                List<Item> &fields, List <Item> &all_fields, Order *order);
 
645
                List<Item> &fields, List <Item> &all_fields, order_st *order);
647
646
int setup_group(Session *session, Item **ref_pointer_array, TableList *tables,
648
 
                List<Item> &fields, List<Item> &all_fields, Order *order,
 
647
                List<Item> &fields, List<Item> &all_fields, order_st *order,
649
648
                bool *hidden_group_fields);
650
649
bool fix_inner_refs(Session *session, List<Item> &all_fields, Select_Lex *select,
651
650
                    Item **ref_pointer_array);
664
663
                         int *timestamps, int *timestamps_with_niladic);
665
664
 
666
665
bool mysql_create_table(Session *session,
667
 
                        const TableIdentifier &identifier,
 
666
                        TableIdentifier &identifier,
668
667
                        HA_CREATE_INFO *create_info,
669
668
                        message::Table &table_proto,
670
669
                        AlterInfo *alter_info,
672
671
                        bool is_if_not_exists);
673
672
 
674
673
bool mysql_create_table_no_lock(Session *session,
675
 
                                const TableIdentifier &identifier,
 
674
                                TableIdentifier &identifier,
676
675
                                HA_CREATE_INFO *create_info,
677
676
                                message::Table &table_proto,
678
677
                                AlterInfo *alter_info,
680
679
                                bool is_if_not_exists);
681
680
 
682
681
bool mysql_create_like_table(Session* session,
683
 
                             const TableIdentifier &destination_identifier,
 
682
                             TableIdentifier &destination_identifier,
684
683
                             TableList* table, TableList* src_table,
685
684
                             message::Table &create_table_proto,
686
685
                             bool is_if_not_exists,
688
687
 
689
688
bool mysql_rename_table(Session &session,
690
689
                        plugin::StorageEngine *base,
691
 
                        const TableIdentifier &old_identifier,
692
 
                        const TableIdentifier &new_identifier);
 
690
                        TableIdentifier &old_identifier,
 
691
                        TableIdentifier &new_identifier);
693
692
 
694
693
bool mysql_prepare_update(Session *session, TableList *table_list,
695
 
                          Item **conds, uint32_t order_num, Order *order);
 
694
                          Item **conds, uint32_t order_num, order_st *order);
696
695
int mysql_update(Session *session,TableList *tables,List<Item> &fields,
697
696
                 List<Item> &values,COND *conds,
698
 
                 uint32_t order_num, Order *order, ha_rows limit,
 
697
                 uint32_t order_num, order_st *order, ha_rows limit,
699
698
                 enum enum_duplicates handle_duplicates, bool ignore);
700
699
bool mysql_prepare_insert(Session *session, TableList *table_list, Table *table,
701
700
                          List<Item> &fields, List_item *values,