~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/math_functions/floor.cc

  • Committer: Brian Aker
  • Date: 2010-10-28 17:12:01 UTC
  • mfrom: (1887.1.3 merge)
  • Revision ID: brian@tangent.org-20101028171201-baj6l1bnntn1s4ad
Merge in POTFILES changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
21
21
#include <math.h>
22
22
#include "floor.h"
23
23
 
24
 
#include <drizzled/type/decimal.h>
25
 
 
26
24
namespace drizzled
27
25
{
28
26
 
36
34
    break;
37
35
  case DECIMAL_RESULT:
38
36
  {
39
 
    type::Decimal dec_buf, *dec;
 
37
    my_decimal dec_buf, *dec;
40
38
    if ((dec= Item_func_floor::decimal_op(&dec_buf)))
41
 
      dec->val_int32(E_DEC_FATAL_ERROR, unsigned_flag, &result);
 
39
      my_decimal2int(E_DEC_FATAL_ERROR, dec, unsigned_flag, &result);
42
40
    else
43
41
      result= 0;
44
42
    break;
61
59
}
62
60
 
63
61
 
64
 
type::Decimal *Item_func_floor::decimal_op(type::Decimal *decimal_value)
 
62
my_decimal *Item_func_floor::decimal_op(my_decimal *decimal_value)
65
63
{
66
 
  type::Decimal val, *value= args[0]->val_decimal(&val);
 
64
  my_decimal val, *value= args[0]->val_decimal(&val);
67
65
  if (!(null_value= (args[0]->null_value ||
68
 
                     class_decimal_floor(E_DEC_FATAL_ERROR, value,
 
66
                     my_decimal_floor(E_DEC_FATAL_ERROR, value,
69
67
                                      decimal_value) > 1)))
70
68
    return decimal_value;
71
69
  return 0;