summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h
index dfc02149f9d..ac480b15324 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1611,6 +1611,7 @@ public:
virtual longlong val_time_packed(THD *thd);
virtual const TYPELIB *get_typelib() const { return NULL; }
virtual CHARSET_INFO *charset() const= 0;
+ virtual void change_charset(const DTCollation &new_cs) {}
virtual const DTCollation &dtcollation() const= 0;
virtual CHARSET_INFO *charset_for_protocol(void) const
{ return binary() ? &my_charset_bin : charset(); }
@@ -2109,6 +2110,12 @@ public:
{
return m_collation;
}
+ void change_charset(const DTCollation &new_cs) override
+ {
+ field_length= (field_length * new_cs.collation->mbmaxlen) /
+ m_collation.collation->mbmaxlen;
+ m_collation= new_cs;
+ }
bool binary() const override { return field_charset() == &my_charset_bin; }
uint32 max_display_length() const override { return field_length; }
uint32 character_octet_length() const override { return field_length; }