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
556a9202
Commit
556a9202
authored
Mar 30, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: moving timestamp_to_TIME() as a method to THD
parent
17bbab5f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
21 deletions
+23
-21
sql/field.cc
sql/field.cc
+2
-21
sql/sql_class.cc
sql/sql_class.cc
+19
-0
sql/sql_class.h
sql/sql_class.h
+2
-0
No files found.
sql/field.cc
View file @
556a9202
...
...
@@ -1819,30 +1819,11 @@ int Field::store(const char *to, size_t length, CHARSET_INFO *cs,
}
static
int
timestamp_to_TIME
(
THD
*
thd
,
MYSQL_TIME
*
ltime
,
my_time_t
ts
,
ulong
sec_part
,
ulonglong
fuzzydate
)
{
thd
->
time_zone_used
=
1
;
if
(
ts
==
0
&&
sec_part
==
0
)
{
if
(
fuzzydate
&
TIME_NO_ZERO_DATE
)
return
1
;
set_zero_time
(
ltime
,
MYSQL_TIMESTAMP_DATETIME
);
}
else
{
thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
ltime
,
ts
);
ltime
->
second_part
=
sec_part
;
}
return
0
;
}
int
Field
::
store_timestamp
(
my_time_t
ts
,
ulong
sec_part
)
{
MYSQL_TIME
ltime
;
THD
*
thd
=
get_thd
();
t
imestamp_to_TIME
(
thd
,
&
ltime
,
ts
,
sec_part
,
0
);
t
hd
->
timestamp_to_TIME
(
&
ltime
,
ts
,
sec_part
,
0
);
return
store_time_dec
(
&
ltime
,
decimals
());
}
...
...
@@ -5316,7 +5297,7 @@ bool Field_timestamp::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
ulong
sec_part
;
my_time_t
ts
=
get_timestamp
(
&
sec_part
);
return
timestamp_to_TIME
(
get_thd
(),
ltime
,
ts
,
sec_part
,
fuzzydate
);
return
get_thd
()
->
timestamp_to_TIME
(
ltime
,
ts
,
sec_part
,
fuzzydate
);
}
...
...
sql/sql_class.cc
View file @
556a9202
...
...
@@ -7788,3 +7788,22 @@ Query_arena_stmt::~Query_arena_stmt()
if
(
arena
)
thd
->
restore_active_arena
(
arena
,
&
backup
);
}
bool
THD
::
timestamp_to_TIME
(
MYSQL_TIME
*
ltime
,
my_time_t
ts
,
ulong
sec_part
,
ulonglong
fuzzydate
)
{
time_zone_used
=
1
;
if
(
ts
==
0
&&
sec_part
==
0
)
{
if
(
fuzzydate
&
TIME_NO_ZERO_DATE
)
return
1
;
set_zero_time
(
ltime
,
MYSQL_TIMESTAMP_DATETIME
);
}
else
{
variables
.
time_zone
->
gmt_sec_to_TIME
(
ltime
,
ts
);
ltime
->
second_part
=
sec_part
;
}
return
0
;
}
sql/sql_class.h
View file @
556a9202
...
...
@@ -3427,6 +3427,8 @@ class THD :public Statement,
return
!
MY_TEST
(
variables
.
sql_mode
&
MODE_NO_BACKSLASH_ESCAPES
);
}
const
Type_handler
*
type_handler_for_date
()
const
;
bool
timestamp_to_TIME
(
MYSQL_TIME
*
ltime
,
my_time_t
ts
,
ulong
sec_part
,
ulonglong
fuzzydate
);
inline
my_time_t
query_start
()
{
query_start_used
=
1
;
return
start_time
;
}
inline
ulong
query_start_sec_part
()
{
query_start_sec_part_used
=
1
;
return
start_time_sec_part
;
}
...
...
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