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
6b3b1de2
Commit
6b3b1de2
authored
Apr 11, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/home/ram/work/5.0.b14360
parents
925cf6bc
c9a01ea3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
0 deletions
+57
-0
mysql-test/r/innodb.result
mysql-test/r/innodb.result
+9
-0
mysql-test/t/innodb.test
mysql-test/t/innodb.test
+12
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+35
-0
sql/item_timefunc.h
sql/item_timefunc.h
+1
-0
No files found.
mysql-test/r/innodb.result
View file @
6b3b1de2
...
...
@@ -3232,3 +3232,12 @@ drop trigger t2t;
drop trigger t3t;
drop trigger t4t;
drop table t1, t2, t3, t4, t5;
create table t1(a date) engine=innodb;
create table t2(a date, key(a)) engine=innodb;
insert into t1 values('2005-10-01');
insert into t2 values('2005-10-01');
select * from t1, t2
where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
a a
2005-10-01 2005-10-01
drop table t1, t2;
mysql-test/t/innodb.test
View file @
6b3b1de2
...
...
@@ -2127,3 +2127,15 @@ drop table t1, t2, t3, t4, t5;
connection
default
;
disconnect
a
;
disconnect
b
;
#
# Bug #14360: problem with intervals
#
create
table
t1
(
a
date
)
engine
=
innodb
;
create
table
t2
(
a
date
,
key
(
a
))
engine
=
innodb
;
insert
into
t1
values
(
'2005-10-01'
);
insert
into
t2
values
(
'2005-10-01'
);
select
*
from
t1
,
t2
where
t2
.
a
between
t1
.
a
-
interval
2
day
and
t1
.
a
+
interval
2
day
;
drop
table
t1
,
t2
;
sql/item_timefunc.cc
View file @
6b3b1de2
...
...
@@ -2125,6 +2125,41 @@ longlong Item_date_add_interval::val_int()
((
date
*
100L
+
ltime
.
hour
)
*
100L
+
ltime
.
minute
)
*
100L
+
ltime
.
second
;
}
bool
Item_date_add_interval
::
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
{
INTERVAL
interval
,
other_interval
;
String
val
=
value
;
// Because of const
if
(
this
==
item
)
return
TRUE
;
if
((
item
->
type
()
!=
FUNC_ITEM
)
||
(
arg_count
!=
((
Item_func
*
)
item
)
->
arg_count
)
||
(
func_name
()
!=
((
Item_func
*
)
item
)
->
func_name
()))
return
FALSE
;
Item_date_add_interval
*
other
=
(
Item_date_add_interval
*
)
item
;
if
((
int_type
!=
other
->
int_type
)
||
(
!
args
[
0
]
->
eq
(
other
->
args
[
0
],
binary_cmp
))
||
(
get_interval_value
(
args
[
1
],
int_type
,
&
val
,
&
interval
)))
return
FALSE
;
val
=
other
->
value
;
if
((
get_interval_value
(
other
->
args
[
1
],
other
->
int_type
,
&
val
,
&
other_interval
))
||
((
date_sub_interval
^
interval
.
neg
)
^
(
other
->
date_sub_interval
^
other_interval
.
neg
)))
return
FALSE
;
// Assume comparing same types here due to earlier check
return
memcmp
(
&
interval
,
&
other_interval
,
sizeof
(
INTERVAL
))
==
0
;
}
static
const
char
*
interval_names
[]
=
{
"year"
,
"quarter"
,
"month"
,
"day"
,
"hour"
,
...
...
sql/item_timefunc.h
View file @
6b3b1de2
...
...
@@ -656,6 +656,7 @@ class Item_date_add_interval :public Item_date_func
double
val_real
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
(
double
)
val_int
();
}
longlong
val_int
();
bool
get_date
(
TIME
*
res
,
uint
fuzzy_date
);
bool
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
;
void
print
(
String
*
str
);
};
...
...
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