~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/functions/str/format.cc

  • Committer: Monty Taylor
  • Date: 2008-11-16 20:15:33 UTC
  • mto: (584.1.9 devel)
  • mto: This revision was merged to the branch mainline in revision 589.
  • Revision ID: monty@inaugust.com-20081116201533-d0f19s1bk1h95iyw
Removed a big bank of includes from item.h.

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"
21
 
#include <drizzled/function/str/format.h>
22
 
 
23
 
#include <limits>
24
 
 
25
 
using namespace std;
26
 
 
27
 
namespace drizzled
28
 
{
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
 
22
#include CMATH_H
 
23
#include <drizzled/functions/str/format.h>
29
24
 
30
25
/**
31
26
  Change a number to format '3,333,333,333.000'.
83
78
    my_decimal dec_val, rnd_dec, *res;
84
79
    res= args[0]->val_decimal(&dec_val);
85
80
    if ((null_value=args[0]->null_value))
86
 
      return 0;
 
81
      return 0; /* purecov: inspected */
87
82
    my_decimal_round(E_DEC_FATAL_ERROR, res, dec, false, &rnd_dec);
88
83
    my_decimal2string(E_DEC_FATAL_ERROR, &rnd_dec, 0, 0, 0, str);
89
84
    str_length= str->length();
94
89
  {
95
90
    double nr= args[0]->val_real();
96
91
    if ((null_value=args[0]->null_value))
97
 
      return 0;
 
92
      return 0; /* purecov: inspected */
98
93
    nr= my_double_round(nr, (int64_t) dec, false, false);
99
94
    /* Here default_charset() is right as this is not an automatic conversion */
100
95
    str->set_real(nr, dec, default_charset());
101
 
    if (nr == numeric_limits<double>::quiet_NaN())
 
96
    if (isnan(nr))
102
97
      return str;
103
98
    str_length=str->length();
104
99
    if (nr < 0)
139
134
  args[1]->print(str, query_type);
140
135
  str->append(')');
141
136
}
142
 
 
143
 
} /* namespace drizzled */