Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
5f794098
Kaydet (Commit)
5f794098
authored
Şub 26, 2013
tarafından
Petri Lehtinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #14720: Enhance sqlite3 microsecond conversion, document its behavior
üst
7aaa1ef8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
sqlite3.rst
Doc/library/sqlite3.rst
+4
-0
dbapi2.py
Lib/sqlite3/dbapi2.py
+1
-1
regression.py
Lib/sqlite3/test/regression.py
+11
-2
No files found.
Doc/library/sqlite3.rst
Dosyayı görüntüle @
5f794098
...
@@ -814,6 +814,10 @@ The following example demonstrates this.
...
@@ -814,6 +814,10 @@ The following example demonstrates this.
.. literalinclude:: ../includes/sqlite3/pysqlite_datetime.py
.. literalinclude:: ../includes/sqlite3/pysqlite_datetime.py
If a timestamp stored in SQLite has a fractional part longer than 6
numbers, its value will be truncated to microsecond precision by the
timestamp converter.
.. _sqlite3-controlling-transactions:
.. _sqlite3-controlling-transactions:
...
...
Lib/sqlite3/dbapi2.py
Dosyayı görüntüle @
5f794098
...
@@ -67,7 +67,7 @@ def register_adapters_and_converters():
...
@@ -67,7 +67,7 @@ def register_adapters_and_converters():
timepart_full
=
timepart
.
split
(
b
"."
)
timepart_full
=
timepart
.
split
(
b
"."
)
hours
,
minutes
,
seconds
=
map
(
int
,
timepart_full
[
0
]
.
split
(
b
":"
))
hours
,
minutes
,
seconds
=
map
(
int
,
timepart_full
[
0
]
.
split
(
b
":"
))
if
len
(
timepart_full
)
==
2
:
if
len
(
timepart_full
)
==
2
:
microseconds
=
int
(
'{:0<6}'
.
format
(
timepart_full
[
1
]
.
decode
()))
microseconds
=
int
(
'{:0<6
.6
}'
.
format
(
timepart_full
[
1
]
.
decode
()))
else
:
else
:
microseconds
=
0
microseconds
=
0
...
...
Lib/sqlite3/test/regression.py
Dosyayı görüntüle @
5f794098
...
@@ -313,11 +313,20 @@ class RegressionTests(unittest.TestCase):
...
@@ -313,11 +313,20 @@ class RegressionTests(unittest.TestCase):
con
=
sqlite
.
connect
(
":memory:"
,
detect_types
=
sqlite
.
PARSE_DECLTYPES
)
con
=
sqlite
.
connect
(
":memory:"
,
detect_types
=
sqlite
.
PARSE_DECLTYPES
)
cur
=
con
.
cursor
()
cur
=
con
.
cursor
()
cur
.
execute
(
"CREATE TABLE t (x TIMESTAMP)"
)
cur
.
execute
(
"CREATE TABLE t (x TIMESTAMP)"
)
# Microseconds should be 456000
cur
.
execute
(
"INSERT INTO t (x) VALUES ('2012-04-04 15:06:00.456')"
)
cur
.
execute
(
"INSERT INTO t (x) VALUES ('2012-04-04 15:06:00.456')"
)
# Microseconds should be truncated to 123456
cur
.
execute
(
"INSERT INTO t (x) VALUES ('2012-04-04 15:06:00.123456789')"
)
cur
.
execute
(
"SELECT * FROM t"
)
cur
.
execute
(
"SELECT * FROM t"
)
date
=
cur
.
fetchall
()[
0
][
0
]
values
=
[
x
[
0
]
for
x
in
cur
.
fetchall
()
]
self
.
assertEqual
(
date
,
datetime
.
datetime
(
2012
,
4
,
4
,
15
,
6
,
0
,
456000
))
self
.
assertEqual
(
values
,
[
datetime
.
datetime
(
2012
,
4
,
4
,
15
,
6
,
0
,
456000
),
datetime
.
datetime
(
2012
,
4
,
4
,
15
,
6
,
0
,
123456
),
])
def
suite
():
def
suite
():
...
...
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