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
8be67876
Commit
8be67876
authored
Jan 14, 2005
by
dlenev@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-dtbug
parents
ebefcc61
77182c44
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
30 deletions
+39
-30
mysql-test/r/func_sapdb.result
mysql-test/r/func_sapdb.result
+5
-2
mysql-test/r/type_timestamp.result
mysql-test/r/type_timestamp.result
+10
-0
mysql-test/t/func_sapdb.test
mysql-test/t/func_sapdb.test
+1
-0
mysql-test/t/type_timestamp.test
mysql-test/t/type_timestamp.test
+12
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+10
-20
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-8
No files found.
mysql-test/r/func_sapdb.result
View file @
8be67876
...
@@ -97,13 +97,16 @@ timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002")
...
@@ -97,13 +97,16 @@ timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002")
46:58:57.999999
46:58:57.999999
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002")
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002")
-2
3:59:59.999999
-2
4:00:00.000001
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
timediff("1997-12-31 23:59:59.000001","23:59:59.000001")
timediff("1997-12-31 23:59:59.000001","23:59:59.000001")
NULL
NULL
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001")
timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001")
-00:00:00.000001
-00:00:00.000001
select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50");
timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50")
-00:00:00.000001
select maketime(10,11,12);
select maketime(10,11,12);
maketime(10,11,12)
maketime(10,11,12)
10:11:12
10:11:12
...
@@ -175,7 +178,7 @@ f8 date YES NULL
...
@@ -175,7 +178,7 @@ f8 date YES NULL
f9 time YES NULL
f9 time YES NULL
select * from t1;
select * from t1;
f1 f2 f3 f4 f5 f6 f7 f8 f9
f1 f2 f3 f4 f5 f6 f7 f8 f9
1997-01-01 1998-01-02 01:01:00 49:01:01 46:58:57 -2
3:59:59
10:11:12 2001-12-01 01:01:01 1997-12-31 23:59:59
1997-01-01 1998-01-02 01:01:00 49:01:01 46:58:57 -2
4:00:00
10:11:12 2001-12-01 01:01:01 1997-12-31 23:59:59
create table test(t1 datetime, t2 time, t3 time, t4 datetime);
create table test(t1 datetime, t2 time, t3 time, t4 datetime);
insert into test values
insert into test values
('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'),
('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'),
...
...
mysql-test/r/type_timestamp.result
View file @
8be67876
...
@@ -422,3 +422,13 @@ max(t)
...
@@ -422,3 +422,13 @@ max(t)
2004-01-01 01:00:00
2004-01-01 01:00:00
2004-02-01 00:00:00
2004-02-01 00:00:00
drop table t1;
drop table t1;
set sql_mode='maxdb';
create table t1 (a timestamp, b timestamp(19));
show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" datetime default NULL,
"b" datetime default NULL
)
set sql_mode='';
drop table t1;
mysql-test/t/func_sapdb.test
View file @
8be67876
...
@@ -54,6 +54,7 @@ select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
...
@@ -54,6 +54,7 @@ select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
select
timediff
(
"1997-12-30 23:59:59.000001"
,
"1997-12-31 23:59:59.000002"
);
select
timediff
(
"1997-12-30 23:59:59.000001"
,
"1997-12-31 23:59:59.000002"
);
select
timediff
(
"1997-12-31 23:59:59.000001"
,
"23:59:59.000001"
);
select
timediff
(
"1997-12-31 23:59:59.000001"
,
"23:59:59.000001"
);
select
timediff
(
"2000:01:01 00:00:00"
,
"2000:01:01 00:00:00.000001"
);
select
timediff
(
"2000:01:01 00:00:00"
,
"2000:01:01 00:00:00.000001"
);
select
timediff
(
"2005-01-11 15:48:49.999999"
,
"2005-01-11 15:48:50"
);
--
enable_ps_protocol
--
enable_ps_protocol
select
maketime
(
10
,
11
,
12
);
select
maketime
(
10
,
11
,
12
);
...
...
mysql-test/t/type_timestamp.test
View file @
8be67876
...
@@ -286,3 +286,15 @@ insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00')
...
@@ -286,3 +286,15 @@ insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00')
(
'b'
,
'2004-02-01 00:00:00'
);
(
'b'
,
'2004-02-01 00:00:00'
);
select
max
(
t
)
from
t1
group
by
a
;
select
max
(
t
)
from
t1
group
by
a
;
drop
table
t1
;
drop
table
t1
;
#
# Test for bug #7418 "TIMESTAMP not always converted to DATETIME in MAXDB
# mode". TIMESTAMP columns should be converted DATETIME columns in MAXDB
# mode regardless of whether a display width is given.
#
set
sql_mode
=
'maxdb'
;
create
table
t1
(
a
timestamp
,
b
timestamp
(
19
));
show
create
table
t1
;
# restore default mode
set
sql_mode
=
''
;
drop
table
t1
;
sql/item_timefunc.cc
View file @
8be67876
...
@@ -2432,8 +2432,7 @@ void Item_func_add_time::print(String *str)
...
@@ -2432,8 +2432,7 @@ void Item_func_add_time::print(String *str)
String
*
Item_func_timediff
::
val_str
(
String
*
str
)
String
*
Item_func_timediff
::
val_str
(
String
*
str
)
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
longlong
seconds
;
longlong
microseconds
;
long
microseconds
;
long
days
;
long
days
;
int
l_sign
=
1
;
int
l_sign
=
1
;
TIME
l_time1
,
l_time2
,
l_time3
;
TIME
l_time1
,
l_time2
,
l_time3
;
...
@@ -2457,32 +2456,23 @@ String *Item_func_timediff::val_str(String *str)
...
@@ -2457,32 +2456,23 @@ String *Item_func_timediff::val_str(String *str)
(
uint
)
l_time2
.
month
,
(
uint
)
l_time2
.
month
,
(
uint
)
l_time2
.
day
));
(
uint
)
l_time2
.
day
));
microseconds
=
l_time1
.
second_part
-
l_sign
*
l_time2
.
second_part
;
microseconds
=
((
longlong
)
days
*
86400L
+
seconds
=
((
longlong
)
days
*
86400L
+
l_time1
.
hour
*
3600L
+
l_time1
.
hour
*
3600L
+
l_time1
.
minute
*
60L
+
l_time1
.
second
-
l_time1
.
minute
*
60L
+
l_time1
.
second
+
microseconds
/
1000000L
-
(
longlong
)
l_sign
*
(
l_time2
.
hour
*
3600L
+
l_time2
.
minute
*
60L
+
(
longlong
)
l_sign
*
(
l_time2
.
hour
*
3600L
+
l_time2
.
minute
*
60L
+
l_time2
.
second
))
*
1000000
+
l_time2
.
second
))
;
l_time1
.
second_part
-
l_sign
*
l_time2
.
second_part
;
l_time3
.
neg
=
0
;
l_time3
.
neg
=
0
;
if
(
seconds
<
0
)
if
(
microseconds
<
0
)
{
seconds
=
-
seconds
;
l_time3
.
neg
=
1
;
}
else
if
(
seconds
==
0
&&
microseconds
<
0
)
{
{
microseconds
=
-
microseconds
;
microseconds
=
-
microseconds
;
l_time3
.
neg
=
1
;
l_time3
.
neg
=
1
;
}
}
if
(
microseconds
<
0
)
if
((
l_time2
.
neg
==
l_time1
.
neg
)
&&
l_time1
.
neg
&&
microseconds
)
{
microseconds
+=
1000000L
;
seconds
--
;
}
if
((
l_time2
.
neg
==
l_time1
.
neg
)
&&
l_time1
.
neg
)
l_time3
.
neg
=
l_time3
.
neg
?
0
:
1
;
l_time3
.
neg
=
l_time3
.
neg
?
0
:
1
;
calc_time_from_sec
(
&
l_time3
,
(
long
)
seconds
,
microseconds
);
calc_time_from_sec
(
&
l_time3
,
(
long
)(
microseconds
/
1000000
),
(
long
)(
microseconds
%
1000000
));
if
(
!
make_datetime
(
l_time1
.
second_part
||
l_time2
.
second_part
?
if
(
!
make_datetime
(
l_time1
.
second_part
||
l_time2
.
second_part
?
TIME_MICROSECOND
:
TIME_ONLY
,
TIME_MICROSECOND
:
TIME_ONLY
,
...
...
sql/sql_yacc.yy
View file @
8be67876
...
@@ -1415,7 +1415,7 @@ type:
...
@@ -1415,7 +1415,7 @@ type:
| YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; }
| YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; }
| DATE_SYM { $$=FIELD_TYPE_DATE; }
| DATE_SYM { $$=FIELD_TYPE_DATE; }
| TIME_SYM { $$=FIELD_TYPE_TIME; }
| TIME_SYM { $$=FIELD_TYPE_TIME; }
| TIMESTAMP
| TIMESTAMP
opt_len
{
{
if (YYTHD->variables.sql_mode & MODE_MAXDB)
if (YYTHD->variables.sql_mode & MODE_MAXDB)
$$=FIELD_TYPE_DATETIME;
$$=FIELD_TYPE_DATETIME;
...
@@ -1428,13 +1428,6 @@ type:
...
@@ -1428,13 +1428,6 @@ type:
$$=FIELD_TYPE_TIMESTAMP;
$$=FIELD_TYPE_TIMESTAMP;
}
}
}
}
| TIMESTAMP '(' NUM ')'
{
LEX *lex= Lex;
lex->length= $3.str;
lex->type|= NOT_NULL_FLAG;
$$= FIELD_TYPE_TIMESTAMP;
}
| DATETIME { $$=FIELD_TYPE_DATETIME; }
| DATETIME { $$=FIELD_TYPE_DATETIME; }
| TINYBLOB { Lex->charset=&my_charset_bin;
| TINYBLOB { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_TINY_BLOB; }
$$=FIELD_TYPE_TINY_BLOB; }
...
...
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