~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

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
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
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
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include <drizzled/server_includes.h>
21
 
#include CSTDINT_H
 
20
#include "config.h"
 
21
 
22
22
#include <drizzled/function/math/plus.h>
23
23
 
 
24
namespace drizzled
 
25
{
 
26
 
24
27
double Item_func_plus::real_op()
25
28
{
26
29
  double value= args[0]->val_real() + args[1]->val_real();
50
53
    \# Value of operation as a decimal
51
54
*/
52
55
 
53
 
my_decimal *Item_func_plus::decimal_op(my_decimal *decimal_value)
 
56
type::Decimal *Item_func_plus::decimal_op(type::Decimal *decimal_value)
54
57
{
55
 
  my_decimal value1, *val1;
56
 
  my_decimal value2, *val2;
 
58
  type::Decimal value1, *val1;
 
59
  type::Decimal value2, *val2;
57
60
  val1= args[0]->val_decimal(&value1);
58
61
  if ((null_value= args[0]->null_value))
59
62
    return 0;
60
63
  val2= args[1]->val_decimal(&value2);
61
64
  if (!(null_value= (args[1]->null_value ||
62
 
                     (my_decimal_add(E_DEC_FATAL_ERROR, decimal_value, val1,
 
65
                     (class_decimal_add(E_DEC_FATAL_ERROR, decimal_value, val1,
63
66
                                     val2) > 3))))
64
67
    return decimal_value;
65
68
  return 0;
66
69
}
 
70
 
 
71
} /* namespace drizzled */