~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item.cc

  • Committer: Brian Aker
  • Date: 2008-11-03 03:49:00 UTC
  • mfrom: (520.4.50 devel)
  • Revision ID: brian@tangent.org-20081103034900-znhvcgtipr3tlel5
Merging in Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#include <drizzled/server_includes.h>
18
18
#include <drizzled/sql_select.h>
19
19
#include <drizzled/error.h>
 
20
#include CMATH_H
 
21
 
 
22
#if defined(CMATH_NAMESPACE)
 
23
using namespace CMATH_NAMESPACE;
 
24
#endif
20
25
 
21
26
const String my_null_string("NULL", 4, default_charset_info);
22
27
 
37
42
  return &real_traits_instance;
38
43
}
39
44
 
 
45
int64_t Hybrid_type_traits::val_int(Hybrid_type *val,
 
46
                                    bool) const
 
47
{
 
48
  return (int64_t) rint(val->real);
 
49
}
40
50
 
41
51
my_decimal *
42
52
Hybrid_type_traits::val_decimal(Hybrid_type *val,
1979
1989
}
1980
1990
 
1981
1991
 
 
1992
int64_t Item_float::val_int()
 
1993
{
 
1994
  assert(fixed == 1);
 
1995
  if (value <= (double) INT64_MIN)
 
1996
  {
 
1997
     return INT64_MIN;
 
1998
  }
 
1999
  else if (value >= (double) (uint64_t) INT64_MAX)
 
2000
  {
 
2001
    return INT64_MAX;
 
2002
  }
 
2003
  return (int64_t) rint(value);
 
2004
}
 
2005
 
1982
2006
my_decimal *Item_float::val_decimal(my_decimal *decimal_value)
1983
2007
{
1984
2008
  // following assert is redundant, because fixed=1 assigned in constructor