3705 Alexander Barkov 2011-02-23
An after-fix for WL#5331 to address binlog_stm_ctype_cp932 test failure.
modified:
mysql-test/extra/binlog_tests/ctype_cp932.test
3704 Alexander Barkov 2011-02-23
WL#5331 Support Unicode for Windows command line client
Based on the original patch form Vladislav Vaintroub:
http://lists.mysql.com/commits/105379
@ client/mysql.cc
- introducing new function tee_write(), to reuse
in a number of places where similar loops displaying
data occurs.
- introducing flags for tee_write(), to support different
printing modes, according to --xml, --raw, --tab, etc,
parameters
- Instead if using argv (which is always in ANSI code page),
we now use UTF16LE API to access command line arguments on Windows,
using this scenario:
a. We translate arguments to UTF8MB4 on startup.
b. Then we process arguments and detect connection character set
from --default-character-set arguments (or my.ini value),
or from the OS localization information by default.
c. Then we convert user, database and the --execute (-e) buffer
from UTF8MB4 to the connection character set.
d. Connect
- Instead of printing using printif/fputs family functions on Windows,
which are limited to the current DOS code page (cp850 on a Western machine)
we now use UTF16LE console API through the new my_win_console_xxx()
functions implemented in my_conio.c
- Using mysql_set_character_set() instead of
mysql_option(OPT_CHARACTER_SET_NAME) to know the ongoing
session character set *before* mysql_real_connect() call,
to convert user and database properly.
- my_win_is_console_cached() has been added to cache
my_win_is_console() result for stdout and stderr,
for performance purposes.
@ client/mysqltest.cc
- Introducing a new mysqltest command: --execw, to
execute commands with non-ASCII characters correctly in Windows.
@ include/my_sys.h
- Adding prototypes for the my_win_console_xxx() functions
@ mysql-test/grant.test
@ mysql-test/t/mysql.test
@ mysql-test/t/mysql_cp932.test
@ mysql-test/t/mysqlbinlog-cp932.test
- Using --execw instead of --exec for the affected tests
@ mysys/my_conio.c
- Implementing functions for Windows console read/write and
command line argument processing.
- Removing my_cgets(), as it's not used any more.
@ sql-common/client.c
- Fixing mysql_set_character_set() to set mysql.charset on
a non-connected "mysql". Previously such a call crashed.
This change allows to know what character set for the
ongoing session is going to be *before* calling mysql_real_connect().
This is needed in mysql.cc, to convert user and database correctly
on Windows.
modified:
client/mysql.cc
client/mysqltest.cc
include/my_sys.h
mysql-test/t/grant.test
mysql-test/t/mysql.test
mysql-test/t/mysql_cp932.test
mysql-test/t/mysqlbinlog-cp932.test
mysys/my_conio.c
sql-common/client.c
=== modified file 'mysql-test/extra/binlog_tests/ctype_cp932.test'
--- a/mysql-test/extra/binlog_tests/ctype_cp932.test 2008-02-20 18:49:26 +0000
+++ b/mysql-test/extra/binlog_tests/ctype_cp932.test 2011-02-23 11:32:08 +0000
@@ -462,7 +462,8 @@ drop table t1;
--exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
# its usage to switch internally in mysql to requested charset
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select ' insert into t1 values('�\'); select * from t1; drop table t1;"
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select '�\'"
---exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select '�\'"
---exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select '�\'"
+--character_set latin1
+--execw $MYSQL --default-character-set=latin1 test -e "charset cp932; select '�\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('�\'); select * from t1; drop table t1;"
+--execw $MYSQL --default-character-set=latin1 test -e "charset cp932; select '�\'"
+--execw $MYSQL --default-character-set=latin1 test -e "/*charset cp932 */; set names cp932, character_set_results=utf8; select '�\'"
+--execw $MYSQL --default-character-set=latin1 test -e "/*!\C cp932 */; set character_set_client= cp932; select '�\'"
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-trunk branch (alexander.barkov:3704 to 3705) WL#5331 | Alexander Barkov | 23 Feb |