Commit 16a0bdd7 authored by unknown's avatar unknown

BUG# 17044 Federated Storage Engine not UTF8 clean

- Added 'SET NAMES <charset>" upon ::open
- Added test and results for simple UTF test

federated.test:
  BUG #17044 Federated Storage Engine not UTF8 clean
  New test. Using hex - pasting various charsets in the terminal doesn't work.
federated.result:
  BUG# 17044 Federated Storage Engine not UTF8 clean
  New test results
ha_federated.cc:
  BUG# 17044 Federated Storage Engine not UTF8 clean
  Upon ::open, set names to table's charset


sql/ha_federated.cc:
  BUG# 17044 Federated Storage Engine not UTF8 clean
          Upon ::open, set names to table's charset
mysql-test/t/federated.test:
   BUG #17044 Federated Storage Engine not UTF8 clean
      New test. Using hex - pasting various charsets in the terminal doesn't work.
    federated.result:
    BUG# 17044 Federated Storage Engine not UTF8 clean
      New test results
mysql-test/r/federated.result:
  BUG# 17044 Federated Storage Engine not UTF8 clean
          New test results
parent 0e3c0305
......@@ -1815,6 +1815,34 @@ engine = federated
connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/test';
drop table federated.test1, federated.test2;
drop table federated.test;
set names utf8;
create table federated.t1 (a varchar(64)) DEFAULT CHARSET=utf8;
insert into federated.t1 values (0x6DC3A56E6164);
select hex(a) from federated.t1;
hex(a)
6DC3A56E6164
set names utf8;
create table federated.t1 (a varchar(64))
ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:9308/federated/t1'
DEFAULT CHARSET=utf8;
select hex(a) from federated.t1;
hex(a)
6DC3A56E6164
insert into federated.t1 values (0xC3A4C3B6C3BCC39F);
insert into federated.t1 values (0xD18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E);
select hex(a) from federated.t1;
hex(a)
6DC3A56E6164
C3A4C3B6C3BCC39F
D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E
select hex(a) from federated.t1;
hex(a)
6DC3A56E6164
C3A4C3B6C3BCC39F
D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E
drop table federated.t1;
drop table federated.t1;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
......
......@@ -1544,4 +1544,35 @@ drop table federated.test1, federated.test2;
connection slave;
drop table federated.test;
#
# BUG# 17044 Federated Storage Engine not UTF8 clean
#
connection slave;
set names utf8;
create table federated.t1 (a varchar(64)) DEFAULT CHARSET=utf8;
insert into federated.t1 values (0x6DC3A56E6164);
select hex(a) from federated.t1;
connection master;
set names utf8;
eval create table federated.t1 (a varchar(64))
ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
DEFAULT CHARSET=utf8;
select hex(a) from federated.t1;
insert into federated.t1 values (0xC3A4C3B6C3BCC39F);
insert into federated.t1 values (0xD18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E);
select hex(a) from federated.t1;
connection slave;
select hex(a) from federated.t1;
connection master;
drop table federated.t1;
connection slave;
drop table federated.t1;
source include/federated_cleanup.inc;
......@@ -1435,6 +1435,16 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked)
/* Connect to foreign database mysql_real_connect() */
mysql= mysql_init(0);
/*
BUG# 17044 Federated Storage Engine is not UTF8 clean
Add set names to whatever charset the table is at open
of table
*/
/* this sets the csname like 'set names utf8' */
mysql_options(mysql,MYSQL_SET_CHARSET_NAME,
this->table->s->table_charset->csname);
if (!mysql || !mysql_real_connect(mysql,
share->hostname,
share->username,
......@@ -1451,6 +1461,7 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked)
API silently reconnect. For future versions, we will need more logic to
deal with transactions
*/
mysql->reconnect= 1;
ref_length= (table->s->primary_key != MAX_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