~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/math/minus.cc

  • Committer: Monty Taylor
  • Date: 2009-12-25 02:37:09 UTC
  • mto: (1253.2.3 out-of-tree)
  • mto: This revision was merged to the branch mainline in revision 1258.
  • Revision ID: mordred@inaugust.com-20091225023709-r5xr0agiyzyfbhin
pandora-buildĀ v0.88

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
18
18
 */
19
19
 
20
20
#include "config.h"
21
 
 
 
21
#include CSTDINT_H
22
22
#include <drizzled/function/math/minus.h>
23
 
#include <drizzled/type/decimal.h>
24
 
 
25
 
namespace drizzled
26
 
{
27
23
 
28
24
/**
29
25
  The following function is here to allow the user to force
59
55
  See Item_func_plus::decimal_op for comments.
60
56
*/
61
57
 
62
 
type::Decimal *Item_func_minus::decimal_op(type::Decimal *decimal_value)
 
58
my_decimal *Item_func_minus::decimal_op(my_decimal *decimal_value)
63
59
{
64
 
  type::Decimal value1, *val1;
65
 
  type::Decimal value2, *val2=
 
60
  my_decimal value1, *val1;
 
61
  my_decimal value2, *val2=
66
62
 
67
63
  val1= args[0]->val_decimal(&value1);
68
64
  if ((null_value= args[0]->null_value))
69
65
    return 0;
70
66
  val2= args[1]->val_decimal(&value2);
71
67
  if (!(null_value= (args[1]->null_value ||
72
 
                     (class_decimal_sub(E_DEC_FATAL_ERROR, decimal_value, val1,
 
68
                     (my_decimal_sub(E_DEC_FATAL_ERROR, decimal_value, val1,
73
69
                                     val2) > 3))))
74
70
    return decimal_value;
75
71
  return 0;
76
72
}
77
73
 
78
 
} /* namespace drizzled */