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
a17c567f
Commit
a17c567f
authored
Apr 16, 2003
by
wax@kishkin.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace default separator in group_concat, correct a bug
parent
b24eeb7f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
29 deletions
+31
-29
mysql-test/r/func_gconcat.result
mysql-test/r/func_gconcat.result
+28
-28
sql/item_sum.h
sql/item_sum.h
+2
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-1
No files found.
mysql-test/r/func_gconcat.result
View file @
a17c567f
...
...
@@ -14,18 +14,18 @@ insert into t1 values (3,9,"D","c");
select grp,group_concat(c) from t1 group by grp;
grp group_concat(c)
1 a
2 b
c
3 E
C D d d
D
2 b
,
c
3 E
,C,D,d,d,
D
select grp,group_concat(a,c) from t1 group by grp;
grp group_concat(a,c)
1 1a
2 2b
3c
3 4E
5C 6D 7d 8d
9D
2 2b
,
3c
3 4E
,5C,6D,7d,8d,
9D
select grp,group_concat("(",a,":",c,")") from t1 group by grp;
grp group_concat("(",a,":",c,")")
1 (1:a)
2 (2:b)
(3:c)
3 (4:E)
(5:C) (6:D) (7:d) (8:d)
(9:D)
2 (2:b)
,
(3:c)
3 (4:E)
,(5:C),(6:D),(7:d),(8:d),
(9:D)
select grp,group_concat(c separator ",") from t1 group by grp;
grp group_concat(c separator ",")
1 a
...
...
@@ -39,48 +39,48 @@ grp group_concat(c separator "---->")
select grp,group_concat(c order by c) from t1 group by grp;
grp group_concat(c order by c)
1 a
2 b
c
3 C
D d d D
E
2 b
,
c
3 C
,D,d,d,D,
E
select grp,group_concat(c order by c desc) from t1 group by grp;
grp group_concat(c order by c desc)
1 a
2 c
b
3 E
D d d D
C
2 c
,
b
3 E
,D,d,d,D,
C
select grp,group_concat(d order by a) from t1 group by grp;
grp group_concat(d order by a)
1 a
2 a
b
3 a
b b d d
c
2 a
,
b
3 a
,b,b,d,d,
c
select grp,group_concat(d order by a desc) from t1 group by grp;
grp group_concat(d order by a desc)
1 a
2 b
a
3 c
d d b b
a
2 b
,
a
3 c
,d,d,b,b,
a
select grp,group_concat(a order by a,d+c) from t1 group by grp;
grp group_concat(a order by a,d+c)
1 1
2 2
3
3 4
5 6 7 8
9
2 2
,
3
3 4
,5,6,7,8,
9
select grp,group_concat(c order by 1) from t1 group by grp;
grp group_concat(c order by 1)
1 a
2 b
c
3 C
D d d D
E
2 b
,
c
3 C
,D,d,d,D,
E
select grp,group_concat(c order by "c") from t1 group by grp;
grp group_concat(c order by "c")
1 a
2 b
c
3 C
D d d D
E
2 b
,
c
3 C
,D,d,d,D,
E
select grp,group_concat(distinct c order by c) from t1 group by grp;
grp group_concat(distinct c order by c)
1 a
2 b
c
3 C
D
E
2 b
,
c
3 C
,D,
E
select grp,group_concat(distinct c order by c desc) from t1 group by grp;
grp group_concat(distinct c order by c desc)
1 a
2 c
b
3 E
D
C
2 c
,
b
3 E
,D,
C
select grp,group_concat(c order by c separator ",") from t1 group by grp;
grp group_concat(c order by c separator ",")
1 a
...
...
@@ -104,8 +104,8 @@ grp group_concat(distinct c order by c desc separator ",")
select grp,group_concat(c order by grp desc) from t1 group by grp order by grp;
grp group_concat(c order by grp desc)
1 a
2 c
b
3 D
d d D C
E
2 c
,
b
3 D
,d,d,D,C,
E
select grp, group_concat(a separator "")+0 from t1 group by grp;
grp group_concat(a separator "")+0
1 1
...
...
@@ -138,7 +138,7 @@ select grp,group_concat(c order by c) from t1 group by grp;
grp group_concat(c order by c)
1 NULL
2 b
3 D
D
E
3 D
,D,
E
4
5 NULL
set group_concat_max_len = 5;
...
...
@@ -146,7 +146,7 @@ select grp,group_concat(c) from t1 group by grp;
grp group_concat(c)
1 NULL
2 b
3 E
D
D
3 E
,D,
D
4
5 NULL
Warnings:
...
...
sql/item_sum.h
View file @
a17c567f
...
...
@@ -697,6 +697,7 @@ class Item_func_group_concat : public Item_sum
enum
Sumfunctype
sum_func
()
const
{
return
GROUP_CONCAT_FUNC
;}
const
char
*
func_name
()
const
{
return
"group_concat"
;
}
enum
Type
type
()
const
{
return
SUM_FUNC_ITEM
;
}
void
fix_length_and_dec
()
{
max_length
=
group_concat_max_len
;
}
virtual
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
void
reset
();
bool
add
();
...
...
@@ -715,4 +716,5 @@ class Item_func_group_concat : public Item_sum
return
res
?
strtoll
(
res
->
c_ptr
(),(
char
**
)
0
,
10
)
:
(
longlong
)
0
;
}
String
*
val_str
(
String
*
str
);
Item
*
copy_or_same
(
THD
*
thd
)
{
return
new
Item_func_group_concat
(
thd
,
*
this
);
}
};
sql/sql_yacc.yy
View file @
a17c567f
...
...
@@ -2588,7 +2588,7 @@ opt_distinct:
|DISTINCT { $$ = 1; };
opt_gconcat_separator:
/* empty */ { $$ = new String("
",1,default_charset_info); }
/* empty */ { $$ = new String("
,
",1,default_charset_info); }
|SEPARATOR_SYM text_string { $$ = $2; };
...
...
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