~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/subselect.h

  • Committer: Brian Aker
  • Date: 2010-05-18 15:49:50 UTC
  • Revision ID: brian@gaz-20100518154950-qhctxu6lvvnyxy9i
Simplify out Open_tables_state() backup/restore (no longer needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "drizzled/item/ref.h"
28
28
#include "drizzled/item/field.h"
29
29
#include "drizzled/item/bin_string.h"
30
 
#include "drizzled/util/test.h"
31
30
 
32
31
namespace drizzled
33
32
{
34
33
 
35
34
class Select_Lex;
36
35
class Select_Lex_Unit;
37
 
class Join;
 
36
class JOIN;
38
37
class select_result_interceptor;
39
38
class subselect_engine;
40
39
class subselect_hash_sj_engine;
104
103
  {
105
104
    null_value= 1;
106
105
  }
107
 
  virtual trans_res select_transformer(Join *join);
 
106
  virtual trans_res select_transformer(JOIN *join);
108
107
  bool assigned() { return value_assigned; }
109
108
  void assigned(bool a) { value_assigned= a; }
110
109
  enum Type type() const;
178
177
  subs_type substype() { return SINGLEROW_SUBS; }
179
178
 
180
179
  void reset();
181
 
  trans_res select_transformer(Join *join);
 
180
  trans_res select_transformer(JOIN *join);
182
181
  void store(uint32_t i, Item* item);
183
182
  double val_real();
184
183
  int64_t val_int ();
357
356
    null_value= 0;
358
357
    was_null= 0;
359
358
  }
360
 
  trans_res select_transformer(Join *join);
361
 
  trans_res select_in_like_transformer(Join *join, const Comp_creator *func);
362
 
  trans_res single_value_transformer(Join *join, const Comp_creator *func);
363
 
  trans_res row_value_transformer(Join * join);
364
 
  trans_res single_value_in_to_exists_transformer(Join * join,
 
359
  trans_res select_transformer(JOIN *join);
 
360
  trans_res select_in_like_transformer(JOIN *join, const Comp_creator *func);
 
361
  trans_res single_value_transformer(JOIN *join, const Comp_creator *func);
 
362
  trans_res row_value_transformer(JOIN * join);
 
363
  trans_res single_value_in_to_exists_transformer(JOIN * join,
365
364
                                                  const Comp_creator *func);
366
 
  trans_res row_value_in_to_exists_transformer(Join * join);
 
365
  trans_res row_value_in_to_exists_transformer(JOIN * join);
367
366
  virtual bool exec();
368
367
  int64_t val_int();
369
368
  double val_real();
401
400
 
402
401
  // only ALL subquery has upper not
403
402
  subs_type substype() { return all?ALL_SUBS:ANY_SUBS; }
404
 
  trans_res select_transformer(Join *join);
 
403
  trans_res select_transformer(JOIN *join);
405
404
  virtual void print(String *str, enum_query_type query_type);
406
405
};
407
406
 
430
429
    res_field_type= DRIZZLE_TYPE_VARCHAR;
431
430
    maybe_null= 0;
432
431
  }
433
 
  virtual ~subselect_engine() {} // to satisfy compiler
 
432
  virtual ~subselect_engine() {}; // to satisfy compiler
434
433
  virtual void cleanup()= 0;
435
434
 
436
435
  /*
463
462
  */
464
463
  virtual int exec()= 0;
465
464
  virtual uint32_t cols()= 0; /* return number of columns in select */
466
 
  virtual bool uncacheable()= 0; /* query is uncacheable */
467
 
  virtual bool uncacheable(uint32_t bit_pos)= 0; /* query is uncacheable */
 
465
  virtual uint8_t uncacheable()= 0; /* query is uncacheable */
468
466
  enum Item_result type() { return res_type; }
469
467
  enum_field_types field_type() { return res_field_type; }
470
468
  virtual void exclude()= 0;
471
 
  virtual bool may_be_null() { return maybe_null; }
 
469
  virtual bool may_be_null() { return maybe_null; };
472
470
  virtual table_map upper_select_const_tables()= 0;
473
471
  static table_map calc_const_tables(TableList *);
474
472
  virtual void print(String *str, enum_query_type query_type)= 0;
491
489
  bool optimized; /* simple subselect is optimized */
492
490
  bool executed; /* simple subselect is executed */
493
491
  Select_Lex *select_lex; /* corresponding select_lex */
494
 
  Join * join; /* corresponding JOIN structure */
 
492
  JOIN * join; /* corresponding JOIN structure */
495
493
public:
496
494
  subselect_single_select_engine(Select_Lex *select,
497
495
                                 select_result_interceptor *result,
501
499
  void fix_length_and_dec(Item_cache** row);
502
500
  int exec();
503
501
  uint32_t cols();
504
 
  bool uncacheable();
505
 
  bool uncacheable(uint32_t bit_pos);
 
502
  uint8_t uncacheable();
506
503
  void exclude();
507
504
  table_map upper_select_const_tables();
508
505
  virtual void print (String *str, enum_query_type query_type);
530
527
  void fix_length_and_dec(Item_cache** row);
531
528
  int exec();
532
529
  uint32_t cols();
533
 
  bool uncacheable();
534
 
  bool uncacheable(uint32_t bit_pos);
 
530
  uint8_t uncacheable();
535
531
  void exclude();
536
532
  table_map upper_select_const_tables();
537
533
  virtual void print (String *str, enum_query_type query_type);
576
572
  bool null_keypart; /* TRUE <=> constructed search tuple has a NULL */
577
573
public:
578
574
 
579
 
  // constructor can assign Session because it will be called after Join::prepare
 
575
  // constructor can assign Session because it will be called after JOIN::prepare
580
576
  subselect_uniquesubquery_engine(Session *session_arg, JoinTable *tab_arg,
581
577
                                  Item_subselect *subs, Item *where)
582
578
    :subselect_engine(subs, 0), tab(tab_arg), cond(where)
588
584
  void fix_length_and_dec(Item_cache** row);
589
585
  int exec();
590
586
  uint32_t cols() { return 1; }
591
 
  bool uncacheable() { return true; }
592
 
  bool uncacheable(uint32_t) { return true; }
 
587
  uint8_t uncacheable() { return UNCACHEABLE_DEPENDENT; }
593
588
  void exclude();
594
589
  table_map upper_select_const_tables() { return 0; }
595
590
  virtual void print (String *str, enum_query_type query_type);
638
633
  Item *having;
639
634
public:
640
635
 
641
 
  // constructor can assign Session because it will be called after Join::prepare
 
636
  // constructor can assign Session because it will be called after JOIN::prepare
642
637
  subselect_indexsubquery_engine(Session *session_arg, JoinTable *tab_arg,
643
638
                                 Item_subselect *subs, Item *where,
644
639
                                 Item *having_arg, bool chk_null)
686
681
    QEP to execute the subquery and materialize its result into a
687
682
    temporary table. Created during the first call to exec().
688
683
  */
689
 
  Join *materialize_join;
 
684
  JOIN *materialize_join;
690
685
  /* Temp table context of the outer select's JOIN. */
691
686
  Tmp_Table_Param *tmp_param;
692
687