~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join.cc

  • Committer: Brian Aker
  • Date: 2011-01-02 05:13:03 UTC
  • mfrom: (2044.1.1 trunk-bug-628397)
  • Revision ID: brian@tangent.org-20110102051303-boac41qa2g1myorm
MErge in Andrew's patch for a mysql bug

Show diffs side-by-side

added added

removed removed

Lines of Context:
5600
5600
       As we use bitmaps to represent the relation the complexity
5601
5601
       of the algorithm is O((number of tables)^2).
5602
5602
    */
5603
 
    for (i= 0, s= stat ; i < table_count ; i++, s++)
 
5603
    for (i= 0; i < table_count; i++)
5604
5604
    {
5605
 
      for (uint32_t j= 0 ; j < table_count ; j++)
 
5605
      uint32_t j;
 
5606
      table= stat[i].table;
 
5607
 
 
5608
      if (!table->reginfo.join_tab->dependent)
 
5609
        continue;
 
5610
 
 
5611
      for (j= 0, s= stat; j < table_count; j++, s++)
5606
5612
      {
5607
 
        table= stat[j].table;
5608
5613
        if (s->dependent & table->map)
 
5614
        {
 
5615
          table_map was_dependent= s->dependent;
5609
5616
          s->dependent |= table->reginfo.join_tab->dependent;
 
5617
          if (i > j && s->dependent != was_dependent)
 
5618
          {
 
5619
            i= j= 1;
 
5620
            break;
 
5621
          }
 
5622
        }
5610
5623
      }
5611
 
      if (s->dependent)
5612
 
        s->table->maybe_null= 1;
5613
5624
    }
5614
5625
    /* Catch illegal cross references for outer joins */
5615
5626
    for (i= 0, s= stat ; i < table_count ; i++, s++)
5620
5631
        my_message(ER_WRONG_OUTER_JOIN, ER(ER_WRONG_OUTER_JOIN), MYF(0));
5621
5632
        return 1;
5622
5633
      }
 
5634
      if (outer_join & s->table->map)
 
5635
        s->table->maybe_null= 1;
 
5636
 
5623
5637
      s->key_dependent= s->dependent;
5624
5638
    }
5625
5639
  }