Commit 7336f9cd authored by serg@serg.mylan's avatar serg@serg.mylan

bugs #701 and #783 - old .frm files were read in incorrectly in 4.1 (each...

bugs #701 and #783 - old .frm files were read in incorrectly in 4.1 (each field was assigned a charset, BLOBs were converted to TEXT)
parent 2fc11f1f
...@@ -1132,7 +1132,7 @@ bool test_if_int(const char *str, int length, const char *int_end, ...@@ -1132,7 +1132,7 @@ bool test_if_int(const char *str, int length, const char *int_end,
*/ */
#define FIELDFLAG_DECIMAL 1 #define FIELDFLAG_DECIMAL 1
#define FIELDFLAG_BINARY 1 // Shares same flag #define FIELDFLAG_BINARY 1 // Shares same flag
#define FIELDFLAG_NUMBER 2 #define FIELDFLAG_NUMBER 2
#define FIELDFLAG_ZEROFILL 4 #define FIELDFLAG_ZEROFILL 4
#define FIELDFLAG_PACK 120 // Bits used for packing #define FIELDFLAG_PACK 120 // Bits used for packing
...@@ -1163,7 +1163,8 @@ bool test_if_int(const char *str, int length, const char *int_end, ...@@ -1163,7 +1163,8 @@ bool test_if_int(const char *str, int length, const char *int_end,
#define f_packtype(x) (((x) >> FIELDFLAG_PACK_SHIFT) & 15) #define f_packtype(x) (((x) >> FIELDFLAG_PACK_SHIFT) & 15)
#define f_decimals(x) ((uint8) (((x) >> FIELDFLAG_DEC_SHIFT) & FIELDFLAG_MAX_DEC)) #define f_decimals(x) ((uint8) (((x) >> FIELDFLAG_DEC_SHIFT) & FIELDFLAG_MAX_DEC))
#define f_is_alpha(x) (!f_is_num(x)) #define f_is_alpha(x) (!f_is_num(x))
#define f_is_enum(x) ((x) & FIELDFLAG_INTERVAL) #define f_is_binary(x) ((x) & FIELDFLAG_BINARY) // 4.0- compatibility
#define f_is_enum(x) ((x) & FIELDFLAG_INTERVAL)
#define f_is_bitfield(x) ((x) & FIELDFLAG_BITFIELD) #define f_is_bitfield(x) ((x) & FIELDFLAG_BITFIELD)
#define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB) #define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB)
#define f_is_geom(x) ((x) & FIELDFLAG_GEOM) #define f_is_geom(x) ((x) & FIELDFLAG_GEOM)
......
...@@ -138,7 +138,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -138,7 +138,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
outparam->raid_chunks= head[42]; outparam->raid_chunks= head[42];
outparam->raid_chunksize= uint4korr(head+43); outparam->raid_chunksize= uint4korr(head+43);
if (!(outparam->table_charset=get_charset((uint) head[38],MYF(0)))) if (!(outparam->table_charset=get_charset((uint) head[38],MYF(0))))
outparam->table_charset=NULL; // QQ display error message? outparam->table_charset=default_charset_info; // QQ display error message?
null_field_first=1; null_field_first=1;
} }
outparam->db_record_offset=1; outparam->db_record_offset=1;
...@@ -398,8 +398,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -398,8 +398,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if (!strpos[14]) if (!strpos[14])
charset= &my_charset_bin; charset= &my_charset_bin;
else if (!(charset=get_charset((uint) strpos[14], MYF(0)))) else if (!(charset=get_charset((uint) strpos[14], MYF(0))))
charset= (outparam->table_charset ? outparam->table_charset: charset= outparam->table_charset;
default_charset_info);
} }
if (!comment_length) if (!comment_length)
{ {
...@@ -423,8 +422,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -423,8 +422,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
/* old frm file */ /* old frm file */
field_type= (enum_field_types) f_packtype(pack_flag); field_type= (enum_field_types) f_packtype(pack_flag);
charset=(outparam->table_charset ? outparam->table_charset : charset=f_is_binary(pack_flag) ? &my_charset_bin : outparam->table_charset;
default_charset_info);
bzero((char*) &comment, sizeof(comment)); bzero((char*) &comment, sizeof(comment));
} }
*field_ptr=reg_field= *field_ptr=reg_field=
...@@ -599,7 +597,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -599,7 +597,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
} }
keyinfo->usable_key_parts=usable_parts; // Filesort keyinfo->usable_key_parts=usable_parts; // Filesort
} }
if (primary_key < MAX_KEY && if (primary_key < MAX_KEY &&
(outparam->keys_in_use & ((key_map) 1 << primary_key))) (outparam->keys_in_use & ((key_map) 1 << primary_key)))
{ {
outparam->primary_key=primary_key; outparam->primary_key=primary_key;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment