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
fdfeb4be
Commit
fdfeb4be
authored
Jun 09, 2011
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small optimization in Field_time_hires.
Fix Field_time_hires::reset()
parent
c3f665dc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
sql/field.cc
sql/field.cc
+8
-5
sql/field.h
sql/field.h
+4
-0
No files found.
sql/field.cc
View file @
fdfeb4be
...
...
@@ -5364,11 +5364,15 @@ void Field_time::sql_type(String &res) const
res
.
set_ascii
(
STRING_WITH_LEN
(
"time"
));
}
static
const
longlong
t_shift
=
((
TIME_MAX_VALUE_SECONDS
+
1
)
*
TIME_SECOND_PART_FACTOR
);
int
Field_time_hires
::
reset
()
{
store_bigendian
(
zero_point
,
ptr
,
Field_time_hires
::
pack_length
());
return
0
;
}
void
Field_time_hires
::
store_TIME
(
MYSQL_TIME
*
ltime
)
{
ulonglong
packed
=
sec_part_shift
(
pack_time
(
ltime
),
dec
)
+
sec_part_shift
(
t_shift
,
dec
);
ulonglong
packed
=
sec_part_shift
(
pack_time
(
ltime
),
dec
)
+
zero_point
;
store_bigendian
(
packed
,
ptr
,
Field_time_hires
::
pack_length
());
}
...
...
@@ -5425,8 +5429,7 @@ bool Field_time_hires::get_date(MYSQL_TIME *ltime, uint fuzzydate)
uint32
len
=
pack_length
();
longlong
packed
=
read_bigendian
(
ptr
,
len
);
if
(
packed
)
packed
=
sec_part_unshift
(
packed
-
sec_part_shift
(
t_shift
,
dec
),
dec
);
packed
=
sec_part_unshift
(
packed
-
zero_point
,
dec
);
unpack_time
(
packed
,
ltime
);
/*
...
...
sql/field.h
View file @
fdfeb4be
...
...
@@ -1420,6 +1420,7 @@ public:
class
Field_time_hires
:
public
Field_time
{
uint
dec
;
longlong
zero_point
;
void
store_TIME
(
MYSQL_TIME
*
ltime
);
public:
Field_time_hires
(
uchar
*
ptr_arg
,
uchar
*
null_ptr_arg
,
uchar
null_bit_arg
,
...
...
@@ -1431,6 +1432,8 @@ public:
{
DBUG_ASSERT
(
dec
);
DBUG_ASSERT
(
dec
<=
TIME_SECOND_PART_DIGITS
);
zero_point
=
sec_part_shift
(
((
TIME_MAX_VALUE_SECONDS
+
1
)
*
TIME_SECOND_PART_FACTOR
),
dec
);
}
enum
ha_base_keytype
key_type
()
const
{
return
HA_KEYTYPE_BINARY
;
}
uint
decimals
()
const
{
return
dec
;
}
...
...
@@ -1438,6 +1441,7 @@ public:
longlong
val_int
(
void
);
double
val_real
(
void
);
String
*
val_str
(
String
*
,
String
*
);
int
reset
(
void
);
bool
get_date
(
MYSQL_TIME
*
ltime
,
uint
fuzzydate
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
...
...
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