summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-07-14 15:05:20 +0300
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-07-14 15:05:20 +0300
commit11b6ff0f67566a383cfd751072e70bb7ea6f5b5d (patch)
treee472fe8a170b9d33b8416303e26e6272ce47d5d5 /sql/sql_load.cc
parentca82f4340c546c089cb90271cbc0755f936af7a4 (diff)
parentdbb643d64e0981f56b6c7b35586f430b08091834 (diff)
downloadmariadb-git-11b6ff0f67566a383cfd751072e70bb7ea6f5b5d.tar.gz
merge
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r--sql/sql_load.cc56
1 files changed, 33 insertions, 23 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 7e540ffbe4b..17c86602583 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -1441,29 +1441,6 @@ int READ_INFO::read_field()
while ( to < end_of_buff)
{
chr = GET;
-#ifdef USE_MB
- if ((my_mbcharlen(read_charset, chr) > 1) &&
- to+my_mbcharlen(read_charset, chr) <= end_of_buff)
- {
- uchar* p = (uchar*)to;
- *to++ = chr;
- int ml = my_mbcharlen(read_charset, chr);
- int i;
- for (i=1; i<ml; i++) {
- chr = GET;
- if (chr == my_b_EOF)
- goto found_eof;
- *to++ = chr;
- }
- if (my_ismbchar(read_charset,
- (const char *)p,
- (const char *)to))
- continue;
- for (i=0; i<ml; i++)
- PUSH((uchar) *--to);
- chr = GET;
- }
-#endif
if (chr == my_b_EOF)
goto found_eof;
if (chr == escape_char)
@@ -1547,6 +1524,39 @@ int READ_INFO::read_field()
return 0;
}
}
+#ifdef USE_MB
+ if (my_mbcharlen(read_charset, chr) > 1 &&
+ to + my_mbcharlen(read_charset, chr) <= end_of_buff)
+ {
+ uchar* p= (uchar*) to;
+ int ml, i;
+ *to++ = chr;
+
+ ml= my_mbcharlen(read_charset, chr);
+
+ for (i= 1; i < ml; i++)
+ {
+ chr= GET;
+ if (chr == my_b_EOF)
+ {
+ /*
+ Need to back up the bytes already ready from illformed
+ multi-byte char
+ */
+ to-= i;
+ goto found_eof;
+ }
+ *to++ = chr;
+ }
+ if (my_ismbchar(read_charset,
+ (const char *)p,
+ (const char *)to))
+ continue;
+ for (i= 0; i < ml; i++)
+ PUSH((uchar) *--to);
+ chr= GET;
+ }
+#endif
*to++ = (uchar) chr;
}
/*