Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
928c449a
Commit
928c449a
authored
Mar 07, 2008
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/svoj/devel/bk/mysql-5.1-engines
into mysql.com:/home/svoj/devel/mysql/BUG13861/mysql-5.1-engines
parents
83bcd5df
a03f1a4c
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
534 additions
and
9 deletions
+534
-9
cmd-line-utils/libedit/el.h
cmd-line-utils/libedit/el.h
+2
-0
cmd-line-utils/libedit/key.c
cmd-line-utils/libedit/key.c
+2
-2
cmd-line-utils/libedit/map.c
cmd-line-utils/libedit/map.c
+1
-1
cmd-line-utils/libedit/read.c
cmd-line-utils/libedit/read.c
+1
-1
cmd-line-utils/libedit/refresh.c
cmd-line-utils/libedit/refresh.c
+3
-3
mysql-test/include/ctype_common.inc
mysql-test/include/ctype_common.inc
+16
-0
mysql-test/r/ctype_big5.result
mysql-test/r/ctype_big5.result
+19
-0
mysql-test/r/ctype_cp1250_ch.result
mysql-test/r/ctype_cp1250_ch.result
+186
-0
mysql-test/r/ctype_euckr.result
mysql-test/r/ctype_euckr.result
+19
-0
mysql-test/r/ctype_gb2312.result
mysql-test/r/ctype_gb2312.result
+19
-0
mysql-test/r/ctype_gbk.result
mysql-test/r/ctype_gbk.result
+19
-0
mysql-test/r/ctype_uca.result
mysql-test/r/ctype_uca.result
+19
-0
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+93
-0
mysql-test/r/log_tables.result
mysql-test/r/log_tables.result
+11
-0
mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
+19
-0
mysql-test/t/ctype_cp1250_ch.test
mysql-test/t/ctype_cp1250_ch.test
+10
-0
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+4
-0
mysql-test/t/log_tables.test
mysql-test/t/log_tables.test
+10
-0
sql/field.cc
sql/field.cc
+11
-0
sql/field.h
sql/field.h
+2
-0
sql/item_create.cc
sql/item_create.cc
+2
-2
sql/log.cc
sql/log.cc
+1
-0
sql/sql_string.cc
sql/sql_string.cc
+62
-0
sql/sql_string.h
sql/sql_string.h
+3
-0
No files found.
cmd-line-utils/libedit/el.h
View file @
928c449a
...
...
@@ -136,6 +136,8 @@ struct editline {
protected
int
el_editmode
(
EditLine
*
,
int
,
const
char
**
);
#define el_isprint(x) ((unsigned char) (x) < 0x80 ? isprint(x) : 1)
#ifdef DEBUG
#define EL_ABORT(a) do { \
fprintf(el->el_errfile, "%s, %d: ", \
...
...
cmd-line-utils/libedit/key.c
View file @
928c449a
...
...
@@ -618,7 +618,7 @@ key__decode_char(char *buf, int cnt, int ch)
}
else
if
(
ch
==
'\\'
)
{
buf
[
cnt
++
]
=
'\\'
;
buf
[
cnt
]
=
'\\'
;
}
else
if
(
ch
==
' '
||
(
isprint
(
ch
)
&&
!
isspace
(
ch
)))
{
}
else
if
(
ch
==
' '
||
(
el_
isprint
(
ch
)
&&
!
isspace
(
ch
)))
{
buf
[
cnt
]
=
ch
;
}
else
{
buf
[
cnt
++
]
=
'\\'
;
...
...
@@ -660,7 +660,7 @@ key__decode_str(const char *str, char *buf, const char *sep)
}
else
if
(
*
p
==
'^'
||
*
p
==
'\\'
)
{
*
b
++
=
'\\'
;
*
b
++
=
*
p
;
}
else
if
(
*
p
==
' '
||
(
isprint
((
unsigned
char
)
*
p
)
&&
}
else
if
(
*
p
==
' '
||
(
el_
isprint
((
unsigned
char
)
*
p
)
&&
!
isspace
((
unsigned
char
)
*
p
)))
{
*
b
++
=
*
p
;
}
else
{
...
...
cmd-line-utils/libedit/map.c
View file @
928c449a
...
...
@@ -961,7 +961,7 @@ map_init_nls(EditLine *el)
el_action_t
*
map
=
el
->
el_map
.
key
;
for
(
i
=
0200
;
i
<=
0377
;
i
++
)
if
(
isprint
(
i
))
if
(
el_
isprint
(
i
))
map
[
i
]
=
ED_INSERT
;
}
...
...
cmd-line-utils/libedit/read.c
View file @
928c449a
...
...
@@ -508,7 +508,7 @@ el_gets(EditLine *el, int *nread)
el
->
el_chared
.
c_redo
.
pos
<
el
->
el_chared
.
c_redo
.
lim
)
{
if
(
cmdnum
==
VI_DELETE_PREV_CHAR
&&
el
->
el_chared
.
c_redo
.
pos
!=
el
->
el_chared
.
c_redo
.
buf
&&
isprint
((
unsigned
char
)
el
->
el_chared
.
c_redo
.
pos
[
-
1
]))
&&
el_
isprint
((
unsigned
char
)
el
->
el_chared
.
c_redo
.
pos
[
-
1
]))
el
->
el_chared
.
c_redo
.
pos
--
;
else
*
el
->
el_chared
.
c_redo
.
pos
++
=
ch
;
...
...
cmd-line-utils/libedit/refresh.c
View file @
928c449a
...
...
@@ -88,7 +88,7 @@ private void
re_addc
(
EditLine
*
el
,
int
c
)
{
if
(
isprint
(
c
))
{
if
(
el_
isprint
(
c
))
{
re_putc
(
el
,
c
,
1
);
return
;
}
...
...
@@ -964,7 +964,7 @@ re_refresh_cursor(EditLine *el)
h
=
1
;
v
++
;
}
}
else
if
(
!
isprint
((
unsigned
char
)
c
))
{
}
else
if
(
!
el_
isprint
((
unsigned
char
)
c
))
{
h
+=
3
;
if
(
h
>
th
)
{
/* if overflow, compensate */
h
=
h
-
th
;
...
...
@@ -1057,7 +1057,7 @@ re_fastaddc(EditLine *el)
char
mc
=
(
c
==
'\177'
)
?
'?'
:
(
c
|
0100
);
re_fastputc
(
el
,
'^'
);
re_fastputc
(
el
,
mc
);
}
else
if
(
isprint
((
unsigned
char
)
c
))
{
/* normal char */
}
else
if
(
el_
isprint
((
unsigned
char
)
c
))
{
/* normal char */
re_fastputc
(
el
,
c
);
}
else
{
re_fastputc
(
el
,
'\\'
);
...
...
mysql-test/include/ctype_common.inc
View file @
928c449a
...
...
@@ -13,6 +13,8 @@
SET
@
safe_character_set_server
=
@@
character_set_server
;
SET
@
safe_collation_server
=
@@
collation_server
;
SET
@
safe_character_set_client
=
@@
character_set_client
;
SET
@
safe_character_set_results
=
@@
character_set_results
;
SET
character_set_server
=
@
test_character_set
;
SET
collation_server
=
@
test_collation
;
CREATE
DATABASE
d1
;
...
...
@@ -62,8 +64,22 @@ select a sounds like a from t1;
select
1
from
t1
order
by
cast
(
a
as
char
(
1
));
drop
table
t1
;
#
# Bug#27580 SPACE() function collation bug?
#
set
names
utf8
;
create
table
t1
(
name
varchar
(
10
),
level
smallint
unsigned
);
show
create
table
t1
;
insert
into
t1
values
(
'string'
,
1
);
select
concat
(
name
,
space
(
level
)),
concat
(
name
,
repeat
(
' '
,
level
))
from
t1
;
drop
table
t1
;
DROP
DATABASE
d1
;
# Restore settings
USE
test
;
SET
character_set_server
=
@
safe_character_set_server
;
SET
collation_server
=
@
safe_collation_server
;
SET
character_set_client
=
@
safe_character_set_client
;
SET
character_set_results
=
@
safe_character_set_results
;
mysql-test/r/ctype_big5.result
View file @
928c449a
...
...
@@ -3,6 +3,8 @@ SET @test_character_set= 'big5';
SET @test_collation= 'big5_chinese_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
...
...
@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1));
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) default NULL,
`level` smallint(5) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=big5
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET NAMES big5;
SET collation_connection='big5_chinese_ci';
create table t1 select repeat('a',4000) a;
...
...
mysql-test/r/ctype_cp1250_ch.result
View file @
928c449a
...
...
@@ -3,6 +3,192 @@ DROP TABLE IF EXISTS t1;
SHOW COLLATION LIKE 'cp1250_czech_cs';
Collation Charset Id Default Compiled Sortlen
cp1250_czech_cs cp1250 34 Yes 2
SET @test_character_set= 'cp1250';
SET @test_collation= 'cp1250_general_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) cp1250_general_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) cp1250_general_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
select 1 from t1 order by cast(a as char(1));
1
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) default NULL,
`level` smallint(5) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1250
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET @test_character_set= 'cp1250';
SET @test_collation= 'cp1250_czech_cs';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) cp1250_czech_cs YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) cp1250_czech_cs YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
select 1 from t1 order by cast(a as char(1));
1
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) collate cp1250_czech_cs default NULL,
`level` smallint(5) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_czech_cs
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
INSERT INTO t1 VALUES ('');
SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
...
...
mysql-test/r/ctype_euckr.result
View file @
928c449a
...
...
@@ -3,6 +3,8 @@ SET @test_character_set= 'euckr';
SET @test_collation= 'euckr_korean_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
...
...
@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1));
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) default NULL,
`level` smallint(5) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=euckr
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET NAMES euckr;
SET collation_connection='euckr_korean_ci';
create table t1 select repeat('a',4000) a;
...
...
mysql-test/r/ctype_gb2312.result
View file @
928c449a
...
...
@@ -3,6 +3,8 @@ SET @test_character_set= 'gb2312';
SET @test_collation= 'gb2312_chinese_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
...
...
@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1));
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) default NULL,
`level` smallint(5) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=gb2312
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET NAMES gb2312;
SET collation_connection='gb2312_chinese_ci';
create table t1 select repeat('a',4000) a;
...
...
mysql-test/r/ctype_gbk.result
View file @
928c449a
...
...
@@ -3,6 +3,8 @@ SET @test_character_set= 'gbk';
SET @test_collation= 'gbk_chinese_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
...
...
@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1));
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) default NULL,
`level` smallint(5) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=gbk
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET NAMES gbk;
SET collation_connection='gbk_chinese_ci';
create table t1 select repeat('a',4000) a;
...
...
mysql-test/r/ctype_uca.result
View file @
928c449a
...
...
@@ -2538,6 +2538,8 @@ SET @test_character_set= 'utf8';
SET @test_collation= 'utf8_swedish_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
...
...
@@ -2604,10 +2606,27 @@ select 1 from t1 order by cast(a as char(1));
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) collate utf8_swedish_ci default NULL,
`level` smallint(5) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
select a, a regexp '[a]' from t1 order by binary a;
...
...
mysql-test/r/ctype_ucs.result
View file @
928c449a
DROP TABLE IF EXISTS t1;
SET @test_character_set= 'ucs2';
SET @test_collation= 'ucs2_general_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) ucs2_general_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) ucs2_general_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
select 1 from t1 order by cast(a as char(1));
1
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) default NULL,
`level` smallint(5) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=ucs2
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET NAMES latin1;
SET character_set_connection=ucs2;
select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
...
...
mysql-test/r/log_tables.result
View file @
928c449a
...
...
@@ -107,6 +107,17 @@ Database Table In_use Name_locked
SET GLOBAL GENERAL_LOG=ON;
SET GLOBAL SLOW_QUERY_LOG=ON;
truncate table mysql.general_log;
set names binary;
select _koi8r'' as test;
test
select * from mysql.general_log;
event_time user_host thread_id server_id command_type argument
TIMESTAMP USER_HOST THREAD_ID 1 Query set names binary
TIMESTAMP USER_HOST THREAD_ID 1 Query select _koi8r'\xD4\xC5\xD3\xD4' as test
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
set names utf8;
truncate table mysql.general_log;
set names utf8;
create table bug16905 (s char(15) character set utf8 default 'пусто');
insert into bug16905 values ('новое');
...
...
mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
View file @
928c449a
...
...
@@ -6,6 +6,8 @@ SET @test_character_set= 'cp932';
SET @test_collation= 'cp932_japanese_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
...
...
@@ -72,10 +74,27 @@ select 1 from t1 order by cast(a as char(1));
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) default NULL,
`level` smallint(5) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp932
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
set names cp932;
set character_set_database = cp932;
CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = cp932;
...
...
mysql-test/t/ctype_cp1250_ch.test
View file @
928c449a
...
...
@@ -9,6 +9,16 @@ DROP TABLE IF EXISTS t1;
SHOW
COLLATION
LIKE
'cp1250_czech_cs'
;
SET
@
test_character_set
=
'cp1250'
;
SET
@
test_collation
=
'cp1250_general_ci'
;
--
source
include
/
ctype_common
.
inc
SET
@
test_character_set
=
'cp1250'
;
SET
@
test_collation
=
'cp1250_czech_cs'
;
--
source
include
/
ctype_common
.
inc
#
# Bugs: #8840: Empty string comparison and character set 'cp1250'
#
...
...
mysql-test/t/ctype_ucs.test
View file @
928c449a
...
...
@@ -4,6 +4,10 @@
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
SET
@
test_character_set
=
'ucs2'
;
SET
@
test_collation
=
'ucs2_general_ci'
;
--
source
include
/
ctype_common
.
inc
SET
NAMES
latin1
;
SET
character_set_connection
=
ucs2
;
--
source
include
/
endspace
.
inc
...
...
mysql-test/t/log_tables.test
View file @
928c449a
...
...
@@ -130,6 +130,16 @@ show open tables;
SET
GLOBAL
GENERAL_LOG
=
ON
;
SET
GLOBAL
SLOW_QUERY_LOG
=
ON
;
#
# Bug#23924 general_log truncates queries with character set introducers.
#
truncate
table
mysql
.
general_log
;
set
names
binary
;
select
_koi8r
''
as
test
;
--
replace_column
1
TIMESTAMP
2
USER_HOST
3
THREAD_ID
select
*
from
mysql
.
general_log
;
set
names
utf8
;
#
# Bug #16905 Log tables: unicode statements are logged incorrectly
#
...
...
sql/field.cc
View file @
928c449a
...
...
@@ -7644,6 +7644,17 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
if
(
value
.
alloc
(
new_length
))
goto
oom_error
;
if
(
f_is_hex_escape
(
flags
))
{
copy_length
=
my_copy_with_hex_escaping
(
field_charset
,
(
char
*
)
value
.
ptr
(),
new_length
,
from
,
length
);
Field_blob
::
store_length
(
copy_length
);
tmp
=
value
.
ptr
();
bmove
(
ptr
+
packlength
,
(
uchar
*
)
&
tmp
,
sizeof
(
char
*
));
return
0
;
}
/*
"length" is OK as "nchars" argument to well_formed_copy_nchars as this
is never used to limit the length of the data. The cut of long data
...
...
sql/field.h
View file @
928c449a
...
...
@@ -2069,6 +2069,7 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions);
#define FIELDFLAG_NO_DEFAULT 16384
/* sql */
#define FIELDFLAG_SUM ((uint) 32768)// predit: +#fieldflag
#define FIELDFLAG_MAYBE_NULL ((uint) 32768)// sql
#define FIELDFLAG_HEX_ESCAPE ((uint) 0x10000)
#define FIELDFLAG_PACK_SHIFT 3
#define FIELDFLAG_DEC_SHIFT 8
#define FIELDFLAG_MAX_DEC 31
...
...
@@ -2094,3 +2095,4 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions);
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)
#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)
#define f_bit_as_char(x) ((x) & FIELDFLAG_TREAT_BIT_AS_CHAR)
#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE)
sql/item_create.cc
View file @
928c449a
...
...
@@ -4354,12 +4354,12 @@ Create_func_space::create(THD *thd, Item *arg1)
if
(
cs
->
mbminlen
>
1
)
{
uint
dummy_errors
;
sp
=
new
(
thd
->
mem_root
)
Item_string
(
""
,
0
,
cs
);
sp
=
new
(
thd
->
mem_root
)
Item_string
(
""
,
0
,
cs
,
DERIVATION_COERCIBLE
,
MY_REPERTOIRE_ASCII
);
sp
->
str_value
.
copy
(
" "
,
1
,
&
my_charset_latin1
,
cs
,
&
dummy_errors
);
}
else
{
sp
=
new
(
thd
->
mem_root
)
Item_string
(
" "
,
1
,
cs
);
sp
=
new
(
thd
->
mem_root
)
Item_string
(
" "
,
1
,
cs
,
DERIVATION_COERCIBLE
,
MY_REPERTOIRE_ASCII
);
}
return
new
(
thd
->
mem_root
)
Item_func_repeat
(
sp
,
arg1
);
...
...
sql/log.cc
View file @
928c449a
...
...
@@ -418,6 +418,7 @@ bool Log_to_csv_event_handler::
A positive return value in store() means truncation.
Still logging a message in the log in this case.
*/
table
->
field
[
5
]
->
flags
|=
FIELDFLAG_HEX_ESCAPE
;
if
(
table
->
field
[
5
]
->
store
(
sql_text
,
sql_text_len
,
client_cs
)
<
0
)
goto
err
;
...
...
sql/sql_string.cc
View file @
928c449a
...
...
@@ -840,6 +840,68 @@ outp:
}
/**
Copy string with HEX-encoding of "bad" characters.
@details This functions copies the string pointed by "src"
to the string pointed by "dst". Not more than "srclen" bytes
are read from "src". Any sequences of bytes representing
a not-well-formed substring (according to cs) are hex-encoded,
and all well-formed substrings (according to cs) are copied as is.
Not more than "dstlen" bytes are written to "dst". The number
of bytes written to "dst" is returned.
@param cs character set pointer of the destination string
@param[out] dst destination string
@param dstlen size of dst
@param src source string
@param srclen length of src
@retval result length
*/
size_t
my_copy_with_hex_escaping
(
CHARSET_INFO
*
cs
,
char
*
dst
,
size_t
dstlen
,
const
char
*
src
,
size_t
srclen
)
{
const
char
*
srcend
=
src
+
srclen
;
char
*
dst0
=
dst
;
for
(
;
src
<
srcend
;
)
{
size_t
chlen
;
if
((
chlen
=
my_ismbchar
(
cs
,
src
,
srcend
)))
{
if
(
dstlen
<
chlen
)
break
;
/* purecov: inspected */
memcpy
(
dst
,
src
,
chlen
);
src
+=
chlen
;
dst
+=
chlen
;
dstlen
-=
chlen
;
}
else
if
(
*
src
&
0x80
)
{
if
(
dstlen
<
4
)
break
;
/* purecov: inspected */
*
dst
++=
'\\'
;
*
dst
++=
'x'
;
*
dst
++=
_dig_vec_upper
[((
unsigned
char
)
*
src
)
>>
4
];
*
dst
++=
_dig_vec_upper
[((
unsigned
char
)
*
src
)
&
15
];
src
++
;
dstlen
-=
4
;
}
else
{
if
(
dstlen
<
1
)
break
;
/* purecov: inspected */
*
dst
++=
*
src
++
;
dstlen
--
;
}
}
return
dst
-
dst0
;
}
/*
copy a string,
with optional character set conversion,
...
...
sql/sql_string.h
View file @
928c449a
...
...
@@ -37,6 +37,9 @@ uint32 well_formed_copy_nchars(CHARSET_INFO *to_cs,
const
char
**
well_formed_error_pos
,
const
char
**
cannot_convert_error_pos
,
const
char
**
from_end_pos
);
size_t
my_copy_with_hex_escaping
(
CHARSET_INFO
*
cs
,
char
*
dst
,
size_t
dstlen
,
const
char
*
src
,
size_t
srclen
);
class
String
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment