~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/func.cc

  • Committer: Lee Bieber
  • Date: 2010-12-23 23:11:00 UTC
  • mfrom: (2024.1.1 clean)
  • Revision ID: kalebral@gmail.com-20101223231100-0rqirgz7ugkl10yp
Merge Brian - session list cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
 
63
63
Item_func::Item_func(List<Item> &list) :
64
64
  _session(*current_session),
65
 
  allowed_arg_cols(1),
66
 
  const_item_cache(false)
 
65
  allowed_arg_cols(1)
67
66
{
68
67
  collation.set(DERIVATION_SYSCONST);
69
68
  set_arguments(list);
84
83
      args= tmp_arg;
85
84
    else
86
85
    {
87
 
      if (!(args=(Item**) session->getMemRoot()->allocate(sizeof(Item*)*arg_count)))
 
86
      if (!(args=(Item**) session->alloc(sizeof(Item*)*arg_count)))
88
87
        return;
89
88
    }
90
89
    memcpy(args, item->args, sizeof(Item*)*arg_count);
135
134
  unsigned char buff[STACK_BUFF_ALLOC];      // Max argument in function
136
135
  session->session_marker= 0;
137
136
  used_tables_cache= not_null_tables_cache= 0;
138
 
  const_item_cache= true;
 
137
  const_item_cache=1;
139
138
 
140
139
  if (check_stack_overrun(session, STACK_MIN_SIZE, buff))
141
140
    return true;        // Fatal error if flag is set!
190
189
  Item **arg,**arg_end;
191
190
 
192
191
  used_tables_cache= not_null_tables_cache= 0;
193
 
  const_item_cache= false;
 
192
  const_item_cache=1;
194
193
 
195
194
  if (arg_count)
196
195
  {
355
354
void Item_func::update_used_tables()
356
355
{
357
356
  used_tables_cache=0;
358
 
  const_item_cache= true;
 
357
  const_item_cache=1;
359
358
  for (uint32_t i=0 ; i < arg_count ; i++)
360
359
  {
361
360
    args[i]->update_used_tables();
435
434
}
436
435
 
437
436
 
438
 
bool Item_func::get_arg0_date(type::Time &ltime, uint32_t fuzzy_date)
 
437
bool Item_func::get_arg0_date(DRIZZLE_TIME *ltime, uint32_t fuzzy_date)
439
438
{
440
439
  return (null_value=args[0]->get_date(ltime, fuzzy_date));
441
440
}
442
441
 
443
442
 
444
 
bool Item_func::get_arg0_time(type::Time &ltime)
 
443
bool Item_func::get_arg0_time(DRIZZLE_TIME *ltime)
445
444
{
446
445
  return (null_value= args[0]->get_time(ltime));
447
446
}
483
482
    return make_string_field(table);
484
483
 
485
484
  case DECIMAL_RESULT:
486
 
    field= new Field_decimal(class_decimal_precision_to_length(decimal_precision(),
 
485
    field= new Field_decimal(my_decimal_precision_to_length(decimal_precision(),
487
486
                                                            decimals,
488
487
                                                            unsigned_flag),
489
488
                             maybe_null,
504
503
}
505
504
 
506
505
 
507
 
type::Decimal *Item_func::val_decimal(type::Decimal *decimal_value)
 
506
my_decimal *Item_func::val_decimal(my_decimal *decimal_value)
508
507
{
509
508
  assert(fixed);
510
 
  int2_class_decimal(E_DEC_FATAL_ERROR, val_int(), unsigned_flag, decimal_value);
 
509
  int2my_decimal(E_DEC_FATAL_ERROR, val_int(), unsigned_flag, decimal_value);
511
510
  return decimal_value;
512
511
}
513
512
 
581
580
    set_if_smaller(unsigned_flag, args[i]->unsigned_flag);
582
581
  }
583
582
  int precision= min(max_int_part + decimals, DECIMAL_MAX_PRECISION);
584
 
  max_length= class_decimal_precision_to_length(precision, decimals,
 
583
  max_length= my_decimal_precision_to_length(precision, decimals,
585
584
                                             unsigned_flag);
586
585
}
587
586