Commit cfc1b1dc authored by unknown's avatar unknown

Fixes for compilation errors in Windows (casts from uint32* to uint*) in repl and charset code.

Moving the part of user_var.test using UCS2 to ctype_ucs.test


mysql-test/r/ctype_ucs.result:
  result update
mysql-test/r/user_var.result:
  result update
mysql-test/t/ctype_ucs.test:
  importing test piece from user_var.test
mysql-test/t/user_var.test:
  using UCS2 in this test fails on non-USC2-capable binaries, so let's move this piece to ctype_ucs.test.
sql/slave.cc:
  changing arg type to uint32* (as what is used in this arg is &thd->db_length which is uint32*)
sql/slave.h:
  changing arg type to uint32*
sql/sql_parse.cc:
  changing arg types to uint32, as what is used in these args is a create_field::length which is uint32.
parent 83317e5b
...@@ -487,3 +487,17 @@ prepare stmt1 from @str2; ...@@ -487,3 +487,17 @@ prepare stmt1 from @str2;
execute stmt1 using @ivar; execute stmt1 using @ivar;
? ?
1234 1234
create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
reset master;
insert into t2 values (@v);
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 User var 1 79 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
master-bin.000001 119 Query 1 119 use `test`; insert into t2 values (@v)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
use test;
SET TIMESTAMP=1100684975;
insert into t2 values (@v);
drop table t2;
...@@ -169,18 +169,12 @@ SET @`a b`='hello'; ...@@ -169,18 +169,12 @@ SET @`a b`='hello';
INSERT INTO t1 VALUES(@`a b`); INSERT INTO t1 VALUES(@`a b`);
set @var1= "';aaa"; set @var1= "';aaa";
insert into t1 values (@var1); insert into t1 values (@var1);
create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
insert into t2 values (@v);
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 User var 1 79 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci master-bin.000001 79 User var 1 79 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
master-bin.000001 120 Query 1 120 use `test`; INSERT INTO t1 VALUES(@`a b`) master-bin.000001 120 Query 1 120 use `test`; INSERT INTO t1 VALUES(@`a b`)
master-bin.000001 184 User var 1 184 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci master-bin.000001 184 User var 1 184 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
master-bin.000001 226 Query 1 226 use `test`; insert into t1 values (@var1) master-bin.000001 226 Query 1 226 use `test`; insert into t1 values (@var1)
master-bin.000001 290 Query 1 290 use `test`; create table t2 (c char(30)) charset=ucs2
master-bin.000001 366 User var 1 366 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
master-bin.000001 406 Query 1 406 use `test`; insert into t2 values (@v)
/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci; SET @`a b`:=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci;
use test; use test;
...@@ -189,12 +183,7 @@ INSERT INTO t1 VALUES(@`a b`); ...@@ -189,12 +183,7 @@ INSERT INTO t1 VALUES(@`a b`);
SET @`var1`:=_latin1 0x273B616161 COLLATE latin1_swedish_ci; SET @`var1`:=_latin1 0x273B616161 COLLATE latin1_swedish_ci;
SET TIMESTAMP=10000; SET TIMESTAMP=10000;
insert into t1 values (@var1); insert into t1 values (@var1);
SET TIMESTAMP=10000; drop table t1;
create table t2 (c char(30)) charset=ucs2;
SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
SET TIMESTAMP=10000;
insert into t2 values (@v);
drop table t1, t2;
set @var= NULL ; set @var= NULL ;
select FIELD( @var,'1it','Hit') as my_column; select FIELD( @var,'1it','Hit') as my_column;
my_column my_column
......
...@@ -323,3 +323,18 @@ set @str1 = 'select ?'; ...@@ -323,3 +323,18 @@ set @str1 = 'select ?';
set @str2 = convert(@str1 using ucs2); set @str2 = convert(@str1 using ucs2);
prepare stmt1 from @str2; prepare stmt1 from @str2;
execute stmt1 using @ivar; execute stmt1 using @ivar;
#
# Check correct binlogging of UCS2 user variables (BUG#3875)
#
create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
reset master;
insert into t2 values (@v);
show binlog events from 79;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
drop table t2;
...@@ -108,16 +108,13 @@ SET @`a b`='hello'; ...@@ -108,16 +108,13 @@ SET @`a b`='hello';
INSERT INTO t1 VALUES(@`a b`); INSERT INTO t1 VALUES(@`a b`);
set @var1= "';aaa"; set @var1= "';aaa";
insert into t1 values (@var1); insert into t1 values (@var1);
create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
insert into t2 values (@v);
show binlog events from 79; show binlog events from 79;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we # more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be # absolutely need variables names to be quoted and strings to be
# escaped). # escaped).
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001 --exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
drop table t1, t2; drop table t1;
# #
......
...@@ -1032,7 +1032,7 @@ bool net_request_file(NET* net, const char* fname) ...@@ -1032,7 +1032,7 @@ bool net_request_file(NET* net, const char* fname)
} }
const char *rewrite_db(const char* db, uint *new_len) const char *rewrite_db(const char* db, uint32 *new_len)
{ {
if (replicate_rewrite_db.is_empty() || !db) if (replicate_rewrite_db.is_empty() || !db)
return db; return db;
...@@ -1043,7 +1043,7 @@ const char *rewrite_db(const char* db, uint *new_len) ...@@ -1043,7 +1043,7 @@ const char *rewrite_db(const char* db, uint *new_len)
{ {
if (!strcmp(tmp->key, db)) if (!strcmp(tmp->key, db))
{ {
*new_len= strlen(tmp->val); *new_len= (uint32)strlen(tmp->val);
return tmp->val; return tmp->val;
} }
} }
......
...@@ -510,7 +510,7 @@ int add_table_rule(HASH* h, const char* table_spec); ...@@ -510,7 +510,7 @@ int add_table_rule(HASH* h, const char* table_spec);
int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec); int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec);
void init_table_rule_hash(HASH* h, bool* h_inited); void init_table_rule_hash(HASH* h, bool* h_inited);
void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited); void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited);
const char *rewrite_db(const char* db, uint *new_db_len); const char *rewrite_db(const char* db, uint32 *new_db_len);
const char *print_slave_db_safe(const char *db); const char *print_slave_db_safe(const char *db);
int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code); int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code);
void skip_load_data_infile(NET* net); void skip_load_data_infile(NET* net);
......
...@@ -4123,7 +4123,7 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length) ...@@ -4123,7 +4123,7 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
- SET uses tot_length. - SET uses tot_length.
*/ */
void calculate_interval_lengths(THD *thd, TYPELIB *interval, void calculate_interval_lengths(THD *thd, TYPELIB *interval,
uint *max_length, uint *tot_length) uint32 *max_length, uint32 *tot_length)
{ {
const char **pos; const char **pos;
uint *len; uint *len;
...@@ -4135,7 +4135,7 @@ void calculate_interval_lengths(THD *thd, TYPELIB *interval, ...@@ -4135,7 +4135,7 @@ void calculate_interval_lengths(THD *thd, TYPELIB *interval,
*len= (uint) strip_sp((char*) *pos); *len= (uint) strip_sp((char*) *pos);
uint length= cs->cset->numchars(cs, *pos, *pos + *len); uint length= cs->cset->numchars(cs, *pos, *pos + *len);
*tot_length+= length; *tot_length+= length;
set_if_bigger(*max_length, length); set_if_bigger(*max_length, (uint32)length);
} }
} }
...@@ -4454,7 +4454,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type, ...@@ -4454,7 +4454,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
if (new_field->pack_length > 4) if (new_field->pack_length > 4)
new_field->pack_length=8; new_field->pack_length=8;
new_field->interval=interval; new_field->interval=interval;
uint dummy_max_length; uint32 dummy_max_length;
calculate_interval_lengths(thd, interval, calculate_interval_lengths(thd, interval,
&dummy_max_length, &new_field->length); &dummy_max_length, &new_field->length);
new_field->length+= (interval->count - 1); new_field->length+= (interval->count - 1);
...@@ -4484,7 +4484,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type, ...@@ -4484,7 +4484,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
new_field->interval=interval; new_field->interval=interval;
new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe
uint dummy_tot_length; uint32 dummy_tot_length;
calculate_interval_lengths(thd, interval, calculate_interval_lengths(thd, interval,
&new_field->length, &dummy_tot_length); &new_field->length, &dummy_tot_length);
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1); set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
......
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