~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_select.cc

  • Committer: Brian Aker
  • Date: 2008-08-15 15:01:59 UTC
  • mto: This revision was merged to the branch mainline in revision 346.
  • Revision ID: brian@tangent.org-20080815150159-vpx04493xvokzrkv
First pass in encapsulating table (it is now an object, no longer a structure).

Show diffs side-by-side

added added

removed removed

Lines of Context:
3514
3514
      while (embedding);
3515
3515
      continue;
3516
3516
    }
3517
 
    if ((table->s->system || table->file->stats.records <= 1) &&
 
3517
    if ((table->file->stats.records <= 1) &&
3518
3518
        !s->dependent &&
3519
3519
        (table->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT) && !join->no_const_tables)
3520
3520
    {
4440
4440
 
4441
4441
  if (key_field->eq_func && !(key_field->optimize & KEY_OPTIMIZE_EXISTS))
4442
4442
  {
4443
 
    for (uint key=0 ; key < form->s->keys ; key++)
 
4443
    for (uint key= 0 ; key < form->sizeKeys() ; key++)
4444
4444
    {
4445
4445
      if (!(form->keys_in_use_for_query.is_set(key)))
4446
4446
        continue;
6261
6261
    }
6262
6262
  }
6263
6263
  if (null_fields)
6264
 
    rec_length+=(join_tab->table->s->null_fields+7)/8;
 
6264
    rec_length+=(join_tab->table->getNullFields() + 7)/8;
6265
6265
  if (join_tab->table->maybe_null)
6266
6266
    rec_length+=sizeof(bool);
6267
6267
  if (blobs)
6268
6268
  {
6269
6269
    uint blob_length=(uint) (join_tab->table->file->stats.mean_rec_length-
6270
 
                             (join_tab->table->s->reclength- rec_length));
 
6270
                             (join_tab->table->getRecordLength()- rec_length));
6271
6271
    rec_length+=(uint) max((uint)4,blob_length);
6272
6272
  }
6273
6273
  join_tab->used_fields=fields;
11081
11081
  table->covering_keys.init();
11082
11082
  table->keys_in_use_for_query.init();
11083
11083
 
11084
 
  table->s= share;
 
11084
  table->setShare(share);
11085
11085
  init_tmp_table_share(thd, share, "", 0, tmpname, tmpname);
11086
11086
  share->blob_field= blob_field;
11087
11087
  share->blob_ptr_size= portable_sizeof_char_ptr;
15684
15684
  length=0;
15685
15685
  for (i=0 ; i < table_count ; i++)
15686
15686
  {
15687
 
    uint null_fields=0,used_fields;
 
15687
    uint null_fields=0, used_fields;
15688
15688
    Field **f_ptr,*field;
15689
15689
    MY_BITMAP *read_set= tables[i].table->read_set;
15690
15690
    for (f_ptr=tables[i].table->field,used_fields=tables[i].used_fields ;
15705
15705
      }
15706
15706
    }
15707
15707
    /* Copy null bits from table */
15708
 
    if (null_fields && tables[i].table->s->null_fields)
 
15708
    if (null_fields && tables[i].table->getNullFields())
15709
15709
    {                                           /* must copy null bits */
15710
15710
      copy->str= tables[i].table->null_flags;
15711
15711
      copy->length= tables[i].table->s->null_bytes;