~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/cmpfunc.cc

  • Committer: Andrew Hutchings
  • Date: 2011-02-07 17:20:59 UTC
  • mfrom: (2148 staging)
  • mto: (2148.2.3 build)
  • mto: This revision was merged to the branch mainline in revision 2149.
  • Revision ID: andrew@linuxjedi.co.uk-20110207172059-dyeahrgzrlincoe3
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
493
493
void Item_bool_func2::fix_length_and_dec()
494
494
{
495
495
  max_length= 1;                                     // Function returns 0 or 1
496
 
  Session *session;
497
496
 
498
497
  /*
499
498
    As some compare functions are generated after sql_yacc,
531
530
    return;
532
531
  }
533
532
 
534
 
  session= current_session;
535
533
  Item_field *field_item= NULL;
536
534
 
537
535
  if (args[0]->real_item()->type() == FIELD_ITEM)
540
538
    if (field_item->field->can_be_compared_as_int64_t() &&
541
539
        !(field_item->is_datetime() && args[1]->result_type() == STRING_RESULT))
542
540
    {
543
 
      if (convert_constant_item(session, field_item, &args[1]))
 
541
      if (convert_constant_item(&getSession(), field_item, &args[1]))
544
542
      {
545
543
        cmp.set_cmp_func(this, tmp_arg, tmp_arg+1,
546
544
                         INT_RESULT);           // Works for all types.
556
554
          !(field_item->is_datetime() &&
557
555
            args[0]->result_type() == STRING_RESULT))
558
556
      {
559
 
        if (convert_constant_item(session, field_item, &args[0]))
 
557
        if (convert_constant_item(&getSession(), field_item, &args[0]))
560
558
        {
561
559
          cmp.set_cmp_func(this, tmp_arg, tmp_arg+1,
562
560
                           INT_RESULT); // Works for all types.
871
869
 
872
870
  if ((cmp_type= can_compare_as_dates(*a, *b, &const_value)))
873
871
  {
874
 
    session= current_session;
875
872
    owner= owner_arg;
876
873
    a_type= (*a)->field_type();
877
874
    b_type= (*b)->field_type();
909
906
 
910
907
void Arg_comparator::set_datetime_cmp_func(Item **a1, Item **b1)
911
908
{
912
 
  session= current_session;
913
909
  /* A caller will handle null values by itself. */
914
910
  owner= NULL;
915
911
  a= a1;
1670
1666
    change records at each execution.
1671
1667
  */
1672
1668
  if ((*args) != new_item)
1673
 
    current_session->change_item_tree(args, new_item);
 
1669
    getSession().change_item_tree(args, new_item);
1674
1670
 
1675
1671
  /*
1676
1672
    Transform the right IN operand which should be an Item_in_subselect or a
2004
2000
  int i;
2005
2001
  bool datetime_found= false;
2006
2002
  compare_as_dates= true;
2007
 
  Session *session= current_session;
2008
2003
 
2009
2004
  /*
2010
2005
    As some compare functions are generated after sql_yacc,
2051
2046
        The following can't be recoded with || as convert_constant_item
2052
2047
        changes the argument
2053
2048
      */
2054
 
      if (convert_constant_item(session, field_item, &args[1]))
 
2049
      if (convert_constant_item(&getSession(), field_item, &args[1]))
2055
2050
        cmp_type=INT_RESULT;                    // Works for all types.
2056
 
      if (convert_constant_item(session, field_item, &args[2]))
 
2051
      if (convert_constant_item(&getSession(), field_item, &args[2]))
2057
2052
        cmp_type=INT_RESULT;                    // Works for all types.
2058
2053
    }
2059
2054
  }
3554
3549
{
3555
3550
  Item **arg, **arg_end;
3556
3551
  bool const_itm= 1;
3557
 
  Session *session= current_session;
3558
3552
  bool datetime_found= false;
3559
3553
  /* true <=> arguments values will be compared as DATETIMEs. */
3560
3554
  bool compare_as_datetime= false;
3702
3696
          bool all_converted= true;
3703
3697
          for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++)
3704
3698
          {
3705
 
            if (!convert_constant_item (session, field_item, &arg[0]))
 
3699
            if (!convert_constant_item (&getSession(), field_item, &arg[0]))
3706
3700
              all_converted= false;
3707
3701
          }
3708
3702
          if (all_converted)
3739
3733
      }
3740
3734
    }
3741
3735
 
3742
 
    if (array && !(session->is_fatal_error))            // If not EOM
 
3736
    if (array && !(getSession().is_fatal_error))                // If not EOM
3743
3737
    {
3744
3738
      uint32_t j=0;
3745
3739
      for (uint32_t arg_num=1 ; arg_num < arg_count ; arg_num++)
4029
4023
      change records at each execution.
4030
4024
    */
4031
4025
    if (new_item != item)
4032
 
      current_session->change_item_tree(li.ref(), new_item);
 
4026
      getSession().change_item_tree(li.ref(), new_item);
4033
4027
  }
4034
4028
  return Item_func::transform(transformer, arg);
4035
4029
}
5165
5159
      change records at each execution.
5166
5160
    */
5167
5161
    if (new_item != item)
5168
 
      current_session->change_item_tree((Item **) it.ref(), new_item);
 
5162
      getSession().change_item_tree((Item **) it.ref(), new_item);
5169
5163
  }
5170
5164
  return Item_func::transform(transformer, arg);
5171
5165
}