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
c8db0df2
Commit
c8db0df2
authored
Sep 21, 2015
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing "DTCollation Arg_comparator::cmp_collation".
Using a CHARSET_INFO pointer instead.
parent
2dc32c02
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
17 deletions
+25
-17
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+15
-10
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+9
-6
sql/sql_select.cc
sql/sql_select.cc
+1
-1
No files found.
sql/item_cmpfunc.cc
View file @
c8db0df2
...
...
@@ -494,10 +494,13 @@ bool Item_func::setup_args_and_comparator(THD *thd, Arg_comparator *cmp)
DBUG_ASSERT
(
arg_count
>=
2
);
// Item_func_nullif has arg_count == 3
if
(
args
[
0
]
->
cmp_type
()
==
STRING_RESULT
&&
args
[
1
]
->
cmp_type
()
==
STRING_RESULT
&&
agg_arg_charsets_for_comparison
(
cmp
->
cmp_collation
,
args
,
2
))
args
[
1
]
->
cmp_type
()
==
STRING_RESULT
)
{
DTCollation
tmp
;
if
(
agg_arg_charsets_for_comparison
(
tmp
,
args
,
2
))
return
true
;
cmp
->
m_compare_collation
=
tmp
.
collation
;
}
// Convert constants when compared to int/year field
DBUG_ASSERT
(
functype
()
!=
LIKE_FUNC
);
convert_const_compared_to_int_field
(
thd
);
...
...
@@ -528,7 +531,7 @@ int Arg_comparator::set_compare_func(Item_func_or_sum *item, Item_result type)
switch
(
type
)
{
case
TIME_RESULT
:
cmp_collation
.
collation
=
&
my_charset_numeric
;
m_compare_
collation
=
&
my_charset_numeric
;
break
;
case
ROW_RESULT
:
{
...
...
@@ -666,17 +669,19 @@ bool get_mysql_time_from_str(THD *thd, String *str, timestamp_type warn_type,
*/
bool
Arg_comparator
::
agg_arg_charsets_for_comparison
()
{
if
(
cmp_collation
.
set
((
*
a
)
->
collation
,
(
*
b
)
->
collation
,
MY_COLL_CMP_CONV
)
||
cmp_collation
.
derivation
==
DERIVATION_NONE
)
DTCollation
tmp
;
if
(
tmp
.
set
((
*
a
)
->
collation
,
(
*
b
)
->
collation
,
MY_COLL_CMP_CONV
)
||
tmp
.
derivation
==
DERIVATION_NONE
)
{
my_coll_agg_error
((
*
a
)
->
collation
,
(
*
b
)
->
collation
,
owner
->
func_name
());
return
true
;
}
if
(
agg_item_set_converter
(
cmp_collation
,
owner
->
func_name
(),
if
(
agg_item_set_converter
(
tmp
,
owner
->
func_name
(),
a
,
1
,
MY_COLL_CMP_CONV
,
1
)
||
agg_item_set_converter
(
cmp_collation
,
owner
->
func_name
(),
agg_item_set_converter
(
tmp
,
owner
->
func_name
(),
b
,
1
,
MY_COLL_CMP_CONV
,
1
))
return
true
;
m_compare_collation
=
tmp
.
collation
;
return
false
;
}
...
...
@@ -909,7 +914,7 @@ int Arg_comparator::compare_string()
{
if
(
set_null
)
owner
->
null_value
=
0
;
return
sortcmp
(
res1
,
res2
,
cmp_collation
.
collation
);
return
sortcmp
(
res1
,
res2
,
compare_collation
()
);
}
}
if
(
set_null
)
...
...
@@ -930,7 +935,7 @@ int Arg_comparator::compare_e_string()
res2
=
(
*
b
)
->
val_str
(
&
value2
);
if
(
!
res1
||
!
res2
)
return
MY_TEST
(
res1
==
res2
);
return
MY_TEST
(
sortcmp
(
res1
,
res2
,
c
mp_collation
.
collation
)
==
0
);
return
MY_TEST
(
sortcmp
(
res1
,
res2
,
c
ompare_collation
()
)
==
0
);
}
...
...
sql/item_cmpfunc.h
View file @
c8db0df2
...
...
@@ -48,6 +48,7 @@ class Arg_comparator: public Sql_alloc
{
Item
**
a
,
**
b
;
Item_result
m_compare_type
;
CHARSET_INFO
*
m_compare_collation
;
arg_cmp_func
func
;
Item_func_or_sum
*
owner
;
bool
set_null
;
// TRUE <=> set owner->null_value
...
...
@@ -65,16 +66,18 @@ class Arg_comparator: public Sql_alloc
int
compare_e_temporal
(
enum_field_types
type
);
public:
DTCollation
cmp_collation
;
/* Allow owner function to use string buffers. */
String
value1
,
value2
;
Arg_comparator
()
:
m_compare_type
(
STRING_RESULT
),
m_compare_collation
(
&
my_charset_bin
),
set_null
(
TRUE
),
comparators
(
0
),
thd
(
0
),
a_cache
(
0
),
b_cache
(
0
)
{};
Arg_comparator
(
Item
**
a1
,
Item
**
a2
)
:
a
(
a1
),
b
(
a2
),
m_compare_type
(
STRING_RESULT
),
set_null
(
TRUE
),
comparators
(
0
),
thd
(
0
),
a_cache
(
0
),
b_cache
(
0
)
{};
m_compare_type
(
STRING_RESULT
),
m_compare_collation
(
&
my_charset_bin
),
set_null
(
TRUE
),
comparators
(
0
),
thd
(
0
),
a_cache
(
0
),
b_cache
(
0
)
{};
public:
inline
int
set_cmp_func
(
Item_func_or_sum
*
owner_arg
,
...
...
@@ -115,6 +118,7 @@ class Arg_comparator: public Sql_alloc
((
Item_func
*
)
owner
)
->
functype
()
==
Item_func
::
EQUAL_FUNC
);
}
Item_result
compare_type
()
const
{
return
m_compare_type
;
}
CHARSET_INFO
*
compare_collation
()
const
{
return
m_compare_collation
;
}
Arg_comparator
*
subcomparators
()
const
{
return
comparators
;
}
void
cleanup
()
{
...
...
@@ -401,8 +405,7 @@ class Item_bool_rowready_func2 :public Item_bool_func2
{
return
cmp
.
set_cmp_func
(
this
,
tmp_arg
,
tmp_arg
+
1
,
true
);
}
CHARSET_INFO
*
compare_collation
()
const
{
return
cmp
.
cmp_collation
.
collation
;
}
CHARSET_INFO
*
compare_collation
()
const
{
return
cmp
.
compare_collation
();
}
Item_result
compare_type
()
const
{
return
cmp
.
compare_type
();
}
Arg_comparator
*
get_comparator
()
{
return
&
cmp
;
}
void
cleanup
()
...
...
@@ -931,7 +934,7 @@ class Item_func_nullif :public Item_func_hybrid_field_type
bool
is_null
();
Item
*
propagate_equal_fields
(
THD
*
thd
,
const
Context
&
ctx
,
COND_EQUAL
*
cond
)
{
Context
cmpctx
(
ANY_SUBST
,
cmp
.
compare_type
(),
cmp
.
c
mp_collation
.
collation
);
Context
cmpctx
(
ANY_SUBST
,
cmp
.
compare_type
(),
cmp
.
c
ompare_collation
()
);
args
[
0
]
->
propagate_equal_fields_and_change_item_tree
(
thd
,
cmpctx
,
cond
,
&
args
[
0
]);
args
[
1
]
->
propagate_equal_fields_and_change_item_tree
(
thd
,
cmpctx
,
...
...
sql/sql_select.cc
View file @
c8db0df2
...
...
@@ -12766,7 +12766,7 @@ static bool check_row_equality(THD *thd, const Arg_comparator *comparators,
is_converted
=
check_simple_equality
(
thd
,
Item
::
Context
(
Item
::
ANY_SUBST
,
tmp
->
compare_type
(),
tmp
->
cmp_collation
.
collation
),
tmp
->
compare_collation
()
),
left_item
,
right_item
,
cond_equal
);
}
...
...
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