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
5f235eb8
Commit
5f235eb8
authored
Jun 10, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-count-4.1
parents
3d33dc7c
ba82b9e7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
0 deletions
+71
-0
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+28
-0
mysql-test/t/func_group.test
mysql-test/t/func_group.test
+22
-0
sql/item_sum.cc
sql/item_sum.cc
+19
-0
sql/item_sum.h
sql/item_sum.h
+2
-0
No files found.
mysql-test/r/func_group.result
View file @
5f235eb8
...
...
@@ -656,3 +656,31 @@ select stddev(2) from t1;
stddev(2)
NULL
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2);
prepare stmt1 from 'SELECT COUNT(*) FROM t1';
execute stmt1;
COUNT(*)
2
execute stmt1;
COUNT(*)
2
execute stmt1;
COUNT(*)
2
deallocate prepare stmt1;
drop table t1;
create table t1 (a int, primary key(a));
insert into t1 values (1),(2);
prepare stmt1 from 'SELECT max(a) FROM t1';
execute stmt1;
max(a)
2
execute stmt1;
max(a)
2
execute stmt1;
max(a)
2
deallocate prepare stmt1;
drop table t1;
mysql-test/t/func_group.test
View file @
5f235eb8
...
...
@@ -396,3 +396,25 @@ create table t1 (a int);
select
variance
(
2
)
from
t1
;
select
stddev
(
2
)
from
t1
;
drop
table
t1
;
#
# cleunup() of optimized away count(*) and max/min
#
create
table
t1
(
a
int
);
insert
into
t1
values
(
1
),(
2
);
prepare
stmt1
from
'SELECT COUNT(*) FROM t1'
;
execute
stmt1
;
execute
stmt1
;
execute
stmt1
;
deallocate
prepare
stmt1
;
drop
table
t1
;
create
table
t1
(
a
int
,
primary
key
(
a
));
insert
into
t1
values
(
1
),(
2
);
prepare
stmt1
from
'SELECT max(a) FROM t1'
;
execute
stmt1
;
execute
stmt1
;
execute
stmt1
;
deallocate
prepare
stmt1
;
drop
table
t1
;
sql/item_sum.cc
View file @
5f235eb8
...
...
@@ -361,6 +361,16 @@ longlong Item_sum_count::val_int()
return
(
longlong
)
count
;
}
void
Item_sum_count
::
cleanup
()
{
DBUG_ENTER
(
"Item_sum_count::cleanup"
);
Item_sum_int
::
cleanup
();
used_table_cache
=
~
(
table_map
)
0
;
DBUG_VOID_RETURN
;
}
/*
Avgerage
*/
...
...
@@ -575,6 +585,15 @@ Item_sum_hybrid::val_str(String *str)
}
void
Item_sum_hybrid
::
cleanup
()
{
DBUG_ENTER
(
"Item_sum_hybrid::cleanup"
);
Item_sum
::
cleanup
();
used_table_cache
=
~
(
table_map
)
0
;
DBUG_VOID_RETURN
;
}
Item
*
Item_sum_min
::
copy_or_same
(
THD
*
thd
)
{
return
new
(
&
thd
->
mem_root
)
Item_sum_min
(
thd
,
this
);
...
...
sql/item_sum.h
View file @
5f235eb8
...
...
@@ -172,6 +172,7 @@ class Item_sum_count :public Item_sum_int
void
make_const
(
longlong
count_arg
)
{
count
=
count_arg
;
used_table_cache
=
0
;
}
longlong
val_int
();
void
reset_field
();
void
cleanup
();
void
update_field
();
const
char
*
func_name
()
const
{
return
"count"
;
}
Item
*
copy_or_same
(
THD
*
thd
);
...
...
@@ -428,6 +429,7 @@ class Item_sum_hybrid :public Item_sum
void
min_max_update_str_field
();
void
min_max_update_real_field
();
void
min_max_update_int_field
();
void
cleanup
();
};
...
...
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