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
d7f3cdd0
Kaydet (Commit)
d7f3cdd0
authored
Agu 21, 2016
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #21718: Merge from 3.5
üst
1dc3c898
6afe8582
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
7 deletions
+48
-7
types.py
Lib/sqlite3/test/types.py
+41
-1
NEWS
Misc/NEWS
+2
-0
cursor.c
Modules/_sqlite/cursor.c
+5
-6
No files found.
Lib/sqlite3/test/types.py
Dosyayı görüntüle @
d7f3cdd0
...
...
@@ -274,6 +274,45 @@ class ColNamesTests(unittest.TestCase):
self
.
cur
.
execute
(
"select * from test where 0 = 1"
)
self
.
assertEqual
(
self
.
cur
.
description
[
0
][
0
],
"x"
)
def
CheckCursorDescriptionInsert
(
self
):
self
.
cur
.
execute
(
"insert into test values (1)"
)
self
.
assertIsNone
(
self
.
cur
.
description
)
@unittest.skipIf
(
sqlite
.
sqlite_version_info
<
(
3
,
8
,
3
),
"CTEs not supported"
)
class
CommonTableExpressionTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
con
=
sqlite
.
connect
(
":memory:"
)
self
.
cur
=
self
.
con
.
cursor
()
self
.
cur
.
execute
(
"create table test(x foo)"
)
def
tearDown
(
self
):
self
.
cur
.
close
()
self
.
con
.
close
()
def
CheckCursorDescriptionCTESimple
(
self
):
self
.
cur
.
execute
(
"with one as (select 1) select * from one"
)
self
.
assertIsNotNone
(
self
.
cur
.
description
)
self
.
assertEqual
(
self
.
cur
.
description
[
0
][
0
],
"1"
)
def
CheckCursorDescriptionCTESMultipleColumns
(
self
):
self
.
cur
.
execute
(
"insert into test values(1)"
)
self
.
cur
.
execute
(
"insert into test values(2)"
)
self
.
cur
.
execute
(
"with testCTE as (select * from test) select * from testCTE"
)
self
.
assertIsNotNone
(
self
.
cur
.
description
)
self
.
assertEqual
(
self
.
cur
.
description
[
0
][
0
],
"x"
)
def
CheckCursorDescriptionCTE
(
self
):
self
.
cur
.
execute
(
"insert into test values (1)"
)
self
.
cur
.
execute
(
"with bar as (select * from test) select * from test where x = 1"
)
self
.
assertIsNotNone
(
self
.
cur
.
description
)
self
.
assertEqual
(
self
.
cur
.
description
[
0
][
0
],
"x"
)
self
.
cur
.
execute
(
"with bar as (select * from test) select * from test where x = 2"
)
self
.
assertIsNotNone
(
self
.
cur
.
description
)
self
.
assertEqual
(
self
.
cur
.
description
[
0
][
0
],
"x"
)
class
ObjectAdaptationTests
(
unittest
.
TestCase
):
def
cast
(
obj
):
return
float
(
obj
)
...
...
@@ -372,7 +411,8 @@ def suite():
adaptation_suite
=
unittest
.
makeSuite
(
ObjectAdaptationTests
,
"Check"
)
bin_suite
=
unittest
.
makeSuite
(
BinaryConverterTests
,
"Check"
)
date_suite
=
unittest
.
makeSuite
(
DateTimeTests
,
"Check"
)
return
unittest
.
TestSuite
((
sqlite_type_suite
,
decltypes_type_suite
,
colnames_type_suite
,
adaptation_suite
,
bin_suite
,
date_suite
))
cte_suite
=
unittest
.
makeSuite
(
CommonTableExpressionTests
,
"Check"
)
return
unittest
.
TestSuite
((
sqlite_type_suite
,
decltypes_type_suite
,
colnames_type_suite
,
adaptation_suite
,
bin_suite
,
date_suite
,
cte_suite
))
def
test
():
runner
=
unittest
.
TextTestRunner
()
...
...
Misc/NEWS
Dosyayı görüntüle @
d7f3cdd0
...
...
@@ -36,6 +36,8 @@ Core and Builtins
Library
-------
- Issue #21718: cursor.description is now available for queries using CTEs.
- Issue #27819: In distutils sdists, simply produce the "gztar" (gzipped tar
format) distributions on all platforms unless "formats" is supplied.
...
...
Modules/_sqlite/cursor.c
Dosyayı görüntüle @
d7f3cdd0
...
...
@@ -645,12 +645,11 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
goto
error
;
}
if
(
rc
==
SQLITE_ROW
||
(
rc
==
SQLITE_DONE
&&
statement_type
==
STATEMENT_SELECT
))
{
if
(
self
->
description
==
Py_None
)
{
Py_BEGIN_ALLOW_THREADS
numcols
=
sqlite3_column_count
(
self
->
statement
->
st
);
Py_END_ALLOW_THREADS
if
(
rc
==
SQLITE_ROW
||
rc
==
SQLITE_DONE
)
{
Py_BEGIN_ALLOW_THREADS
numcols
=
sqlite3_column_count
(
self
->
statement
->
st
);
Py_END_ALLOW_THREADS
if
(
self
->
description
==
Py_None
&&
numcols
>
0
)
{
Py_SETREF
(
self
->
description
,
PyTuple_New
(
numcols
));
if
(
!
self
->
description
)
{
goto
error
;
...
...
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