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
feaef5d4
Commit
feaef5d4
authored
Mar 31, 2013
by
Chaithra Gopalareddy
Browse files
Options
Browse Files
Download
Plain Diff
Merge from 5.1 to 5.5
parents
9952d345
5e905fdb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
38 deletions
+50
-38
sql/item_sum.cc
sql/item_sum.cc
+50
-38
No files found.
sql/item_sum.cc
View file @
feaef5d4
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2013 Oracle and/or its affiliates. All
rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -2840,7 +2841,7 @@ int group_concat_key_cmp_with_distinct(void* arg, const void* key1,
{
Item
*
item
=
item_func
->
args
[
i
];
/*
If
field_item is a const item then either get_t
p_table_field returns 0
If
item is a const item then either get_tm
p_table_field returns 0
or it is an item over a const table.
*/
if
(
item
->
const_item
())
...
...
@@ -2851,9 +2852,13 @@ int group_concat_key_cmp_with_distinct(void* arg, const void* key1,
the temporary table, not the original field
*/
Field
*
field
=
item
->
get_tmp_table_field
();
int
res
;
if
(
!
field
)
continue
;
uint
offset
=
field
->
offset
(
field
->
table
->
record
[
0
])
-
table
->
s
->
null_bytes
;
if
((
res
=
field
->
cmp
((
uchar
*
)
key1
+
offset
,
(
uchar
*
)
key2
+
offset
)))
int
res
=
field
->
cmp
((
uchar
*
)
key1
+
offset
,
(
uchar
*
)
key2
+
offset
);
if
(
res
)
return
res
;
}
return
0
;
...
...
@@ -2877,25 +2882,27 @@ int group_concat_key_cmp_with_order(void* arg, const void* key1,
order_item
++
)
{
Item
*
item
=
*
(
*
order_item
)
->
item
;
/*
If item is a const item then either get_tmp_table_field returns 0
or it is an item over a const table.
*/
if
(
item
->
const_item
())
continue
;
/*
We have to use get_tmp_table_field() instead of
real_item()->get_tmp_table_field() because we want the field in
the temporary table, not the original field
*/
Field
*
field
=
item
->
get_tmp_table_field
();
/*
If item is a const item then either get_tp_table_field returns 0
or it is an item over a const table.
*/
if
(
field
&&
!
item
->
const_item
())
{
int
res
;
if
(
!
field
)
continue
;
uint
offset
=
(
field
->
offset
(
field
->
table
->
record
[
0
])
-
table
->
s
->
null_bytes
);
if
((
res
=
field
->
cmp
((
uchar
*
)
key1
+
offset
,
(
uchar
*
)
key2
+
offset
)))
int
res
=
field
->
cmp
((
uchar
*
)
key1
+
offset
,
(
uchar
*
)
key2
+
offset
);
if
(
res
)
return
(
*
order_item
)
->
asc
?
res
:
-
res
;
}
}
/*
We can't return 0 because in that case the tree class would remove this
item as double value. This would cause problems for case-changes and
...
...
@@ -2933,8 +2940,6 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
for
(;
arg
<
arg_end
;
arg
++
)
{
String
*
res
;
if
(
!
(
*
arg
)
->
const_item
())
{
/*
We have to use get_tmp_table_field() instead of
real_item()->get_tmp_table_field() because we want the field in
...
...
@@ -2942,7 +2947,13 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
We also can't use table->field array to access the fields
because it contains both order and arg list fields.
*/
if
((
*
arg
)
->
const_item
())
res
=
(
*
arg
)
->
val_str
(
&
tmp
);
else
{
Field
*
field
=
(
*
arg
)
->
get_tmp_table_field
();
if
(
field
)
{
uint
offset
=
(
field
->
offset
(
field
->
table
->
record
[
0
])
-
table
->
s
->
null_bytes
);
DBUG_ASSERT
(
offset
<
table
->
s
->
reclength
);
...
...
@@ -2950,6 +2961,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
}
else
res
=
(
*
arg
)
->
val_str
(
&
tmp
);
}
if
(
res
)
result
->
append
(
*
res
);
}
...
...
@@ -3195,13 +3207,13 @@ bool Item_func_group_concat::add()
for
(
uint
i
=
0
;
i
<
arg_count_field
;
i
++
)
{
Item
*
show_item
=
args
[
i
];
if
(
!
show_item
->
const_item
())
{
Field
*
f
=
show_item
->
get_tmp_table_field
();
if
(
f
->
is_null_in_record
((
const
uchar
*
)
table
->
record
[
0
]))
if
(
show_item
->
const_item
())
continue
;
Field
*
field
=
show_item
->
get_tmp_table_field
();
if
(
field
&&
field
->
is_null_in_record
((
const
uchar
*
)
table
->
record
[
0
]))
return
0
;
// Skip row if it contains null
}
}
null_value
=
FALSE
;
bool
row_eligible
=
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