~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/subselect.h

  • Committer: Eric Herman
  • Date: 2008-12-06 19:42:46 UTC
  • mto: (656.1.6 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: eric@mysql.com-20081206194246-5cdexuu81i366eek
removed trailing whitespace with simple script:

for file in $(find . -name "*.c") $(find . -name "*.cc") $(find . -name "*.h"); do ruby -pe 'gsub(/\s+$/, $/)' < $file > $file.out; mv $file.out $file; done;

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
  bool changed;
75
75
 
76
76
  /* TRUE <=> The underlying SELECT is correlated w.r.t some ancestor select */
77
 
  bool is_correlated; 
 
77
  bool is_correlated;
78
78
 
79
79
  enum trans_res {RES_OK, RES_REDUCE, RES_ERROR};
80
80
  enum subs_type {UNKNOWN_SUBS, SINGLEROW_SUBS,
236
236
  Item_exists_subselect(): Item_subselect() {}
237
237
 
238
238
  subs_type substype() { return EXISTS_SUBS; }
239
 
  void reset() 
 
239
  void reset()
240
240
  {
241
241
    value= 0;
242
242
  }
261
261
  "left_expr IN (SELECT ...)".
262
262
 
263
263
  @detail
264
 
  This class has: 
 
264
  This class has:
265
265
   - A "subquery execution engine" (as a subclass of Item_subselect) that allows
266
266
     it to evaluate subqueries. (and this class participates in execution by
267
267
     having was_null variable where part of execution result is stored.
295
295
public:
296
296
  /* Used to trigger on/off conditions that were pushed down to subselect */
297
297
  bool *pushed_cond_guards;
298
 
  
 
298
 
299
299
  /* Priority of this predicate in the convert-to-semi-join-nest process. */
300
300
  int sj_convert_priority;
301
301
 
302
 
  /* 
 
302
  /*
303
303
    Location of the subquery predicate. It is either
304
304
     - pointer to join nest if the subquery predicate is in the ON expression
305
305
     - (TableList*)1 if the predicate is in the WHERE.
319
319
  {
320
320
    return pushed_cond_guards ? pushed_cond_guards + i : NULL;
321
321
  }
322
 
  void set_cond_guard_var(int i, bool v) 
323
 
  { 
 
322
  void set_cond_guard_var(int i, bool v)
 
323
  {
324
324
    if ( pushed_cond_guards)
325
325
      pushed_cond_guards[i]= v;
326
326
  }
336
336
  {}
337
337
  void cleanup();
338
338
  subs_type substype() { return IN_SUBS; }
339
 
  void reset() 
 
339
  void reset()
340
340
  {
341
341
    value= 0;
342
342
    null_value= 0;
438
438
      stored somewhere by the exec() method itself.
439
439
 
440
440
      A required side effect: If at least one pushed-down predicate is
441
 
      disabled, subselect_engine->no_rows() must return correct result after 
 
441
      disabled, subselect_engine->no_rows() must return correct result after
442
442
      the exec() call.
443
443
 
444
444
    RETURN
533
533
  lookup in a unique index.
534
534
 
535
535
  This engine is used to resolve subqueries in forms
536
 
  
537
 
    outer_expr IN (SELECT tbl.unique_key FROM tbl WHERE subq_where) 
538
 
    
 
536
 
 
537
    outer_expr IN (SELECT tbl.unique_key FROM tbl WHERE subq_where)
 
538
 
539
539
  or, tuple-based:
540
 
  
 
540
 
541
541
    (oe1, .. oeN) IN (SELECT uniq_key_part1, ... uniq_key_partK
542
 
                      FROM tbl WHERE subqwhere) 
543
 
  
 
542
                      FROM tbl WHERE subqwhere)
 
543
 
544
544
  i.e. the subquery is a single table SELECT without GROUP BY, aggregate
545
545
  functions, etc.
546
546
*/
550
550
protected:
551
551
  st_join_table *tab;
552
552
  Item *cond; /* The WHERE condition of subselect */
553
 
  /* 
 
553
  /*
554
554
    TRUE<=> last execution produced empty set. Valid only when left
555
555
    expression is NULL.
556
556
  */
587
587
{
588
588
  /* FALSE for 'ref', TRUE for 'ref-or-null'. */
589
589
  bool check_null;
590
 
  /* 
 
590
  /*
591
591
    The "having" clause. This clause (further reffered to as "artificial
592
 
    having") was inserted by subquery transformation code. It contains 
593
 
    Item(s) that have a side-effect: they record whether the subquery has 
 
592
    having") was inserted by subquery transformation code. It contains
 
593
    Item(s) that have a side-effect: they record whether the subquery has
594
594
    produced a row with NULL certain components. We need to use it for cases
595
595
    like
596
596
      (oe1, oe2) IN (SELECT t.key, t.no_key FROM t1)
597
597
    where we do index lookup on t.key=oe1 but need also to check if there
598
598
    was a row such that t.no_key IS NULL.
599
 
    
 
599
 
600
600
    NOTE: This is currently here and not in the uniquesubquery_engine. Ideally
601
601
    it should have been in uniquesubquery_engine in order to allow execution of
602
602
    subqueries like
603
 
    
 
603
 
604
604
      (oe1, oe2) IN (SELECT primary_key, non_key_maybe_null_field FROM tbl)
605
605
 
606
606
    We could use uniquesubquery_engine for the first component and let
613
613
    The above example subquery is handled as a full-blown SELECT with eq_ref
614
614
    access to one table.
615
615
 
616
 
    Due to this limitation, the "artificial having" currently needs to be 
 
616
    Due to this limitation, the "artificial having" currently needs to be
617
617
    checked by only in indexsubquery_engine.
618
618
  */
619
619
  Item *having;