Skip to content

Commit 891bc2f

Browse files
methanemiss-islington
authored andcommitted
Doc: Correct sqlite3 API descriptions and SQL examples (GH-162193)
(cherry picked from commit 6ffa102) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
1 parent 54639dc commit 891bc2f

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

‎Doc/library/sqlite3.rst‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -443,18 +443,19 @@ Module constants
443443
.. code-block:: sql
444444
445445
CREATE TABLE test(
446-
i integer primary key, ! will look up a converter named "integer"
447-
p point, ! will look up a converter named "point"
448-
n number(10) ! will look up a converter named "number"
446+
i integer primary key, -- will look up a converter named "integer"
447+
p point, -- will look up a converter named "point"
448+
n number(10) -- will look up a converter named "number"
449449
)
450450
451451
This flag may be combined with :const:`PARSE_COLNAMES` using the ``|``
452452
(bitwise or) operator.
453453

454454
.. note::
455455

456-
Generated fields (for example ``MAX(p)``) are returned as :class:`str`.
457-
Use :const:`!PARSE_COLNAMES` to enforce types for such queries.
456+
Expressions such as ``MAX(p)`` have no declared type, so their results use
457+
the :ref:`default type conversions <sqlite3-types>`.
458+
Use :const:`!PARSE_COLNAMES` to specify a converter for such expressions.
458459

459460
.. data:: PARSE_COLNAMES
460461

@@ -467,7 +468,7 @@ Module constants
467468

468469
.. code-block:: sql
469470
470-
SELECT MAX(p) as "p [point]" FROM test; ! will look up converter "point"
471+
SELECT MAX(p) as "p [point]" FROM test; -- will look up converter "point"
471472
472473
This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|``
473474
(bitwise or) operator.
@@ -820,7 +821,7 @@ Connection objects
820821
* ``finalize()``: Return the final result of the aggregate as
821822
:ref:`a type natively supported by SQLite <sqlite3-types>`.
822823

823-
The number of arguments that the ``step()`` and ``value()`` methods
824+
The number of arguments that the ``step()`` and ``inverse()`` methods
824825
must accept is controlled by *num_params*.
825826

826827
Set to ``None`` to remove an existing SQL aggregate window function.
@@ -1160,8 +1161,8 @@ Connection objects
11601161
``ATTACH DATABASE`` SQL statement.
11611162

11621163
:param float sleep:
1163-
The number of seconds to sleep between successive attempts
1164-
to back up remaining pages.
1164+
The number of seconds to wait before retrying a backup step
1165+
when the database is busy or locked.
11651166

11661167
Example 1, copy an existing database into another:
11671168

@@ -1381,8 +1382,7 @@ Connection objects
13811382
This read-only attribute corresponds to the low-level SQLite
13821383
`autocommit mode`_.
13831384

1384-
``True`` if a transaction is active (there are uncommitted changes),
1385-
``False`` otherwise.
1385+
``True`` if a transaction is active, ``False`` otherwise.
13861386

13871387
.. versionadded:: 3.2
13881388

@@ -2142,7 +2142,7 @@ The coordinate pair will be stored as a text string in the database,
21422142
using a semicolon to separate the coordinates.
21432143
This can be implemented by adding a ``__conform__(self, protocol)``
21442144
method which returns the adapted value.
2145-
The object passed to *protocol* will be of type :class:`PrepareProtocol`.
2145+
The parameter *protocol* will be :class:`PrepareProtocol`.
21462146

21472147
.. testcode::
21482148

@@ -2413,7 +2413,7 @@ or if :attr:`~Connection.autocommit` is ``True``,
24132413
the context manager does nothing.
24142414

24152415
.. note::
2416-
The context manager neither implicitly opens a new transaction
2416+
The context manager neither implicitly opens a new transaction on entry
24172417
nor closes the connection. If you need a closing context manager, consider
24182418
using :meth:`contextlib.closing`.
24192419

@@ -2461,8 +2461,8 @@ Some useful URI tricks include:
24612461
OperationalError: attempt to write a readonly database
24622462
>>> con.close()
24632463

2464-
* Do not implicitly create a new database file if it does not already exist;
2465-
will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:
2464+
* Open an existing database in read/write mode.
2465+
If the file does not exist, :func:`connect` raises :exc:`OperationalError`:
24662466

24672467
.. doctest::
24682468

0 commit comments

Comments
 (0)