diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index f57d5dc7c9..41abd7740c 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-05 00:10+0000\n" +"POT-Creation-Date: 2022-07-29 00:16+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -179,6 +179,16 @@ msgstr "" #: ../../library/concurrent.futures.rst:152 msgid "" +"All threads enqueued to ``ThreadPoolExecutor`` will be joined before the " +"interpreter can exit. Note that the exit handler which does this is executed " +"*before* any exit handlers added using `atexit`. This means exceptions in " +"the main thread must be caught and handled in order to signal threads to " +"exit gracefully. For this reason, it is recommended that " +"``ThreadPoolExecutor`` not be used for long-running tasks." +msgstr "" + +#: ../../library/concurrent.futures.rst:159 +msgid "" "*initializer* is an optional callable that is called at the start of each " "worker thread; *initargs* is a tuple of arguments passed to the " "initializer. Should *initializer* raise an exception, all currently pending " @@ -186,7 +196,7 @@ msgid "" "well as any attempt to submit more jobs to the pool." msgstr "" -#: ../../library/concurrent.futures.rst:158 +#: ../../library/concurrent.futures.rst:165 msgid "" "If *max_workers* is ``None`` or not given, it will default to the number of " "processors on the machine, multiplied by ``5``, assuming that :class:" @@ -195,19 +205,19 @@ msgid "" "`ProcessPoolExecutor`." msgstr "" -#: ../../library/concurrent.futures.rst:166 +#: ../../library/concurrent.futures.rst:173 msgid "" "The *thread_name_prefix* argument was added to allow users to control the :" "class:`threading.Thread` names for worker threads created by the pool for " "easier debugging." msgstr "" -#: ../../library/concurrent.futures.rst:171 -#: ../../library/concurrent.futures.rst:265 +#: ../../library/concurrent.futures.rst:178 +#: ../../library/concurrent.futures.rst:272 msgid "Added the *initializer* and *initargs* arguments." msgstr "新增 *initializer* 與 *initargs* 引數。" -#: ../../library/concurrent.futures.rst:174 +#: ../../library/concurrent.futures.rst:181 msgid "" "Default value of *max_workers* is changed to ``min(32, os.cpu_count() + " "4)``. This default value preserves at least 5 workers for I/O bound tasks. " @@ -215,21 +225,21 @@ msgid "" "And it avoids using very large resources implicitly on many-core machines." msgstr "" -#: ../../library/concurrent.futures.rst:180 +#: ../../library/concurrent.futures.rst:187 msgid "" "ThreadPoolExecutor now reuses idle worker threads before starting " "*max_workers* worker threads too." msgstr "" -#: ../../library/concurrent.futures.rst:187 +#: ../../library/concurrent.futures.rst:194 msgid "ThreadPoolExecutor Example" msgstr "ThreadPoolExecutor 範例" -#: ../../library/concurrent.futures.rst:219 +#: ../../library/concurrent.futures.rst:226 msgid "ProcessPoolExecutor" msgstr "ProcessPoolExecutor" -#: ../../library/concurrent.futures.rst:221 +#: ../../library/concurrent.futures.rst:228 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " "uses a pool of processes to execute calls asynchronously. :class:" @@ -239,20 +249,20 @@ msgid "" "returned." msgstr "" -#: ../../library/concurrent.futures.rst:228 +#: ../../library/concurrent.futures.rst:235 msgid "" "The ``__main__`` module must be importable by worker subprocesses. This " "means that :class:`ProcessPoolExecutor` will not work in the interactive " "interpreter." msgstr "" -#: ../../library/concurrent.futures.rst:231 +#: ../../library/concurrent.futures.rst:238 msgid "" "Calling :class:`Executor` or :class:`Future` methods from a callable " "submitted to a :class:`ProcessPoolExecutor` will result in deadlock." msgstr "" -#: ../../library/concurrent.futures.rst:236 +#: ../../library/concurrent.futures.rst:243 msgid "" "An :class:`Executor` subclass that executes calls asynchronously using a " "pool of at most *max_workers* processes. If *max_workers* is ``None`` or " @@ -266,7 +276,7 @@ msgid "" "not given, the default multiprocessing context is used." msgstr "" -#: ../../library/concurrent.futures.rst:249 +#: ../../library/concurrent.futures.rst:256 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker process; *initargs* is a tuple of arguments passed to the " @@ -275,7 +285,7 @@ msgid "" "well as any attempt to submit more jobs to the pool." msgstr "" -#: ../../library/concurrent.futures.rst:255 +#: ../../library/concurrent.futures.rst:262 msgid "" "When one of the worker processes terminates abruptly, a :exc:" "`BrokenProcessPool` error is now raised. Previously, behaviour was " @@ -283,34 +293,34 @@ msgid "" "or deadlock." msgstr "" -#: ../../library/concurrent.futures.rst:261 +#: ../../library/concurrent.futures.rst:268 msgid "" "The *mp_context* argument was added to allow users to control the " "start_method for worker processes created by the pool." msgstr "" -#: ../../library/concurrent.futures.rst:271 +#: ../../library/concurrent.futures.rst:278 msgid "ProcessPoolExecutor Example" msgstr "ProcessPoolExecutor 範例" -#: ../../library/concurrent.futures.rst:309 +#: ../../library/concurrent.futures.rst:316 msgid "Future Objects" msgstr "" -#: ../../library/concurrent.futures.rst:311 +#: ../../library/concurrent.futures.rst:318 msgid "" "The :class:`Future` class encapsulates the asynchronous execution of a " "callable. :class:`Future` instances are created by :meth:`Executor.submit`." msgstr "" -#: ../../library/concurrent.futures.rst:316 +#: ../../library/concurrent.futures.rst:323 msgid "" "Encapsulates the asynchronous execution of a callable. :class:`Future` " "instances are created by :meth:`Executor.submit` and should not be created " "directly except for testing." msgstr "" -#: ../../library/concurrent.futures.rst:322 +#: ../../library/concurrent.futures.rst:329 msgid "" "Attempt to cancel the call. If the call is currently being executed or " "finished running and cannot be cancelled then the method will return " @@ -318,22 +328,22 @@ msgid "" "``True``." msgstr "" -#: ../../library/concurrent.futures.rst:329 +#: ../../library/concurrent.futures.rst:336 msgid "Return ``True`` if the call was successfully cancelled." msgstr "" -#: ../../library/concurrent.futures.rst:333 +#: ../../library/concurrent.futures.rst:340 msgid "" "Return ``True`` if the call is currently being executed and cannot be " "cancelled." msgstr "" -#: ../../library/concurrent.futures.rst:338 +#: ../../library/concurrent.futures.rst:345 msgid "" "Return ``True`` if the call was successfully cancelled or finished running." msgstr "" -#: ../../library/concurrent.futures.rst:343 +#: ../../library/concurrent.futures.rst:350 msgid "" "Return the value returned by the call. If the call hasn't yet completed then " "this method will wait up to *timeout* seconds. If the call hasn't completed " @@ -342,19 +352,19 @@ msgid "" "``None``, there is no limit to the wait time." msgstr "" -#: ../../library/concurrent.futures.rst:350 -#: ../../library/concurrent.futures.rst:364 +#: ../../library/concurrent.futures.rst:357 +#: ../../library/concurrent.futures.rst:371 msgid "" "If the future is cancelled before completing then :exc:`.CancelledError` " "will be raised." msgstr "" -#: ../../library/concurrent.futures.rst:353 +#: ../../library/concurrent.futures.rst:360 msgid "" "If the call raised an exception, this method will raise the same exception." msgstr "" -#: ../../library/concurrent.futures.rst:357 +#: ../../library/concurrent.futures.rst:364 msgid "" "Return the exception raised by the call. If the call hasn't yet completed " "then this method will wait up to *timeout* seconds. If the call hasn't " @@ -363,18 +373,18 @@ msgid "" "*timeout* is not specified or ``None``, there is no limit to the wait time." msgstr "" -#: ../../library/concurrent.futures.rst:367 +#: ../../library/concurrent.futures.rst:374 msgid "If the call completed without raising, ``None`` is returned." msgstr "" -#: ../../library/concurrent.futures.rst:371 +#: ../../library/concurrent.futures.rst:378 msgid "" "Attaches the callable *fn* to the future. *fn* will be called, with the " "future as its only argument, when the future is cancelled or finishes " "running." msgstr "" -#: ../../library/concurrent.futures.rst:375 +#: ../../library/concurrent.futures.rst:382 msgid "" "Added callables are called in the order that they were added and are always " "called in a thread belonging to the process that added them. If the " @@ -383,26 +393,26 @@ msgid "" "behavior is undefined." msgstr "" -#: ../../library/concurrent.futures.rst:381 +#: ../../library/concurrent.futures.rst:388 msgid "" "If the future has already completed or been cancelled, *fn* will be called " "immediately." msgstr "" -#: ../../library/concurrent.futures.rst:384 +#: ../../library/concurrent.futures.rst:391 msgid "" "The following :class:`Future` methods are meant for use in unit tests and :" "class:`Executor` implementations." msgstr "" -#: ../../library/concurrent.futures.rst:389 +#: ../../library/concurrent.futures.rst:396 msgid "" "This method should only be called by :class:`Executor` implementations " "before executing the work associated with the :class:`Future` and by unit " "tests." msgstr "" -#: ../../library/concurrent.futures.rst:393 +#: ../../library/concurrent.futures.rst:400 msgid "" "If the method returns ``False`` then the :class:`Future` was cancelled, i." "e. :meth:`Future.cancel` was called and returned `True`. Any threads " @@ -410,49 +420,49 @@ msgid "" "or :func:`wait`) will be woken up." msgstr "" -#: ../../library/concurrent.futures.rst:398 +#: ../../library/concurrent.futures.rst:405 msgid "" "If the method returns ``True`` then the :class:`Future` was not cancelled " "and has been put in the running state, i.e. calls to :meth:`Future.running` " "will return `True`." msgstr "" -#: ../../library/concurrent.futures.rst:402 +#: ../../library/concurrent.futures.rst:409 msgid "" "This method can only be called once and cannot be called after :meth:`Future." "set_result` or :meth:`Future.set_exception` have been called." msgstr "" -#: ../../library/concurrent.futures.rst:408 +#: ../../library/concurrent.futures.rst:415 msgid "" "Sets the result of the work associated with the :class:`Future` to *result*." msgstr "" -#: ../../library/concurrent.futures.rst:411 -#: ../../library/concurrent.futures.rst:424 +#: ../../library/concurrent.futures.rst:418 +#: ../../library/concurrent.futures.rst:431 msgid "" "This method should only be used by :class:`Executor` implementations and " "unit tests." msgstr "" -#: ../../library/concurrent.futures.rst:414 -#: ../../library/concurrent.futures.rst:427 +#: ../../library/concurrent.futures.rst:421 +#: ../../library/concurrent.futures.rst:434 msgid "" "This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" "`Future` is already done." msgstr "" -#: ../../library/concurrent.futures.rst:421 +#: ../../library/concurrent.futures.rst:428 msgid "" "Sets the result of the work associated with the :class:`Future` to the :" "class:`Exception` *exception*." msgstr "" -#: ../../library/concurrent.futures.rst:433 +#: ../../library/concurrent.futures.rst:440 msgid "Module Functions" msgstr "模組函式" -#: ../../library/concurrent.futures.rst:437 +#: ../../library/concurrent.futures.rst:444 msgid "" "Wait for the :class:`Future` instances (possibly created by different :class:" "`Executor` instances) given by *fs* to complete. Duplicate futures given to " @@ -463,55 +473,55 @@ msgid "" "running futures)." msgstr "" -#: ../../library/concurrent.futures.rst:445 +#: ../../library/concurrent.futures.rst:452 msgid "" "*timeout* can be used to control the maximum number of seconds to wait " "before returning. *timeout* can be an int or float. If *timeout* is not " "specified or ``None``, there is no limit to the wait time." msgstr "" -#: ../../library/concurrent.futures.rst:449 +#: ../../library/concurrent.futures.rst:456 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/concurrent.futures.rst:455 +#: ../../library/concurrent.futures.rst:462 msgid "Constant" msgstr "常數" -#: ../../library/concurrent.futures.rst:455 +#: ../../library/concurrent.futures.rst:462 msgid "Description" msgstr "描述" -#: ../../library/concurrent.futures.rst:457 +#: ../../library/concurrent.futures.rst:464 msgid ":const:`FIRST_COMPLETED`" msgstr ":const:`FIRST_COMPLETED`" -#: ../../library/concurrent.futures.rst:457 +#: ../../library/concurrent.futures.rst:464 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/concurrent.futures.rst:460 +#: ../../library/concurrent.futures.rst:467 msgid ":const:`FIRST_EXCEPTION`" msgstr ":const:`FIRST_EXCEPTION`" -#: ../../library/concurrent.futures.rst:460 +#: ../../library/concurrent.futures.rst:467 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" "`ALL_COMPLETED`." msgstr "" -#: ../../library/concurrent.futures.rst:466 +#: ../../library/concurrent.futures.rst:473 msgid ":const:`ALL_COMPLETED`" msgstr ":const:`ALL_COMPLETED`" -#: ../../library/concurrent.futures.rst:466 +#: ../../library/concurrent.futures.rst:473 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/concurrent.futures.rst:472 +#: ../../library/concurrent.futures.rst:479 msgid "" "Returns an iterator over the :class:`Future` instances (possibly created by " "different :class:`Executor` instances) given by *fs* that yields futures as " @@ -525,49 +535,49 @@ msgid "" "wait time." msgstr "" -#: ../../library/concurrent.futures.rst:486 +#: ../../library/concurrent.futures.rst:493 msgid ":pep:`3148` -- futures - execute computations asynchronously" msgstr "" -#: ../../library/concurrent.futures.rst:486 +#: ../../library/concurrent.futures.rst:493 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: ../../library/concurrent.futures.rst:491 +#: ../../library/concurrent.futures.rst:498 msgid "Exception classes" msgstr "" -#: ../../library/concurrent.futures.rst:497 +#: ../../library/concurrent.futures.rst:504 msgid "Raised when a future is cancelled." msgstr "" -#: ../../library/concurrent.futures.rst:501 +#: ../../library/concurrent.futures.rst:508 msgid "Raised when a future operation exceeds the given timeout." msgstr "" -#: ../../library/concurrent.futures.rst:505 +#: ../../library/concurrent.futures.rst:512 msgid "" "Derived from :exc:`RuntimeError`, this exception class is raised when an " "executor is broken for some reason, and cannot be used to submit or execute " "new tasks." msgstr "" -#: ../../library/concurrent.futures.rst:513 +#: ../../library/concurrent.futures.rst:520 msgid "" "Raised when an operation is performed on a future that is not allowed in the " "current state." msgstr "" -#: ../../library/concurrent.futures.rst:522 +#: ../../library/concurrent.futures.rst:529 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " "is raised when one of the workers of a :class:`ThreadPoolExecutor` has " "failed initializing." msgstr "" -#: ../../library/concurrent.futures.rst:532 +#: ../../library/concurrent.futures.rst:539 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" "`RuntimeError`), this exception class is raised when one of the workers of " diff --git a/library/datetime.po b/library/datetime.po index ab4ce95b0c..7e04d28566 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-22 00:18+0000\n" +"POT-Creation-Date: 2022-07-30 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -813,7 +813,7 @@ msgid "``date2 = date1 + timedelta``" msgstr "``date2 = date1 + timedelta``" #: ../../library/datetime.rst:584 -msgid "*date2* is ``timedelta.days`` days removed from *date1*. (1)" +msgid "*date2* will be ``timedelta.days`` days after *date1*. (1)" msgstr "" #: ../../library/datetime.rst:587 diff --git a/library/sqlite3.po b/library/sqlite3.po index 26ee869167..53d9a9817d 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-23 00:17+0000\n" +"POT-Creation-Date: 2022-07-30 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,7 +26,11 @@ msgstr "" msgid "**Source code:** :source:`Lib/sqlite3/`" msgstr "**原始碼:**\\ :source:`Lib/sqlite3/`" -#: ../../library/sqlite3.rst:13 +#: ../../library/sqlite3.rst:15 ../../library/sqlite3.rst:1108 +msgid "Introduction" +msgstr "簡介" + +#: ../../library/sqlite3.rst:17 msgid "" "SQLite is a C library that provides a lightweight disk-based database that " "doesn't require a separate server process and allows accessing the database " @@ -36,51 +40,59 @@ msgid "" "PostgreSQL or Oracle." msgstr "" -#: ../../library/sqlite3.rst:20 +#: ../../library/sqlite3.rst:24 msgid "" "The sqlite3 module was written by Gerhard Häring. It provides an SQL " "interface compliant with the DB-API 2.0 specification described by :pep:" "`249`, and requires SQLite 3.7.15 or newer." msgstr "" -#: ../../library/sqlite3.rst:24 +#: ../../library/sqlite3.rst:32 +msgid "Tutorial" +msgstr "" + +#: ../../library/sqlite3.rst:34 msgid "" "To use the module, start by creating a :class:`Connection` object that " "represents the database. Here the data will be stored in the :file:`example." "db` file::" msgstr "" -#: ../../library/sqlite3.rst:31 +#: ../../library/sqlite3.rst:41 msgid "" "The special path name ``:memory:`` can be provided to create a temporary " "database in RAM." msgstr "" -#: ../../library/sqlite3.rst:34 +#: ../../library/sqlite3.rst:44 msgid "" "Once a :class:`Connection` has been established, create a :class:`Cursor` " "object and call its :meth:`~Cursor.execute` method to perform SQL commands::" msgstr "" -#: ../../library/sqlite3.rst:53 +#: ../../library/sqlite3.rst:63 msgid "" "The saved data is persistent: it can be reloaded in a subsequent session " "even after restarting the Python interpreter::" msgstr "" -#: ../../library/sqlite3.rst:60 +#: ../../library/sqlite3.rst:70 +msgid "At this point, our database only contains one row::" +msgstr "" + +#: ../../library/sqlite3.rst:76 msgid "" -"To retrieve data after executing a SELECT statement, either treat the cursor " -"as an :term:`iterator`, call the cursor's :meth:`~Cursor.fetchone` method to " -"retrieve a single matching row, or call :meth:`~Cursor.fetchall` to get a " -"list of the matching rows." +"The result is a one-item :class:`tuple`: one row, with one column. Now, let " +"us insert three more rows of data, using :meth:`~Cursor.executemany`::" msgstr "" -#: ../../library/sqlite3.rst:65 -msgid "This example uses the iterator form::" +#: ../../library/sqlite3.rst:88 +msgid "" +"Then, retrieve the data by iterating over the result of a ``SELECT`` " +"statement::" msgstr "" -#: ../../library/sqlite3.rst:78 +#: ../../library/sqlite3.rst:101 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -88,7 +100,7 @@ msgid "" "com/327/>`_ for a humorous example of what can go wrong)::" msgstr "" -#: ../../library/sqlite3.rst:87 +#: ../../library/sqlite3.rst:110 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -104,50 +116,50 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:107 +#: ../../library/sqlite3.rst:130 msgid "https://www.sqlite.org" msgstr "https://www.sqlite.org" -#: ../../library/sqlite3.rst:106 +#: ../../library/sqlite3.rst:129 msgid "" "The SQLite web page; the documentation describes the syntax and the " "available data types for the supported SQL dialect." msgstr "" -#: ../../library/sqlite3.rst:110 +#: ../../library/sqlite3.rst:133 msgid "https://www.w3schools.com/sql/" msgstr "https://www.w3schools.com/sql/" -#: ../../library/sqlite3.rst:110 +#: ../../library/sqlite3.rst:133 msgid "Tutorial, reference and examples for learning SQL syntax." msgstr "" -#: ../../library/sqlite3.rst:112 +#: ../../library/sqlite3.rst:135 msgid ":pep:`249` - Database API Specification 2.0" msgstr "" -#: ../../library/sqlite3.rst:113 +#: ../../library/sqlite3.rst:136 msgid "PEP written by Marc-André Lemburg." msgstr "PEP 由 Marc-André Lemburg 撰寫。" -#: ../../library/sqlite3.rst:119 +#: ../../library/sqlite3.rst:142 msgid "Module functions and constants" msgstr "" -#: ../../library/sqlite3.rst:124 +#: ../../library/sqlite3.rst:147 msgid "" "String constant stating the supported DB-API level. Required by the DB-API. " "Hard-coded to ``\"2.0\"``." msgstr "" -#: ../../library/sqlite3.rst:129 +#: ../../library/sqlite3.rst:152 msgid "" "String constant stating the type of parameter marker formatting expected by " "the :mod:`sqlite3` module. Required by the DB-API. Hard-coded to ``\"qmark" "\"``." msgstr "" -#: ../../library/sqlite3.rst:135 +#: ../../library/sqlite3.rst:158 msgid "" "The :mod:`sqlite3` module supports both ``qmark`` and ``numeric`` DB-API " "parameter styles, because that is what the underlying SQLite library " @@ -155,28 +167,30 @@ msgid "" "``paramstyle`` attribute." msgstr "" -#: ../../library/sqlite3.rst:142 +#: ../../library/sqlite3.rst:165 msgid "" -"The version number of this module, as a string. This is not the version of " -"the SQLite library." +"Version number of this module as a :class:`string `. This is not the " +"version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:148 +#: ../../library/sqlite3.rst:171 msgid "" -"The version number of this module, as a tuple of integers. This is not the " -"version of the SQLite library." +"Version number of this module as a :class:`tuple` of :class:`integers " +"`. This is not the version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:154 -msgid "The version number of the run-time SQLite library, as a string." +#: ../../library/sqlite3.rst:177 +msgid "" +"Version number of the runtime SQLite library as a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:159 +#: ../../library/sqlite3.rst:182 msgid "" -"The version number of the run-time SQLite library, as a tuple of integers." +"Version number of the runtime SQLite library as a :class:`tuple` of :class:" +"`integers `." msgstr "" -#: ../../library/sqlite3.rst:164 +#: ../../library/sqlite3.rst:188 msgid "" "Integer constant required by the DB-API, stating the level of thread safety " "the :mod:`sqlite3` module supports. Currently hard-coded to ``1``, meaning *" @@ -185,13 +199,13 @@ msgid "" "time threaded mode using the following query::" msgstr "" -#: ../../library/sqlite3.rst:177 +#: ../../library/sqlite3.rst:201 msgid "" "Note that the `SQLITE_THREADSAFE levels `_ do not match the DB-API 2.0 ``threadsafety`` levels." msgstr "" -#: ../../library/sqlite3.rst:184 +#: ../../library/sqlite3.rst:208 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " "look up a converter function using the declared types for each column. The " @@ -200,13 +214,13 @@ msgid "" "converter dictionary key. For example:" msgstr "" -#: ../../library/sqlite3.rst:201 +#: ../../library/sqlite3.rst:225 msgid "" "This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:207 +#: ../../library/sqlite3.rst:231 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " "look up a converter function by using the type name, parsed from the query " @@ -214,13 +228,13 @@ msgid "" "in square brackets (``[]``)." msgstr "" -#: ../../library/sqlite3.rst:217 +#: ../../library/sqlite3.rst:241 msgid "" "This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:224 +#: ../../library/sqlite3.rst:248 msgid "Open a connection to an SQLite database." msgstr "" @@ -228,13 +242,13 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/sqlite3.rst:226 +#: ../../library/sqlite3.rst:250 msgid "" "The path to the database file to be opened. Pass ``\":memory:\"`` to open a " "connection to a database that is in RAM instead of on disk." msgstr "" -#: ../../library/sqlite3.rst:232 +#: ../../library/sqlite3.rst:256 msgid "" "How many seconds the connection should wait before raising an exception, if " "the database is locked by another connection. If another connection opens a " @@ -242,7 +256,7 @@ msgid "" "is committed. Default five seconds." msgstr "" -#: ../../library/sqlite3.rst:240 +#: ../../library/sqlite3.rst:264 msgid "" "Control whether and how data types not :ref:`natively supported by SQLite " "` are looked up to be converted to Python types, using the " @@ -255,7 +269,7 @@ msgid "" "disabled." msgstr "" -#: ../../library/sqlite3.rst:255 +#: ../../library/sqlite3.rst:279 msgid "" "The :attr:`~Connection.isolation_level` of the connection, controlling " "whether and how transactions are implicitly opened. Can be ``\"DEFERRED\"`` " @@ -264,7 +278,7 @@ msgid "" "transactions` for more." msgstr "" -#: ../../library/sqlite3.rst:263 +#: ../../library/sqlite3.rst:287 msgid "" "If :const:`True` (default), only the creating thread may use the connection. " "If :const:`False`, the connection may be shared across multiple threads; if " @@ -272,19 +286,19 @@ msgid "" "corruption." msgstr "" -#: ../../library/sqlite3.rst:270 +#: ../../library/sqlite3.rst:294 msgid "" "A custom subclass of :class:`Connection` to create the connection with, if " "not the default :class:`Connection` class." msgstr "" -#: ../../library/sqlite3.rst:275 +#: ../../library/sqlite3.rst:299 msgid "" "The number of statements that ``sqlite3`` should internally cache for this " "connection, to avoid parsing overhead. By default, 100 statements." msgstr "" -#: ../../library/sqlite3.rst:281 +#: ../../library/sqlite3.rst:305 msgid "" "If set to :const:`True`, *database* is interpreted as a :abbr:`URI (Uniform " "Resource Identifier)` with a file path and an optional query string. The " @@ -297,32 +311,32 @@ msgstr "" msgid "Return type" msgstr "" -#: ../../library/sqlite3.rst:293 +#: ../../library/sqlite3.rst:317 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." msgstr "" -#: ../../library/sqlite3.rst:294 +#: ../../library/sqlite3.rst:318 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect/handle`` with " "argument ``connection_handle``." msgstr "" -#: ../../library/sqlite3.rst:296 +#: ../../library/sqlite3.rst:320 msgid "The *uri* parameter." msgstr "*uri* 參數。" -#: ../../library/sqlite3.rst:299 +#: ../../library/sqlite3.rst:323 msgid "" "*database* can now also be a :term:`path-like object`, not only a string." msgstr "" -#: ../../library/sqlite3.rst:302 +#: ../../library/sqlite3.rst:326 msgid "The ``sqlite3.connect/handle`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:308 +#: ../../library/sqlite3.rst:332 msgid "" "Register the *converter* callable to convert SQLite objects of type " "*typename* into a Python object of a specific type. The converter is invoked " @@ -332,13 +346,13 @@ msgid "" "type detection works." msgstr "" -#: ../../library/sqlite3.rst:316 +#: ../../library/sqlite3.rst:340 msgid "" "Note: *typename* and the name of the type in your query are matched case-" "insensitively." msgstr "" -#: ../../library/sqlite3.rst:322 +#: ../../library/sqlite3.rst:346 msgid "" "Register an *adapter* callable to adapt the Python type *type* into an " "SQLite type. The adapter is called with a Python object of type *type* as " @@ -346,7 +360,7 @@ msgid "" "natively understands`." msgstr "" -#: ../../library/sqlite3.rst:331 +#: ../../library/sqlite3.rst:355 msgid "" "Returns :const:`True` if the string *statement* contains one or more " "complete SQL statements terminated by semicolons. It does not verify that " @@ -354,29 +368,44 @@ msgid "" "literals and the statement is terminated by a semicolon." msgstr "" -#: ../../library/sqlite3.rst:336 +#: ../../library/sqlite3.rst:360 msgid "" "This can be used to build a shell for SQLite, as in the following example:" msgstr "" -#: ../../library/sqlite3.rst:344 +#: ../../library/sqlite3.rst:368 msgid "" -"By default you will not get any tracebacks in user-defined functions, " -"aggregates, converters, authorizer callbacks etc. If you want to debug them, " -"you can call this function with *flag* set to ``True``. Afterwards, you will " -"get tracebacks from callbacks on ``sys.stderr``. Use :const:`False` to " -"disable the feature again." +"Enable or disable callback tracebacks. By default you will not get any " +"tracebacks in user-defined functions, aggregates, converters, authorizer " +"callbacks etc. If you want to debug them, you can call this function with " +"*flag* set to ``True``. Afterwards, you will get tracebacks from callbacks " +"on ``sys.stderr``. Use :const:`False` to disable the feature again." msgstr "" -#: ../../library/sqlite3.rst:354 +#: ../../library/sqlite3.rst:379 msgid "Connection Objects" msgstr "" -#: ../../library/sqlite3.rst:358 +#: ../../library/sqlite3.rst:383 +msgid "" +"Each open SQLite database is represented by a ``Connection`` object, which " +"is created using :func:`sqlite3.connect`. Their main purpose is creating :" +"class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." +msgstr "" + +#: ../../library/sqlite3.rst:390 +msgid ":ref:`sqlite3-connection-shortcuts`" +msgstr "" + +#: ../../library/sqlite3.rst:391 +msgid ":ref:`sqlite3-connection-context-manager`" +msgstr "" + +#: ../../library/sqlite3.rst:393 msgid "An SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:362 +#: ../../library/sqlite3.rst:397 msgid "" "This attribute controls the :ref:`transaction handling ` performed by ``sqlite3``. If set to :const:`None`, " @@ -386,159 +415,204 @@ msgid "" "` is performed." msgstr "" -#: ../../library/sqlite3.rst:370 +#: ../../library/sqlite3.rst:405 msgid "" "If not overridden by the *isolation_level* parameter of :func:`connect`, the " "default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." msgstr "" -#: ../../library/sqlite3.rst:375 +#: ../../library/sqlite3.rst:410 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: ../../library/sqlite3.rst:378 +#: ../../library/sqlite3.rst:413 msgid "" ":const:`True` if a transaction is active (there are uncommitted changes), :" "const:`False` otherwise." msgstr "" -#: ../../library/sqlite3.rst:385 +#: ../../library/sqlite3.rst:420 msgid "" -"The cursor method accepts a single optional parameter *factory*. If " -"supplied, this must be a callable returning an instance of :class:`Cursor` " -"or its subclasses." +"Create and return a :class:`Cursor` object. The cursor method accepts a " +"single optional parameter *factory*. If supplied, this must be a callable " +"returning an instance of :class:`Cursor` or its subclasses." msgstr "" -#: ../../library/sqlite3.rst:391 +#: ../../library/sqlite3.rst:427 msgid "" "Commit any pending transaction to the database. If there is no open " "transaction, this method is a no-op." msgstr "" -#: ../../library/sqlite3.rst:396 +#: ../../library/sqlite3.rst:432 msgid "" "Roll back to the start of any pending transaction. If there is no open " "transaction, this method is a no-op." msgstr "" -#: ../../library/sqlite3.rst:401 +#: ../../library/sqlite3.rst:437 msgid "" "Close the database connection. Any pending transaction is not committed " "implicitly; make sure to :meth:`commit` before closing to avoid losing " "pending changes." msgstr "" -#: ../../library/sqlite3.rst:408 +#: ../../library/sqlite3.rst:444 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:414 +#: ../../library/sqlite3.rst:450 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:420 +#: ../../library/sqlite3.rst:456 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:426 +#: ../../library/sqlite3.rst:462 +msgid "Create or remove a user-defined SQL function." +msgstr "" + +#: ../../library/sqlite3.rst:464 +msgid "The name of the SQL function." +msgstr "" + +#: ../../library/sqlite3.rst:468 msgid "" -"Creates a user-defined function that you can later use from within SQL " -"statements under the function name *name*. *narg* is the number of " -"parameters the function accepts (if *narg* is -1, the function may take any " -"number of arguments), and *func* is a Python callable that is called as the " -"SQL function. If *deterministic* is true, the created function is marked as " -"`deterministic `_, which allows " -"SQLite to perform additional optimizations. This flag is supported by SQLite " -"3.8.3 or higher, :exc:`NotSupportedError` will be raised if used with older " -"versions." +"The number of arguments the SQL function can accept. If ``-1``, it may take " +"any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:436 +#: ../../library/sqlite3.rst:473 msgid "" -"The function can return any of :ref:`the types natively supported by SQLite " -"`." +"A callable that is called when the SQL function is invoked. The callable " +"must return :ref:`a type natively supported by SQLite `. Set " +"to :const:`None` to remove an existing SQL function." +msgstr "" + +#: ../../library/sqlite3.rst:480 +msgid "" +"If :const:`True`, the created SQL function is marked as `deterministic " +"`_, which allows SQLite to perform " +"additional optimizations." +msgstr "" + +#: ../../library/sqlite3.rst:0 +msgid "Raises" +msgstr "" + +#: ../../library/sqlite3.rst:486 +msgid "If *deterministic* is used with SQLite versions older than 3.8.3." msgstr "" -#: ../../library/sqlite3.rst:439 -msgid "The *deterministic* parameter was added." +#: ../../library/sqlite3.rst:489 +msgid "The *deterministic* parameter." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:442 ../../library/sqlite3.rst:459 -#: ../../library/sqlite3.rst:588 ../../library/sqlite3.rst:746 +#: ../../library/sqlite3.rst:492 ../../library/sqlite3.rst:523 +#: ../../library/sqlite3.rst:658 ../../library/sqlite3.rst:680 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:449 -msgid "Creates a user-defined aggregate function." +#: ../../library/sqlite3.rst:499 +msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:451 +#: ../../library/sqlite3.rst:501 +msgid "The name of the SQL aggregate function." +msgstr "" + +#: ../../library/sqlite3.rst:505 msgid "" -"The aggregate class must implement a ``step`` method, which accepts the " -"number of parameters *n_arg* (if *n_arg* is -1, the function may take any " -"number of arguments), and a ``finalize`` method which will return the final " -"result of the aggregate." +"The number of arguments the SQL aggregate function can accept. If ``-1``, it " +"may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:456 +#: ../../library/sqlite3.rst:510 +msgid "" +"A class must implement the following methods: * ``step()``: Add a row to " +"the aggregate. * ``finalize()``: Return the final result of the aggregate " +"as :ref:`a type natively supported by SQLite `. The number " +"of arguments that the ``step()`` method must accept is controlled by " +"*n_arg*. Set to :const:`None` to remove an existing SQL aggregate function." +msgstr "" + +#: ../../library/sqlite3.rst:511 +msgid "A class must implement the following methods:" +msgstr "" + +#: ../../library/sqlite3.rst:513 +msgid "``step()``: Add a row to the aggregate." +msgstr "" + +#: ../../library/sqlite3.rst:514 msgid "" -"The ``finalize`` method can return any of :ref:`the types natively supported " -"by SQLite `." +"``finalize()``: Return the final result of the aggregate as :ref:`a type " +"natively supported by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:466 +#: ../../library/sqlite3.rst:517 +msgid "" +"The number of arguments that the ``step()`` method must accept is controlled " +"by *n_arg*." +msgstr "" + +#: ../../library/sqlite3.rst:520 +msgid "Set to :const:`None` to remove an existing SQL aggregate function." +msgstr "" + +#: ../../library/sqlite3.rst:530 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: ../../library/sqlite3.rst:470 +#: ../../library/sqlite3.rst:534 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:471 +#: ../../library/sqlite3.rst:535 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:472 +#: ../../library/sqlite3.rst:536 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:474 +#: ../../library/sqlite3.rst:538 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:478 +#: ../../library/sqlite3.rst:542 msgid "Remove a collation function by setting *callable* to :const:`None`." msgstr "" -#: ../../library/sqlite3.rst:483 +#: ../../library/sqlite3.rst:547 msgid "" -"You can call this method from a different thread to abort any queries that " -"might be executing on the connection. The query will then abort and the " -"caller will get an exception." +"Call this method from a different thread to abort any queries that might be " +"executing on the connection. Aborted queries will raise an exception." msgstr "" -#: ../../library/sqlite3.rst:490 +#: ../../library/sqlite3.rst:554 msgid "" -"This routine registers a callback. The callback is invoked for each attempt " -"to access a column of a table in the database. The callback should return :" +"Register callable *authorizer_callback* to be invoked for each attempt to " +"access a column of a table in the database. The callback should return :" "const:`SQLITE_OK` if access is allowed, :const:`SQLITE_DENY` if the entire " "SQL statement should be aborted with an error and :const:`SQLITE_IGNORE` if " "the column should be treated as a NULL value. These constants are available " "in the :mod:`sqlite3` module." msgstr "" -#: ../../library/sqlite3.rst:497 +#: ../../library/sqlite3.rst:561 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or :const:`None` " @@ -549,7 +623,7 @@ msgid "" "code." msgstr "" -#: ../../library/sqlite3.rst:504 +#: ../../library/sqlite3.rst:568 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -557,34 +631,34 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:511 +#: ../../library/sqlite3.rst:575 msgid "" -"This routine registers a callback. The callback is invoked for every *n* " +"Register callable *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " "get called from SQLite during long-running operations, for example to update " "a GUI." msgstr "" -#: ../../library/sqlite3.rst:516 +#: ../../library/sqlite3.rst:580 msgid "" "If you want to clear any previously installed progress handler, call the " "method with :const:`None` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:519 +#: ../../library/sqlite3.rst:583 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise an :exc:`OperationalError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:526 +#: ../../library/sqlite3.rst:590 msgid "" -"Registers *trace_callback* to be called for each SQL statement that is " -"actually executed by the SQLite backend." +"Register callable *trace_callback* to be invoked for each SQL statement that " +"is actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:593 msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " @@ -594,66 +668,71 @@ msgid "" "of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:537 +#: ../../library/sqlite3.rst:601 msgid "" "Passing :const:`None` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:540 +#: ../../library/sqlite3.rst:604 msgid "" "Exceptions raised in the trace callback are not propagated. As a development " "and debugging aid, use :meth:`~sqlite3.enable_callback_tracebacks` to enable " "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: ../../library/sqlite3.rst:550 +#: ../../library/sqlite3.rst:614 msgid "" -"This routine allows/disallows the SQLite engine to load SQLite extensions " -"from shared libraries. SQLite extensions can define new functions, " -"aggregates or whole new virtual table implementations. One well-known " -"extension is the fulltext-search extension distributed with SQLite." +"Enable the SQLite engine to load SQLite extensions from shared libraries if " +"*enabled* is :const:`True`; else, disallow loading SQLite extensions. SQLite " +"extensions can define new functions, aggregates or whole new virtual table " +"implementations. One well-known extension is the fulltext-search extension " +"distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:555 ../../library/sqlite3.rst:572 -msgid "Loadable extensions are disabled by default. See [#f1]_." +#: ../../library/sqlite3.rst:623 +msgid "" +"The ``sqlite3`` module is not built with loadable extension support by " +"default, because some platforms (notably macOS) have SQLite libraries which " +"are compiled without this feature. To get loadable extension support, you " +"must pass the :option:`--enable-loadable-sqlite-extensions` option to :" +"program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:557 +#: ../../library/sqlite3.rst:630 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." msgstr "" -#: ../../library/sqlite3.rst:561 +#: ../../library/sqlite3.rst:634 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:568 +#: ../../library/sqlite3.rst:641 msgid "" -"This routine loads an SQLite extension from a shared library. You have to " -"enable extension loading with :meth:`enable_load_extension` before you can " -"use this routine." +"Load an SQLite extension from a shared library located at *path*. Enable " +"extension loading with :meth:`enable_load_extension` before calling this " +"method." msgstr "" -#: ../../library/sqlite3.rst:574 +#: ../../library/sqlite3.rst:645 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." msgstr "" -#: ../../library/sqlite3.rst:578 +#: ../../library/sqlite3.rst:649 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:583 +#: ../../library/sqlite3.rst:654 msgid "" -"You can change this attribute to a callable that accepts the cursor and the " -"original row as a tuple and will return the real result row. This way, you " -"can implement more advanced ways of returning results, such as returning an " -"object that can also access columns by name." +"A callable that accepts two arguments, a :class:`Cursor` object and the raw " +"row results as a :class:`tuple`, and returns a custom object representing an " +"SQLite row." msgstr "" -#: ../../library/sqlite3.rst:592 +#: ../../library/sqlite3.rst:662 msgid "" "If returning a tuple doesn't suffice and you want name-based access to " "columns, you should consider setting :attr:`row_factory` to the highly " @@ -663,107 +742,115 @@ msgid "" "approach or even a db_row based solution." msgstr "" -#: ../../library/sqlite3.rst:604 +#: ../../library/sqlite3.rst:674 msgid "" -"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 :mod:`sqlite3` module will return :class:`str` objects for ``TEXT``. If " -"you want to return :class:`bytes` instead, you can set it to :class:`bytes`." +"A callable that accepts a :class:`bytes` parameter and returns a text " +"representation of it. The callable is invoked for SQLite values with the " +"``TEXT`` data type. By default, this attribute is set to :class:`str`. If " +"you want to return ``bytes`` instead, set *text_factory* to ``bytes``." msgstr "" -#: ../../library/sqlite3.rst:609 +#: ../../library/sqlite3.rst:687 msgid "" -"You can also set it to any other callable that accepts a single bytestring " -"parameter and returns the resulting object." -msgstr "" - -#: ../../library/sqlite3.rst:612 -msgid "See the following example code for illustration:" -msgstr "" - -#: ../../library/sqlite3.rst:619 -msgid "" -"Returns the total number of database rows that have been modified, inserted, " +"Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:625 +#: ../../library/sqlite3.rst:693 msgid "" -"Returns an iterator to dump the database in an SQL text format. Useful when " -"saving an in-memory database for later restoration. This function provides " -"the same capabilities as the :kbd:`.dump` command in the :program:`sqlite3` " -"shell." +"Return an :term:`iterator` to dump the database as SQL source code. Useful " +"when saving an in-memory database for later restoration. Similar to the ``." +"dump`` command in the :program:`sqlite3` shell." msgstr "" -#: ../../library/sqlite3.rst:630 +#: ../../library/sqlite3.rst:697 ../../library/sqlite3.rst:828 +#: ../../library/sqlite3.rst:847 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/sqlite3.rst:644 +#: ../../library/sqlite3.rst:711 +msgid "Create a backup of an SQLite database." +msgstr "" + +#: ../../library/sqlite3.rst:713 msgid "" -"This method makes a backup of an SQLite database even while it's being " -"accessed by other clients, or concurrently by the same connection. The copy " -"will be written into the mandatory argument *target*, that must be another :" -"class:`Connection` instance." +"Works even if the database is being accessed by other clients or " +"concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:649 +#: ../../library/sqlite3.rst:716 +msgid "The database connection to save the backup to." +msgstr "" + +#: ../../library/sqlite3.rst:720 msgid "" -"By default, or when *pages* is either ``0`` or a negative integer, the " -"entire database is copied in a single step; otherwise the method performs a " -"loop copying up to *pages* pages at a time." +"The number of pages to copy at a time. If equal to or less than ``0``, the " +"entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: ../../library/sqlite3.rst:653 +#: ../../library/sqlite3.rst:727 msgid "" -"If *progress* is specified, it must either be ``None`` or a callable object " -"that will be executed at each iteration with three integer arguments, " -"respectively the *status* of the last iteration, the *remaining* number of " -"pages still to be copied and the *total* number of pages." +"If set to a callable, it is invoked with three integer arguments for every " +"backup iteration: the *status* of the last iteration, the *remaining* number " +"of pages still to be copied, and the *total* number of pages. Defaults to :" +"const:`None`." msgstr "" -#: ../../library/sqlite3.rst:658 +#: ../../library/sqlite3.rst:736 msgid "" -"The *name* argument specifies the database name that will be copied: it must " -"be a string containing either ``\"main\"``, the default, to indicate the " -"main database, ``\"temp\"`` to indicate the temporary database or the name " -"specified after the ``AS`` keyword in an ``ATTACH DATABASE`` statement for " -"an attached database." +"The name of the database to back up. Either ``\"main\"`` (the default) for " +"the main database, ``\"temp\"`` for the temporary database, or the name of a " +"custom database as attached using the ``ATTACH DATABASE`` SQL statment." msgstr "" -#: ../../library/sqlite3.rst:664 +#: ../../library/sqlite3.rst:744 msgid "" -"The *sleep* argument specifies the number of seconds to sleep by between " -"successive attempts to backup remaining pages, can be specified either as an " -"integer or a floating point value." +"The number of seconds to sleep between successive attempts to back up " +"remaining pages." msgstr "" -#: ../../library/sqlite3.rst:668 +#: ../../library/sqlite3.rst:749 msgid "Example 1, copy an existing database into another::" msgstr "" -#: ../../library/sqlite3.rst:682 +#: ../../library/sqlite3.rst:763 msgid "Example 2, copy an existing database into a transient copy::" msgstr "" -#: ../../library/sqlite3.rst:696 +#: ../../library/sqlite3.rst:777 msgid "Cursor Objects" msgstr "" -#: ../../library/sqlite3.rst:700 +#: ../../library/sqlite3.rst:779 +msgid "" +"A ``Cursor`` object represents a `database cursor`_ which is used to execute " +"SQL statements, and manage the context of a fetch operation. Cursors are " +"created using :meth:`Connection.cursor`, or by using any of the :ref:" +"`connection shortcut methods `." +msgstr "" + +#: ../../library/sqlite3.rst:786 +msgid "" +"Cursor objects are :term:`iterators `, meaning that if you :meth:" +"`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " +"to fetch the resulting rows::" +msgstr "" + +#: ../../library/sqlite3.rst:797 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:707 +#: ../../library/sqlite3.rst:804 msgid "" -"Execute an SQL statement. Values may be bound to the statement using :ref:" -"`placeholders `." +"Execute SQL statement *sql*. Bind values to the statement using :ref:" +"`placeholders ` that map to the :term:`sequence` or :" +"class:`dict` *parameters*." msgstr "" -#: ../../library/sqlite3.rst:710 +#: ../../library/sqlite3.rst:809 msgid "" ":meth:`execute` will only execute a single SQL statement. If you try to " "execute more than one statement with it, it will raise a :exc:`Warning`. " @@ -771,7 +858,7 @@ msgid "" "with one call." msgstr "" -#: ../../library/sqlite3.rst:715 +#: ../../library/sqlite3.rst:814 msgid "" "If :attr:`~Connection.isolation_level` is not :const:`None`, *sql* is an " "``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is " @@ -779,53 +866,48 @@ msgid "" "*sql*." msgstr "" -#: ../../library/sqlite3.rst:723 +#: ../../library/sqlite3.rst:822 msgid "" -"Execute a :ref:`parameterized ` SQL command against " -"all parameter sequences or mappings found in the sequence " -"*seq_of_parameters*. It is also possible to use an :term:`iterator` " -"yielding parameters instead of a sequence. Uses the same implicit " -"transaction handling as :meth:`~Cursor.execute`." -msgstr "" - -#: ../../library/sqlite3.rst:731 -msgid "Here's a shorter example using a :term:`generator`:" +"Execute :ref:`parameterized ` SQL statement *sql* " +"against all parameter sequences or mappings found in the sequence " +"*parameters*. It is also possible to use an :term:`iterator` yielding " +"parameters instead of a sequence. Uses the same implicit transaction " +"handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:738 +#: ../../library/sqlite3.rst:839 msgid "" -"Execute multiple SQL statements at once. If there is a pending transaciton, " -"an implicit ``COMMIT`` statement is executed first. No other implicit " -"transaction control is performed; any transaction control must be added to " -"*sql_script*." +"Execute the SQL statements in *sql_script*. If there is a pending " +"transaciton, an implicit ``COMMIT`` statement is executed first. No other " +"implicit transaction control is performed; any transaction control must be " +"added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:744 +#: ../../library/sqlite3.rst:845 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:753 +#: ../../library/sqlite3.rst:861 msgid "" -"Fetches the next row of a query result set, returning a single sequence, or :" -"const:`None` when no more data is available." +"Fetch the next row of a query result set as a :class:`tuple`. Return :const:" +"`None` if no more data is available." msgstr "" -#: ../../library/sqlite3.rst:759 +#: ../../library/sqlite3.rst:867 msgid "" -"Fetches the next set of rows of a query result, returning a list. An empty " -"list is returned when no more rows are available." +"Fetch the next set of rows of a query result as a :class:`list`. Return an " +"empty list if no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:762 +#: ../../library/sqlite3.rst:870 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " -"If it is not given, the cursor's arraysize determines the number of rows to " -"be fetched. The method should try to fetch as many rows as indicated by the " -"size parameter. If this is not possible due to the specified number of rows " -"not being available, fewer rows may be returned." +"If *size* is not given, :attr:`arraysize` determines the number of rows to " +"be fetched. If fewer than *size* rows are available, as many rows as are " +"available are returned." msgstr "" -#: ../../library/sqlite3.rst:768 +#: ../../library/sqlite3.rst:876 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -833,29 +915,29 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:775 +#: ../../library/sqlite3.rst:883 msgid "" -"Fetches all (remaining) rows of a query result, returning a list. Note that " -"the cursor's arraysize attribute can affect the performance of this " -"operation. An empty list is returned when no rows are available." +"Fetch all (remaining) rows of a query result as a :class:`list`. Return an " +"empty list if no rows are available. Note that the :attr:`arraysize` " +"attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:781 +#: ../../library/sqlite3.rst:890 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:783 +#: ../../library/sqlite3.rst:892 msgid "" "The cursor will be unusable from this point forward; a :exc:" "`ProgrammingError` exception will be raised if any operation is attempted " "with the cursor." msgstr "" -#: ../../library/sqlite3.rst:788 ../../library/sqlite3.rst:792 +#: ../../library/sqlite3.rst:897 ../../library/sqlite3.rst:901 msgid "Required by the DB-API. Does nothing in :mod:`sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:796 +#: ../../library/sqlite3.rst:905 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -864,9 +946,9 @@ msgid "" "methods." msgstr "" -#: ../../library/sqlite3.rst:804 +#: ../../library/sqlite3.rst:913 msgid "" -"This read-only attribute provides the row id of the last inserted row. It is " +"Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " "the :meth:`execute` method. For other statements, after :meth:`executemany` " "or :meth:`executescript`, or if the insertion failed, the value of " @@ -874,101 +956,96 @@ msgid "" "const:`None`." msgstr "" -#: ../../library/sqlite3.rst:812 +#: ../../library/sqlite3.rst:921 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:814 +#: ../../library/sqlite3.rst:923 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:819 +#: ../../library/sqlite3.rst:928 msgid "" "Read/write attribute that controls the number of rows returned by :meth:" "`fetchmany`. The default value is 1 which means a single row would be " "fetched per call." msgstr "" -#: ../../library/sqlite3.rst:824 +#: ../../library/sqlite3.rst:933 msgid "" -"This read-only attribute provides the column names of the last query. To " +"Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are :const:`None`." msgstr "" -#: ../../library/sqlite3.rst:828 +#: ../../library/sqlite3.rst:937 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:832 +#: ../../library/sqlite3.rst:941 msgid "" -"This read-only attribute provides the SQLite database :class:`Connection` " -"used by the :class:`Cursor` object. A :class:`Cursor` object created by " -"calling :meth:`con.cursor() ` will have a :attr:" -"`connection` attribute that refers to *con*::" +"Read-only attribute that provides the SQLite database :class:`Connection` " +"belonging to the cursor. A :class:`Cursor` object created by calling :meth:" +"`con.cursor() ` will have a :attr:`connection` attribute " +"that refers to *con*::" msgstr "" -#: ../../library/sqlite3.rst:845 +#: ../../library/sqlite3.rst:954 msgid "Row Objects" msgstr "" -#: ../../library/sqlite3.rst:849 +#: ../../library/sqlite3.rst:958 msgid "" "A :class:`Row` instance serves as a highly optimized :attr:`~Connection." -"row_factory` for :class:`Connection` objects. It tries to mimic a tuple in " -"most of its features." +"row_factory` for :class:`Connection` objects. It tries to mimic a :class:" +"`tuple` in most of its features, and supports iteration, :func:`repr`, " +"equality testing, :func:`len`, and :term:`mapping` access by column name and " +"index." msgstr "" -#: ../../library/sqlite3.rst:853 -msgid "" -"It supports mapping access by column name and index, iteration, " -"representation, equality testing and :func:`len`." +#: ../../library/sqlite3.rst:964 +msgid "Two row objects compare equal if have equal columns and equal members." msgstr "" -#: ../../library/sqlite3.rst:856 +#: ../../library/sqlite3.rst:968 msgid "" -"If two :class:`Row` objects have exactly the same columns and their members " -"are equal, they compare equal." +"Return a :class:`list` of column names as :class:`strings `. " +"Immediately after a query, it is the first member of each tuple in :attr:" +"`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:861 -msgid "" -"This method returns a list of column names. Immediately after a query, it is " -"the first member of each tuple in :attr:`Cursor.description`." -msgstr "" - -#: ../../library/sqlite3.rst:864 +#: ../../library/sqlite3.rst:972 msgid "Added support of slicing." msgstr "" -#: ../../library/sqlite3.rst:867 +#: ../../library/sqlite3.rst:975 msgid "Let's assume we initialize a table as in the example given above::" msgstr "" -#: ../../library/sqlite3.rst:879 +#: ../../library/sqlite3.rst:987 msgid "Now we plug :class:`Row` in::" msgstr "" -#: ../../library/sqlite3.rst:909 +#: ../../library/sqlite3.rst:1017 msgid "PrepareProtocol Objects" msgstr "" -#: ../../library/sqlite3.rst:913 +#: ../../library/sqlite3.rst:1021 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:921 +#: ../../library/sqlite3.rst:1029 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:923 +#: ../../library/sqlite3.rst:1031 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:927 +#: ../../library/sqlite3.rst:1035 msgid "" "This exception is raised by ``sqlite3`` if an SQL query is not a :class:" "`string `, or if multiple statements are passed to :meth:`~Cursor." @@ -976,21 +1053,21 @@ msgid "" "`Exception`." msgstr "" -#: ../../library/sqlite3.rst:934 +#: ../../library/sqlite3.rst:1042 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:940 +#: ../../library/sqlite3.rst:1048 msgid "" "This exception is raised by ``sqlite3`` for fetch across rollback, or if " "``sqlite3`` is unable to bind parameters. ``InterfaceError`` is a subclass " "of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:946 +#: ../../library/sqlite3.rst:1054 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -998,14 +1075,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:953 +#: ../../library/sqlite3.rst:1061 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:959 +#: ../../library/sqlite3.rst:1067 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -1013,20 +1090,20 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:967 +#: ../../library/sqlite3.rst:1075 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:972 +#: ../../library/sqlite3.rst:1080 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:979 +#: ../../library/sqlite3.rst:1087 msgid "" "Exception raised for ``sqlite3`` API programming errors, for example trying " "to operate on a closed :class:`Connection`, or trying to execute non-DML " @@ -1034,7 +1111,7 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:986 +#: ../../library/sqlite3.rst:1094 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to :const:" @@ -1043,82 +1120,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:996 +#: ../../library/sqlite3.rst:1104 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1000 -msgid "Introduction" -msgstr "簡介" - -#: ../../library/sqlite3.rst:1002 +#: ../../library/sqlite3.rst:1110 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1005 +#: ../../library/sqlite3.rst:1113 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1008 ../../library/sqlite3.rst:1025 +#: ../../library/sqlite3.rst:1116 ../../library/sqlite3.rst:1133 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1008 ../../library/sqlite3.rst:1025 +#: ../../library/sqlite3.rst:1116 ../../library/sqlite3.rst:1133 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1010 ../../library/sqlite3.rst:1027 +#: ../../library/sqlite3.rst:1118 ../../library/sqlite3.rst:1135 msgid ":const:`None`" msgstr ":const:`None`" -#: ../../library/sqlite3.rst:1010 ../../library/sqlite3.rst:1027 +#: ../../library/sqlite3.rst:1118 ../../library/sqlite3.rst:1135 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1012 ../../library/sqlite3.rst:1029 +#: ../../library/sqlite3.rst:1120 ../../library/sqlite3.rst:1137 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1012 ../../library/sqlite3.rst:1029 +#: ../../library/sqlite3.rst:1120 ../../library/sqlite3.rst:1137 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1014 ../../library/sqlite3.rst:1031 +#: ../../library/sqlite3.rst:1122 ../../library/sqlite3.rst:1139 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1014 ../../library/sqlite3.rst:1031 +#: ../../library/sqlite3.rst:1122 ../../library/sqlite3.rst:1139 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1016 +#: ../../library/sqlite3.rst:1124 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1016 ../../library/sqlite3.rst:1033 +#: ../../library/sqlite3.rst:1124 ../../library/sqlite3.rst:1141 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1018 ../../library/sqlite3.rst:1036 +#: ../../library/sqlite3.rst:1126 ../../library/sqlite3.rst:1144 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1018 ../../library/sqlite3.rst:1036 +#: ../../library/sqlite3.rst:1126 ../../library/sqlite3.rst:1144 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1022 +#: ../../library/sqlite3.rst:1130 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1033 +#: ../../library/sqlite3.rst:1141 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1039 +#: ../../library/sqlite3.rst:1147 msgid "" "The type system of the :mod:`sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via object " @@ -1126,18 +1199,18 @@ msgid "" "to different Python types via converters." msgstr "" -#: ../../library/sqlite3.rst:1046 +#: ../../library/sqlite3.rst:1154 msgid "Using adapters to store custom Python types in SQLite databases" msgstr "" -#: ../../library/sqlite3.rst:1048 +#: ../../library/sqlite3.rst:1156 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands`." msgstr "" -#: ../../library/sqlite3.rst:1052 +#: ../../library/sqlite3.rst:1160 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -1147,11 +1220,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:1064 +#: ../../library/sqlite3.rst:1172 msgid "Letting your object adapt itself" msgstr "" -#: ../../library/sqlite3.rst:1066 +#: ../../library/sqlite3.rst:1174 msgid "" "Suppose we have a ``Point`` class that represents a pair of coordinates, " "``x`` and ``y``, in a Cartesian coordinate system. The coordinate pair will " @@ -1161,107 +1234,107 @@ msgid "" "*protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:1078 +#: ../../library/sqlite3.rst:1186 msgid "Registering an adapter callable" msgstr "" -#: ../../library/sqlite3.rst:1080 +#: ../../library/sqlite3.rst:1188 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:1088 +#: ../../library/sqlite3.rst:1196 msgid "Converting SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:1090 +#: ../../library/sqlite3.rst:1198 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:1095 +#: ../../library/sqlite3.rst:1203 msgid "" "Let's go back to the :class:`Point` class. We stored the x and y coordinates " "separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:1098 +#: ../../library/sqlite3.rst:1206 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:1103 +#: ../../library/sqlite3.rst:1211 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:1112 +#: ../../library/sqlite3.rst:1220 msgid "" "We now need to tell ``sqlite3`` when it should convert a given SQLite value. " "This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:1116 +#: ../../library/sqlite3.rst:1224 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:1117 +#: ../../library/sqlite3.rst:1225 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:1118 +#: ../../library/sqlite3.rst:1226 msgid "" "Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." "PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:1122 +#: ../../library/sqlite3.rst:1230 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:1128 +#: ../../library/sqlite3.rst:1236 msgid "Default adapters and converters" msgstr "" -#: ../../library/sqlite3.rst:1130 +#: ../../library/sqlite3.rst:1238 msgid "" "There are default adapters for the date and datetime types in the datetime " "module. They will be sent as ISO dates/ISO timestamps to SQLite." msgstr "" -#: ../../library/sqlite3.rst:1133 +#: ../../library/sqlite3.rst:1241 msgid "" "The default converters are registered under the name \"date\" for :class:" "`datetime.date` and under the name \"timestamp\" for :class:`datetime." "datetime`." msgstr "" -#: ../../library/sqlite3.rst:1137 +#: ../../library/sqlite3.rst:1245 msgid "" "This way, you can use date/timestamps from Python without any additional " "fiddling in most cases. The format of the adapters is also compatible with " "the experimental SQLite date/time functions." msgstr "" -#: ../../library/sqlite3.rst:1141 +#: ../../library/sqlite3.rst:1249 msgid "The following example demonstrates this." msgstr "" -#: ../../library/sqlite3.rst:1145 +#: ../../library/sqlite3.rst:1253 msgid "" "If a timestamp stored in SQLite has a fractional part longer than 6 numbers, " "its value will be truncated to microsecond precision by the timestamp " "converter." msgstr "" -#: ../../library/sqlite3.rst:1151 +#: ../../library/sqlite3.rst:1259 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -1269,25 +1342,25 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:1160 +#: ../../library/sqlite3.rst:1268 msgid "Adapter and Converter Recipes" msgstr "" -#: ../../library/sqlite3.rst:1162 +#: ../../library/sqlite3.rst:1270 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:1205 +#: ../../library/sqlite3.rst:1313 msgid "Controlling Transactions" msgstr "" -#: ../../library/sqlite3.rst:1207 +#: ../../library/sqlite3.rst:1315 msgid "" "The ``sqlite3`` module does not adhere to the transaction handling " "recommended by :pep:`249`." msgstr "" -#: ../../library/sqlite3.rst:1210 +#: ../../library/sqlite3.rst:1318 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not :" "const:`None`, new transactions are implicitly opened before :meth:`~Cursor." @@ -1300,7 +1373,7 @@ msgid "" "isolation_level` attribute." msgstr "" -#: ../../library/sqlite3.rst:1222 +#: ../../library/sqlite3.rst:1330 msgid "" "If :attr:`~Connection.isolation_level` is set to :const:`None`, no " "transactions are implicitly opened at all. This leaves the underlying SQLite " @@ -1310,88 +1383,88 @@ msgid "" "in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:1230 +#: ../../library/sqlite3.rst:1338 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:1234 +#: ../../library/sqlite3.rst:1342 msgid "" ":mod:`sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:1248 +#: ../../library/sqlite3.rst:1356 msgid "SQLite URI tricks" msgstr "" -#: ../../library/sqlite3.rst:1250 +#: ../../library/sqlite3.rst:1358 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:1252 +#: ../../library/sqlite3.rst:1360 msgid "Open a database in read-only mode::" msgstr "" -#: ../../library/sqlite3.rst:1256 +#: ../../library/sqlite3.rst:1364 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file::" msgstr "" -#: ../../library/sqlite3.rst:1261 +#: ../../library/sqlite3.rst:1369 msgid "Create a shared named in-memory database::" msgstr "" -#: ../../library/sqlite3.rst:1270 +#: ../../library/sqlite3.rst:1378 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:1276 +#: ../../library/sqlite3.rst:1384 msgid "Using :mod:`sqlite3` efficiently" msgstr "" -#: ../../library/sqlite3.rst:1280 -msgid "Using shortcut methods" +#: ../../library/sqlite3.rst:1390 +msgid "Using connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:1282 +#: ../../library/sqlite3.rst:1392 msgid "" -"Using the nonstandard :meth:`execute`, :meth:`executemany` and :meth:" -"`executescript` methods of the :class:`Connection` object, your code can be " -"written more concisely because you don't have to create the (often " -"superfluous) :class:`Cursor` objects explicitly. Instead, the :class:" +"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" +"meth:`~Connection.executescript` methods of the :class:`Connection` class, " +"your code can be written more concisely because you don't have to create the " +"(often superfluous) :class:`Cursor` objects explicitly. Instead, the :class:" "`Cursor` objects are created implicitly and these shortcut methods return " "the cursor objects. This way, you can execute a ``SELECT`` statement and " "iterate over it directly using only a single call on the :class:`Connection` " "object." msgstr "" -#: ../../library/sqlite3.rst:1294 +#: ../../library/sqlite3.rst:1405 msgid "Accessing columns by name instead of by index" msgstr "" -#: ../../library/sqlite3.rst:1296 +#: ../../library/sqlite3.rst:1407 msgid "" "One useful feature of the :mod:`sqlite3` module is the built-in :class:" "`sqlite3.Row` class designed to be used as a row factory." msgstr "" -#: ../../library/sqlite3.rst:1299 +#: ../../library/sqlite3.rst:1410 msgid "" "Rows wrapped with this class can be accessed both by index (like tuples) and " "case-insensitively by name:" msgstr "" -#: ../../library/sqlite3.rst:1308 +#: ../../library/sqlite3.rst:1419 msgid "Using the connection as a context manager" msgstr "" -#: ../../library/sqlite3.rst:1310 +#: ../../library/sqlite3.rst:1421 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -1401,26 +1474,17 @@ msgid "" "exception, the transaction is rolled back." msgstr "" -#: ../../library/sqlite3.rst:1319 +#: ../../library/sqlite3.rst:1430 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, the context manager is a no-op." msgstr "" -#: ../../library/sqlite3.rst:1324 +#: ../../library/sqlite3.rst:1435 msgid "" "The context manager neither implicitly opens a new transaction nor closes " "the connection." msgstr "" -#: ../../library/sqlite3.rst:1331 -msgid "Footnotes" -msgstr "註解" - -#: ../../library/sqlite3.rst:1332 -msgid "" -"The sqlite3 module is not built with loadable extension support by default, " -"because some platforms (notably macOS) have SQLite libraries which are " -"compiled without this feature. To get loadable extension support, you must " -"pass the :option:`--enable-loadable-sqlite-extensions` option to configure." -msgstr "" +#~ msgid "Footnotes" +#~ msgstr "註解"