mirror of https://github.com/python/cpython
sqlite3: Modernize documentation around unicode and bytes. (GH-28652)
This commit is contained in:
parent
833fdf126c
commit
1dac95c814
|
@ -3,9 +3,9 @@ import sqlite3
|
||||||
con = sqlite3.connect(":memory:")
|
con = sqlite3.connect(":memory:")
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
|
|
||||||
AUSTRIA = "\xd6sterreich"
|
AUSTRIA = "Österreich"
|
||||||
|
|
||||||
# by default, rows are returned as Unicode
|
# by default, rows are returned as str
|
||||||
cur.execute("select ?", (AUSTRIA,))
|
cur.execute("select ?", (AUSTRIA,))
|
||||||
row = cur.fetchone()
|
row = cur.fetchone()
|
||||||
assert row[0] == AUSTRIA
|
assert row[0] == AUSTRIA
|
||||||
|
|
|
@ -537,8 +537,8 @@ Connection Objects
|
||||||
|
|
||||||
Using this attribute you can control what objects are returned for the ``TEXT``
|
Using this attribute you can control what objects are returned for the ``TEXT``
|
||||||
data type. By default, this attribute is set to :class:`str` and the
|
data type. By default, this attribute is set to :class:`str` and the
|
||||||
:mod:`sqlite3` module will return Unicode objects for ``TEXT``. If you want to
|
:mod:`sqlite3` module will return :class:`str` objects for ``TEXT``.
|
||||||
return bytestrings instead, you can set it to :class:`bytes`.
|
If you want to return :class:`bytes` instead, you can set it to :class:`bytes`.
|
||||||
|
|
||||||
You can also set it to any other callable that accepts a single bytestring
|
You can also set it to any other callable that accepts a single bytestring
|
||||||
parameter and returns the resulting object.
|
parameter and returns the resulting object.
|
||||||
|
|
Loading…
Reference in New Issue