~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Lee Bieber
  • Date: 2010-11-07 19:34:48 UTC
  • mfrom: (1910.1.2 build)
  • Revision ID: kalebral@gmail.com-20101107193448-64kdu912qej354sh
Merge Stewart - including adapting and expanding the "differences from mysql" page from the wiki.
Merge Stewart - fix bug 668143: drizzleslap with --commit runs second iteration data load in a transaction

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
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;