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
500874b5
Commit
500874b5
authored
Jun 08, 2004
by
bar@bar.intranet.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #3717 ENCODE returns a character string, not a binary string
parent
581ff1d9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
3 deletions
+12
-3
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+7
-2
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+3
-1
sql/item_strfunc.cc
sql/item_strfunc.cc
+2
-0
No files found.
mysql-test/r/func_str.result
View file @
500874b5
...
...
@@ -528,6 +528,9 @@ latin2_general_ci 3
select collation(replace(_latin2'abcd',_latin2'b',_latin2'B')), coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'));
collation(replace(_latin2'abcd',_latin2'b',_latin2'B')) coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'))
latin2_general_ci 3
select collation(encode('abcd','ab')), coercibility(encode('abcd','ab'));
collation(encode('abcd','ab')) coercibility(encode('abcd','ab'))
binary 3
create table t1
select
bin(130),
...
...
@@ -559,7 +562,8 @@ quote(_latin2'ab'),
soundex(_latin2'ab'),
substring(_latin2'ab',1),
insert(_latin2'abcd',2,3,_latin2'ef'),
replace(_latin2'abcd',_latin2'b',_latin2'B')
replace(_latin2'abcd',_latin2'b',_latin2'B'),
encode('abcd','ab')
;
Warnings:
Warning 1265 Data truncated for column 'format(130,10)' at row 1
...
...
@@ -595,7 +599,8 @@ t1 CREATE TABLE `t1` (
`soundex(_latin2'ab')` char(4) character set latin2 NOT NULL default '',
`substring(_latin2'ab',1)` char(2) character set latin2 NOT NULL default '',
`insert(_latin2'abcd',2,3,_latin2'ef')` char(6) character set latin2 NOT NULL default '',
`replace(_latin2'abcd',_latin2'b',_latin2'B')` char(4) character set latin2 NOT NULL default ''
`replace(_latin2'abcd',_latin2'b',_latin2'B')` char(4) character set latin2 NOT NULL default '',
`encode('abcd','ab')` binary(4) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select SUBSTR('abcdefg',3,2);
...
...
mysql-test/t/func_str.test
View file @
500874b5
...
...
@@ -304,6 +304,7 @@ select collation(soundex(_latin2'ab')), coercibility(soundex(_latin2'ab'));
select
collation
(
substring
(
_latin2
'ab'
,
1
)),
coercibility
(
substring
(
_latin2
'ab'
,
1
));
select
collation
(
insert
(
_latin2
'abcd'
,
2
,
3
,
_latin2
'ef'
)),
coercibility
(
insert
(
_latin2
'abcd'
,
2
,
3
,
_latin2
'ef'
));
select
collation
(
replace
(
_latin2
'abcd'
,
_latin2
'b'
,
_latin2
'B'
)),
coercibility
(
replace
(
_latin2
'abcd'
,
_latin2
'b'
,
_latin2
'B'
));
select
collation
(
encode
(
'abcd'
,
'ab'
)),
coercibility
(
encode
(
'abcd'
,
'ab'
));
create
table
t1
select
...
...
@@ -336,7 +337,8 @@ select
soundex
(
_latin2
'ab'
),
substring
(
_latin2
'ab'
,
1
),
insert
(
_latin2
'abcd'
,
2
,
3
,
_latin2
'ef'
),
replace
(
_latin2
'abcd'
,
_latin2
'b'
,
_latin2
'B'
)
replace
(
_latin2
'abcd'
,
_latin2
'b'
,
_latin2
'B'
),
encode
(
'abcd'
,
'ab'
)
;
show
create
table
t1
;
drop
table
t1
;
...
...
sql/item_strfunc.cc
View file @
500874b5
...
...
@@ -1461,6 +1461,7 @@ void Item_func_encode::fix_length_and_dec()
{
max_length
=
args
[
0
]
->
max_length
;
maybe_null
=
args
[
0
]
->
maybe_null
;
collation
.
set
(
&
my_charset_bin
);
}
String
*
Item_func_encode
::
val_str
(
String
*
str
)
...
...
@@ -1476,6 +1477,7 @@ String *Item_func_encode::val_str(String *str)
res
=
copy_if_not_alloced
(
str
,
res
,
res
->
length
());
sql_crypt
.
init
();
sql_crypt
.
encode
((
char
*
)
res
->
ptr
(),
res
->
length
());
res
->
set_charset
(
&
my_charset_bin
);
return
res
;
}
...
...
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