summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 48f9dfea4e1..17b0519b61c 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -43,7 +43,7 @@ Item::Item():
{
marker= 0;
maybe_null=null_value=with_sum_func=unsigned_flag=0;
- set_charset(default_charset(), DERIVATION_COERCIBLE);
+ collation.set(default_charset(), DERIVATION_COERCIBLE);
name= 0;
decimals= 0; max_length= 0;
THD *thd= current_thd;
@@ -149,7 +149,7 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const
{
if (binary_cmp)
return !sortcmp(&str_value, &item->str_value, &my_charset_bin);
- return !sortcmp(&str_value, &item->str_value, charset());
+ return !sortcmp(&str_value, &item->str_value, collation.collation);
}
return 0;
}
@@ -258,7 +258,7 @@ bool DTCollation::aggregate(DTCollation &dt)
Item_field::Item_field(Field *f) :Item_ident(NullS,f->table_name,f->field_name)
{
set_field(f);
- set_charset(DERIVATION_IMPLICIT);
+ collation.set(DERIVATION_IMPLICIT);
fixed= 1; // This item is not needed in fix_fields
}
@@ -267,7 +267,7 @@ Item_field::Item_field(THD *thd, Item_field &item):
Item_ident(thd, item),
field(item.field),
result_field(item.result_field)
-{ set_charset(DERIVATION_IMPLICIT); }
+{ collation.set(DERIVATION_IMPLICIT); }
void Item_field::set_field(Field *field_par)
{
@@ -279,7 +279,7 @@ void Item_field::set_field(Field *field_par)
field_name=field_par->field_name;
db_name=field_par->table->table_cache_key;
unsigned_flag=test(field_par->flags & UNSIGNED_FLAG);
- set_charset(field_par->charset(), DERIVATION_IMPLICIT);
+ collation.set(field_par->charset(), DERIVATION_IMPLICIT);
}
const char *Item_ident::full_name() const
@@ -962,7 +962,7 @@ void Item::init_make_field(Send_field *tmp_field,
tmp_field->org_col_name= empty_name;
tmp_field->table_name= empty_name;
tmp_field->col_name= name;
- tmp_field->charsetnr= charset()->number;
+ tmp_field->charsetnr= collation.collation->number;
tmp_field->flags=maybe_null ? 0 : NOT_NULL_FLAG;
tmp_field->type=field_type;
tmp_field->length=max_length;
@@ -1076,7 +1076,7 @@ int Item::save_in_field(Field *field, bool no_conversions)
field->result_type() == STRING_RESULT)
{
String *result;
- CHARSET_INFO *cs=charset();
+ CHARSET_INFO *cs= collation.collation;
char buff[MAX_FIELD_WIDTH]; // Alloc buffer for small columns
str_value.set_quick(buff,sizeof(buff),cs);
result=val_str(&str_value);
@@ -1113,7 +1113,8 @@ int Item_string::save_in_field(Field *field, bool no_conversions)
if (null_value)
return set_field_to_null(field);
field->set_notnull();
- return (field->store(result->ptr(),result->length(),charset())) ? -1 : 0;
+ return (field->store(result->ptr(),result->length(),collation.collation)) ?
+ -1 : 0;
}
@@ -1167,7 +1168,7 @@ Item_varbinary::Item_varbinary(const char *str, uint str_length)
str+=2;
}
*ptr=0; // Keep purify happy
- set_charset(&my_charset_bin, DERIVATION_COERCIBLE);
+ collation.set(&my_charset_bin, DERIVATION_COERCIBLE);
}
longlong Item_varbinary::val_int()
@@ -1188,7 +1189,7 @@ int Item_varbinary::save_in_field(Field *field, bool no_conversions)
field->set_notnull();
if (field->result_type() == STRING_RESULT)
{
- error=field->store(str_value.ptr(),str_value.length(),charset());
+ error=field->store(str_value.ptr(),str_value.length(),collation.collation);
}
else
{
@@ -1686,7 +1687,7 @@ Item_cache* Item_cache::get_cache(Item_result type)
void Item_cache_str::store(Item *item)
{
- str_value.set(buffer, sizeof(buffer), item->charset());
+ str_value.set(buffer, sizeof(buffer), item->collation.collation);
value= item->str_result(&str_value);
if ((null_value= item->null_value))
value= 0;