~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/func.cc

  • Committer: Padraig O'Sullivan
  • Date: 2010-02-11 16:22:34 UTC
  • mto: (1300.3.1 query-as-string)
  • mto: This revision was merged to the branch mainline in revision 1307.
  • Revision ID: osullivan.padraig@gmail.com-20100211162234-tkk64v4vdqkb9syv
Removed the found_semicolon member from the parsing stage

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <drizzled/sql_list.h>
24
24
 
25
25
#include <drizzled/function/math/int.h>
26
 
#include <drizzled/field/int32.h>
27
 
#include <drizzled/field/int64.h>
 
26
#include <drizzled/field/int64_t.h>
 
27
#include <drizzled/field/long.h>
28
28
#include <drizzled/field/double.h>
29
29
#include <drizzled/field/decimal.h>
30
30
#include <drizzled/session.h>
59
59
  list.empty();          // Fields are used
60
60
}
61
61
 
62
 
Item_func::Item_func(List<Item> &list) :
63
 
  _session(*current_session),
64
 
  allowed_arg_cols(1)
 
62
Item_func::Item_func(List<Item> &list)
 
63
  :allowed_arg_cols(1)
65
64
{
66
 
  collation.set(DERIVATION_SYSCONST);
67
65
  set_arguments(list);
68
66
}
69
67
 
70
 
Item_func::Item_func(Session *session, Item_func *item) :
71
 
  Item_result_field(session, item),
72
 
  _session(*current_session),
73
 
  allowed_arg_cols(item->allowed_arg_cols),
74
 
  arg_count(item->arg_count),
75
 
  used_tables_cache(item->used_tables_cache),
76
 
  not_null_tables_cache(item->not_null_tables_cache),
77
 
  const_item_cache(item->const_item_cache)
 
68
Item_func::Item_func(Session *session, Item_func *item)
 
69
  :Item_result_field(session, item),
 
70
   allowed_arg_cols(item->allowed_arg_cols),
 
71
   arg_count(item->arg_count),
 
72
   used_tables_cache(item->used_tables_cache),
 
73
   not_null_tables_cache(item->not_null_tables_cache),
 
74
   const_item_cache(item->const_item_cache)
78
75
{
79
76
  if (arg_count)
80
77
  {
87
84
    }
88
85
    memcpy(args, item->args, sizeof(Item*)*arg_count);
89
86
  }
90
 
  collation.set(DERIVATION_SYSCONST);
91
87
}
92
88
 
93
89
 
283
279
        change records at each execution.
284
280
      */
285
281
      if (*arg != new_item)
286
 
        getSession().change_item_tree(arg, new_item);
 
282
        current_session->change_item_tree(arg, new_item);
287
283
    }
288
284
  }
289
285
  return (this->*transformer)(argument);
454
450
 
455
451
Field *Item_func::tmp_table_field(Table *table)
456
452
{
457
 
  Field *field= NULL;
 
453
  Field *field;
458
454
 
459
455
  switch (result_type()) {
460
456
  case INT_RESULT:
461
457
    if (max_length > MY_INT32_NUM_DECIMAL_DIGITS)
462
 
      field= new field::Int64(max_length, maybe_null, name, unsigned_flag);
 
458
      field= new Field_int64_t(max_length, maybe_null, name, unsigned_flag);
463
459
    else
464
 
      field= new field::Int32(max_length, maybe_null, name, unsigned_flag);
 
460
      field= new Field_long(max_length, maybe_null, name, unsigned_flag);
465
461
    break;
466
 
 
467
462
  case REAL_RESULT:
468
463
    field= new Field_double(max_length, maybe_null, name, decimals);
469
464
    break;
470
 
 
471
465
  case STRING_RESULT:
472
466
    return make_string_field(table);
473
 
 
474
467
  case DECIMAL_RESULT:
475
468
    field= new Field_decimal(my_decimal_precision_to_length(decimal_precision(),
476
469
                                                            decimals,
481
474
                             unsigned_flag);
482
475
    break;
483
476
  case ROW_RESULT:
 
477
  default:
484
478
    // This case should never be chosen
485
479
    assert(0);
 
480
    field= 0;
486
481
    break;
487
482
  }
488
 
 
489
483
  if (field)
490
484
    field->init(table);
491
 
 
492
485
  return field;
493
486
}
494
487
 
625
618
 
626
619
void Item_func::signal_divide_by_null()
627
620
{
628
 
  my_error(ER_DIVISION_BY_ZERO, MYF(0));
629
 
  null_value= 0;
 
621
  Session *session= current_session;
 
622
  push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR, ER_DIVISION_BY_ZERO, ER(ER_DIVISION_BY_ZERO));
 
623
  null_value= 1;
630
624
}
631
625
 
632
626