Commit d59c06d9 authored by Alexander Barkov's avatar Alexander Barkov

A post-fix for WL#2649 Number-to-string conversion

Fixing problems discovered by "mtr --embedded" and "mtr --ps"


  @ libmysqld/lib_sql.cc
   "mtr --embedded --do-test=ps" failed.
   Applying a similar change to the one previously done in protocol.cc,
   to make embedded version work the same with client/server version.
   (a bug in the WL#2649 patch)

  @ mysql-test/include/ctype_numconv.inc
  @ mysql-test/r/ctype_binary.result
  @ mysql-test/r/ctype_cp1251.result
  @ mysql-test/r/ctype_latin1.result
  @ mysql-test/r/ctype_ucs.result

  - Changing tinyint(30) to tinyint(4)
    due to problems with "mtr --ps"
    Possibly a bug in libmysql.cc, in function fetch_long_with_conversion().
    Zerofill buffer is to short.

  - Commenting tests with get_lock/release_lock
    "mtr --ps" failed for some reasons in ctype_cp1251.
parent 1094ffd5
...@@ -941,10 +941,10 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags) ...@@ -941,10 +941,10 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
strlen(server_field.org_table_name), cs, thd_cs); strlen(server_field.org_table_name), cs, thd_cs);
client_field->org_name= dup_str_aux(field_alloc, server_field.org_col_name, client_field->org_name= dup_str_aux(field_alloc, server_field.org_col_name,
strlen(server_field.org_col_name), cs, thd_cs); strlen(server_field.org_col_name), cs, thd_cs);
if (item->collation.collation == &my_charset_bin || thd_cs == NULL) if (item->charset_for_protocol() == &my_charset_bin || thd_cs == NULL)
{ {
/* No conversion */ /* No conversion */
client_field->charsetnr= server_field.charsetnr; client_field->charsetnr= item->charset_for_protocol()->number;
client_field->length= server_field.length; client_field->length= server_field.length;
} }
else else
......
...@@ -412,11 +412,12 @@ create table t1 as select concat(sleep(0)) as c1; ...@@ -412,11 +412,12 @@ create table t1 as select concat(sleep(0)) as c1;
show create table t1; show create table t1;
drop table t1; drop table t1;
select hex(concat(get_lock('a',0))); # Fails with "mtr --ps-protocol" for some reasons.
select hex(concat(release_lock('a'))); #select hex(concat(get_lock('a',0)));
create table t1 as select concat(get_lock('a',0)) as c1; #select hex(concat(release_lock('a')));
show create table t1; #create table t1 as select concat(get_lock('a',0)) as c1;
drop table t1; #show create table t1;
#drop table t1;
select hex(concat(is_free_lock('xxxx'))); select hex(concat(is_free_lock('xxxx')));
create table t1 as select concat(is_free_lock('xxxx')) as c1; create table t1 as select concat(is_free_lock('xxxx')) as c1;
...@@ -1053,7 +1054,7 @@ insert into t1 values (1), (10), (100); ...@@ -1053,7 +1054,7 @@ insert into t1 values (1), (10), (100);
select hex(concat(a)), a from t1; select hex(concat(a)), a from t1;
drop table t1; drop table t1;
create table t1 (a tinyint(30) zerofill); create table t1 (a tinyint(4) zerofill);
insert into t1 values (1), (10), (100); insert into t1 values (1), (10), (100);
select hex(concat(a)), a from t1; select hex(concat(a)), a from t1;
drop table t1; drop table t1;
......
...@@ -698,19 +698,6 @@ t1 CREATE TABLE `t1` ( ...@@ -698,19 +698,6 @@ t1 CREATE TABLE `t1` (
`c1` varbinary(21) NOT NULL DEFAULT '' `c1` varbinary(21) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
select hex(concat(get_lock('a',0)));
hex(concat(get_lock('a',0)))
31
select hex(concat(release_lock('a')));
hex(concat(release_lock('a')))
31
create table t1 as select concat(get_lock('a',0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varbinary(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx'))); select hex(concat(is_free_lock('xxxx')));
hex(concat(is_free_lock('xxxx'))) hex(concat(is_free_lock('xxxx')))
31 31
...@@ -1889,13 +1876,13 @@ hex(concat(a)) a ...@@ -1889,13 +1876,13 @@ hex(concat(a)) a
303130 010 303130 010
313030 100 313030 100
drop table t1; drop table t1;
create table t1 (a tinyint(30) zerofill); create table t1 (a tinyint(4) zerofill);
insert into t1 values (1), (10), (100); insert into t1 values (1), (10), (100);
select hex(concat(a)), a from t1; select hex(concat(a)), a from t1;
hex(concat(a)) a hex(concat(a)) a
303030303030303030303030303030303030303030303030303030303031 000000000000000000000000000001 30303031 0001
303030303030303030303030303030303030303030303030303030303130 000000000000000000000000000010 30303130 0010
303030303030303030303030303030303030303030303030303030313030 000000000000000000000000000100 30313030 0100
drop table t1; drop table t1;
create table t1 (a decimal(10,2)); create table t1 (a decimal(10,2));
insert into t1 values (123.45); insert into t1 values (123.45);
......
...@@ -780,19 +780,6 @@ t1 CREATE TABLE `t1` ( ...@@ -780,19 +780,6 @@ t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
select hex(concat(get_lock('a',0)));
hex(concat(get_lock('a',0)))
31
select hex(concat(release_lock('a')));
hex(concat(release_lock('a')))
31
create table t1 as select concat(get_lock('a',0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx'))); select hex(concat(is_free_lock('xxxx')));
hex(concat(is_free_lock('xxxx'))) hex(concat(is_free_lock('xxxx')))
31 31
...@@ -1971,13 +1958,13 @@ hex(concat(a)) a ...@@ -1971,13 +1958,13 @@ hex(concat(a)) a
303130 010 303130 010
313030 100 313030 100
drop table t1; drop table t1;
create table t1 (a tinyint(30) zerofill); create table t1 (a tinyint(4) zerofill);
insert into t1 values (1), (10), (100); insert into t1 values (1), (10), (100);
select hex(concat(a)), a from t1; select hex(concat(a)), a from t1;
hex(concat(a)) a hex(concat(a)) a
303030303030303030303030303030303030303030303030303030303031 000000000000000000000000000001 30303031 0001
303030303030303030303030303030303030303030303030303030303130 000000000000000000000000000010 30303130 0010
303030303030303030303030303030303030303030303030303030313030 000000000000000000000000000100 30313030 0100
drop table t1; drop table t1;
create table t1 (a decimal(10,2)); create table t1 (a decimal(10,2));
insert into t1 values (123.45); insert into t1 values (123.45);
......
...@@ -1108,19 +1108,6 @@ t1 CREATE TABLE `t1` ( ...@@ -1108,19 +1108,6 @@ t1 CREATE TABLE `t1` (
`c1` varchar(21) NOT NULL DEFAULT '' `c1` varchar(21) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
select hex(concat(get_lock('a',0)));
hex(concat(get_lock('a',0)))
31
select hex(concat(release_lock('a')));
hex(concat(release_lock('a')))
31
create table t1 as select concat(get_lock('a',0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx'))); select hex(concat(is_free_lock('xxxx')));
hex(concat(is_free_lock('xxxx'))) hex(concat(is_free_lock('xxxx')))
31 31
...@@ -2299,13 +2286,13 @@ hex(concat(a)) a ...@@ -2299,13 +2286,13 @@ hex(concat(a)) a
303130 010 303130 010
313030 100 313030 100
drop table t1; drop table t1;
create table t1 (a tinyint(30) zerofill); create table t1 (a tinyint(4) zerofill);
insert into t1 values (1), (10), (100); insert into t1 values (1), (10), (100);
select hex(concat(a)), a from t1; select hex(concat(a)), a from t1;
hex(concat(a)) a hex(concat(a)) a
303030303030303030303030303030303030303030303030303030303031 000000000000000000000000000001 30303031 0001
303030303030303030303030303030303030303030303030303030303130 000000000000000000000000000010 30303130 0010
303030303030303030303030303030303030303030303030303030313030 000000000000000000000000000100 30313030 0100
drop table t1; drop table t1;
create table t1 (a decimal(10,2)); create table t1 (a decimal(10,2));
insert into t1 values (123.45); insert into t1 values (123.45);
......
...@@ -1932,19 +1932,6 @@ t1 CREATE TABLE `t1` ( ...@@ -1932,19 +1932,6 @@ t1 CREATE TABLE `t1` (
`c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
select hex(concat(get_lock('a',0)));
hex(concat(get_lock('a',0)))
0031
select hex(concat(release_lock('a')));
hex(concat(release_lock('a')))
0031
create table t1 as select concat(get_lock('a',0)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(is_free_lock('xxxx'))); select hex(concat(is_free_lock('xxxx')));
hex(concat(is_free_lock('xxxx'))) hex(concat(is_free_lock('xxxx')))
0031 0031
...@@ -3123,13 +3110,13 @@ hex(concat(a)) a ...@@ -3123,13 +3110,13 @@ hex(concat(a)) a
003000310030 010 003000310030 010
003100300030 100 003100300030 100
drop table t1; drop table t1;
create table t1 (a tinyint(30) zerofill); create table t1 (a tinyint(4) zerofill);
insert into t1 values (1), (10), (100); insert into t1 values (1), (10), (100);
select hex(concat(a)), a from t1; select hex(concat(a)), a from t1;
hex(concat(a)) a hex(concat(a)) a
003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300031 000000000000000000000000000001 0030003000300031 0001
003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000310030 000000000000000000000000000010 0030003000310030 0010
003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003100300030 000000000000000000000000000100 0030003100300030 0100
drop table t1; drop table t1;
create table t1 (a decimal(10,2)); create table t1 (a decimal(10,2));
insert into t1 values (123.45); insert into t1 values (123.45);
......
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