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
80484114
Commit
80484114
authored
Sep 07, 2005
by
igor@rurik.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Manual merge
parents
052e9262
1e6736b5
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
218 additions
and
363 deletions
+218
-363
mysql-test/r/func_gconcat.result
mysql-test/r/func_gconcat.result
+20
-0
mysql-test/t/func_gconcat.test
mysql-test/t/func_gconcat.test
+16
-0
sql/item_sum.cc
sql/item_sum.cc
+11
-2
sql/item_sum.h
sql/item_sum.h
+171
-361
No files found.
mysql-test/r/func_gconcat.result
View file @
80484114
...
...
@@ -576,3 +576,23 @@ group_concat('x')
NULL
1
drop table t1;
CREATE TABLE t1 (id int, a varchar(9));
INSERT INTO t1 VALUES
(2, ''), (1, ''), (2, 'x'), (1, 'y'), (3, 'z'), (3, '');
SELECT GROUP_CONCAT(a) FROM t1;
GROUP_CONCAT(a)
,,x,y,z,
SELECT GROUP_CONCAT(a ORDER BY a) FROM t1;
GROUP_CONCAT(a ORDER BY a)
,,,x,y,z
SELECT GROUP_CONCAT(a) FROM t1 GROUP BY id;
GROUP_CONCAT(a)
,y
,x
z,
SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id;
GROUP_CONCAT(a ORDER BY a)
,y
,x
,z
DROP TABLE t1;
mysql-test/t/func_gconcat.test
View file @
80484114
...
...
@@ -373,4 +373,20 @@ select * from (select group_concat(a) from t1) t2;
select
group_concat
(
'x'
)
UNION
ALL
select
1
;
drop
table
t1
;
#
# Bug #12863 : missing separators after first empty cancatanated elements
#
CREATE
TABLE
t1
(
id
int
,
a
varchar
(
9
));
INSERT
INTO
t1
VALUES
(
2
,
''
),
(
1
,
''
),
(
2
,
'x'
),
(
1
,
'y'
),
(
3
,
'z'
),
(
3
,
''
);
SELECT
GROUP_CONCAT
(
a
)
FROM
t1
;
SELECT
GROUP_CONCAT
(
a
ORDER
BY
a
)
FROM
t1
;
SELECT
GROUP_CONCAT
(
a
)
FROM
t1
GROUP
BY
id
;
SELECT
GROUP_CONCAT
(
a
ORDER
BY
a
)
FROM
t1
GROUP
BY
id
;
DROP
TABLE
t1
;
# End of 4.1 tests
sql/item_sum.cc
View file @
80484114
...
...
@@ -2740,8 +2740,10 @@ int dump_leaf_key(byte* key, element_count count __attribute__((unused)),
String
*
result
=
&
item
->
result
;
Item
**
arg
=
item
->
args
,
**
arg_end
=
item
->
args
+
item
->
arg_count_field
;
if
(
result
->
length
())
result
->
append
(
*
item
->
separator
);
if
(
item
->
no_appended
)
item
->
no_appended
=
FALSE
;
else
item
->
result
.
append
(
*
item
->
separator
);
tmp
.
length
(
0
);
...
...
@@ -2925,6 +2927,7 @@ void Item_func_group_concat::clear()
result
.
copy
();
null_value
=
TRUE
;
warning_for_row
=
FALSE
;
no_appended
=
TRUE
;
if
(
tree
)
reset_tree
(
tree
);
/* No need to reset the table as we never call write_row */
...
...
@@ -2969,6 +2972,12 @@ bool Item_func_group_concat::add()
}
void
Item_func_group_concat
::
reset_field
()
{
DBUG_ASSERT
(
0
);
}
bool
Item_func_group_concat
::
fix_fields
(
THD
*
thd
,
Item
**
ref
)
{
...
...
sql/item_sum.h
View file @
80484114
This diff is collapsed.
Click to expand it.
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