37 :
Item(session, item), enum_set_typelib(0), fld_type(get_real_type(item))
116 uint32_t max_length_orig= max_length;
117 uint32_t decimals_orig= decimals;
120 int item_decimals= item->decimals;
124 decimals= max((
int)decimals, item_decimals);
128 decimals= min((
int)max(decimals, item->decimals), DECIMAL_MAX_SCALE);
129 int precision= min(max(prev_decimal_int_part, item->decimal_int_part())
130 + decimals, DECIMAL_MAX_PRECISION);
131 unsigned_flag&= item->unsigned_flag;
132 max_length= class_decimal_precision_to_length(precision, decimals,
140 const char *old_cs, *old_derivation;
141 uint32_t old_max_chars= max_length / collation.collation->mbmaxlen;
142 old_cs= collation.collation->name;
143 old_derivation= collation.derivation_name();
144 if (collation.aggregate(item->collation, MY_COLL_ALLOW_CONV))
146 my_error(ER_CANT_AGGREGATE_2COLLATIONS, MYF(0),
147 old_cs, old_derivation,
148 item->collation.collation->name,
149 item->collation.derivation_name(),
158 if (collation.collation != &my_charset_bin)
160 max_length= max(old_max_chars * collation.collation->mbmaxlen,
162 item->collation.collation->mbmaxlen *
163 collation.collation->mbmaxlen);
171 if (decimals != NOT_FIXED_DEC)
173 int delta1= max_length_orig - decimals_orig;
174 int delta2= item->max_length - item->decimals;
175 max_length= max(delta1, delta2) + decimals;
176 if (fld_type == DRIZZLE_TYPE_DOUBLE && max_length > DBL_DIG + 2)
178 max_length= DBL_DIG + 7;
179 decimals= NOT_FIXED_DEC;
183 max_length= DBL_DIG+7;
196 prev_decimal_int_part= decimal_int_part();
268 if (fld_type == DRIZZLE_TYPE_ENUM)
270 if (item->type() == Item::SUM_FUNC_ITEM &&
271 (((
Item_sum*)item)->sum_func() == Item_sum::MAX_FUNC ||
272 ((
Item_sum*)item)->sum_func() == Item_sum::MIN_FUNC))
278 assert((enum_set_typelib &&
280 (!enum_set_typelib &&
281 item->type() == Item::FIELD_ITEM &&
284 if (!enum_set_typelib)