~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/func.cc

  • Committer: Brian Aker
  • Date: 2010-07-20 02:17:09 UTC
  • mto: This revision was merged to the branch mainline in revision 1665.
  • Revision ID: brian@gaz-20100720021709-1yeehbw8d5vbtmlc
Removed identifier bit

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>
63
63
  _session(*current_session),
64
64
  allowed_arg_cols(1)
65
65
{
66
 
  collation.set(DERIVATION_SYSCONST);
67
66
  set_arguments(list);
68
67
}
69
68
 
87
86
    }
88
87
    memcpy(args, item->args, sizeof(Item*)*arg_count);
89
88
  }
90
 
  collation.set(DERIVATION_SYSCONST);
91
89
}
92
90
 
93
91
 
454
452
 
455
453
Field *Item_func::tmp_table_field(Table *table)
456
454
{
457
 
  Field *field= NULL;
 
455
  Field *field;
458
456
 
459
457
  switch (result_type()) {
460
458
  case INT_RESULT:
461
459
    if (max_length > MY_INT32_NUM_DECIMAL_DIGITS)
462
 
      field= new field::Int64(max_length, maybe_null, name, unsigned_flag);
 
460
      field= new Field_int64_t(max_length, maybe_null, name, unsigned_flag);
463
461
    else
464
 
      field= new field::Int32(max_length, maybe_null, name, unsigned_flag);
 
462
      field= new Field_long(max_length, maybe_null, name, unsigned_flag);
465
463
    break;
466
 
 
467
464
  case REAL_RESULT:
468
465
    field= new Field_double(max_length, maybe_null, name, decimals);
469
466
    break;
470
 
 
471
467
  case STRING_RESULT:
472
468
    return make_string_field(table);
473
 
 
474
469
  case DECIMAL_RESULT:
475
470
    field= new Field_decimal(my_decimal_precision_to_length(decimal_precision(),
476
471
                                                            decimals,
481
476
                             unsigned_flag);
482
477
    break;
483
478
  case ROW_RESULT:
 
479
  default:
484
480
    // This case should never be chosen
485
481
    assert(0);
 
482
    field= 0;
486
483
    break;
487
484
  }
488
 
 
489
485
  if (field)
490
486
    field->init(table);
491
 
 
492
487
  return field;
493
488
}
494
489
 
625
620
 
626
621
void Item_func::signal_divide_by_null()
627
622
{
628
 
  my_error(ER_DIVISION_BY_ZERO, MYF(0));
629
 
  null_value= 0;
 
623
  push_warning(getSessionPtr(), DRIZZLE_ERROR::WARN_LEVEL_ERROR, ER_DIVISION_BY_ZERO, ER(ER_DIVISION_BY_ZERO));
 
624
  null_value= 1;
630
625
}
631
626
 
632
627