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
d67dcb7b
Commit
d67dcb7b
authored
Feb 04, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-15205 Remove mysql_type_to_time_type()
parent
28d4cf0c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
43 deletions
+10
-43
sql/field.cc
sql/field.cc
+6
-7
sql/field.h
sql/field.h
+0
-31
sql/sql_time.cc
sql/sql_time.cc
+4
-5
No files found.
sql/field.cc
View file @
d67dcb7b
...
@@ -5489,11 +5489,9 @@ void Field_temporal::set_warnings(Sql_condition::enum_warning_level trunc_level,
...
@@ -5489,11 +5489,9 @@ void Field_temporal::set_warnings(Sql_condition::enum_warning_level trunc_level,
a DATE field and non-zero time part is thrown away.
a DATE field and non-zero time part is thrown away.
*/
*/
if
(
was_cut
&
MYSQL_TIME_WARN_TRUNCATED
)
if
(
was_cut
&
MYSQL_TIME_WARN_TRUNCATED
)
set_datetime_warning
(
trunc_level
,
WARN_DATA_TRUNCATED
,
set_datetime_warning
(
trunc_level
,
WARN_DATA_TRUNCATED
,
str
,
ts_type
,
1
);
str
,
mysql_type_to_time_type
(
type
()),
1
);
if
(
was_cut
&
MYSQL_TIME_WARN_OUT_OF_RANGE
)
if
(
was_cut
&
MYSQL_TIME_WARN_OUT_OF_RANGE
)
set_datetime_warning
(
ER_WARN_DATA_OUT_OF_RANGE
,
set_datetime_warning
(
ER_WARN_DATA_OUT_OF_RANGE
,
str
,
ts_type
,
1
);
str
,
mysql_type_to_time_type
(
type
()),
1
);
}
}
...
@@ -5529,14 +5527,15 @@ int Field_temporal_with_date::store_TIME_with_warning(MYSQL_TIME *ltime,
...
@@ -5529,14 +5527,15 @@ int Field_temporal_with_date::store_TIME_with_warning(MYSQL_TIME *ltime,
}
}
else
if
(
!
MYSQL_TIME_WARN_HAVE_WARNINGS
(
was_cut
)
&&
else
if
(
!
MYSQL_TIME_WARN_HAVE_WARNINGS
(
was_cut
)
&&
(
MYSQL_TIME_WARN_HAVE_NOTES
(
was_cut
)
||
(
MYSQL_TIME_WARN_HAVE_NOTES
(
was_cut
)
||
(
mysql_type_to_time_type
(
type
()
)
==
MYSQL_TIMESTAMP_DATE
&&
(
type_handler
()
->
mysql_timestamp_type
(
)
==
MYSQL_TIMESTAMP_DATE
&&
(
ltime
->
hour
||
ltime
->
minute
||
ltime
->
second
||
ltime
->
second_part
))))
(
ltime
->
hour
||
ltime
->
minute
||
ltime
->
second
||
ltime
->
second_part
))))
{
{
trunc_level
=
Sql_condition
::
WARN_LEVEL_NOTE
;
trunc_level
=
Sql_condition
::
WARN_LEVEL_NOTE
;
was_cut
|=
MYSQL_TIME_WARN_TRUNCATED
;
was_cut
|=
MYSQL_TIME_WARN_TRUNCATED
;
ret
=
3
;
ret
=
3
;
}
}
set_warnings
(
trunc_level
,
str
,
was_cut
,
mysql_type_to_time_type
(
type
()));
set_warnings
(
trunc_level
,
str
,
was_cut
,
type_handler
()
->
mysql_timestamp_type
());
store_TIME
(
ltime
);
store_TIME
(
ltime
);
return
was_cut
?
ret
:
0
;
return
was_cut
?
ret
:
0
;
}
}
...
@@ -5626,7 +5625,7 @@ my_decimal *Field_temporal::val_decimal(my_decimal *d)
...
@@ -5626,7 +5625,7 @@ my_decimal *Field_temporal::val_decimal(my_decimal *d)
if
(
get_date
(
&
ltime
,
0
))
if
(
get_date
(
&
ltime
,
0
))
{
{
bzero
(
&
ltime
,
sizeof
(
ltime
));
bzero
(
&
ltime
,
sizeof
(
ltime
));
ltime
.
time_type
=
mysql_type_to_time_type
(
type
()
);
ltime
.
time_type
=
type_handler
()
->
mysql_timestamp_type
(
);
}
}
return
TIME_to_my_decimal
(
&
ltime
,
d
);
return
TIME_to_my_decimal
(
&
ltime
,
d
);
}
}
...
...
sql/field.h
View file @
d67dcb7b
...
@@ -488,37 +488,6 @@ inline enum_field_types real_type_to_type(enum_field_types real_type)
...
@@ -488,37 +488,6 @@ inline enum_field_types real_type_to_type(enum_field_types real_type)
}
}
static
inline
enum
enum_mysql_timestamp_type
mysql_type_to_time_type
(
enum
enum_field_types
mysql_type
)
{
switch
(
mysql_type
)
{
case
MYSQL_TYPE_TIME2
:
case
MYSQL_TYPE_TIME
:
return
MYSQL_TIMESTAMP_TIME
;
case
MYSQL_TYPE_TIMESTAMP2
:
case
MYSQL_TYPE_TIMESTAMP
:
case
MYSQL_TYPE_DATETIME2
:
case
MYSQL_TYPE_DATETIME
:
return
MYSQL_TIMESTAMP_DATETIME
;
case
MYSQL_TYPE_NEWDATE
:
case
MYSQL_TYPE_DATE
:
return
MYSQL_TIMESTAMP_DATE
;
default:
return
MYSQL_TIMESTAMP_ERROR
;
}
}
/**
Tests if field type is temporal, i.e. represents
DATE, TIME, DATETIME or TIMESTAMP types in SQL.
@param type Field type, as returned by field->type().
@retval true If field type is temporal
@retval false If field type is not temporal
*/
inline
bool
is_temporal_type
(
enum_field_types
type
)
{
return
mysql_type_to_time_type
(
type
)
!=
MYSQL_TIMESTAMP_ERROR
;
}
enum
enum_vcol_info_type
enum
enum_vcol_info_type
{
{
VCOL_GENERATED_VIRTUAL
,
VCOL_GENERATED_STORED
,
VCOL_GENERATED_VIRTUAL
,
VCOL_GENERATED_STORED
,
...
...
sql/sql_time.cc
View file @
d67dcb7b
...
@@ -357,19 +357,19 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
...
@@ -357,19 +357,19 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
{
{
int
was_cut
;
int
was_cut
;
longlong
res
;
longlong
res
;
enum_
field_types
f
_type
;
enum_
mysql_timestamp_type
ts
_type
;
bool
have_warnings
;
bool
have_warnings
;
if
(
fuzzydate
&
TIME_TIME_ONLY
)
if
(
fuzzydate
&
TIME_TIME_ONLY
)
{
{
fuzzydate
=
TIME_TIME_ONLY
;
// clear other flags
fuzzydate
=
TIME_TIME_ONLY
;
// clear other flags
f_type
=
MYSQL_TYPE
_TIME
;
ts_type
=
MYSQL_TIMESTAMP
_TIME
;
res
=
number_to_time
(
neg
,
nr
,
sec_part
,
ltime
,
&
was_cut
);
res
=
number_to_time
(
neg
,
nr
,
sec_part
,
ltime
,
&
was_cut
);
have_warnings
=
MYSQL_TIME_WARN_HAVE_WARNINGS
(
was_cut
);
have_warnings
=
MYSQL_TIME_WARN_HAVE_WARNINGS
(
was_cut
);
}
}
else
else
{
{
f_type
=
MYSQL_TYPE
_DATETIME
;
ts_type
=
MYSQL_TIMESTAMP
_DATETIME
;
if
(
neg
)
if
(
neg
)
{
{
res
=
-
1
;
res
=
-
1
;
...
@@ -385,8 +385,7 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
...
@@ -385,8 +385,7 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
{
{
make_truncated_value_warning
(
current_thd
,
make_truncated_value_warning
(
current_thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
str
,
Sql_condition
::
WARN_LEVEL_WARN
,
str
,
res
<
0
?
MYSQL_TIMESTAMP_ERROR
res
<
0
?
MYSQL_TIMESTAMP_ERROR
:
ts_type
,
:
mysql_type_to_time_type
(
f_type
),
field_name
);
field_name
);
}
}
return
res
<
0
;
return
res
<
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