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
4511a713
Kaydet (Commit)
4511a713
authored
18 years ago
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Whitespace normalization.
üst
3053667d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
72 deletions
+64
-72
adapter_point_1.py
Doc/lib/sqlite3/adapter_point_1.py
+0
-1
adapter_point_2.py
Doc/lib/sqlite3/adapter_point_2.py
+0
-1
execute_2.py
Doc/lib/sqlite3/execute_2.py
+0
-1
execute_3.py
Doc/lib/sqlite3/execute_3.py
+0
-2
insert_more_people.py
Doc/lib/sqlite3/insert_more_people.py
+0
-1
shortcut_methods.py
Doc/lib/sqlite3/shortcut_methods.py
+21
-22
text_factory.py
Doc/lib/sqlite3/text_factory.py
+42
-43
test_unicode.py
Lib/test/test_unicode.py
+1
-1
No files found.
Doc/lib/sqlite3/adapter_point_1.py
Dosyayı görüntüle @
4511a713
...
@@ -14,4 +14,3 @@ cur = con.cursor()
...
@@ -14,4 +14,3 @@ cur = con.cursor()
p
=
Point
(
4.0
,
-
3.2
)
p
=
Point
(
4.0
,
-
3.2
)
cur
.
execute
(
"select ?"
,
(
p
,))
cur
.
execute
(
"select ?"
,
(
p
,))
print
cur
.
fetchone
()[
0
]
print
cur
.
fetchone
()[
0
]
This diff is collapsed.
Click to expand it.
Doc/lib/sqlite3/adapter_point_2.py
Dosyayı görüntüle @
4511a713
...
@@ -15,4 +15,3 @@ cur = con.cursor()
...
@@ -15,4 +15,3 @@ cur = con.cursor()
p
=
Point
(
4.0
,
-
3.2
)
p
=
Point
(
4.0
,
-
3.2
)
cur
.
execute
(
"select ?"
,
(
p
,))
cur
.
execute
(
"select ?"
,
(
p
,))
print
cur
.
fetchone
()[
0
]
print
cur
.
fetchone
()[
0
]
This diff is collapsed.
Click to expand it.
Doc/lib/sqlite3/execute_2.py
Dosyayı görüntüle @
4511a713
...
@@ -10,4 +10,3 @@ age = 72
...
@@ -10,4 +10,3 @@ age = 72
cur
.
execute
(
"select name_last, age from people where name_last=:who and age=:age"
,
cur
.
execute
(
"select name_last, age from people where name_last=:who and age=:age"
,
{
"who"
:
who
,
"age"
:
age
})
{
"who"
:
who
,
"age"
:
age
})
print
cur
.
fetchone
()
print
cur
.
fetchone
()
This diff is collapsed.
Click to expand it.
Doc/lib/sqlite3/execute_3.py
Dosyayı görüntüle @
4511a713
...
@@ -10,5 +10,3 @@ age = 72
...
@@ -10,5 +10,3 @@ age = 72
cur
.
execute
(
"select name_last, age from people where name_last=:who and age=:age"
,
cur
.
execute
(
"select name_last, age from people where name_last=:who and age=:age"
,
locals
())
locals
())
print
cur
.
fetchone
()
print
cur
.
fetchone
()
This diff is collapsed.
Click to expand it.
Doc/lib/sqlite3/insert_more_people.py
Dosyayı görüntüle @
4511a713
...
@@ -14,4 +14,3 @@ for person in newPeople:
...
@@ -14,4 +14,3 @@ for person in newPeople:
# The changes will not be saved unless the transaction is committed explicitly:
# The changes will not be saved unless the transaction is committed explicitly:
con
.
commit
()
con
.
commit
()
This diff is collapsed.
Click to expand it.
Doc/lib/sqlite3/shortcut_methods.py
Dosyayı görüntüle @
4511a713
import
sqlite3
import
sqlite3
persons
=
[
persons
=
[
(
"Hugo"
,
"Boss"
),
(
"Hugo"
,
"Boss"
),
(
"Calvin"
,
"Klein"
)
(
"Calvin"
,
"Klein"
)
]
]
con
=
sqlite3
.
connect
(
":memory:"
)
con
=
sqlite3
.
connect
(
":memory:"
)
# Create the table
# Create the table
con
.
execute
(
"create table person(firstname, lastname)"
)
con
.
execute
(
"create table person(firstname, lastname)"
)
# Fill the table
# Fill the table
con
.
executemany
(
"insert into person(firstname, lastname) values (?, ?)"
,
persons
)
con
.
executemany
(
"insert into person(firstname, lastname) values (?, ?)"
,
persons
)
# Print the table contents
# Print the table contents
for
row
in
con
.
execute
(
"select firstname, lastname from person"
):
for
row
in
con
.
execute
(
"select firstname, lastname from person"
):
print
row
print
row
# Using a dummy WHERE clause to not let SQLite take the shortcut table deletes.
# Using a dummy WHERE clause to not let SQLite take the shortcut table deletes.
print
"I just deleted"
,
con
.
execute
(
"delete from person where 1=1"
)
.
rowcount
,
"rows"
print
"I just deleted"
,
con
.
execute
(
"delete from person where 1=1"
)
.
rowcount
,
"rows"
This diff is collapsed.
Click to expand it.
Doc/lib/sqlite3/text_factory.py
Dosyayı görüntüle @
4511a713
import
sqlite3
import
sqlite3
con
=
sqlite3
.
connect
(
":memory:"
)
con
=
sqlite3
.
connect
(
":memory:"
)
cur
=
con
.
cursor
()
cur
=
con
.
cursor
()
# Create the table
# Create the table
con
.
execute
(
"create table person(lastname, firstname)"
)
con
.
execute
(
"create table person(lastname, firstname)"
)
AUSTRIA
=
u"
\xd6
sterreich"
AUSTRIA
=
u"
\xd6
sterreich"
# by default, rows are returned as Unicode
# by default, rows are returned as Unicode
cur
.
execute
(
"select ?"
,
(
AUSTRIA
,))
cur
.
execute
(
"select ?"
,
(
AUSTRIA
,))
row
=
cur
.
fetchone
()
row
=
cur
.
fetchone
()
assert
row
[
0
]
==
AUSTRIA
assert
row
[
0
]
==
AUSTRIA
# but we can make pysqlite always return bytestrings ...
# but we can make pysqlite always return bytestrings ...
con
.
text_factory
=
str
con
.
text_factory
=
str
cur
.
execute
(
"select ?"
,
(
AUSTRIA
,))
cur
.
execute
(
"select ?"
,
(
AUSTRIA
,))
row
=
cur
.
fetchone
()
row
=
cur
.
fetchone
()
assert
type
(
row
[
0
])
==
str
assert
type
(
row
[
0
])
==
str
# the bytestrings will be encoded in UTF-8, unless you stored garbage in the
# the bytestrings will be encoded in UTF-8, unless you stored garbage in the
# database ...
# database ...
assert
row
[
0
]
==
AUSTRIA
.
encode
(
"utf-8"
)
assert
row
[
0
]
==
AUSTRIA
.
encode
(
"utf-8"
)
# we can also implement a custom text_factory ...
# we can also implement a custom text_factory ...
# here we implement one that will ignore Unicode characters that cannot be
# here we implement one that will ignore Unicode characters that cannot be
# decoded from UTF-8
# decoded from UTF-8
con
.
text_factory
=
lambda
x
:
unicode
(
x
,
"utf-8"
,
"ignore"
)
con
.
text_factory
=
lambda
x
:
unicode
(
x
,
"utf-8"
,
"ignore"
)
cur
.
execute
(
"select ?"
,
(
"this is latin1 and would normally create errors"
+
u"
\xe4\xf6\xfc
"
.
encode
(
"latin1"
),))
cur
.
execute
(
"select ?"
,
(
"this is latin1 and would normally create errors"
+
u"
\xe4\xf6\xfc
"
.
encode
(
"latin1"
),))
row
=
cur
.
fetchone
()
row
=
cur
.
fetchone
()
assert
type
(
row
[
0
])
==
unicode
assert
type
(
row
[
0
])
==
unicode
# pysqlite offers a builtin optimized text_factory that will return bytestring
# pysqlite offers a builtin optimized text_factory that will return bytestring
# objects, if the data is in ASCII only, and otherwise return unicode objects
# objects, if the data is in ASCII only, and otherwise return unicode objects
con
.
text_factory
=
sqlite3
.
OptimizedUnicode
con
.
text_factory
=
sqlite3
.
OptimizedUnicode
cur
.
execute
(
"select ?"
,
(
AUSTRIA
,))
cur
.
execute
(
"select ?"
,
(
AUSTRIA
,))
row
=
cur
.
fetchone
()
row
=
cur
.
fetchone
()
assert
type
(
row
[
0
])
==
unicode
assert
type
(
row
[
0
])
==
unicode
cur
.
execute
(
"select ?"
,
(
"Germany"
,))
cur
.
execute
(
"select ?"
,
(
"Germany"
,))
row
=
cur
.
fetchone
()
row
=
cur
.
fetchone
()
assert
type
(
row
[
0
])
==
str
assert
type
(
row
[
0
])
==
str
This diff is collapsed.
Click to expand it.
Lib/test/test_unicode.py
Dosyayı görüntüle @
4511a713
...
@@ -410,7 +410,7 @@ class UnicodeTest(
...
@@ -410,7 +410,7 @@ class UnicodeTest(
def
__str__
(
self
):
def
__str__
(
self
):
return
u'
\u1234
'
return
u'
\u1234
'
self
.
assertEqual
(
'
%
s'
%
Wrapper
(),
u'
\u1234
'
)
self
.
assertEqual
(
'
%
s'
%
Wrapper
(),
u'
\u1234
'
)
@test_support.run_with_locale
(
'LC_ALL'
,
'de_DE'
,
'fr_FR'
)
@test_support.run_with_locale
(
'LC_ALL'
,
'de_DE'
,
'fr_FR'
)
def
test_format_float
(
self
):
def
test_format_float
(
self
):
# should not format with a comma, but always with C locale
# should not format with a comma, but always with C locale
...
...
This diff is collapsed.
Click to expand it.
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