~ubuntu-branches/ubuntu/gutsy/mysql-dfsg-5.0/gutsy

« back to all changes in this revision

Viewing changes to sql/item_func.cc

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2007-04-03 09:43:01 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20070403094301-fnjhfr59hu72pvtg
Tags: 5.0.38-0ubuntu1
* Package the Enterprise version again (.37 was a community version), since
  Debian and we have always done so. This brings in a few more bug fixes and
  makes functional derivations less likely.
* debian/README.Maintainer: Add pointer to upstream download URL, since it
  is very hard to find the Enterprise versions.
* Disable 33_scripts__mysql_create_system_tables__no_test.dpatch, since that
  script was removed upstream.
* debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch: Adapted to
  changed formatting in new upstream version.
* Remove debian/patches/86_PATH_MAX.dpatch, fixed upstream.
* Add debian/patches/90_org_tables_definition.dpatch: Fix local variable
  declaration in libmysqld/sql_parse.cc to fix compilation with
  EMBEDDED_LIBRARY.

Show diffs side-by-side

added added

removed removed

Lines of Context:
409
409
  if (item->type() != FUNC_ITEM)
410
410
    return 0;
411
411
  Item_func *item_func=(Item_func*) item;
412
 
  if (arg_count != item_func->arg_count ||
413
 
      func_name() != item_func->func_name())
 
412
  Item_func::Functype func_type;
 
413
  if ((func_type= functype()) != item_func->functype() ||
 
414
      arg_count != item_func->arg_count ||
 
415
      (func_type != Item_func::FUNC_SP &&
 
416
       func_name() != item_func->func_name()) ||
 
417
      (func_type == Item_func::FUNC_SP &&
 
418
       my_strcasecmp(system_charset_info, func_name(), item_func->func_name())))
414
419
    return 0;
415
420
  for (uint i=0; i < arg_count ; i++)
416
421
    if (!args[i]->eq(item_func->args[i], binary_cmp))
2360
2365
                                            b->ptr(), b->length(),
2361
2366
                                            &match, 1))
2362
2367
    return 0;
2363
 
  return (longlong) match.mblen + start0 + 1;
 
2368
  return (longlong) match.mb_len + start0 + 1;
2364
2369
}
2365
2370
 
2366
2371
 
3161
3166
    null_value = 1;
3162
3167
    return 0;
3163
3168
  }
 
3169
#ifdef HAVE_REPLICATION
3164
3170
  longlong pos = (ulong)args[1]->val_int();
3165
3171
  longlong timeout = (arg_count==3) ? args[2]->val_int() : 0 ;
3166
 
#ifdef HAVE_REPLICATION
3167
3172
  if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos, timeout)) == -2)
3168
3173
  {
3169
3174
    null_value = 1;
3207
3212
    Structure is now initialized.  Try to get the lock.
3208
3213
    Set up control struct to allow others to abort locks
3209
3214
  */
3210
 
  thd_proc_info(thd, "User lock");
 
3215
  thd->proc_info="User lock";
3211
3216
  thd->mysys_var->current_mutex= &LOCK_user_locks;
3212
3217
  thd->mysys_var->current_cond=  &ull->cond;
3213
3218
 
3232
3237
  }
3233
3238
  pthread_mutex_unlock(&LOCK_user_locks);
3234
3239
  pthread_mutex_lock(&thd->mysys_var->mutex);
3235
 
  thd_proc_info(thd, 0);
 
3240
  thd->proc_info=0;
3236
3241
  thd->mysys_var->current_mutex= 0;
3237
3242
  thd->mysys_var->current_cond=  0;
3238
3243
  pthread_mutex_unlock(&thd->mysys_var->mutex);
3313
3318
    Structure is now initialized.  Try to get the lock.
3314
3319
    Set up control struct to allow others to abort locks.
3315
3320
  */
3316
 
  thd_proc_info(thd, "User lock");
 
3321
  thd->proc_info="User lock";
3317
3322
  thd->mysys_var->current_mutex= &LOCK_user_locks;
3318
3323
  thd->mysys_var->current_cond=  &ull->cond;
3319
3324
 
3351
3356
  pthread_mutex_unlock(&LOCK_user_locks);
3352
3357
 
3353
3358
  pthread_mutex_lock(&thd->mysys_var->mutex);
3354
 
  thd_proc_info(thd, 0);
 
3359
  thd->proc_info=0;
3355
3360
  thd->mysys_var->current_mutex= 0;
3356
3361
  thd->mysys_var->current_cond=  0;
3357
3362
  pthread_mutex_unlock(&thd->mysys_var->mutex);
3459
3464
  DBUG_ASSERT(fixed == 1);
3460
3465
  char buff[MAX_FIELD_WIDTH];
3461
3466
  String tmp(buff,sizeof(buff), &my_charset_bin);
 
3467
  my_decimal tmp_decimal;
3462
3468
  THD *thd=current_thd;
3463
3469
 
3464
3470
  for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++)
3473
3479
    case STRING_RESULT:
3474
3480
      (void) args[0]->val_str(&tmp);
3475
3481
      break;
 
3482
    case DECIMAL_RESULT:
 
3483
      (void) args[0]->val_decimal(&tmp_decimal);
 
3484
      break;
3476
3485
    case ROW_RESULT:
3477
3486
    default:
3478
3487
      // This case should never be chosen
3715
3724
 
3716
3725
 
3717
3726
bool
3718
 
Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type,
 
3727
Item_func_set_user_var::update_hash(void *ptr, uint length,
 
3728
                                    Item_result res_type,
3719
3729
                                    CHARSET_INFO *cs, Derivation dv,
3720
3730
                                    bool unsigned_arg)
3721
3731
{
3724
3734
    result type of the variable
3725
3735
  */
3726
3736
  if ((null_value= args[0]->null_value) && null_item)
3727
 
    type= entry->type;                          // Don't change type of item
 
3737
    res_type= entry->type;                      // Don't change type of item
3728
3738
  if (::update_hash(entry, (null_value= args[0]->null_value),
3729
 
                    ptr, length, type, cs, dv, unsigned_arg))
 
3739
                    ptr, length, res_type, cs, dv, unsigned_arg))
3730
3740
  {
3731
3741
    current_thd->fatal_error();     // Probably end of memory
3732
3742
    null_value= 1;
4226
4236
  user_var_entry *var_entry;
4227
4237
  var_entry= get_variable(&thd->user_vars, name, 0);
4228
4238
 
4229
 
  if (!(opt_bin_log && is_update_query(sql_command)))
 
4239
  /*
 
4240
    Any reference to user-defined variable which is done from stored
 
4241
    function or trigger affects their execution and the execution of the
 
4242
    calling statement. We must log all such variables even if they are 
 
4243
    not involved in table-updating statements.
 
4244
  */
 
4245
  if (!(opt_bin_log && 
 
4246
       (is_update_query(sql_command) || thd->in_sub_stmt)))
4230
4247
  {
4231
4248
    *out_entry= var_entry;
4232
4249
    return 0;
4978
4995
}
4979
4996
 
4980
4997
 
4981
 
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name)
4982
 
  :Item_func(), context(context_arg), m_name(name), m_sp(NULL),
 
4998
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
 
4999
                           sp_name *name_arg)
 
5000
  :Item_func(), context(context_arg), m_name(name_arg), m_sp(NULL),
4983
5001
   result_field(NULL)
4984
5002
{
4985
5003
  maybe_null= 1;
4989
5007
 
4990
5008
 
4991
5009
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
4992
 
                           sp_name *name, List<Item> &list)
4993
 
  :Item_func(list), context(context_arg), m_name(name), m_sp(NULL),
 
5010
                           sp_name *name_arg, List<Item> &list)
 
5011
  :Item_func(list), context(context_arg), m_name(name_arg), m_sp(NULL),
4994
5012
   result_field(NULL)
4995
5013
{
4996
5014
  maybe_null= 1;