From: Date: October 27 2006 5:50pm Subject: bk commit into 5.0 tree (patg:1.2283) BUG#17044 List-Archive: http://lists.mysql.com/commits/14495 X-Bug: 17044 Message-Id: <20061027155049.341EE65880D@govinda.patg.net> Below is the list of changes that have just been committed into a local 5.0 repository of patg. When patg does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2006-10-27 11:50:44-04:00, patg@stripped +3 -0 BUG# 17044 Federated Storage Engine not UTF8 clean - Added 'SET NAMES " upon ::open - Added test and results for simple UTF test - Add explicite collation to loop building select mysql-test/r/federated.result@stripped, 2006-10-27 11:50:42-04:00, patg@stripped +28 -0 BUG# 17044 Federated Storage Engine not UTF8 clean New test results mysql-test/t/federated.test@stripped, 2006-10-27 11:50:42-04:00, patg@stripped +30 -0 BUG# 17044 Federated Storage Engine not UTF8 clean New test. Using hex - pasting various charsets in the terminal doesn't work. sql/ha_federated.cc@stripped, 2006-10-27 11:50:42-04:00, patg@stripped +22 -0 BUG# 17044 Federated Storage Engine not UTF8 clean - Upon ::open, set names to table's charset. - In loop which builds sql query, explicite collation for each field which is not binary. All tests pass with this. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: patg # Host: govinda.patg.net # Root: /home/patg/mysql-build/mysql-5.0-engines-bug17044 --- 1.38/mysql-test/r/federated.result 2006-10-27 11:50:48 -04:00 +++ 1.39/mysql-test/r/federated.result 2006-10-27 11:50:48 -04:00 @@ -1815,6 +1815,34 @@ connection='mysql://root@stripped: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@stripped: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; --- 1.33/mysql-test/t/federated.test 2006-10-27 11:50:48 -04:00 +++ 1.34/mysql-test/t/federated.test 2006-10-27 11:50:49 -04:00 @@ -1544,4 +1544,34 @@ 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@stripped:$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; --- 1.68/sql/ha_federated.cc 2006-10-27 11:50:49 -04:00 +++ 1.69/sql/ha_federated.cc 2006-10-27 11:50:49 -04:00 @@ -1314,6 +1314,12 @@ query.append(FEDERATED_BTICK); query.append((*field)->field_name); query.append(FEDERATED_BTICK); + if ((*field)->charset()->name && (*field)->charset() != &my_charset_bin) + { + query.append(' '); + query.append('_'); + query.append((*field)->charset()->name); + } query.append(FEDERATED_COMMA); } query.length(query.length()- strlen(FEDERATED_COMMA)); @@ -1427,8 +1433,12 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked) { + char query_buffer[FEDERATED_QUERY_BUFFER_SIZE]; + String query(query_buffer, sizeof(query_buffer), &my_charset_bin); DBUG_ENTER("ha_federated::open"); + query.length(0); + if (!(share= get_share(name, table))) DBUG_RETURN(1); thr_lock_data_init(&share->lock, &lock, NULL); @@ -1457,6 +1467,17 @@ table->key_info[table->s->primary_key].key_length : table->s->reclength); DBUG_PRINT("info", ("ref_length: %u", ref_length)); + /* + BUG# 17044 Federated Storage Engine is not UTF8 clean + Add set names to whatever charset the table is at open + of table + */ + query.append("SET NAMES "); + query.append(this->table->s->table_charset->csname); + if (mysql_real_query(mysql, query.ptr(), query.length())) + DBUG_RETURN(stash_remote_error()); + + DBUG_RETURN(0); DBUG_RETURN(0); } @@ -1585,6 +1606,7 @@ */ for (field= table->field; *field; field++) { + DBUG_PRINT("info",("field charset %s", (*field)->charset()->name)); if ((*field)->is_null()) insert_field_value_string.append(FEDERATED_NULL); else