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
db39a766
Commit
db39a766
authored
Jan 31, 2009
by
Tatiana A. Nurnberg
Browse files
Options
Browse Files
Download
Plain Diff
auto-merge
parents
690dc721
d36d50f4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
3 deletions
+40
-3
mysql-test/r/type_timestamp.result
mysql-test/r/type_timestamp.result
+19
-0
mysql-test/t/type_timestamp.test
mysql-test/t/type_timestamp.test
+19
-1
sql/item.cc
sql/item.cc
+2
-2
No files found.
mysql-test/r/type_timestamp.result
View file @
db39a766
...
...
@@ -492,6 +492,7 @@ a b c
5 NULL 2001-09-09 04:46:59
6 NULL 2006-06-06 06:06:06
drop table t1;
End of 4.1 tests
set time_zone= @@global.time_zone;
CREATE TABLE t1 (
`id` int(11) NOT NULL auto_increment,
...
...
@@ -508,3 +509,21 @@ select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COL
is_nullable
NO
drop table t1;
CREATE TABLE t1 ( f1 INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
f2 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
f3 TIMESTAMP);
INSERT INTO t1 (f2,f3) VALUES (NOW(), "0000-00-00 00:00:00");
INSERT INTO t1 (f2,f3) VALUES (NOW(), NULL);
INSERT INTO t1 (f2,f3) VALUES (NOW(), ASCII(NULL));
INSERT INTO t1 (f2,f3) VALUES (NOW(), FROM_UNIXTIME('9999999999'));
INSERT INTO t1 (f2,f3) VALUES (NOW(), TIME(NULL));
UPDATE t1 SET f2=NOW(), f3=FROM_UNIXTIME('9999999999') WHERE f1=1;
SELECT f1,f2-f3 FROM t1;
f1 f2-f3
1 0
2 0
3 0
4 0
5 0
DROP TABLE t1;
End of 5.0 tests
mysql-test/t/type_timestamp.test
View file @
db39a766
...
...
@@ -324,7 +324,7 @@ insert into t1 (a, c) values (4, '2004-04-04 00:00:00'),
select
*
from
t1
;
drop
table
t1
;
#
End of 4.1 tests
--
echo
End
of
4.1
tests
# Restore timezone to default
set
time_zone
=
@@
global
.
time_zone
;
...
...
@@ -339,3 +339,21 @@ PRIMARY KEY (`id`)
show
fields
from
t1
;
select
is_nullable
from
INFORMATION_SCHEMA
.
COLUMNS
where
TABLE_NAME
=
't1'
and
COLUMN_NAME
=
'posted_on'
;
drop
table
t1
;
#
# Bug#41370: TIMESTAMP field does not accepts NULL from FROM_UNIXTIME()
#
CREATE
TABLE
t1
(
f1
INT
(
11
)
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
f2
TIMESTAMP
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
f3
TIMESTAMP
);
INSERT
INTO
t1
(
f2
,
f3
)
VALUES
(
NOW
(),
"0000-00-00 00:00:00"
);
INSERT
INTO
t1
(
f2
,
f3
)
VALUES
(
NOW
(),
NULL
);
INSERT
INTO
t1
(
f2
,
f3
)
VALUES
(
NOW
(),
ASCII
(
NULL
));
INSERT
INTO
t1
(
f2
,
f3
)
VALUES
(
NOW
(),
FROM_UNIXTIME
(
'9999999999'
));
INSERT
INTO
t1
(
f2
,
f3
)
VALUES
(
NOW
(),
TIME
(
NULL
));
UPDATE
t1
SET
f2
=
NOW
(),
f3
=
FROM_UNIXTIME
(
'9999999999'
)
WHERE
f1
=
1
;
SELECT
f1
,
f2
-
f3
FROM
t1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
sql/item.cc
View file @
db39a766
...
...
@@ -327,7 +327,7 @@ int Item::save_time_in_field(Field *field)
{
MYSQL_TIME
ltime
;
if
(
get_time
(
&
ltime
))
return
set_field_to_null
(
field
);
return
set_field_to_null
_with_conversions
(
field
,
0
);
field
->
set_notnull
();
return
field
->
store_time
(
&
ltime
,
MYSQL_TIMESTAMP_TIME
);
}
...
...
@@ -337,7 +337,7 @@ int Item::save_date_in_field(Field *field)
{
MYSQL_TIME
ltime
;
if
(
get_date
(
&
ltime
,
TIME_FUZZY_DATE
))
return
set_field_to_null
(
field
);
return
set_field_to_null
_with_conversions
(
field
,
0
);
field
->
set_notnull
();
return
field
->
store_time
(
&
ltime
,
MYSQL_TIMESTAMP_DATETIME
);
}
...
...
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