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