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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b54cb499
Commit
b54cb499
authored
Apr 11, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-0
parents
c97aa492
981bbaef
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
10 deletions
+49
-10
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+25
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+22
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+2
-10
No files found.
mysql-test/r/func_time.result
View file @
b54cb499
...
...
@@ -847,3 +847,28 @@ timestampdiff(year,'2004-02-28','2005-02-28')
select timestampdiff(year,'2004-02-29','2005-02-28');
timestampdiff(year,'2004-02-29','2005-02-28')
0
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, day date);
CREATE TABLE t2 (id int NOT NULL PRIMARY KEY, day date);
INSERT INTO t1 VALUES
(1, '2005-06-01'), (2, '2005-02-01'), (3, '2005-07-01');
INSERT INTO t2 VALUES
(1, '2005-08-01'), (2, '2005-06-15'), (3, '2005-07-15');
SELECT * FROM t1, t2
WHERE t1.day BETWEEN
'2005.09.01' - INTERVAL 6 MONTH AND t2.day;
id day id day
1 2005-06-01 1 2005-08-01
3 2005-07-01 1 2005-08-01
1 2005-06-01 2 2005-06-15
1 2005-06-01 3 2005-07-15
3 2005-07-01 3 2005-07-15
SELECT * FROM t1, t2
WHERE CAST(t1.day AS DATE) BETWEEN
'2005.09.01' - INTERVAL 6 MONTH AND t2.day;
id day id day
1 2005-06-01 1 2005-08-01
3 2005-07-01 1 2005-08-01
1 2005-06-01 2 2005-06-15
1 2005-06-01 3 2005-07-15
3 2005-07-01 3 2005-07-15
DROP TABLE t1,t2;
mysql-test/t/func_time.test
View file @
b54cb499
...
...
@@ -446,4 +446,26 @@ select timestampdiff(year,'1999-09-11','2001-9-11');
select
timestampdiff
(
year
,
'2004-02-28'
,
'2005-02-28'
);
select
timestampdiff
(
year
,
'2004-02-29'
,
'2005-02-28'
);
#
# Bug #18618: BETWEEN for dates with the second argument being a constant
# expression and the first and the third arguments being fields
#
CREATE
TABLE
t1
(
id
int
NOT
NULL
PRIMARY
KEY
,
day
date
);
CREATE
TABLE
t2
(
id
int
NOT
NULL
PRIMARY
KEY
,
day
date
);
INSERT
INTO
t1
VALUES
(
1
,
'2005-06-01'
),
(
2
,
'2005-02-01'
),
(
3
,
'2005-07-01'
);
INSERT
INTO
t2
VALUES
(
1
,
'2005-08-01'
),
(
2
,
'2005-06-15'
),
(
3
,
'2005-07-15'
);
SELECT
*
FROM
t1
,
t2
WHERE
t1
.
day
BETWEEN
'2005.09.01'
-
INTERVAL
6
MONTH
AND
t2
.
day
;
SELECT
*
FROM
t1
,
t2
WHERE
CAST
(
t1
.
day
AS
DATE
)
BETWEEN
'2005.09.01'
-
INTERVAL
6
MONTH
AND
t2
.
day
;
DROP
TABLE
t1
,
t2
;
# End of 5.0 tests
sql/item_cmpfunc.cc
View file @
b54cb499
...
...
@@ -52,7 +52,6 @@ static void agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems)
{
uint
i
;
Field
*
field
=
NULL
;
bool
all_constant
=
TRUE
;
/* If the first argument is a FIELD_ITEM, pull out the field. */
if
(
items
[
0
]
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
)
...
...
@@ -65,16 +64,9 @@ static void agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems)
for
(
i
=
1
;
i
<
nitems
;
i
++
)
{
type
[
0
]
=
item_cmp_type
(
type
[
0
],
items
[
i
]
->
result_type
());
if
(
field
&&
!
convert_constant_item
(
thd
,
field
,
&
items
[
i
]))
all_constant
=
FALSE
;
}
/*
If we had a field that can be compared as a longlong, and all constant
items, then the aggregate result will be an INT_RESULT.
*/
if
(
field
&&
all_constant
)
if
(
field
&&
convert_constant_item
(
thd
,
field
,
&
items
[
i
]))
type
[
0
]
=
INT_RESULT
;
}
}
...
...
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