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
be2cf338
Kaydet (Commit)
be2cf338
authored
Şub 15, 2012
tarafından
Petri Lehtinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge branch '3.2'
Issue #13491.
üst
482ee66c
1ca93954
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
29 additions
and
41 deletions
+29
-41
converter_point.py
Doc/includes/sqlite3/converter_point.py
+2
-2
execute_1.py
Doc/includes/sqlite3/execute_1.py
+8
-3
execute_2.py
Doc/includes/sqlite3/execute_2.py
+0
-12
executemany_2.py
Doc/includes/sqlite3/executemany_2.py
+2
-2
md5func.py
Doc/includes/sqlite3/md5func.py
+1
-1
rowclass.py
Doc/includes/sqlite3/rowclass.py
+4
-4
text_factory.py
Doc/includes/sqlite3/text_factory.py
+6
-11
sqlite3.rst
Doc/library/sqlite3.rst
+2
-6
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/includes/sqlite3/converter_point.py
Dosyayı görüntüle @
be2cf338
...
...
@@ -8,10 +8,10 @@ class Point:
return
"(
%
f;
%
f)"
%
(
self
.
x
,
self
.
y
)
def
adapt_point
(
point
):
return
"
%
f;
%
f"
%
(
point
.
x
,
point
.
y
)
return
(
"
%
f;
%
f"
%
(
point
.
x
,
point
.
y
))
.
encode
(
'ascii'
)
def
convert_point
(
s
):
x
,
y
=
list
(
map
(
float
,
s
.
split
(
";"
)))
x
,
y
=
list
(
map
(
float
,
s
.
split
(
b
";"
)))
return
Point
(
x
,
y
)
# Register the adapter
...
...
Doc/includes/sqlite3/execute_1.py
Dosyayı görüntüle @
be2cf338
import
sqlite3
con
=
sqlite3
.
connect
(
"mydb"
)
con
=
sqlite3
.
connect
(
":memory:"
)
cur
=
con
.
cursor
()
cur
.
execute
(
"create table people (name_last, age)"
)
who
=
"Yeltsin"
age
=
72
cur
.
execute
(
"select name_last, age from people where name_last=? and age=?"
,
(
who
,
age
))
# This is the qmark style:
cur
.
execute
(
"insert into people values (?, ?)"
,
(
who
,
age
))
# And this is the named style:
cur
.
execute
(
"select * from people where name_last=:who and age=:age"
,
{
"who"
:
who
,
"age"
:
age
})
print
(
cur
.
fetchone
())
Doc/includes/sqlite3/execute_2.py
deleted
100644 → 0
Dosyayı görüntüle @
482ee66c
import
sqlite3
con
=
sqlite3
.
connect
(
"mydb"
)
cur
=
con
.
cursor
()
who
=
"Yeltsin"
age
=
72
cur
.
execute
(
"select name_last, age from people where name_last=:who and age=:age"
,
{
"who"
:
who
,
"age"
:
age
})
print
(
cur
.
fetchone
())
Doc/includes/sqlite3/executemany_2.py
Dosyayı görüntüle @
be2cf338
import
sqlite3
import
string
def
char_generator
():
import
string
for
c
in
string
.
letters
[:
26
]:
for
c
in
string
.
ascii_lowercase
:
yield
(
c
,)
con
=
sqlite3
.
connect
(
":memory:"
)
...
...
Doc/includes/sqlite3/md5func.py
Dosyayı görüntüle @
be2cf338
...
...
@@ -7,5 +7,5 @@ def md5sum(t):
con
=
sqlite3
.
connect
(
":memory:"
)
con
.
create_function
(
"md5"
,
1
,
md5sum
)
cur
=
con
.
cursor
()
cur
.
execute
(
"select md5(?)"
,
(
"foo"
,))
cur
.
execute
(
"select md5(?)"
,
(
b
"foo"
,))
print
(
cur
.
fetchone
()[
0
])
Doc/includes/sqlite3/rowclass.py
Dosyayı görüntüle @
be2cf338
import
sqlite3
con
=
sqlite3
.
connect
(
"
mydb
"
)
con
=
sqlite3
.
connect
(
"
:memory:
"
)
con
.
row_factory
=
sqlite3
.
Row
cur
=
con
.
cursor
()
cur
.
execute
(
"select
name_last, age from peopl
e"
)
cur
.
execute
(
"select
'John' as name, 42 as ag
e"
)
for
row
in
cur
:
assert
row
[
0
]
==
row
[
"name
_last
"
]
assert
row
[
"name
_last"
]
==
row
[
"nAmE_lAsT
"
]
assert
row
[
0
]
==
row
[
"name"
]
assert
row
[
"name
"
]
==
row
[
"nAmE
"
]
assert
row
[
1
]
==
row
[
"age"
]
assert
row
[
1
]
==
row
[
"AgE"
]
Doc/includes/sqlite3/text_factory.py
Dosyayı görüntüle @
be2cf338
...
...
@@ -3,9 +3,6 @@ import sqlite3
con
=
sqlite3
.
connect
(
":memory:"
)
cur
=
con
.
cursor
()
# Create the table
con
.
execute
(
"create table person(lastname, firstname)"
)
AUSTRIA
=
"
\xd6
sterreich"
# by default, rows are returned as Unicode
...
...
@@ -14,19 +11,17 @@ row = cur.fetchone()
assert
row
[
0
]
==
AUSTRIA
# but we can make sqlite3 always return bytestrings ...
con
.
text_factory
=
str
con
.
text_factory
=
bytes
cur
.
execute
(
"select ?"
,
(
AUSTRIA
,))
row
=
cur
.
fetchone
()
assert
type
(
row
[
0
])
==
str
assert
type
(
row
[
0
])
is
bytes
# the bytestrings will be encoded in UTF-8, unless you stored garbage in the
# database ...
assert
row
[
0
]
==
AUSTRIA
.
encode
(
"utf-8"
)
# we can also implement a custom text_factory ...
# here we implement one that will ignore Unicode characters that cannot be
# decoded from UTF-8
con
.
text_factory
=
lambda
x
:
str
(
x
,
"utf-8"
,
"ignore"
)
cur
.
execute
(
"select ?"
,
(
"this is latin1 and would normally create errors"
+
"
\xe4\xf6\xfc
"
.
encode
(
"latin1"
),))
# here we implement one that appends "foo" to all strings
con
.
text_factory
=
lambda
x
:
x
.
decode
(
"utf-8"
)
+
"foo"
cur
.
execute
(
"select ?"
,
(
"bar"
,))
row
=
cur
.
fetchone
()
assert
type
(
row
[
0
])
==
str
assert
row
[
0
]
==
"barfoo"
Doc/library/sqlite3.rst
Dosyayı görüntüle @
be2cf338
...
...
@@ -484,14 +484,10 @@ Cursor Objects
kinds of placeholders: question marks (qmark style) and named placeholders
(named style).
This example shows how to use parameters with qmark style
:
Here's an example of both styles
:
.. literalinclude:: ../includes/sqlite3/execute_1.py
This example shows how to use the named style:
.. literalinclude:: ../includes/sqlite3/execute_2.py
:meth:`execute` will only execute a single SQL statement. If you try to execute
more than one statement with it, it will raise a Warning. Use
:meth:`executescript` if you want to execute multiple SQL statements with one
...
...
@@ -773,7 +769,7 @@ and constructs a :class:`Point` object from it.
::
def convert_point(s):
x, y = map(float, s.split(";"))
x, y = map(float, s.split(
b
";"))
return Point(x, y)
Now you need to make the :mod:`sqlite3` module know that what you select from
...
...
Misc/ACKS
Dosyayı görüntüle @
be2cf338
...
...
@@ -1041,6 +1041,7 @@ Kannan Vijayan
Kurt Vile
Norman Vine
Frank Visser
Johannes Vogel
Sjoerd de Vries
Niki W. Waibel
Wojtek Walczak
...
...
Misc/NEWS
Dosyayı görüntüle @
be2cf338
...
...
@@ -2254,6 +2254,9 @@ C-API
Documentation
-------------
-
Issue
#
13491
:
Fix
many
errors
in
sqlite3
documentation
.
Initial
patch
by
Johannes
Vogel
.
-
Issue
#
13402
:
Document
absoluteness
of
sys
.
executable
.
-
Issue
#
13883
:
PYTHONCASEOK
also
works
on
OS
X
.
...
...
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