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
2942ab3f
Commit
2942ab3f
authored
Nov 07, 2006
by
holyfoot/hf@mysql.com/deer.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk@192.168.21.1:mysql-5.0-opt
into mysql.com:/home/hf/work/8663/my50-8663
parents
d3eb8070
7ddb8b68
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
2 deletions
+32
-2
include/my_time.h
include/my_time.h
+2
-0
sql-common/my_time.c
sql-common/my_time.c
+2
-2
sql/field.cc
sql/field.cc
+28
-0
No files found.
include/my_time.h
View file @
2942ab3f
...
@@ -49,6 +49,8 @@ typedef long my_time_t;
...
@@ -49,6 +49,8 @@ typedef long my_time_t;
#define TIME_NO_ZERO_DATE (TIME_NO_ZERO_IN_DATE*2)
#define TIME_NO_ZERO_DATE (TIME_NO_ZERO_IN_DATE*2)
#define TIME_INVALID_DATES (TIME_NO_ZERO_DATE*2)
#define TIME_INVALID_DATES (TIME_NO_ZERO_DATE*2)
my_bool
check_date
(
const
MYSQL_TIME
*
ltime
,
my_bool
not_zero_date
,
ulong
flags
,
int
*
was_cut
);
enum
enum_mysql_timestamp_type
enum
enum_mysql_timestamp_type
str_to_datetime
(
const
char
*
str
,
uint
length
,
MYSQL_TIME
*
l_time
,
str_to_datetime
(
const
char
*
str
,
uint
length
,
MYSQL_TIME
*
l_time
,
uint
flags
,
int
*
was_cut
);
uint
flags
,
int
*
was_cut
);
...
...
sql-common/my_time.c
View file @
2942ab3f
...
@@ -76,8 +76,8 @@ uint calc_days_in_year(uint year)
...
@@ -76,8 +76,8 @@ uint calc_days_in_year(uint year)
1 error
1 error
*/
*/
static
my_bool
check_date
(
const
MYSQL_TIME
*
ltime
,
my_bool
not_zero_date
,
my_bool
check_date
(
const
MYSQL_TIME
*
ltime
,
my_bool
not_zero_date
,
ulong
flags
,
int
*
was_cut
)
ulong
flags
,
int
*
was_cut
)
{
{
if
(
not_zero_date
)
if
(
not_zero_date
)
{
{
...
...
sql/field.cc
View file @
2942ab3f
...
@@ -5407,7 +5407,21 @@ int Field_newdate::store_time(TIME *ltime,timestamp_type type)
...
@@ -5407,7 +5407,21 @@ int Field_newdate::store_time(TIME *ltime,timestamp_type type)
long
tmp
;
long
tmp
;
int
error
=
0
;
int
error
=
0
;
if
(
type
==
MYSQL_TIMESTAMP_DATE
||
type
==
MYSQL_TIMESTAMP_DATETIME
)
if
(
type
==
MYSQL_TIMESTAMP_DATE
||
type
==
MYSQL_TIMESTAMP_DATETIME
)
{
tmp
=
ltime
->
year
*
16
*
32
+
ltime
->
month
*
32
+
ltime
->
day
;
tmp
=
ltime
->
year
*
16
*
32
+
ltime
->
month
*
32
+
ltime
->
day
;
if
((
my_bool
)
check_date
(
ltime
,
tmp
,
(
TIME_FUZZY_DATE
|
(
current_thd
->
variables
.
sql_mode
&
(
MODE_NO_ZERO_IN_DATE
|
MODE_NO_ZERO_DATE
|
MODE_INVALID_DATES
))),
&
error
))
{
char
buff
[
12
];
String
str
(
buff
,
sizeof
(
buff
),
&
my_charset_latin1
);
make_date
((
DATE_TIME_FORMAT
*
)
0
,
ltime
,
&
str
);
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
str
.
ptr
(),
str
.
length
(),
MYSQL_TIMESTAMP_DATE
,
1
);
}
}
else
else
{
{
tmp
=
0
;
tmp
=
0
;
...
@@ -5616,8 +5630,22 @@ int Field_datetime::store_time(TIME *ltime,timestamp_type type)
...
@@ -5616,8 +5630,22 @@ int Field_datetime::store_time(TIME *ltime,timestamp_type type)
structure always fit into DATETIME range.
structure always fit into DATETIME range.
*/
*/
if
(
type
==
MYSQL_TIMESTAMP_DATE
||
type
==
MYSQL_TIMESTAMP_DATETIME
)
if
(
type
==
MYSQL_TIMESTAMP_DATE
||
type
==
MYSQL_TIMESTAMP_DATETIME
)
{
tmp
=
((
ltime
->
year
*
10000L
+
ltime
->
month
*
100
+
ltime
->
day
)
*
LL
(
1000000
)
+
tmp
=
((
ltime
->
year
*
10000L
+
ltime
->
month
*
100
+
ltime
->
day
)
*
LL
(
1000000
)
+
(
ltime
->
hour
*
10000L
+
ltime
->
minute
*
100
+
ltime
->
second
));
(
ltime
->
hour
*
10000L
+
ltime
->
minute
*
100
+
ltime
->
second
));
if
((
my_bool
)
check_date
(
ltime
,
tmp
,
(
TIME_FUZZY_DATE
|
(
current_thd
->
variables
.
sql_mode
&
(
MODE_NO_ZERO_IN_DATE
|
MODE_NO_ZERO_DATE
|
MODE_INVALID_DATES
))),
&
error
))
{
char
buff
[
12
];
String
str
(
buff
,
sizeof
(
buff
),
&
my_charset_latin1
);
make_datetime
((
DATE_TIME_FORMAT
*
)
0
,
ltime
,
&
str
);
set_datetime_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
str
.
ptr
(),
str
.
length
(),
MYSQL_TIMESTAMP_DATETIME
,
1
);
}
}
else
else
{
{
tmp
=
0
;
tmp
=
0
;
...
...
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