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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e0752134
Commit
e0752134
authored
Mar 16, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/home/bar/mysql-4.1-bug8785
parents
936ec001
518a2c53
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
2 deletions
+33
-2
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+7
-0
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+9
-0
sql/item.cc
sql/item.cc
+12
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+1
-2
sql/sql_string.h
sql/sql_string.h
+4
-0
No files found.
mysql-test/r/ctype_utf8.result
View file @
e0752134
...
...
@@ -861,6 +861,13 @@ user c
one <one>
two <two>
DROP TABLE t1;
create table t1 (f1 varchar(1) not null) default charset utf8;
insert into t1 values (''), ('');
select concat(concat(_latin1'->',f1),_latin1'<-') from t1;
concat(concat(_latin1'->',f1),_latin1'<-')
-><-
-><-
drop table t1;
select convert(_koi8r'' using utf8) < convert(_koi8r'' using utf8);
convert(_koi8r'' using utf8) < convert(_koi8r'' using utf8)
1
mysql-test/t/ctype_utf8.test
View file @
e0752134
...
...
@@ -694,6 +694,15 @@ SELECT CHARSET('a');
SELECT
user
,
CONCAT
(
'<'
,
user
,
'>'
)
AS
c
FROM
t1
;
DROP
TABLE
t1
;
#
# Bug#8785
# the same problem with the above, but with nested CONCATs
#
create
table
t1
(
f1
varchar
(
1
)
not
null
)
default
charset
utf8
;
insert
into
t1
values
(
''
),
(
''
);
select
concat
(
concat
(
_latin1
'->'
,
f1
),
_latin1
'<-'
)
from
t1
;
drop
table
t1
;
#
# Bug#8385: utf8_general_ci treats Cyrillic letters I and SHORT I as the same
#
...
...
sql/item.cc
View file @
e0752134
...
...
@@ -236,6 +236,18 @@ Item *Item_string::safe_charset_converter(CHARSET_INFO *tocs)
return
NULL
;
}
conv
->
str_value
.
copy
();
/*
The above line executes str_value.realloc() internally,
which alligns Alloced_length using ALLIGN_SIZE.
In the case of Item_string::str_value we don't want
Alloced_length to be longer than str_length.
Otherwise, some functions like Item_func_concat::val_str()
try to reuse str_value as a buffer for concatenation result
for optimization purposes, so our string constant become
corrupted. See bug#8785 for more details.
Let's shrink Alloced_length to str_length to avoid this problem.
*/
conv
->
str_value
.
shrink_to_length
();
return
conv
;
}
...
...
sql/item_strfunc.cc
View file @
e0752134
...
...
@@ -277,8 +277,7 @@ String *Item_func_concat::val_str(String *str)
current_thd
->
variables
.
max_allowed_packet
);
goto
null
;
}
if
(
!
args
[
0
]
->
const_item
()
&&
res
->
alloced_length
()
>=
res
->
length
()
+
res2
->
length
())
if
(
res
->
alloced_length
()
>=
res
->
length
()
+
res2
->
length
())
{
// Use old buffer
res
->
append
(
*
res2
);
}
...
...
sql/sql_string.h
View file @
e0752134
...
...
@@ -177,6 +177,10 @@ class String
}
}
}
inline
void
shrink_to_length
()
{
Alloced_length
=
str_length
;
}
bool
is_alloced
()
{
return
alloced
;
}
inline
String
&
operator
=
(
const
String
&
s
)
{
...
...
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