~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Stewart Smith
  • Date: 2010-11-07 04:22:31 UTC
  • mto: (1911.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: stewart@flamingspork.com-20101107042231-ola4sl7j0qvg58tz
fix ARCHIVE storage engine calling exit (lintian warning). Was because we were linking in libinternal into libazio, which links into archive plugin. Just link libinternal into the command line utilities.

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
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
 
22
22
#include <math.h>
23
23
#include <limits.h>
25
25
#include <limits>
26
26
#include <algorithm>
27
27
 
28
 
#include <drizzled/function/math/round.h>
29
 
#include <drizzled/util/test.h>
 
28
#include "drizzled/function/math/round.h"
 
29
#include "drizzled/util/test.h"
30
30
 
31
31
namespace drizzled
32
32
{
100
100
 
101
101
    precision-= decimals_delta - length_increase;
102
102
    decimals= min(decimals_to_set, DECIMAL_MAX_SCALE);
103
 
    max_length= class_decimal_precision_to_length(precision, decimals,
 
103
    max_length= my_decimal_precision_to_length(precision, decimals,
104
104
                                               unsigned_flag);
105
105
    break;
106
106
  }
212
212
}
213
213
 
214
214
 
215
 
type::Decimal *Item_func_round::decimal_op(type::Decimal *decimal_value)
 
215
my_decimal *Item_func_round::decimal_op(my_decimal *decimal_value)
216
216
{
217
 
  type::Decimal val, *value= args[0]->val_decimal(&val);
 
217
  my_decimal val, *value= args[0]->val_decimal(&val);
218
218
  int64_t dec= args[1]->val_int();
219
219
 
220
220
  if (dec >= 0 || args[1]->unsigned_flag)
223
223
    dec= INT_MIN;
224
224
 
225
225
  if (!(null_value= (args[0]->null_value || args[1]->null_value ||
226
 
                     class_decimal_round(E_DEC_FATAL_ERROR, value, (int) dec,
 
226
                     my_decimal_round(E_DEC_FATAL_ERROR, value, (int) dec,
227
227
                                      truncate, decimal_value) > 1)))
228
228
  {
229
229
    decimal_value->frac= decimals;