~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.cc

Remove open tables, other assorted code bits (cleanup on style)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2377
2377
  uint32_t  blob_count,group_null_items, string_count;
2378
2378
  uint32_t fieldnr= 0;
2379
2379
  ulong reclength, string_total_length;
2380
 
  bool  using_unique_constraint= 0;
2381
 
  bool  use_packed_rows= 0;
 
2380
  bool  using_unique_constraint= false;
 
2381
  bool  use_packed_rows= true;
2382
2382
  bool  not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
2383
2383
  char  *tmpname,path[FN_REFLEN];
2384
2384
  unsigned char *pos, *group_buff, *bitmaps;
2409
2409
 
2410
2410
  if (group)
2411
2411
  {
2412
 
    if (!param->quick_group)
 
2412
    if (! param->quick_group)
2413
2413
      group= 0;                                 // Can't use group key
2414
2414
    else for (order_st *tmp=group ; tmp ; tmp=tmp->next)
2415
2415
    {
2421
2421
      */
2422
2422
      (*tmp->item)->marker= 4;
2423
2423
      if ((*tmp->item)->max_length >= CONVERT_IF_BIGGER_TO_BLOB)
2424
 
        using_unique_constraint=1;
 
2424
        using_unique_constraint= true;
2425
2425
    }
2426
2426
    if (param->group_length >= MAX_BLOB_WIDTH)
2427
 
      using_unique_constraint=1;
 
2427
      using_unique_constraint= true;
2428
2428
    if (group)
2429
2429
      distinct= 0;                              // Can't use distinct
2430
2430
  }
2663
2663
  /* If result table is small; use a heap */
2664
2664
  /* future: storage engine selection can be made dynamic? */
2665
2665
  if (blob_count || using_unique_constraint ||
2666
 
      (select_options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT)) ==
2667
 
      OPTION_BIG_TABLES || (select_options & TMP_TABLE_FORCE_MYISAM))
 
2666
      (select_options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT)) == OPTION_BIG_TABLES)
2668
2667
  {
2669
2668
    share->storage_engine= myisam_engine;
2670
2669
    table->cursor= share->db_type()->getCursor(*share, &table->mem_root);
2671
2670
    if (group &&
2672
2671
        (param->group_parts > table->cursor->getEngine()->max_key_parts() ||
2673
2672
         param->group_length > table->cursor->getEngine()->max_key_length()))
2674
 
      using_unique_constraint=1;
 
2673
      using_unique_constraint= true;
2675
2674
  }
2676
2675
  else
2677
2676
  {
2678
2677
    share->storage_engine= heap_engine;
2679
2678
    table->cursor= share->db_type()->getCursor(*share, &table->mem_root);
2680
2679
  }
2681
 
  if (!table->cursor)
 
2680
  if (! table->cursor)
2682
2681
    goto err;
2683
2682
 
2684
2683
 
2685
 
  if (!using_unique_constraint)
 
2684
  if (! using_unique_constraint)
2686
2685
    reclength+= group_null_items;       // null flag is stored separately
2687
2686
 
2688
2687
  share->blob_fields= blob_count;
3210
3209
 
3211
3210
  if (share->keys)
3212
3211
  {                                             // Get keys for ni_create
3213
 
    bool using_unique_constraint= 0;
 
3212
    bool using_unique_constraint= false;
3214
3213
    HA_KEYSEG *seg= (HA_KEYSEG*) alloc_root(&this->mem_root,
3215
3214
                                            sizeof(*seg) * keyinfo->key_parts);
3216
3215
    if (!seg)
3224
3223
      /* Can't create a key; Make a unique constraint instead of a key */
3225
3224
      share->keys=    0;
3226
3225
      share->uniques= 1;
3227
 
      using_unique_constraint=1;
 
3226
      using_unique_constraint= true;
3228
3227
      memset(&uniquedef, 0, sizeof(uniquedef));
3229
3228
      uniquedef.keysegs=keyinfo->key_parts;
3230
3229
      uniquedef.seg=seg;
3274
3273
          In this case we have to tell MyISAM that two NULL should
3275
3274
          on INSERT be regarded at the same value
3276
3275
        */
3277
 
        if (!using_unique_constraint)
 
3276
        if (! using_unique_constraint)
3278
3277
          keydef.flag|= HA_NULL_ARE_EQUAL;
3279
3278
      }
3280
3279
    }