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
95af195d
Commit
95af195d
authored
Mar 06, 2003
by
serg@serg.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable partial timestamps in --new mode
parent
6897b002
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
mysql-test/r/type_timestamp.result
mysql-test/r/type_timestamp.result
+2
-2
sql/field.cc
sql/field.cc
+6
-10
No files found.
mysql-test/r/type_timestamp.result
View file @
95af195d
...
...
@@ -101,6 +101,6 @@ t2 t4 t6 t8 t10 t12 t14
set new=1;
select * from t1;
t2 t4 t6 t8 t10 t12 t14
00
00-00 00-00-00 0000-00-00 00-00-00 00:00
00-00-00 00:00:00 0000-00-00 00:00:00
97 97-12 97-12-31 1997-12-31 97-12-31 23:47
97-12-31 23:47:59 1997-12-31 23:47:59
00
00-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 00
00-00-00 00:00:00 0000-00-00 00:00:00
1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 19
97-12-31 23:47:59 1997-12-31 23:47:59
drop table t1;
sql/field.cc
View file @
95af195d
...
...
@@ -2616,17 +2616,14 @@ String *Field_timestamp::val_str(String *val_buffer,
String
*
val_ptr
__attribute__
((
unused
)))
{
uint
pos
;
int
extra
;
int
part_time
;
uint32
temp
;
time_t
time_arg
;
struct
tm
*
l_time
;
struct
tm
tm_tmp
;
my_bool
new_format
=
(
current_thd
->
variables
.
new_mode
),
full_year
=
(
field_length
==
8
||
field_length
==
14
);
static
const
uint
extras
[]
=
{
0
,
1
,
2
,
2
,
4
,
5
,
5
};
extra
=
new_format
?
extras
[
field_length
/
2
-
1
]
:
0
;
full_year
=
(
field_length
==
8
||
field_length
==
14
||
new_format
);
int
real_field_length
=
new_format
?
19
:
field_length
;
#ifdef WORDS_BIGENDIAN
if
(
table
->
db_low_byte_first
)
...
...
@@ -2638,18 +2635,17 @@ String *Field_timestamp::val_str(String *val_buffer,
if
(
temp
==
0L
)
{
/* Zero time is "000000" */
if
(
new_format
)
val_buffer
->
copy
(
"0000-00-00 00:00:00"
+
2
*
(
1
-
full_year
),
field_length
+
extra
);
val_buffer
->
copy
(
"0000-00-00 00:00:00"
,
real_field_length
);
else
val_buffer
->
copy
(
"00000000000000"
,
field_length
);
val_buffer
->
copy
(
"00000000000000"
,
real_
field_length
);
return
val_buffer
;
}
time_arg
=
(
time_t
)
temp
;
localtime_r
(
&
time_arg
,
&
tm_tmp
);
l_time
=&
tm_tmp
;
val_buffer
->
alloc
(
field_length
+
extra
+
1
);
char
*
to
=
(
char
*
)
val_buffer
->
ptr
(),
*
end
=
to
+
field_length
+
extra
;
val_buffer
->
alloc
(
real_field_length
+
1
);
char
*
to
=
(
char
*
)
val_buffer
->
ptr
(),
*
end
=
to
+
real_field_length
;
for
(
pos
=
0
;
to
<
end
;
pos
++
)
{
...
...
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