~mdcallag/+junk/5.1-map

« back to all changes in this revision

Viewing changes to sql/sql_select.h

  • Committer: msvensson at pilot
  • Date: 2007-04-24 09:11:45 UTC
  • mfrom: (2469.1.106)
  • Revision ID: sp1r-msvensson@pilot.blaudden-20070424091145-10463
Merge pilot.blaudden:/home/msvensson/mysql/my51-m-mysql_upgrade
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
  JOIN          *join;
193
193
  /* Bitmap of nested joins this table is part of */
194
194
  nested_join_map embedding_map;
195
 
  
 
195
 
196
196
  void cleanup();
197
197
  inline bool is_using_loose_index_scan()
198
198
  {
331
331
 
332
332
  bool need_tmp, hidden_group_fields;
333
333
  DYNAMIC_ARRAY keyuse;
334
 
  Item::cond_result cond_value;
 
334
  Item::cond_result cond_value, having_value;
335
335
  List<Item> all_fields; // to store all fields that used in query
336
336
  //Above list changed to use temporary table
337
337
  List<Item> tmp_all_fields1, tmp_all_fields2, tmp_all_fields3;
527
527
 
528
528
class store_key :public Sql_alloc
529
529
{
530
 
 protected:
531
 
  Field *to_field;                              // Store data here
532
 
  char *null_ptr;
533
 
  char err;
534
530
public:
535
531
  bool null_key; /* TRUE <=> the value of the key has a null part */
536
532
  enum store_key_result { STORE_KEY_OK, STORE_KEY_FATAL, STORE_KEY_CONV };
537
533
  store_key(THD *thd, Field *field_arg, char *ptr, char *null, uint length)
538
 
    :null_ptr(null), err(0), null_key(0)
 
534
    :null_key(0), null_ptr(null), err(0)
539
535
  {
540
536
    if (field_arg->type() == MYSQL_TYPE_BLOB)
541
537
    {
550
546
                                        ptr, (uchar*) null, 1);
551
547
  }
552
548
  virtual ~store_key() {}                       /* Not actually needed */
553
 
  virtual enum store_key_result copy()=0;
554
549
  virtual const char *name() const=0;
 
550
 
 
551
  /**
 
552
    @brief sets ignore truncation warnings mode and calls the real copy method
 
553
 
 
554
    @details this function makes sure truncation warnings when preparing the
 
555
    key buffers don't end up as errors (because of an enclosing INSERT/UPDATE).
 
556
  */
 
557
  enum store_key_result copy()
 
558
  {
 
559
    enum store_key_result result;
 
560
    enum_check_fields saved_count_cuted_fields= 
 
561
      to_field->table->in_use->count_cuted_fields;
 
562
 
 
563
    to_field->table->in_use->count_cuted_fields= CHECK_FIELD_IGNORE;
 
564
 
 
565
    result= copy_inner();
 
566
 
 
567
    to_field->table->in_use->count_cuted_fields= saved_count_cuted_fields;
 
568
 
 
569
    return result;
 
570
  }
 
571
 
 
572
 protected:
 
573
  Field *to_field;                              // Store data here
 
574
  char *null_ptr;
 
575
  char err;
 
576
 
 
577
  virtual enum store_key_result copy_inner()=0;
555
578
};
556
579
 
557
580
 
571
594
      copy_field.set(to_field,from_field,0);
572
595
    }
573
596
  }
574
 
  enum store_key_result copy()
 
597
  const char *name() const { return field_name; }
 
598
 
 
599
 protected: 
 
600
  enum store_key_result copy_inner()
575
601
  {
576
602
    TABLE *table= copy_field.to_field->table;
577
603
    my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
581
607
    null_key= to_field->is_null();
582
608
    return err != 0 ? STORE_KEY_FATAL : STORE_KEY_OK;
583
609
  }
584
 
  const char *name() const { return field_name; }
585
610
};
586
611
 
587
612
 
596
621
               null_ptr_arg ? null_ptr_arg : item_arg->maybe_null ?
597
622
               &err : NullS, length), item(item_arg)
598
623
  {}
599
 
  enum store_key_result copy()
 
624
  const char *name() const { return "func"; }
 
625
 
 
626
 protected:  
 
627
  enum store_key_result copy_inner()
600
628
  {
601
629
    TABLE *table= to_field->table;
602
630
    my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
606
634
    null_key= to_field->is_null() || item->null_value;
607
635
    return (err != 0 || res > 2 ? STORE_KEY_FATAL : (store_key_result) res); 
608
636
  }
609
 
  const char *name() const { return "func"; }
610
637
};
611
638
 
612
639
 
622
649
                    &err : NullS, length, item_arg), inited(0)
623
650
  {
624
651
  }
625
 
  enum store_key_result copy()
 
652
  const char *name() const { return "const"; }
 
653
 
 
654
protected:  
 
655
  enum store_key_result copy_inner()
626
656
  {
627
657
    int res;
628
658
    if (!inited)
637
667
    null_key= to_field->is_null() || item->null_value;
638
668
    return (err > 2 ?  STORE_KEY_FATAL : (store_key_result) err);
639
669
  }
640
 
  const char *name() const { return "const"; }
641
670
};
642
671
 
643
672
bool cp_buffer_from_ref(THD *thd, TABLE *table, TABLE_REF *ref);