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
e0d3d405
Commit
e0d3d405
authored
Mar 12, 2018
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: add Item::convert_time_to_datetime() helper
will be used in following commits
parent
75ac5789
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
sql/item.cc
sql/item.cc
+3
-7
sql/item.h
sql/item.h
+9
-0
No files found.
sql/item.cc
View file @
e0d3d405
...
...
@@ -151,13 +151,9 @@ bool Item::get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate)
if
(
get_date
(
ltime
,
fuzzydate
|
time_flag
))
return
true
;
if
(
ltime
->
time_type
==
MYSQL_TIMESTAMP_TIME
&&
!
(
fuzzydate
&
TIME_TIME_ONLY
))
{
MYSQL_TIME
tmp
;
if
(
time_to_datetime_with_warn
(
thd
,
ltime
,
&
tmp
,
fuzzydate
))
return
null_value
=
true
;
*
ltime
=
tmp
;
}
!
(
fuzzydate
&
TIME_TIME_ONLY
)
&&
convert_time_to_datetime
(
thd
,
ltime
,
fuzzydate
))
return
true
;
return
false
;
}
...
...
sql/item.h
View file @
e0d3d405
...
...
@@ -27,6 +27,7 @@
#include "sql_const.h"
/* RAND_TABLE_BIT, MAX_FIELD_NAME */
#include "field.h"
/* Derivation */
#include "sql_type.h"
#include "sql_time.h"
C_MODE_START
#include <ma_dyncol.h>
...
...
@@ -1361,6 +1362,14 @@ class Item: public Value_source,
bool
get_time
(
MYSQL_TIME
*
ltime
)
{
return
get_date
(
ltime
,
TIME_TIME_ONLY
|
TIME_INVALID_DATES
);
}
// Get date with automatic TIME->DATETIME conversion
bool
convert_time_to_datetime
(
THD
*
thd
,
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
MYSQL_TIME
tmp
;
if
(
time_to_datetime_with_warn
(
thd
,
ltime
,
&
tmp
,
fuzzydate
))
return
null_value
=
true
;
*
ltime
=
tmp
;
return
false
;
}
bool
get_date_with_conversion
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
);
/*
Get time with automatic DATE/DATETIME to TIME conversion.
...
...
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