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
0a214a42
Commit
0a214a42
authored
Jun 18, 2009
by
Martin Hansson
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
880dbcce
acc642c8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
6 deletions
+40
-6
mysql-test/r/func_set.result
mysql-test/r/func_set.result
+13
-0
mysql-test/t/func_set.test
mysql-test/t/func_set.test
+13
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+2
-3
sql/sql_string.cc
sql/sql_string.cc
+12
-3
No files found.
mysql-test/r/func_set.result
View file @
0a214a42
...
@@ -146,3 +146,16 @@ NULL
...
@@ -146,3 +146,16 @@ NULL
0
0
0
0
drop table t1;
drop table t1;
CREATE TABLE t1( a SET('a', 'b', 'c') );
CREATE TABLE t2( a SET('a', 'b', 'c') );
INSERT INTO t1 VALUES ('d');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
INSERT INTO t2 VALUES ('');
SELECT CONVERT( a USING latin1 ) FROM t1;
CONVERT( a USING latin1 )
SELECT CONVERT( a USING latin1 ) FROM t2;
CONVERT( a USING latin1 )
DROP TABLE t1, t2;
mysql-test/t/func_set.test
View file @
0a214a42
...
@@ -84,3 +84,16 @@ engine=myisam default charset=latin1;
...
@@ -84,3 +84,16 @@ engine=myisam default charset=latin1;
insert
into
t1
values
(
''
),(
null
),(
null
),(
''
),(
''
),(
''
);
insert
into
t1
values
(
''
),(
null
),(
null
),(
''
),(
''
),(
''
);
select
find_in_set
(
f1
,
f1
)
as
a
from
t1
,(
select
find_in_set
(
f1
,
f1
)
as
b
from
t1
)
a
;
select
find_in_set
(
f1
,
f1
)
as
a
from
t1
,(
select
find_in_set
(
f1
,
f1
)
as
b
from
t1
)
a
;
drop
table
t1
;
drop
table
t1
;
#
# Bug#45168: assertion with convert() and empty set value
#
CREATE
TABLE
t1
(
a
SET
(
'a'
,
'b'
,
'c'
)
);
CREATE
TABLE
t2
(
a
SET
(
'a'
,
'b'
,
'c'
)
);
INSERT
INTO
t1
VALUES
(
'd'
);
INSERT
INTO
t2
VALUES
(
''
);
SELECT
CONVERT
(
a
USING
latin1
)
FROM
t1
;
SELECT
CONVERT
(
a
USING
latin1
)
FROM
t2
;
DROP
TABLE
t1
,
t2
;
sql/item_strfunc.cc
View file @
0a214a42
...
@@ -2710,13 +2710,12 @@ String *Item_func_conv_charset::val_str(String *str)
...
@@ -2710,13 +2710,12 @@ String *Item_func_conv_charset::val_str(String *str)
return
null_value
?
0
:
&
str_value
;
return
null_value
?
0
:
&
str_value
;
/*
/*
Here we don't pass 'str' as a parameter to args[0]->val_str()
Here we don't pass 'str' as a parameter to args[0]->val_str()
as 'str' may point
s
to 'str_value' (e.g. see Item::save_in_field()),
as 'str' may point to 'str_value' (e.g. see Item::save_in_field()),
which we use below to convert string.
which we use below to convert string.
Use argument's 'str_value' instead.
Use argument's 'str_value' instead.
*/
*/
String
*
arg
=
args
[
0
]
->
val_str
(
&
args
[
0
]
->
str_value
);
;
String
*
arg
=
args
[
0
]
->
val_str
(
&
args
[
0
]
->
str_value
);
uint
dummy_errors
;
uint
dummy_errors
;
arg
=
args
[
0
]
->
val_str
(
&
args
[
0
]
->
str_value
);
if
(
!
arg
)
if
(
!
arg
)
{
{
null_value
=
1
;
null_value
=
1
;
...
...
sql/sql_string.cc
View file @
0a214a42
...
@@ -322,14 +322,23 @@ bool String::set_or_copy_aligned(const char *str,uint32 arg_length,
...
@@ -322,14 +322,23 @@ bool String::set_or_copy_aligned(const char *str,uint32 arg_length,
return
copy_aligned
(
str
,
arg_length
,
offset
,
cs
);
return
copy_aligned
(
str
,
arg_length
,
offset
,
cs
);
}
}
/* Copy with charset conversion */
/**
Copies the character data into this String, with optional character set
conversion.
@return
FALSE ok
TRUE Could not allocate result buffer
*/
bool
String
::
copy
(
const
char
*
str
,
uint32
arg_length
,
bool
String
::
copy
(
const
char
*
str
,
uint32
arg_length
,
CHARSET_INFO
*
from_cs
,
CHARSET_INFO
*
to_cs
,
uint
*
errors
)
CHARSET_INFO
*
from_cs
,
CHARSET_INFO
*
to_cs
,
uint
*
errors
)
{
{
uint32
offset
;
uint32
offset
;
DBUG_ASSERT
(
str
!=
Ptr
);
DBUG_ASSERT
(
!
str
||
str
!=
Ptr
);
if
(
!
needs_conversion
(
arg_length
,
from_cs
,
to_cs
,
&
offset
))
if
(
!
needs_conversion
(
arg_length
,
from_cs
,
to_cs
,
&
offset
))
{
{
...
...
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