~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/min_max.cc

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

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"
 
20
#include <config.h>
21
21
 
22
22
#include <drizzled/function/min_max.h>
23
23
#include <drizzled/item/cmpfunc.h>
 
24
#include <drizzled/session.h>
24
25
 
25
26
namespace drizzled
26
27
{
59
60
    }
60
61
  }
61
62
  else if ((cmp_type == DECIMAL_RESULT) || (cmp_type == INT_RESULT))
62
 
    max_length= my_decimal_precision_to_length(max_int_part+decimals, decimals,
 
63
    max_length= class_decimal_precision_to_length(max_int_part+decimals, decimals,
63
64
                                            unsigned_flag);
64
65
  cached_field_type= agg_field_type(args, arg_count);
65
66
}
151
152
 
152
153
  case DECIMAL_RESULT:
153
154
    {
154
 
      my_decimal dec_buf, *dec_val= val_decimal(&dec_buf);
 
155
      type::Decimal dec_buf, *dec_val= val_decimal(&dec_buf);
155
156
      if (null_value)
156
157
        return 0;
157
 
      my_decimal2string(E_DEC_FATAL_ERROR, dec_val, 0, 0, 0, str);
 
158
      class_decimal2string(dec_val, 0, str);
158
159
      return str;
159
160
    }
160
161
 
257
258
}
258
259
 
259
260
 
260
 
my_decimal *Item_func_min_max::val_decimal(my_decimal *dec)
 
261
type::Decimal *Item_func_min_max::val_decimal(type::Decimal *dec)
261
262
{
262
263
  assert(fixed == 1);
263
 
  my_decimal tmp_buf, *tmp, *res= NULL;
 
264
  type::Decimal tmp_buf, *tmp, *res= NULL;
264
265
 
265
266
  if (compare_as_dates)
266
267
  {
276
277
    else
277
278
    {
278
279
      tmp= args[i]->val_decimal(&tmp_buf);      // Zero if NULL
279
 
      if (tmp && (my_decimal_cmp(tmp, res) * cmp_sign) < 0)
 
280
      if (tmp && (class_decimal_cmp(tmp, res) * cmp_sign) < 0)
280
281
      {
281
282
        if (tmp == &tmp_buf)
282
283
        {
283
284
          /* Move value out of tmp_buf as this will be reused on next loop */
284
 
          my_decimal2decimal(tmp, dec);
 
285
          class_decimal2decimal(tmp, dec);
285
286
          res= dec;
286
287
        }
287
288
        else