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
1c0b3b65
Commit
1c0b3b65
authored
Jun 07, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rurik.mysql.com:/home/igor/mysql-4.1
into rurik.mysql.com:/home/igor/dev/mysql-4.1-0
parents
1fd1fbc6
931e78ec
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
5 deletions
+38
-5
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+11
-0
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+17
-0
sql/item.h
sql/item.h
+2
-2
sql/item_buff.cc
sql/item_buff.cc
+7
-2
sql/sql_select.cc
sql/sql_select.cc
+1
-1
No files found.
mysql-test/r/group_by.result
View file @
1c0b3b65
...
...
@@ -711,3 +711,14 @@ select min(b) from t1;
min(b)
3000000000
drop table t1;
CREATE TABLE t1 (id int PRIMARY KEY, user_id int, hostname longtext);
INSERT INTO t1 VALUES
(1, 7, 'cache-dtc-af05.proxy.aol.com'),
(2, 3, 'what.ever.com'),
(3, 7, 'cache-dtc-af05.proxy.aol.com'),
(4, 7, 'cache-dtc-af05.proxy.aol.com');
SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1
WHERE hostname LIKE '%aol%'
GROUP BY hostname;
hostname no
cache-dtc-af05.proxy.aol.com 1
mysql-test/t/group_by.test
View file @
1c0b3b65
...
...
@@ -522,3 +522,20 @@ insert into t1 values(3000000000);
select
*
from
t1
;
select
min
(
b
)
from
t1
;
drop
table
t1
;
#
# Test for bug #11088: GROUP BY a BLOB colimn with COUNT(DISTINCT column1)
#
CREATE
TABLE
t1
(
id
int
PRIMARY
KEY
,
user_id
int
,
hostname
longtext
);
INSERT
INTO
t1
VALUES
(
1
,
7
,
'cache-dtc-af05.proxy.aol.com'
),
(
2
,
3
,
'what.ever.com'
),
(
3
,
7
,
'cache-dtc-af05.proxy.aol.com'
),
(
4
,
7
,
'cache-dtc-af05.proxy.aol.com'
);
SELECT
hostname
,
COUNT
(
DISTINCT
user_id
)
as
no
FROM
t1
WHERE
hostname
LIKE
'%aol%'
GROUP
BY
hostname
;
sql/item.h
View file @
1c0b3b65
...
...
@@ -1118,7 +1118,7 @@ class Item_str_buff :public Item_buff
Item
*
item
;
String
value
,
tmp_value
;
public:
Item_str_buff
(
Item
*
arg
)
:
item
(
arg
),
value
(
arg
->
max_length
)
{}
Item_str_buff
(
THD
*
thd
,
Item
*
arg
);
bool
cmp
(
void
);
~
Item_str_buff
();
// Deallocate String:s
};
...
...
@@ -1385,7 +1385,7 @@ class Item_type_holder: public Item
};
extern
Item_buff
*
new_Item_buff
(
Item
*
item
);
extern
Item_buff
*
new_Item_buff
(
THD
*
thd
,
Item
*
item
);
extern
Item_result
item_cmp_type
(
Item_result
a
,
Item_result
b
);
extern
void
resolve_const_item
(
THD
*
thd
,
Item
**
ref
,
Item
*
cmp_item
);
extern
bool
field_is_equal_to_item
(
Field
*
field
,
Item
*
item
);
sql/item_buff.cc
View file @
1c0b3b65
...
...
@@ -23,13 +23,13 @@
** Create right type of item_buffer for an item
*/
Item_buff
*
new_Item_buff
(
Item
*
item
)
Item_buff
*
new_Item_buff
(
THD
*
thd
,
Item
*
item
)
{
if
(
item
->
type
()
==
Item
::
FIELD_ITEM
&&
!
(((
Item_field
*
)
item
)
->
field
->
flags
&
BLOB_FLAG
))
return
new
Item_field_buff
((
Item_field
*
)
item
);
if
(
item
->
result_type
()
==
STRING_RESULT
)
return
new
Item_str_buff
((
Item_field
*
)
item
);
return
new
Item_str_buff
(
thd
,
(
Item_field
*
)
item
);
if
(
item
->
result_type
()
==
INT_RESULT
)
return
new
Item_int_buff
((
Item_field
*
)
item
);
return
new
Item_real_buff
(
item
);
...
...
@@ -42,12 +42,17 @@ Item_buff::~Item_buff() {}
** Return true if values have changed
*/
Item_str_buff
::
Item_str_buff
(
THD
*
thd
,
Item
*
arg
)
:
item
(
arg
),
value
(
min
(
arg
->
max_length
,
thd
->
variables
.
max_sort_length
))
{}
bool
Item_str_buff
::
cmp
(
void
)
{
String
*
res
;
bool
tmp
;
res
=
item
->
val_str
(
&
tmp_value
);
res
->
length
(
min
(
res
->
length
(),
value
.
alloced_length
()));
if
(
null_value
!=
item
->
null_value
)
{
if
((
null_value
=
item
->
null_value
))
...
...
sql/sql_select.cc
View file @
1c0b3b65
...
...
@@ -8656,7 +8656,7 @@ alloc_group_fields(JOIN *join,ORDER *group)
{
for
(;
group
;
group
=
group
->
next
)
{
Item_buff
*
tmp
=
new_Item_buff
(
*
group
->
item
);
Item_buff
*
tmp
=
new_Item_buff
(
join
->
thd
,
*
group
->
item
);
if
(
!
tmp
||
join
->
group_fields
.
push_front
(
tmp
))
return
TRUE
;
}
...
...
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