Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9e14755b
Commit
9e14755b
authored
Feb 23, 2013
by
Petri Lehtinen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #14720: sqlite3: Convert datetime microseconds correctly
Patch by Lowe Thiderman
parent
c23178ba
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
2 deletions
+23
-2
Lib/sqlite3/dbapi2.py
Lib/sqlite3/dbapi2.py
+1
-1
Lib/sqlite3/test/regression.py
Lib/sqlite3/test/regression.py
+18
-1
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/sqlite3/dbapi2.py
View file @
9e14755b
...
@@ -68,7 +68,7 @@ def register_adapters_and_converters():
...
@@ -68,7 +68,7 @@ def register_adapters_and_converters():
timepart_full
=
timepart
.
split
(
"."
)
timepart_full
=
timepart
.
split
(
"."
)
hours
,
minutes
,
seconds
=
map
(
int
,
timepart_full
[
0
].
split
(
":"
))
hours
,
minutes
,
seconds
=
map
(
int
,
timepart_full
[
0
].
split
(
":"
))
if
len
(
timepart_full
)
==
2
:
if
len
(
timepart_full
)
==
2
:
microseconds
=
int
(
timepart_full
[
1
]
)
microseconds
=
int
(
'{:0<6}'
.
format
(
timepart_full
[
1
].
decode
())
)
else
:
else
:
microseconds
=
0
microseconds
=
0
...
...
Lib/sqlite3/test/regression.py
View file @
9e14755b
#-*- coding:
ISO
-8859-1 -*-
#-*- coding:
iso
-8859-1 -*-
# pysqlite2/test/regression.py: pysqlite regression tests
# pysqlite2/test/regression.py: pysqlite regression tests
#
#
# Copyright (C) 2006-2007 Gerhard Hring <gh@ghaering.de>
# Copyright (C) 2006-2007 Gerhard Hring <gh@ghaering.de>
...
@@ -285,6 +285,23 @@ class RegressionTests(unittest.TestCase):
...
@@ -285,6 +285,23 @@ class RegressionTests(unittest.TestCase):
cur
.
executemany
(
"insert into b (baz) values (?)"
,
cur
.
executemany
(
"insert into b (baz) values (?)"
,
((
i
,)
for
i
in
foo
()))
((
i
,)
for
i
in
foo
()))
def
CheckConvertTimestampMicrosecondPadding
(
self
):
"""
http://bugs.python.org/issue14720
The microsecond parsing of convert_timestamp() should pad with zeros,
since the microsecond string "456" actually represents "456000".
"""
con
=
sqlite
.
connect
(
":memory:"
,
detect_types
=
sqlite
.
PARSE_DECLTYPES
)
cur
=
con
.
cursor
()
cur
.
execute
(
"CREATE TABLE t (x TIMESTAMP)"
)
cur
.
execute
(
"INSERT INTO t (x) VALUES ('2012-04-04 15:06:00.456')"
)
cur
.
execute
(
"SELECT * FROM t"
)
date
=
cur
.
fetchall
()[
0
][
0
]
self
.
assertEqual
(
date
,
datetime
.
datetime
(
2012
,
4
,
4
,
15
,
6
,
0
,
456000
))
def
suite
():
def
suite
():
regression_suite
=
unittest
.
makeSuite
(
RegressionTests
,
"Check"
)
regression_suite
=
unittest
.
makeSuite
(
RegressionTests
,
"Check"
)
...
...
Misc/ACKS
View file @
9e14755b
...
@@ -990,6 +990,7 @@ Anatoly Techtonik
...
@@ -990,6 +990,7 @@ Anatoly Techtonik
Mikhail Terekhov
Mikhail Terekhov
Richard M. Tew
Richard M. Tew
Tobias Thelen
Tobias Thelen
Lowe Thiderman
Nicolas M. Thiéry
Nicolas M. Thiéry
James Thomas
James Thomas
Robin Thomas
Robin Thomas
...
...
Misc/NEWS
View file @
9e14755b
...
@@ -208,6 +208,9 @@ Core and Builtins
...
@@ -208,6 +208,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #14720: sqlite3: Convert datetime microseconds correctly.
Patch by Lowe Thiderman.
- Issue #17225: JSON decoder now counts columns in the first line starting
- Issue #17225: JSON decoder now counts columns in the first line starting
with 1, as in other lines.
with 1, as in other lines.
...
...
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