Commit 77eb790e authored by wax@kishkin.ru's avatar wax@kishkin.ru

SCRUM

correct sql_alloc, ORDER BY and NULL value in group_concat
add comments
move test msg_arg
add test on NULL
parent 12f1cb55
...@@ -121,7 +121,7 @@ grp ROUND(group_concat(a separator "")) ...@@ -121,7 +121,7 @@ grp ROUND(group_concat(a separator ""))
1 1 1 1
2 23 2 23
3 456789 3 456789
drop table if exists t1; drop table t1;
create table t1 (grp int, c char(10)); create table t1 (grp int, c char(10));
insert into t1 values (1,NULL); insert into t1 values (1,NULL);
insert into t1 values (2,"b"); insert into t1 values (2,"b");
...@@ -132,17 +132,23 @@ insert into t1 values (3,"D"); ...@@ -132,17 +132,23 @@ insert into t1 values (3,"D");
insert into t1 values (3,NULL); insert into t1 values (3,NULL);
insert into t1 values (3,NULL); insert into t1 values (3,NULL);
insert into t1 values (3,"D"); insert into t1 values (3,"D");
insert into t1 values (4,"");
insert into t1 values (5,NULL);
select grp,group_concat(c order by c) from t1 group by grp; select grp,group_concat(c order by c) from t1 group by grp;
grp group_concat(c order by c) grp group_concat(c order by c)
1 1 NULL
2 b 2 b
3 D D E 3 D D E
4
5 NULL
set group_concat_max_len = 5; set group_concat_max_len = 5;
select grp,group_concat(c) from t1 group by grp; select grp,group_concat(c) from t1 group by grp;
grp group_concat(c) grp group_concat(c)
1 1 NULL
2 b 2 b
3 E D 3 E D D
4
5 NULL
Warnings: Warnings:
Warning 1250 1 line(s) was(were) cut by group_concat() Warning 1250 1 line(s) was(were) cut by group_concat()
show warnings; show warnings;
......
...@@ -48,7 +48,7 @@ select grp, ROUND(group_concat(a separator "")) from t1 group by grp; ...@@ -48,7 +48,7 @@ select grp, ROUND(group_concat(a separator "")) from t1 group by grp;
# Test NULL values # Test NULL values
drop table if exists t1; drop table t1;
create table t1 (grp int, c char(10)); create table t1 (grp int, c char(10));
insert into t1 values (1,NULL); insert into t1 values (1,NULL);
insert into t1 values (2,"b"); insert into t1 values (2,"b");
...@@ -59,6 +59,8 @@ insert into t1 values (3,"D"); ...@@ -59,6 +59,8 @@ insert into t1 values (3,"D");
insert into t1 values (3,NULL); insert into t1 values (3,NULL);
insert into t1 values (3,NULL); insert into t1 values (3,NULL);
insert into t1 values (3,"D"); insert into t1 values (3,"D");
insert into t1 values (4,"");
insert into t1 values (5,NULL);
select grp,group_concat(c order by c) from t1 group by grp; select grp,group_concat(c order by c) from t1 group by grp;
# Test warnings # Test warnings
......
This diff is collapsed.
...@@ -327,12 +327,12 @@ public: ...@@ -327,12 +327,12 @@ public:
const char *msg_arg) const char *msg_arg)
:code(code_arg), level(level_arg) :code(code_arg), level(level_arg)
{ {
set_msg(msg_arg); if (msg_arg)
msg=sql_strdup(msg_arg);
} }
inline void set_msg(const char *msg_arg) inline void set_msg(const char *msg_arg)
{ {
if (msg_arg) msg=sql_strdup(msg_arg);
msg=sql_strdup(msg_arg);
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment