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
14b55bcc
Commit
14b55bcc
authored
May 15, 2002
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in datetime range optimization
parent
4a634059
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
4 deletions
+53
-4
Docs/manual.texi
Docs/manual.texi
+5
-2
mysql-test/r/type_datetime.result
mysql-test/r/type_datetime.result
+7
-0
mysql-test/t/type_datetime.test
mysql-test/t/type_datetime.test
+20
-0
sql/item.h
sql/item.h
+19
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+2
-2
No files found.
Docs/manual.texi
View file @
14b55bcc
...
...
@@ -46771,8 +46771,6 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@item
Fixed bug in DROP DATABASE with symlink
@item
Multi-table @code{DELETE}.
@item
Don't support old client protocols prior to MySQL 3.21 any more.
...
...
@@ -46918,6 +46916,11 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.51
@itemize @bullet
@item
Fixed bug in @code{DROP DATABASE} with symlinked directory.
@item
Fixed optimization problem with @code{DATETIME} and value outside
@code{DATETIME} range.
@item
Removed BDB documentation.
@item
Fixed mit-pthreads to compile with glibc 2.2 (needed for @code{make dist}).
mysql-test/r/type_datetime.result
View file @
14b55bcc
...
...
@@ -33,3 +33,10 @@ date_format(a,"%Y-%m-%d")=b right(a,6)=c+0 a=d+0
1 1 1
a
0000-00-00 00:00:00
date numfacture expedition
0000-00-00 00:00:00 0 0001-00-00 00:00:00
date numfacture expedition
0000-00-00 00:00:00 0 0001-00-00 00:00:00
0000-00-00 00:00:00 1212 0001-00-00 00:00:00
table type possible_keys key key_len ref rows Extra
t1 ref expedition expedition 8 const 1 where used
mysql-test/t/type_datetime.test
View file @
14b55bcc
...
...
@@ -30,3 +30,23 @@ CREATE TABLE t1 (a datetime not null);
insert
into
t1
values
(
0
);
select
*
from
t1
where
a
is
null
;
drop
table
t1
;
#
# Test of datetime optimization
#
CREATE
TABLE
`t1`
(
`date`
datetime
NOT
NULL
default
'0000-00-00 00:00:00'
,
`numfacture`
int
(
6
)
unsigned
NOT
NULL
default
'0'
,
`expedition`
datetime
NOT
NULL
default
'0000-00-00 00:00:00'
,
PRIMARY
KEY
(
`numfacture`
),
KEY
`date`
(
`date`
),
KEY
`expedition`
(
`expedition`
)
)
TYPE
=
MyISAM
;
INSERT
INTO
t1
(
expedition
)
VALUES
(
'0001-00-00 00:00:00'
);
SELECT
*
FROM
t1
WHERE
expedition
=
'0001-00-00 00:00:00'
;
INSERT
INTO
t1
(
numfacture
,
expedition
)
VALUES
(
'1212'
,
'0001-00-00 00:00:00'
);
SELECT
*
FROM
t1
WHERE
expedition
=
'0001-00-00 00:00:00'
;
EXPLAIN
SELECT
*
FROM
t1
WHERE
expedition
=
'0001-00-00 00:00:00'
;
drop
table
t1
;
sql/item.h
View file @
14b55bcc
...
...
@@ -342,6 +342,25 @@ class Item_ref :public Item_ident
};
/*
The following class is used to optimize comparing of date columns
We need to save the original item, to be able to set the field to the
original value in 'opt_range'.
*/
class
Item_int_with_ref
:
public
Item_int
{
Item
*
ref
;
public:
Item_int_with_ref
(
longlong
i
,
Item
*
ref_arg
)
:
Item_int
(
i
),
ref
(
ref_arg
)
{}
bool
save_in_field
(
Field
*
field
)
{
return
ref
->
save_in_field
(
field
);
}
};
#include "item_sum.h"
#include "item_func.h"
#include "item_cmpfunc.h"
...
...
sql/item_cmpfunc.cc
View file @
14b55bcc
...
...
@@ -45,8 +45,8 @@ static bool convert_constant_item(Field *field, Item **item)
(
*
item
)
->
save_in_field
(
field
);
if
(
!
((
*
item
)
->
null_value
))
{
Item
*
tmp
=
new
Item_int
(
field
->
val_int
()
);
if
(
(
tmp
)
)
Item
*
tmp
=
new
Item_int
_with_ref
(
field
->
val_int
(),
*
item
);
if
(
tmp
)
*
item
=
tmp
;
return
1
;
}
...
...
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