~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/sum.cc

  • Committer: Andrew Hutchings
  • Date: 2011-02-07 17:20:59 UTC
  • mfrom: (2148 staging)
  • mto: (2148.2.3 build)
  • mto: This revision was merged to the branch mainline in revision 2149.
  • Revision ID: andrew@linuxjedi.co.uk-20110207172059-dyeahrgzrlincoe3
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
420
420
 
421
421
void Item_sum::mark_as_sum_func()
422
422
{
423
 
  Select_Lex *cur_select= current_session->lex->current_select;
 
423
  Select_Lex *cur_select= getSession().getLex()->current_select;
424
424
  cur_select->n_sum_items++;
425
425
  cur_select->with_sum_func= 1;
426
426
  with_sum_func= 1;
724
724
  {
725
725
    field= ((Item_field*) args[0])->field;
726
726
 
727
 
    if ((field= create_tmp_field_from_field(current_session, field, name, table,
 
727
    if ((field= create_tmp_field_from_field(&getSession(), field, name, table,
728
728
                                            NULL, convert_blob_length)))
729
729
      field->flags&= ~NOT_NULL_FLAG;
730
730
    return field;
745
745
  default:
746
746
    return Item_sum::create_tmp_field(group, table, convert_blob_length);
747
747
  }
 
748
 
748
749
  if (field)
749
750
    field->init(table);
 
751
 
750
752
  return field;
751
753
}
752
754
 
1163
1165
Item_sum_avg_distinct::fix_length_and_dec()
1164
1166
{
1165
1167
  Item_sum_distinct::fix_length_and_dec();
1166
 
  prec_increment= current_session->variables.div_precincrement;
 
1168
  prec_increment= getSession().variables.div_precincrement;
1167
1169
  /*
1168
1170
    AVG() will divide val by count. We need to reserve digits
1169
1171
    after decimal point as the result can be fractional.
1226
1228
{
1227
1229
  Item_sum_sum::fix_length_and_dec();
1228
1230
  maybe_null=null_value=1;
1229
 
  prec_increment= current_session->variables.div_precincrement;
 
1231
  prec_increment= getSession().variables.div_precincrement;
 
1232
 
1230
1233
  if (hybrid_type == DECIMAL_RESULT)
1231
1234
  {
1232
1235
    int precision= args[0]->decimal_precision() + prec_increment;
1423
1426
void Item_sum_variance::fix_length_and_dec()
1424
1427
{
1425
1428
  maybe_null= null_value= 1;
1426
 
  prec_increment= current_session->variables.div_precincrement;
 
1429
  prec_increment= getSession().variables.div_precincrement;
1427
1430
 
1428
1431
  /*
1429
1432
    According to the SQL2003 standard (Part 2, Foundations; sec 10.9,
1708
1711
    str->set_real(sum,decimals, &my_charset_bin);
1709
1712
    break;
1710
1713
  case DECIMAL_RESULT:
1711
 
    class_decimal2string(E_DEC_FATAL_ERROR, &sum_dec, 0, 0, 0, str);
 
1714
    class_decimal2string(&sum_dec, 0, str);
1712
1715
    return str;
1713
1716
  case INT_RESULT:
1714
1717
    str->set_int(sum_int, unsigned_flag, &my_charset_bin);
3048
3051
  {
3049
3052
    char warn_buff[DRIZZLE_ERRMSG_SIZE];
3050
3053
    snprintf(warn_buff, sizeof(warn_buff), ER(ER_CUT_VALUE_GROUP_CONCAT), count_cut_values);
3051
 
    warning->set_msg(current_session, warn_buff);
 
3054
    warning->set_msg(&getSession(), warn_buff);
3052
3055
    warning= 0;
3053
3056
  }
3054
3057