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
82942ebf
Commit
82942ebf
authored
Jul 10, 2003
by
ram@mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for the bug #803.
Now INTERVAL(NULL, N1, N2, ...) returns NULL.
parent
c4c8ce93
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
10 deletions
+16
-10
mysql-test/r/func_set.result
mysql-test/r/func_set.result
+3
-0
mysql-test/t/func_set.test
mysql-test/t/func_set.test
+1
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+12
-10
No files found.
mysql-test/r/func_set.result
View file @
82942ebf
...
...
@@ -25,3 +25,6 @@ find_in_set("","a,b,c") find_in_set("","a,b,c,") find_in_set("",",a,b,c")
select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc");
find_in_set("abc","abc") find_in_set("ab","abc") find_in_set("abcd","abc")
1 0 0
select interval(null, 1, 10, 100);
interval(null, 1, 10, 100)
NULL
mysql-test/t/func_set.test
View file @
82942ebf
...
...
@@ -15,3 +15,4 @@ select export_set(9,"Y","N","-",5),export_set(9,"Y","N"),export_set(9,"Y","N",""
select
elt
(
2
,
1
),
field
(
NULL
,
"a"
,
"b"
,
"c"
);
select
find_in_set
(
""
,
"a,b,c"
),
find_in_set
(
""
,
"a,b,c,"
),
find_in_set
(
""
,
",a,b,c"
);
select
find_in_set
(
"abc"
,
"abc"
),
find_in_set
(
"ab"
,
"abc"
),
find_in_set
(
"abcd"
,
"abc"
);
select
interval
(
null
,
1
,
10
,
100
);
sql/item_cmpfunc.cc
View file @
82942ebf
...
...
@@ -311,7 +311,7 @@ void Item_func_interval::split_sum_func(List<Item> &fields)
}
/*
return
-1
if null value,
return
NULL
if null value,
0 if lower than lowest
1 - arg_count if between args[n] and args[n+1]
arg_count+1 if higher than biggest argument
...
...
@@ -319,26 +319,28 @@ void Item_func_interval::split_sum_func(List<Item> &fields)
longlong
Item_func_interval
::
val_int
()
{
double
value
=
item
->
val
();
double
value
=
item
->
val
();
if
(
item
->
null_value
)
return
-
1
;
// -1 if null /* purecov: inspected */
{
null_value
=
1
;
return
-
1
;
}
if
(
intervals
)
{
// Use binary search to find interval
uint
start
,
end
;
start
=
0
;
end
=
arg_count
-
1
;
uint
start
=
0
,
end
=
arg_count
-
1
;
while
(
start
!=
end
)
{
uint
mid
=
(
start
+
end
+
1
)
/
2
;
uint
mid
=
(
start
+
end
+
1
)
/
2
;
if
(
intervals
[
mid
]
<=
value
)
start
=
mid
;
start
=
mid
;
else
end
=
mid
-
1
;
end
=
mid
-
1
;
}
return
(
value
<
intervals
[
start
])
?
0
:
start
+
1
;
return
(
value
<
intervals
[
start
])
?
0
:
start
+
1
;
}
if
(
args
[
0
]
->
val
()
>
value
)
return
0
;
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
{
if
(
args
[
i
]
->
val
()
>
value
)
return
i
;
...
...
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