7
7
msgstr ""
8
8
"Project-Id-Version : Python 3.11\n "
9
9
"Report-Msgid-Bugs-To : \n "
10
- "POT-Creation-Date : 2023-01-02 00:31 +0000\n "
10
+ "POT-Creation-Date : 2023-01-15 00:34 +0000\n "
11
11
"PO-Revision-Date : 2018-05-23 16:10+0000\n "
12
12
"
Last-Translator :
Adrian Liaw <[email protected] >\n "
13
13
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -1760,29 +1760,38 @@ msgid ""
1760
1760
"Instead, use the DB-API's parameter substitution. To insert a variable into "
1761
1761
"a query string, use a placeholder in the string, and substitute the actual "
1762
1762
"values into the query by providing them as a :class:`tuple` of values to the "
1763
- "second argument of the cursor's :meth:`~Cursor.execute` method. An SQL "
1764
- "statement may use one of two kinds of placeholders: question marks (qmark "
1765
- "style) or named placeholders (named style). For the qmark style, "
1766
- "``parameters`` must be a :term:`sequence <sequence>`. For the named style, "
1767
- "it can be either a :term:`sequence <sequence>` or :class:`dict` instance. "
1768
- "The length of the :term:`sequence <sequence>` must match the number of "
1769
- "placeholders, or a :exc:`ProgrammingError` is raised. If a :class:`dict` is "
1770
- "given, it must contain keys for all named parameters. Any extra items are "
1771
- "ignored. Here's an example of both styles:"
1772
- msgstr ""
1773
-
1774
- #: ../../library/sqlite3.rst:1865
1763
+ "second argument of the cursor's :meth:`~Cursor.execute` method."
1764
+ msgstr ""
1765
+
1766
+ #: ../../library/sqlite3.rst:1828
1767
+ msgid ""
1768
+ "An SQL statement may use one of two kinds of placeholders: question marks "
1769
+ "(qmark style) or named placeholders (named style). For the qmark style, "
1770
+ "*parameters* must be a :term:`sequence` whose length must match the number "
1771
+ "of placeholders, or a :exc:`ProgrammingError` is raised. For the named "
1772
+ "style, *parameters* should be an instance of a :class:`dict` (or a "
1773
+ "subclass), which must contain keys for all named parameters; any extra items "
1774
+ "are ignored. Here's an example of both styles:"
1775
+ msgstr ""
1776
+
1777
+ #: ../../library/sqlite3.rst:1866
1778
+ msgid ""
1779
+ ":pep:`249` numeric placeholders are *not* supported. If used, they will be "
1780
+ "interpreted as named placeholders."
1781
+ msgstr ""
1782
+
1783
+ #: ../../library/sqlite3.rst:1873
1775
1784
msgid "How to adapt custom Python types to SQLite values"
1776
1785
msgstr ""
1777
1786
1778
- #: ../../library/sqlite3.rst:1867
1787
+ #: ../../library/sqlite3.rst:1875
1779
1788
msgid ""
1780
1789
"SQLite supports only a limited set of data types natively. To store custom "
1781
1790
"Python types in SQLite databases, *adapt* them to one of the :ref:`Python "
1782
1791
"types SQLite natively understands <sqlite3-types>`."
1783
1792
msgstr ""
1784
1793
1785
- #: ../../library/sqlite3.rst:1871
1794
+ #: ../../library/sqlite3.rst:1879
1786
1795
msgid ""
1787
1796
"There are two ways to adapt Python objects to SQLite types: letting your "
1788
1797
"object adapt itself, or using an *adapter callable*. The latter will take "
@@ -1792,11 +1801,11 @@ msgid ""
1792
1801
"custom adapter functions."
1793
1802
msgstr ""
1794
1803
1795
- #: ../../library/sqlite3.rst:1883
1804
+ #: ../../library/sqlite3.rst:1891
1796
1805
msgid "How to write adaptable objects"
1797
1806
msgstr ""
1798
1807
1799
- #: ../../library/sqlite3.rst:1885
1808
+ #: ../../library/sqlite3.rst:1893
1800
1809
msgid ""
1801
1810
"Suppose we have a :class:`!Point` class that represents a pair of "
1802
1811
"coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The "
@@ -1806,84 +1815,84 @@ msgid ""
1806
1815
"object passed to *protocol* will be of type :class:`PrepareProtocol`."
1807
1816
msgstr ""
1808
1817
1809
- #: ../../library/sqlite3.rst:1916
1818
+ #: ../../library/sqlite3.rst:1924
1810
1819
msgid "How to register adapter callables"
1811
1820
msgstr ""
1812
1821
1813
- #: ../../library/sqlite3.rst:1918
1822
+ #: ../../library/sqlite3.rst:1926
1814
1823
msgid ""
1815
1824
"The other possibility is to create a function that converts the Python "
1816
1825
"object to an SQLite-compatible type. This function can then be registered "
1817
1826
"using :func:`register_adapter`."
1818
1827
msgstr ""
1819
1828
1820
- #: ../../library/sqlite3.rst:1948
1829
+ #: ../../library/sqlite3.rst:1956
1821
1830
msgid "How to convert SQLite values to custom Python types"
1822
1831
msgstr ""
1823
1832
1824
- #: ../../library/sqlite3.rst:1950
1833
+ #: ../../library/sqlite3.rst:1958
1825
1834
msgid ""
1826
1835
"Writing an adapter lets you convert *from* custom Python types *to* SQLite "
1827
1836
"values. To be able to convert *from* SQLite values *to* custom Python types, "
1828
1837
"we use *converters*."
1829
1838
msgstr ""
1830
1839
1831
- #: ../../library/sqlite3.rst:1955
1840
+ #: ../../library/sqlite3.rst:1963
1832
1841
msgid ""
1833
1842
"Let's go back to the :class:`!Point` class. We stored the x and y "
1834
1843
"coordinates separated via semicolons as strings in SQLite."
1835
1844
msgstr ""
1836
1845
1837
- #: ../../library/sqlite3.rst:1958
1846
+ #: ../../library/sqlite3.rst:1966
1838
1847
msgid ""
1839
1848
"First, we'll define a converter function that accepts the string as a "
1840
1849
"parameter and constructs a :class:`!Point` object from it."
1841
1850
msgstr ""
1842
1851
1843
- #: ../../library/sqlite3.rst:1963
1852
+ #: ../../library/sqlite3.rst:1971
1844
1853
msgid ""
1845
1854
"Converter functions are **always** passed a :class:`bytes` object, no matter "
1846
1855
"the underlying SQLite data type."
1847
1856
msgstr ""
1848
1857
1849
- #: ../../library/sqlite3.rst:1972
1858
+ #: ../../library/sqlite3.rst:1980
1850
1859
msgid ""
1851
1860
"We now need to tell :mod:`!sqlite3` when it should convert a given SQLite "
1852
1861
"value. This is done when connecting to a database, using the *detect_types* "
1853
1862
"parameter of :func:`connect`. There are three options:"
1854
1863
msgstr ""
1855
1864
1856
- #: ../../library/sqlite3.rst:1976
1865
+ #: ../../library/sqlite3.rst:1984
1857
1866
msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`"
1858
1867
msgstr ""
1859
1868
1860
- #: ../../library/sqlite3.rst:1977
1869
+ #: ../../library/sqlite3.rst:1985
1861
1870
msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`"
1862
1871
msgstr ""
1863
1872
1864
- #: ../../library/sqlite3.rst:1978
1873
+ #: ../../library/sqlite3.rst:1986
1865
1874
msgid ""
1866
1875
"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3."
1867
1876
"PARSE_COLNAMES``. Column names take precedence over declared types."
1868
1877
msgstr ""
1869
1878
1870
- #: ../../library/sqlite3.rst:1982
1879
+ #: ../../library/sqlite3.rst:1990
1871
1880
msgid "The following example illustrates the implicit and explicit approaches:"
1872
1881
msgstr ""
1873
1882
1874
- #: ../../library/sqlite3.rst:2033
1883
+ #: ../../library/sqlite3.rst:2041
1875
1884
msgid "Adapter and converter recipes"
1876
1885
msgstr ""
1877
1886
1878
- #: ../../library/sqlite3.rst:2035
1887
+ #: ../../library/sqlite3.rst:2043
1879
1888
msgid "This section shows recipes for common adapters and converters."
1880
1889
msgstr ""
1881
1890
1882
- #: ../../library/sqlite3.rst:2097
1891
+ #: ../../library/sqlite3.rst:2105
1883
1892
msgid "How to use connection shortcut methods"
1884
1893
msgstr ""
1885
1894
1886
- #: ../../library/sqlite3.rst:2099
1895
+ #: ../../library/sqlite3.rst:2107
1887
1896
msgid ""
1888
1897
"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :"
1889
1898
"meth:`~Connection.executescript` methods of the :class:`Connection` class, "
@@ -1895,11 +1904,11 @@ msgid ""
1895
1904
"object."
1896
1905
msgstr ""
1897
1906
1898
- #: ../../library/sqlite3.rst:2140
1907
+ #: ../../library/sqlite3.rst:2148
1899
1908
msgid "How to use the connection context manager"
1900
1909
msgstr ""
1901
1910
1902
- #: ../../library/sqlite3.rst:2142
1911
+ #: ../../library/sqlite3.rst:2150
1903
1912
msgid ""
1904
1913
"A :class:`Connection` object can be used as a context manager that "
1905
1914
"automatically commits or rolls back open transactions when leaving the body "
@@ -1909,118 +1918,118 @@ msgid ""
1909
1918
"exception, the transaction is rolled back."
1910
1919
msgstr ""
1911
1920
1912
- #: ../../library/sqlite3.rst:2151
1921
+ #: ../../library/sqlite3.rst:2159
1913
1922
msgid ""
1914
1923
"If there is no open transaction upon leaving the body of the ``with`` "
1915
1924
"statement, the context manager is a no-op."
1916
1925
msgstr ""
1917
1926
1918
- #: ../../library/sqlite3.rst:2156
1927
+ #: ../../library/sqlite3.rst:2164
1919
1928
msgid ""
1920
1929
"The context manager neither implicitly opens a new transaction nor closes "
1921
1930
"the connection."
1922
1931
msgstr ""
1923
1932
1924
- #: ../../library/sqlite3.rst:2189
1933
+ #: ../../library/sqlite3.rst:2197
1925
1934
msgid "How to work with SQLite URIs"
1926
1935
msgstr ""
1927
1936
1928
- #: ../../library/sqlite3.rst:2191
1937
+ #: ../../library/sqlite3.rst:2199
1929
1938
msgid "Some useful URI tricks include:"
1930
1939
msgstr ""
1931
1940
1932
- #: ../../library/sqlite3.rst:2193
1941
+ #: ../../library/sqlite3.rst:2201
1933
1942
msgid "Open a database in read-only mode:"
1934
1943
msgstr ""
1935
1944
1936
- #: ../../library/sqlite3.rst:2202
1945
+ #: ../../library/sqlite3.rst:2210
1937
1946
msgid ""
1938
1947
"Do not implicitly create a new database file if it does not already exist; "
1939
1948
"will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:"
1940
1949
msgstr ""
1941
1950
1942
- #: ../../library/sqlite3.rst:2212
1951
+ #: ../../library/sqlite3.rst:2220
1943
1952
msgid "Create a shared named in-memory database:"
1944
1953
msgstr ""
1945
1954
1946
- #: ../../library/sqlite3.rst:2226
1955
+ #: ../../library/sqlite3.rst:2234
1947
1956
msgid ""
1948
1957
"More information about this feature, including a list of parameters, can be "
1949
1958
"found in the `SQLite URI documentation`_."
1950
1959
msgstr ""
1951
1960
1952
- #: ../../library/sqlite3.rst:2235
1961
+ #: ../../library/sqlite3.rst:2243
1953
1962
msgid "How to create and use row factories"
1954
1963
msgstr ""
1955
1964
1956
- #: ../../library/sqlite3.rst:2237
1965
+ #: ../../library/sqlite3.rst:2245
1957
1966
msgid ""
1958
1967
"By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :"
1959
1968
"class:`!tuple` does not suit your needs, you can use the :class:`sqlite3."
1960
1969
"Row` class or a custom :attr:`~Cursor.row_factory`."
1961
1970
msgstr ""
1962
1971
1963
- #: ../../library/sqlite3.rst:2242
1972
+ #: ../../library/sqlite3.rst:2250
1964
1973
msgid ""
1965
1974
"While :attr:`!row_factory` exists as an attribute both on the :class:"
1966
1975
"`Cursor` and the :class:`Connection`, it is recommended to set :class:"
1967
1976
"`Connection.row_factory`, so all cursors created from the connection will "
1968
1977
"use the same row factory."
1969
1978
msgstr ""
1970
1979
1971
- #: ../../library/sqlite3.rst:2247
1980
+ #: ../../library/sqlite3.rst:2255
1972
1981
msgid ""
1973
1982
":class:`!Row` provides indexed and case-insensitive named access to columns, "
1974
1983
"with minimal memory overhead and performance impact over a :class:`!tuple`. "
1975
1984
"To use :class:`!Row` as a row factory, assign it to the :attr:`!row_factory` "
1976
1985
"attribute:"
1977
1986
msgstr ""
1978
1987
1979
- #: ../../library/sqlite3.rst:2257
1988
+ #: ../../library/sqlite3.rst:2265
1980
1989
msgid "Queries now return :class:`!Row` objects:"
1981
1990
msgstr ""
1982
1991
1983
- #: ../../library/sqlite3.rst:2272
1992
+ #: ../../library/sqlite3.rst:2280
1984
1993
msgid ""
1985
1994
"You can create a custom :attr:`~Cursor.row_factory` that returns each row as "
1986
1995
"a :class:`dict`, with column names mapped to values:"
1987
1996
msgstr ""
1988
1997
1989
- #: ../../library/sqlite3.rst:2281
1998
+ #: ../../library/sqlite3.rst:2289
1990
1999
msgid ""
1991
2000
"Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:"
1992
2001
msgstr ""
1993
2002
1994
- #: ../../library/sqlite3.rst:2291
2003
+ #: ../../library/sqlite3.rst:2299
1995
2004
msgid "The following row factory returns a :term:`named tuple`:"
1996
2005
msgstr ""
1997
2006
1998
- #: ../../library/sqlite3.rst:2302
2007
+ #: ../../library/sqlite3.rst:2310
1999
2008
msgid ":func:`!namedtuple_factory` can be used as follows:"
2000
2009
msgstr ""
2001
2010
2002
- #: ../../library/sqlite3.rst:2317
2011
+ #: ../../library/sqlite3.rst:2325
2003
2012
msgid ""
2004
2013
"With some adjustments, the above recipe can be adapted to use a :class:"
2005
2014
"`~dataclasses.dataclass`, or any other custom class, instead of a :class:"
2006
2015
"`~collections.namedtuple`."
2007
2016
msgstr ""
2008
2017
2009
- #: ../../library/sqlite3.rst:2325
2018
+ #: ../../library/sqlite3.rst:2333
2010
2019
msgid "Explanation"
2011
2020
msgstr "解釋"
2012
2021
2013
- #: ../../library/sqlite3.rst:2330
2022
+ #: ../../library/sqlite3.rst:2338
2014
2023
msgid "Transaction control"
2015
2024
msgstr ""
2016
2025
2017
- #: ../../library/sqlite3.rst:2332
2026
+ #: ../../library/sqlite3.rst:2340
2018
2027
msgid ""
2019
2028
"The :mod:`!sqlite3` module does not adhere to the transaction handling "
2020
2029
"recommended by :pep:`249`."
2021
2030
msgstr ""
2022
2031
2023
- #: ../../library/sqlite3.rst:2335
2032
+ #: ../../library/sqlite3.rst:2343
2024
2033
msgid ""
2025
2034
"If the connection attribute :attr:`~Connection.isolation_level` is not "
2026
2035
"``None``, new transactions are implicitly opened before :meth:`~Cursor."
@@ -2034,7 +2043,7 @@ msgid ""
2034
2043
"attribute."
2035
2044
msgstr ""
2036
2045
2037
- #: ../../library/sqlite3.rst:2348
2046
+ #: ../../library/sqlite3.rst:2356
2038
2047
msgid ""
2039
2048
"If :attr:`~Connection.isolation_level` is set to ``None``, no transactions "
2040
2049
"are implicitly opened at all. This leaves the underlying SQLite library in "
@@ -2044,14 +2053,14 @@ msgid ""
2044
2053
"in_transaction` attribute."
2045
2054
msgstr ""
2046
2055
2047
- #: ../../library/sqlite3.rst:2356
2056
+ #: ../../library/sqlite3.rst:2364
2048
2057
msgid ""
2049
2058
"The :meth:`~Cursor.executescript` method implicitly commits any pending "
2050
2059
"transaction before execution of the given SQL script, regardless of the "
2051
2060
"value of :attr:`~Connection.isolation_level`."
2052
2061
msgstr ""
2053
2062
2054
- #: ../../library/sqlite3.rst:2360
2063
+ #: ../../library/sqlite3.rst:2368
2055
2064
msgid ""
2056
2065
":mod:`!sqlite3` used to implicitly commit an open transaction before DDL "
2057
2066
"statements. This is no longer the case."
0 commit comments