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
0412a7c7
Commit
0412a7c7
authored
Sep 10, 2009
by
Sergey Glukhov
Browse files
Options
Browse Files
Download
Plain Diff
5.0-bugteam->5.1-bugteam merge
parents
e436b886
10406ae6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+9
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+13
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+6
-1
No files found.
mysql-test/r/func_str.result
View file @
0412a7c7
...
@@ -2534,6 +2534,15 @@ SELECT LOAD_FILE(a) FROM t1;
...
@@ -2534,6 +2534,15 @@ SELECT LOAD_FILE(a) FROM t1;
LOAD_FILE(a)
LOAD_FILE(a)
NULL
NULL
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (f2 VARCHAR(20));
CREATE TABLE t2 (f2 VARCHAR(20));
INSERT INTO t1 VALUES ('MIN'),('MAX');
INSERT INTO t2 VALUES ('LOAD');
SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1;
concat_name
LOAD_MIN
LOAD_MAX
DROP TABLE t1, t2;
End of 5.0 tests
End of 5.0 tests
drop table if exists t1;
drop table if exists t1;
create table t1(f1 tinyint default null)engine=myisam;
create table t1(f1 tinyint default null)engine=myisam;
...
...
mysql-test/t/func_str.test
View file @
0412a7c7
...
@@ -1291,6 +1291,19 @@ INSERT INTO t1 VALUES ('aaaaaaaa');
...
@@ -1291,6 +1291,19 @@ INSERT INTO t1 VALUES ('aaaaaaaa');
SELECT
LOAD_FILE
(
a
)
FROM
t1
;
SELECT
LOAD_FILE
(
a
)
FROM
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug#46815 CONCAT_WS returning wrong data
#
CREATE
TABLE
t1
(
f2
VARCHAR
(
20
));
CREATE
TABLE
t2
(
f2
VARCHAR
(
20
));
INSERT
INTO
t1
VALUES
(
'MIN'
),(
'MAX'
);
INSERT
INTO
t2
VALUES
(
'LOAD'
);
SELECT
CONCAT_WS
(
'_'
,
(
SELECT
t2
.
f2
FROM
t2
),
t1
.
f2
)
AS
concat_name
FROM
t1
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
...
...
sql/item_strfunc.cc
View file @
0412a7c7
...
@@ -631,6 +631,7 @@ String *Item_func_concat_ws::val_str(String *str)
...
@@ -631,6 +631,7 @@ String *Item_func_concat_ws::val_str(String *str)
String
tmp_sep_str
(
tmp_str_buff
,
sizeof
(
tmp_str_buff
),
default_charset_info
),
String
tmp_sep_str
(
tmp_str_buff
,
sizeof
(
tmp_str_buff
),
default_charset_info
),
*
sep_str
,
*
res
,
*
res2
,
*
use_as_buff
;
*
sep_str
,
*
res
,
*
res2
,
*
use_as_buff
;
uint
i
;
uint
i
;
bool
is_const
=
0
;
null_value
=
0
;
null_value
=
0
;
if
(
!
(
sep_str
=
args
[
0
]
->
val_str
(
&
tmp_sep_str
)))
if
(
!
(
sep_str
=
args
[
0
]
->
val_str
(
&
tmp_sep_str
)))
...
@@ -644,7 +645,11 @@ String *Item_func_concat_ws::val_str(String *str)
...
@@ -644,7 +645,11 @@ String *Item_func_concat_ws::val_str(String *str)
// If not, return the empty string
// If not, return the empty string
for
(
i
=
1
;
i
<
arg_count
;
i
++
)
for
(
i
=
1
;
i
<
arg_count
;
i
++
)
if
((
res
=
args
[
i
]
->
val_str
(
str
)))
if
((
res
=
args
[
i
]
->
val_str
(
str
)))
{
is_const
=
args
[
i
]
->
const_item
()
||
!
args
[
i
]
->
used_tables
();
break
;
break
;
}
if
(
i
==
arg_count
)
if
(
i
==
arg_count
)
return
&
my_empty_string
;
return
&
my_empty_string
;
...
@@ -662,7 +667,7 @@ String *Item_func_concat_ws::val_str(String *str)
...
@@ -662,7 +667,7 @@ String *Item_func_concat_ws::val_str(String *str)
current_thd
->
variables
.
max_allowed_packet
);
current_thd
->
variables
.
max_allowed_packet
);
goto
null
;
goto
null
;
}
}
if
(
res
->
alloced_length
()
>=
if
(
!
is_const
&&
res
->
alloced_length
()
>=
res
->
length
()
+
sep_str
->
length
()
+
res2
->
length
())
res
->
length
()
+
sep_str
->
length
()
+
res2
->
length
())
{
// Use old buffer
{
// Use old buffer
res
->
append
(
*
sep_str
);
// res->length() > 0 always
res
->
append
(
*
sep_str
);
// res->length() > 0 always
...
...
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