255
255
my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value)
259
258
if (!(res= val_str(&str_value)))
260
259
return 0; // NULL or EOM
262
end_ptr= (char*) res->ptr()+ res->length();
263
261
if (str2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM,
264
262
res->ptr(), res->length(), res->charset(),
265
263
decimal_value) & E_DEC_BAD_NUM)
383
381
maybe_null=null_value=with_sum_func=unsigned_flag=0;
384
382
decimals= 0; max_length= 0;
385
383
with_subselect= 0;
386
cmp_context= (Item_result)-1;
384
cmp_context= IMPOSSIBLE_RESULT;
388
386
/* Put item in free list so that we can free all items at end */
389
387
THD *thd= current_thd;
1200
1198
if (str->reserve(MAX_INT_WIDTH + sizeof("case_expr@")))
1201
1199
return; /* purecov: inspected */
1202
VOID(str->append(STRING_WITH_LEN("case_expr@")));
1200
(void) str->append(STRING_WITH_LEN("case_expr@"));
1203
1201
str->qs_append(m_case_expr_id);
1501
1497
else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) &&
1502
1498
left_is_superset(this, &dt))
1506
1502
else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) &&
1507
1503
left_is_superset(&dt, this))
3185
Preserve the original parameter types and values
3186
when re-preparing a prepared statement.
3188
@details Copy parameter type information and conversion
3189
function pointers from a parameter of the old statement
3190
to the corresponding parameter of the new one.
3192
Move parameter values from the old parameters to the new
3193
one. We simply "exchange" the values, which allows
3194
to save on allocation and character set conversion in
3195
case a parameter is a string or a blob/clob.
3197
The old parameter gets the value of this one, which
3198
ensures that all memory of this parameter is freed
3201
@param[in] src parameter item of the original
3206
Item_param::set_param_type_and_swap_value(Item_param *src)
3208
unsigned_flag= src->unsigned_flag;
3209
param_type= src->param_type;
3210
set_param_func= src->set_param_func;
3211
item_type= src->item_type;
3212
item_result_type= src->item_result_type;
3214
collation.set(src->collation);
3215
maybe_null= src->maybe_null;
3216
null_value= src->null_value;
3217
max_length= src->max_length;
3218
decimals= src->decimals;
3222
decimal_value.swap(src->decimal_value);
3223
str_value.swap(src->str_value);
3224
str_value_ptr.swap(src->str_value_ptr);
3188
3227
/****************************************************************************
3189
3228
Item_copy_string
3190
3229
****************************************************************************/
4127
4166
thd->lex->current_select->non_agg_fields.push_back(this);
4128
4167
marker= thd->lex->current_select->cur_pos_in_select_list;
4170
if (fixed && thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY)
4173
Mark selects according to presence of non aggregated fields.
4174
Fields from outer selects added to the aggregate function
4175
outer_fields list as its unknown at the moment whether it's
4178
if (!thd->lex->in_sum_func)
4179
cached_table->select_lex->full_group_by_flag|= NON_AGG_FIELD_USED;
4183
thd->lex->in_sum_func->outer_fields.push_back(this);
4184
else if (thd->lex->in_sum_func->nest_level !=
4185
thd->lex->current_select->nest_level)
4186
cached_table->select_lex->full_group_by_flag|= NON_AGG_FIELD_USED;
4248
4307
String tmp(buff,sizeof(buff), field->charset()), *res;
4250
4309
res= (*item)->val_str(&tmp);
4251
field->prepend_zeros(res);
4252
pos= (char *) sql_strmake (res->ptr(), res->length());
4253
*item= new Item_string(pos, res->length(), field->charset());
4310
if ((*item)->is_null())
4311
*item= new Item_null();
4314
field->prepend_zeros(res);
4315
pos= (char *) sql_strmake (res->ptr(), res->length());
4316
*item= new Item_string(pos, res->length(), field->charset());
4298
4362
DATE/TIME represented as an int and as a string.
4301
(cmp_context != (Item_result)-1 && item->cmp_context != cmp_context))
4365
(cmp_context != IMPOSSIBLE_RESULT && item->cmp_context != cmp_context))
4303
4367
else if (field && (field->flags & ZEROFILL_FLAG) && IS_NUM(field->type()))
4543
4607
DBUG_ASSERT(collation.collation);
4544
4608
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
4545
4609
field= new Field_blob(max_length, maybe_null, name,
4546
collation.collation);
4610
collation.collation, TRUE);
4547
4611
/* Item_type_holder holds the exact type, do not change it */
4548
4612
else if (max_length > 0 &&
4549
4613
(type() != Item::TYPE_HOLDER || field_type() != MYSQL_TYPE_STRING))
5138
5202
str_value.set(ptr, max_length, &my_charset_bin);
5139
ptr+= max_length - 1;
5140
ptr[1]= 0; // Set end null for string
5141
for (; end >= str; end--)
5206
ptr+= max_length - 1;
5207
ptr[1]= 0; // Set end null for string
5208
for (; end >= str; end--)
5154
5225
collation.set(&my_charset_bin, DERIVATION_COERCIBLE);