~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/func.cc

  • Committer: Brian Aker
  • Date: 2010-12-20 19:24:24 UTC
  • mfrom: (2008.2.5 integer-refactor)
  • Revision ID: brian@tangent.org-20101220192424-iyccxsagvuw43kaz
A rather large and tasty cleanup of issues around ints, and one additional
fix for alter table.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <drizzled/function/math/int.h>
26
26
#include <drizzled/field/int32.h>
27
27
#include <drizzled/field/int64.h>
 
28
#include <drizzled/field/decimal.h>
28
29
#include <drizzled/field/double.h>
29
 
#include <drizzled/field/decimal.h>
 
30
#include <drizzled/field/size.h>
30
31
#include <drizzled/session.h>
31
32
#include <drizzled/error.h>
32
33
#include <drizzled/check_stack_overrun.h>
458
459
 
459
460
  switch (result_type()) {
460
461
  case INT_RESULT:
461
 
    if (max_length > MY_INT32_NUM_DECIMAL_DIGITS)
462
 
      field= new field::Int64(max_length, maybe_null, name, unsigned_flag);
 
462
    if (unsigned_flag)
 
463
    {
 
464
      field= new field::Size(max_length, maybe_null, name, true);
 
465
    } 
 
466
    else if (max_length > MY_INT32_NUM_DECIMAL_DIGITS)
 
467
    {
 
468
      field= new field::Int64(max_length, maybe_null, name, false);
 
469
    }
463
470
    else
464
 
      field= new field::Int32(max_length, maybe_null, name, unsigned_flag);
 
471
    {
 
472
      field= new field::Int32(max_length, maybe_null, name, false);
 
473
    }
 
474
 
465
475
    break;
466
476
 
467
477
  case REAL_RESULT: