From 7fce07d52d8411d5b97f9de12661c664b1c552b5 Mon Sep 17 00:00:00 2001 From: "bar@gw.udmsearch.izhnet.ru" <> Date: Tue, 14 May 2002 20:58:38 +0500 Subject: Now several character sets can live in the same table, However some hacks were used while waiting for new FRM file --- sql/table.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'sql/table.cc') diff --git a/sql/table.cc b/sql/table.cc index 3c217ced03c..eb5f5ecbc9a 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -341,6 +341,15 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, (hash_get_key) get_field_name,0, HASH_CASE_INSENSITIVE); +// BAR: dirty hack while waiting for new FRM +// BAR: take a charset information from table name +{ + const char* csname=strstr(alias,"_cs_"); + if(!csname || + !(outparam->table_charset=get_charset_by_name(csname+4,MYF(MY_WME)))) + outparam->table_charset=default_charset_info; +} + for (i=0 ; i < outparam->fields; i++, strpos+= 11, field_ptr++) { uint pack_flag= uint2korr(strpos+6); @@ -357,6 +366,18 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, (TYPELIB*) 0), outparam->fieldnames.type_names[i], outparam); + if (!reg_field->binary()) + { + // BAR: dirty hack while waiting for new FRM + // BAR: take a charset information from field name + + Field_str* str_field=(Field_str*)reg_field; + const char* csname=strstr(str_field->field_name,"_cs_"); + CHARSET_INFO *fcs; + if (!csname || (!(fcs=get_charset_by_name(csname+4,MYF(MY_WME))))) + fcs=outparam->table_charset; + str_field->set_charset(fcs); + } if (!(reg_field->flags & NOT_NULL_FLAG)) { if ((null_bit<<=1) == 256) -- cgit v1.2.1