~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/math_functions/floor.cc

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <config.h>
21
21
#include <math.h>
22
22
#include "floor.h"
23
23
 
 
24
#include <drizzled/type/decimal.h>
 
25
 
24
26
namespace drizzled
25
27
{
26
28
 
34
36
    break;
35
37
  case DECIMAL_RESULT:
36
38
  {
37
 
    my_decimal dec_buf, *dec;
 
39
    type::Decimal dec_buf, *dec;
38
40
    if ((dec= Item_func_floor::decimal_op(&dec_buf)))
39
 
      my_decimal2int(E_DEC_FATAL_ERROR, dec, unsigned_flag, &result);
 
41
      dec->val_int32(E_DEC_FATAL_ERROR, unsigned_flag, &result);
40
42
    else
41
43
      result= 0;
42
44
    break;
59
61
}
60
62
 
61
63
 
62
 
my_decimal *Item_func_floor::decimal_op(my_decimal *decimal_value)
 
64
type::Decimal *Item_func_floor::decimal_op(type::Decimal *decimal_value)
63
65
{
64
 
  my_decimal val, *value= args[0]->val_decimal(&val);
 
66
  type::Decimal val, *value= args[0]->val_decimal(&val);
65
67
  if (!(null_value= (args[0]->null_value ||
66
 
                     my_decimal_floor(E_DEC_FATAL_ERROR, value,
 
68
                     class_decimal_floor(E_DEC_FATAL_ERROR, value,
67
69
                                      decimal_value) > 1)))
68
70
    return decimal_value;
69
71
  return 0;