~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_select.h

  • Committer: Brian Aker
  • Date: 2008-08-16 22:34:15 UTC
  • mto: This revision was merged to the branch mainline in revision 346.
  • Revision ID: brian@tangent.org-20080816223415-n24esdpfcqi4pwpy
Refactor around classes. TABLE_LIST has been factored out of table.h

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#define KEY_OPTIMIZE_REF_OR_NULL        2
36
36
 
37
37
typedef struct keyuse_t {
38
 
  TABLE *table;
 
38
  Table *table;
39
39
  Item  *val;                           /**< or value if no field */
40
40
  table_map used_tables;
41
41
  uint  key, keypart;
122
122
  Field_blob *blob_field;
123
123
  bool strip; /* true <=> Strip endspaces ?? */
124
124
 
125
 
  TABLE *get_rowid; /* _ != NULL <=> */
 
125
  Table *get_rowid; /* _ != NULL <=> */
126
126
} CACHE_FIELD;
127
127
 
128
128
 
183
183
 
184
184
typedef struct st_join_table {
185
185
  st_join_table() {}                          /* Remove gcc warning */
186
 
  TABLE         *table;
 
186
  Table         *table;
187
187
  KEYUSE        *keyuse;                        /**< pointer to first used key */
188
188
  SQL_SELECT    *select;
189
189
  COND          *select_cond;
374
374
  JOIN_TAB *join_tab,**best_ref;
375
375
  JOIN_TAB **map2table;    ///< mapping between table indexes and JOIN_TABs
376
376
  JOIN_TAB *join_tab_save; ///< saved join_tab for subquery reexecution
377
 
  TABLE    **table,**all_tables;
 
377
  Table    **table,**all_tables;
378
378
  /**
379
379
    The table which has an index that allows to produce the requried ordering.
380
380
    A special value of 0x1 means that the ordering will be produced by
381
381
    passing 1st non-const table to filesort(). NULL means no such table exists.
382
382
  */
383
 
  TABLE    *sort_by_table;
 
383
  Table    *sort_by_table;
384
384
  uint     tables;        /**< Number of tables in the join */
385
385
  uint     outer_tables;  /**< Number of tables that are not inside semijoin */
386
386
  uint     const_tables;
415
415
  double   best_read;
416
416
  List<Item> *fields;
417
417
  List<Cached_item> group_fields, group_fields_cache;
418
 
  TABLE    *tmp_table;
 
418
  Table    *tmp_table;
419
419
  /// used to store 2 possible tmp table of SELECT
420
 
  TABLE    *exec_tmp_table1, *exec_tmp_table2;
 
420
  Table    *exec_tmp_table1, *exec_tmp_table2;
421
421
  THD      *thd;
422
422
  Item_sum  **sum_funcs, ***sum_funcs_end;
423
423
  /** second copy of sumfuncs (for queries with 2 temporary tables */
512
512
    excessive memory usage.
513
513
  */  
514
514
  SORT_FIELD *sortorder;                        // make_unireg_sortorder()
515
 
  TABLE **table_reexec;                         // make_simple_join()
 
515
  Table **table_reexec;                         // make_simple_join()
516
516
  JOIN_TAB *join_tab_reexec;                    // make_simple_join()
517
517
  /* end of allocation caching storage */
518
518
 
611
611
  bool rollup_make_fields(List<Item> &all_fields, List<Item> &fields,
612
612
                          Item_sum ***func);
613
613
  int rollup_send_data(uint idx);
614
 
  int rollup_write_data(uint idx, TABLE *table);
 
614
  int rollup_write_data(uint idx, Table *table);
615
615
  void remove_subq_pushed_predicates(Item **where);
616
616
  /**
617
617
    Release memory and, if possible, the open tables held by this execution
648
648
 
649
649
/* Extern functions in sql_select.cc */
650
650
bool store_val_in_field(Field *field, Item *val, enum_check_fields check_flag);
651
 
TABLE *create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
 
651
Table *create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
652
652
                        ORDER *group, bool distinct, bool save_sum_fields,
653
653
                        uint64_t select_options, ha_rows rows_limit,
654
654
                        char* alias);
655
 
void free_tmp_table(THD *thd, TABLE *entry);
 
655
void free_tmp_table(THD *thd, Table *entry);
656
656
void count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param, 
657
657
                       List<Item> &fields, bool reset_with_sum_func);
658
658
bool setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
661
661
                       uint elements, List<Item> &fields);
662
662
void copy_fields(TMP_TABLE_PARAM *param);
663
663
void copy_funcs(Item **func_ptr);
664
 
uint find_shortest_key(TABLE *table, const key_map *usable_keys);
 
664
uint find_shortest_key(Table *table, const key_map *usable_keys);
665
665
Field* create_tmp_field_from_field(THD *thd, Field* org_field,
666
 
                                   const char *name, TABLE *table,
 
666
                                   const char *name, Table *table,
667
667
                                   Item_field *item, uint convert_blob_length);
668
668
                                                                      
669
669
/* functions from opt_sum.cc */
753
753
 protected: 
754
754
  enum store_key_result copy_inner()
755
755
  {
756
 
    TABLE *table= copy_field.to_field->table;
 
756
    Table *table= copy_field.to_field->table;
757
757
    my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
758
758
                                                     table->write_set);
759
759
    copy_field.do_copy(&copy_field);
780
780
 protected:  
781
781
  enum store_key_result copy_inner()
782
782
  {
783
 
    TABLE *table= to_field->table;
 
783
    Table *table= to_field->table;
784
784
    my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
785
785
                                                     table->write_set);
786
786
    int res= item->save_in_field(to_field, 1);
823
823
  }
824
824
};
825
825
 
826
 
bool cp_buffer_from_ref(THD *thd, TABLE *table, TABLE_REF *ref);
 
826
bool cp_buffer_from_ref(THD *thd, Table *table, TABLE_REF *ref);
827
827
bool error_if_full_join(JOIN *join);
828
 
int report_error(TABLE *table, int error);
 
828
int report_error(Table *table, int error);
829
829
int safe_index_read(JOIN_TAB *tab);
830
830
COND *remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value);
831
831
int test_if_item_cache_changed(List<Cached_item> &list);