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
fdb51f67
Commit
fdb51f67
authored
Aug 17, 2004
by
sergefp@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug#4488: sign-aware equality check
parent
4ddeee9d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
0 deletions
+30
-0
mysql-test/r/range.result
mysql-test/r/range.result
+9
-0
mysql-test/t/range.test
mysql-test/t/range.test
+4
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+16
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+1
-0
No files found.
mysql-test/r/range.result
View file @
fdb51f67
...
...
@@ -500,6 +500,9 @@ count(*)
select count(*) from t1 where x > -16;
count(*)
2
select count(*) from t1 where x = 18446744073709551601;
count(*)
1
create table t2 (x bigint not null);
insert into t2(x) values (0xfffffffffffffff0);
insert into t2(x) values (0xfffffffffffffff1);
...
...
@@ -525,6 +528,9 @@ count(*)
select count(*) from t2 where x > -16;
count(*)
1
select count(*) from t2 where x = 18446744073709551601;
count(*)
0
drop table t1;
create table t1 (x bigint unsigned not null primary key) engine=innodb;
insert into t1(x) values (0xfffffffffffffff0);
...
...
@@ -551,4 +557,7 @@ count(*)
select count(*) from t1 where x > -16;
count(*)
1
select count(*) from t1 where x = 18446744073709551601;
count(*)
1
drop table t1;
mysql-test/t/range.test
View file @
fdb51f67
...
...
@@ -396,6 +396,8 @@ select count(*) from t1 where x<0;
select
count
(
*
)
from
t1
where
x
<
-
16
;
select
count
(
*
)
from
t1
where
x
=
-
16
;
select
count
(
*
)
from
t1
where
x
>
-
16
;
select
count
(
*
)
from
t1
where
x
=
18446744073709551601
;
create
table
t2
(
x
bigint
not
null
);
insert
into
t2
(
x
)
values
(
0xfffffffffffffff0
);
...
...
@@ -407,6 +409,7 @@ select count(*) from t2 where x<0;
select
count
(
*
)
from
t2
where
x
<
-
16
;
select
count
(
*
)
from
t2
where
x
=
-
16
;
select
count
(
*
)
from
t2
where
x
>
-
16
;
select
count
(
*
)
from
t2
where
x
=
18446744073709551601
;
drop
table
t1
;
create
table
t1
(
x
bigint
unsigned
not
null
primary
key
)
engine
=
innodb
;
...
...
@@ -419,6 +422,7 @@ select count(*) from t1 where x<0;
select
count
(
*
)
from
t1
where
x
<
-
16
;
select
count
(
*
)
from
t1
where
x
=
-
16
;
select
count
(
*
)
from
t1
where
x
>
-
16
;
select
count
(
*
)
from
t1
where
x
=
18446744073709551601
;
drop
table
t1
;
sql/item_cmpfunc.cc
View file @
fdb51f67
...
...
@@ -325,6 +325,11 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
else
if
((
*
b
)
->
unsigned_flag
)
func
=
&
Arg_comparator
::
compare_int_signed_unsigned
;
}
else
if
(
func
==
&
Arg_comparator
::
compare_e_int
)
{
if
((
*
a
)
->
unsigned_flag
^
(
*
b
)
->
unsigned_flag
)
func
=
&
Arg_comparator
::
compare_e_int_diff_signedness
;
}
}
return
0
;
}
...
...
@@ -530,6 +535,17 @@ int Arg_comparator::compare_e_int()
return
test
(
val1
==
val2
);
}
/*
Compare unsigned *a with signed *b or signed *a with unsigned *b.
*/
int
Arg_comparator
::
compare_e_int_diff_signedness
()
{
longlong
val1
=
(
*
a
)
->
val_int
();
longlong
val2
=
(
*
b
)
->
val_int
();
if
((
*
a
)
->
null_value
||
(
*
b
)
->
null_value
)
return
test
((
*
a
)
->
null_value
&&
(
*
b
)
->
null_value
);
return
(
val1
>=
0
)
&&
test
(
val1
==
val2
);
}
int
Arg_comparator
::
compare_row
()
{
...
...
sql/item_cmpfunc.h
View file @
fdb51f67
...
...
@@ -74,6 +74,7 @@ class Arg_comparator: public Sql_alloc
int
compare_e_binary_string
();
// compare args[0] & args[1]
int
compare_e_real
();
// compare args[0] & args[1]
int
compare_e_int
();
// compare args[0] & args[1]
int
compare_e_int_diff_signedness
();
int
compare_e_row
();
// compare args[0] & args[1]
static
arg_cmp_func
comparator_matrix
[
4
][
2
];
...
...
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