~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Daniel Nichter
  • Date: 2011-10-23 16:01:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2448.
  • Revision ID: daniel@percona.com-20111023160137-7ac3blgz8z4tf8za
Add Administration Getting Started and Logging.  Capitalize SQL clause keywords.

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