~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/item_subselect.h

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
class Item_subselect :public Item_result_field
34
34
{
35
 
  bool value_assigned; /* value already assigned to subselect */
 
35
  my_bool value_assigned; /* value already assigned to subselect */
36
36
public:
37
37
  /* thread handler, will be assigned in fix_fields only */
38
38
  THD *thd;
108
108
  Item *get_tmp_table_item(THD *thd);
109
109
  void update_used_tables();
110
110
  virtual void print(String *str, enum_query_type query_type);
111
 
  virtual bool have_guarded_conds() { return false; }
 
111
  virtual bool have_guarded_conds() { return FALSE; }
112
112
  bool change_engine(subselect_engine *eng)
113
113
  {
114
114
    old_engine= engine;
165
165
  trans_res select_transformer(JOIN *join);
166
166
  void store(uint i, Item* item);
167
167
  double val_real();
168
 
  int64_t val_int ();
 
168
  longlong val_int ();
169
169
  String *val_str (String *);
170
170
  my_decimal *val_decimal(my_decimal *);
171
171
  bool val_bool();
210
210
  virtual void print(String *str, enum_query_type query_type);
211
211
  void cleanup();
212
212
  bool any_value() { return was_values; }
213
 
  void register_value() { was_values= true; }
214
 
  void reset_value_registration() { was_values= false; }
 
213
  void register_value() { was_values= TRUE; }
 
214
  void reset_value_registration() { was_values= FALSE; }
215
215
};
216
216
 
217
217
/* exists subselect */
232
232
  }
233
233
 
234
234
  enum Item_result result_type() const { return INT_RESULT;}
235
 
  int64_t val_int();
 
235
  longlong val_int();
236
236
  double val_real();
237
237
  String *val_str(String*);
238
238
  my_decimal *val_decimal(my_decimal *);
292
292
  /* 
293
293
    Location of the subquery predicate. It is either
294
294
     - pointer to join nest if the subquery predicate is in the ON expression
295
 
     - (TableList*)1 if the predicate is in the WHERE.
 
295
     - (TABLE_LIST*)1 if the predicate is in the WHERE.
296
296
  */
297
 
  TableList *expr_join_nest;
 
297
  TABLE_LIST *expr_join_nest;
298
298
 
299
299
  /* The method chosen to execute the IN predicate.  */
300
300
  enum enum_exec_method {
320
320
 
321
321
  Item_in_subselect(Item * left_expr, st_select_lex *select_lex);
322
322
  Item_in_subselect()
323
 
    :Item_exists_subselect(), left_expr_cache(0), first_execution(true),
 
323
    :Item_exists_subselect(), left_expr_cache(0), first_execution(TRUE),
324
324
    optimizer(0), abort_on_null(0), pushed_cond_guards(NULL),
325
325
    exec_method(NOT_TRANSFORMED), upper_item(0)
326
326
  {}
340
340
                                                  Comp_creator *func);
341
341
  trans_res row_value_in_to_exists_transformer(JOIN * join);
342
342
  virtual bool exec();
343
 
  int64_t val_int();
 
343
  longlong val_int();
344
344
  double val_real();
345
345
  String *val_str(String*);
346
346
  my_decimal *val_decimal(my_decimal *);
402
402
    result= res;
403
403
    item= si;
404
404
    res_type= STRING_RESULT;
405
 
    res_field_type= DRIZZLE_TYPE_VARCHAR;
 
405
    res_field_type= MYSQL_TYPE_VAR_STRING;
406
406
    maybe_null= 0;
407
407
  }
408
408
  virtual ~subselect_engine() {}; // to satisfy compiler
438
438
  */
439
439
  virtual int exec()= 0;
440
440
  virtual uint cols()= 0; /* return number of columns in select */
441
 
  virtual uint8_t uncacheable()= 0; /* query is uncacheable */
 
441
  virtual uint8 uncacheable()= 0; /* query is uncacheable */
442
442
  enum Item_result type() { return res_type; }
443
443
  enum_field_types field_type() { return res_field_type; }
444
444
  virtual void exclude()= 0;
445
445
  virtual bool may_be_null() { return maybe_null; };
446
446
  virtual table_map upper_select_const_tables()= 0;
447
 
  static table_map calc_const_tables(TableList *);
 
447
  static table_map calc_const_tables(TABLE_LIST *);
448
448
  virtual void print(String *str, enum_query_type query_type)= 0;
449
449
  virtual bool change_result(Item_subselect *si,
450
450
                             select_result_interceptor *result)= 0;
451
451
  virtual bool no_tables()= 0;
452
 
  virtual bool is_executed() const { return false; }
 
452
  virtual bool is_executed() const { return FALSE; }
453
453
  /* Check if subquery produced any rows during last query execution */
454
454
  virtual bool no_rows() = 0;
455
455
  virtual enum_engine_type engine_type() { return ABSTRACT_ENGINE; }
461
461
 
462
462
class subselect_single_select_engine: public subselect_engine
463
463
{
464
 
  bool prepared; /* simple subselect is prepared */
465
 
  bool optimized; /* simple subselect is optimized */
466
 
  bool executed; /* simple subselect is executed */
 
464
  my_bool prepared; /* simple subselect is prepared */
 
465
  my_bool optimized; /* simple subselect is optimized */
 
466
  my_bool executed; /* simple subselect is executed */
467
467
  st_select_lex *select_lex; /* corresponding select_lex */
468
468
  JOIN * join; /* corresponding JOIN structure */
469
469
public:
475
475
  void fix_length_and_dec(Item_cache** row);
476
476
  int exec();
477
477
  uint cols();
478
 
  uint8_t uncacheable();
 
478
  uint8 uncacheable();
479
479
  void exclude();
480
480
  table_map upper_select_const_tables();
481
481
  virtual void print (String *str, enum_query_type query_type);
503
503
  void fix_length_and_dec(Item_cache** row);
504
504
  int exec();
505
505
  uint cols();
506
 
  uint8_t uncacheable();
 
506
  uint8 uncacheable();
507
507
  void exclude();
508
508
  table_map upper_select_const_tables();
509
509
  virtual void print (String *str, enum_query_type query_type);
560
560
  void fix_length_and_dec(Item_cache** row);
561
561
  int exec();
562
562
  uint cols() { return 1; }
563
 
  uint8_t uncacheable() { return UNCACHEABLE_DEPENDENT; }
 
563
  uint8 uncacheable() { return UNCACHEABLE_DEPENDENT; }
564
564
  void exclude();
565
565
  table_map upper_select_const_tables() { return 0; }
566
566
  virtual void print (String *str, enum_query_type query_type);
665
665
  subselect_hash_sj_engine(THD *thd, Item_subselect *in_predicate,
666
666
                               subselect_single_select_engine *old_engine)
667
667
    :subselect_uniquesubquery_engine(thd, NULL, in_predicate, NULL),
668
 
    is_materialized(false), materialize_engine(old_engine),
 
668
    is_materialized(FALSE), materialize_engine(old_engine),
669
669
    materialize_join(NULL), tmp_param(NULL)
670
670
  {}
671
671
  ~subselect_hash_sj_engine();