~ubuntu-branches/ubuntu/karmic/mysql-dfsg-5.1/karmic

« back to all changes in this revision

Viewing changes to sql/item_func.cc

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-06-25 12:55:45 UTC
  • mfrom: (0.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20090625125545-v27uqh8rlsj8uh2y
Tags: upstream-5.1.34
ImportĀ upstreamĀ versionĀ 5.1.34

Show diffs side-by-side

added added

removed removed

Lines of Context:
2739
2739
          if (is_last_item && !is_separator)
2740
2740
            str_end= substr_end;
2741
2741
          if (!my_strnncoll(cs, (const uchar *) str_begin,
2742
 
                            str_end - str_begin,
 
2742
                            (uint) (str_end - str_begin),
2743
2743
                            find_str, find_str_len))
2744
2744
            return (longlong) position;
2745
2745
          else
3808
3808
}
3809
3809
 
3810
3810
 
 
3811
void Item_func_set_user_var::cleanup()
 
3812
{
 
3813
  Item_func::cleanup();
 
3814
  entry= NULL;
 
3815
}
 
3816
 
 
3817
 
3811
3818
bool Item_func_set_user_var::set_entry(THD *thd, bool create_if_not_exists)
3812
3819
{
3813
3820
  if (entry && thd->thread_id == entry_thread_id)
4307
4314
}
4308
4315
 
4309
4316
 
 
4317
bool Item_func_set_user_var::is_null_result()
 
4318
{
 
4319
  DBUG_ASSERT(fixed == 1);
 
4320
  check(TRUE);
 
4321
  update();                                     // Store expression
 
4322
  return is_null();
 
4323
}
 
4324
 
 
4325
 
4310
4326
void Item_func_set_user_var::print(String *str, enum_query_type query_type)
4311
4327
{
4312
4328
  str->append(STRING_WITH_LEN("(@"));
4809
4825
  component(*component_arg), cache_present(0)
4810
4826
{
4811
4827
  /* set_name() will allocate the name */
4812
 
  set_name(name_arg, name_len_arg, system_charset_info);
 
4828
  set_name(name_arg, (uint) name_len_arg, system_charset_info);
4813
4829
}
4814
4830
 
4815
4831
 
4821
4837
 
4822
4838
void Item_func_get_system_var::fix_length_and_dec()
4823
4839
{
 
4840
  char *cptr;
4824
4841
  maybe_null=0;
 
4842
  max_length= 0;
4825
4843
 
4826
4844
  if (var->check_type(var_type))
4827
4845
  {
4851
4869
      break;
4852
4870
    case SHOW_CHAR:
4853
4871
    case SHOW_CHAR_PTR:
 
4872
      pthread_mutex_lock(&LOCK_global_system_variables);
 
4873
      cptr= var->show_type() == SHOW_CHAR_PTR ? 
 
4874
        *(char**) var->value_ptr(current_thd, var_type, &component) :
 
4875
        (char*) var->value_ptr(current_thd, var_type, &component);
 
4876
      if (cptr)
 
4877
        max_length= strlen(cptr) * system_charset_info->mbmaxlen;
 
4878
      pthread_mutex_unlock(&LOCK_global_system_variables);
4854
4879
      collation.set(system_charset_info, DERIVATION_SYSCONST);
4855
 
      max_length= MAX_BLOB_WIDTH;
4856
4880
      decimals=NOT_FIXED_DEC;
4857
4881
      break;
4858
4882
    case SHOW_BOOL:
5355
5379
    if (item->type() == Item::REF_ITEM)
5356
5380
      args[i]= item= *((Item_ref *)item)->ref;
5357
5381
    if (item->type() != Item::FIELD_ITEM)
5358
 
      key=NO_SUCH_KEY;
 
5382
    {
 
5383
      my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST");
 
5384
      return TRUE;
 
5385
    }
5359
5386
  }
5360
5387
  /*
5361
5388
    Check that all columns come from the same table.