mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
[3.12] Docs: add links to 'callable' term in sqlite3 docs (GH-106072) (#106073)
(cherry picked from commit bef1c8761e
)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
This commit is contained in:
parent
9cd366462b
commit
f930bee003
1 changed files with 18 additions and 17 deletions
|
@ -413,15 +413,15 @@ Module functions
|
||||||
|
|
||||||
.. function:: register_adapter(type, adapter, /)
|
.. function:: register_adapter(type, adapter, /)
|
||||||
|
|
||||||
Register an *adapter* callable to adapt the Python type *type* into an
|
Register an *adapter* :term:`callable` to adapt the Python type *type*
|
||||||
SQLite type.
|
into an SQLite type.
|
||||||
The adapter is called with a Python object of type *type* as its sole
|
The adapter is called with a Python object of type *type* as its sole
|
||||||
argument, and must return a value of a
|
argument, and must return a value of a
|
||||||
:ref:`type that SQLite natively understands <sqlite3-types>`.
|
:ref:`type that SQLite natively understands <sqlite3-types>`.
|
||||||
|
|
||||||
.. function:: register_converter(typename, converter, /)
|
.. function:: register_converter(typename, converter, /)
|
||||||
|
|
||||||
Register the *converter* callable to convert SQLite objects of type
|
Register the *converter* :term:`callable` to convert SQLite objects of type
|
||||||
*typename* into a Python object of a specific type.
|
*typename* into a Python object of a specific type.
|
||||||
The converter is invoked for all SQLite values of type *typename*;
|
The converter is invoked for all SQLite values of type *typename*;
|
||||||
it is passed a :class:`bytes` object and should return an object of the
|
it is passed a :class:`bytes` object and should return an object of the
|
||||||
|
@ -484,7 +484,7 @@ Module constants
|
||||||
SQLITE_DENY
|
SQLITE_DENY
|
||||||
SQLITE_IGNORE
|
SQLITE_IGNORE
|
||||||
|
|
||||||
Flags that should be returned by the *authorizer_callback* callable
|
Flags that should be returned by the *authorizer_callback* :term:`callable`
|
||||||
passed to :meth:`Connection.set_authorizer`, to indicate whether:
|
passed to :meth:`Connection.set_authorizer`, to indicate whether:
|
||||||
|
|
||||||
* Access is allowed (:const:`!SQLITE_OK`),
|
* Access is allowed (:const:`!SQLITE_OK`),
|
||||||
|
@ -629,8 +629,8 @@ Connection objects
|
||||||
|
|
||||||
Create and return a :class:`Cursor` object.
|
Create and return a :class:`Cursor` object.
|
||||||
The cursor method accepts a single optional parameter *factory*. If
|
The cursor method accepts a single optional parameter *factory*. If
|
||||||
supplied, this must be a callable returning an instance of :class:`Cursor`
|
supplied, this must be a :term:`callable` returning
|
||||||
or its subclasses.
|
an instance of :class:`Cursor` or its subclasses.
|
||||||
|
|
||||||
.. method:: blobopen(table, column, row, /, *, readonly=False, name="main")
|
.. method:: blobopen(table, column, row, /, *, readonly=False, name="main")
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ Connection objects
|
||||||
If ``-1``, it may take any number of arguments.
|
If ``-1``, it may take any number of arguments.
|
||||||
|
|
||||||
:param func:
|
:param func:
|
||||||
A callable that is called when the SQL function is invoked.
|
A :term:`callable` that is called when the SQL function is invoked.
|
||||||
The callable must return :ref:`a type natively supported by SQLite
|
The callable must return :ref:`a type natively supported by SQLite
|
||||||
<sqlite3-types>`.
|
<sqlite3-types>`.
|
||||||
Set to ``None`` to remove an existing SQL function.
|
Set to ``None`` to remove an existing SQL function.
|
||||||
|
@ -948,9 +948,10 @@ Connection objects
|
||||||
|
|
||||||
.. method:: set_authorizer(authorizer_callback)
|
.. method:: set_authorizer(authorizer_callback)
|
||||||
|
|
||||||
Register callable *authorizer_callback* to be invoked for each attempt to
|
Register :term:`callable` *authorizer_callback* to be invoked
|
||||||
access a column of a table in the database. The callback should return
|
for each attempt to access a column of a table in the database.
|
||||||
one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, or :const:`SQLITE_IGNORE`
|
The callback should return one of :const:`SQLITE_OK`,
|
||||||
|
:const:`SQLITE_DENY`, or :const:`SQLITE_IGNORE`
|
||||||
to signal how access to the column should be handled
|
to signal how access to the column should be handled
|
||||||
by the underlying SQLite library.
|
by the underlying SQLite library.
|
||||||
|
|
||||||
|
@ -973,7 +974,7 @@ Connection objects
|
||||||
|
|
||||||
.. method:: set_progress_handler(progress_handler, n)
|
.. method:: set_progress_handler(progress_handler, n)
|
||||||
|
|
||||||
Register callable *progress_handler* to be invoked for every *n*
|
Register :term:`callable` *progress_handler* to be invoked for every *n*
|
||||||
instructions of the SQLite virtual machine. This is useful if you want to
|
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
|
get called from SQLite during long-running operations, for example to update
|
||||||
a GUI.
|
a GUI.
|
||||||
|
@ -988,8 +989,8 @@ Connection objects
|
||||||
|
|
||||||
.. method:: set_trace_callback(trace_callback)
|
.. method:: set_trace_callback(trace_callback)
|
||||||
|
|
||||||
Register callable *trace_callback* to be invoked for each SQL statement
|
Register :term:`callable` *trace_callback* to be invoked
|
||||||
that is actually executed by the SQLite backend.
|
for each SQL statement that is actually executed by the SQLite backend.
|
||||||
|
|
||||||
The only argument passed to the callback is the statement (as
|
The only argument passed to the callback is the statement (as
|
||||||
:class:`str`) that is being executed. The return value of the callback is
|
:class:`str`) that is being executed. The return value of the callback is
|
||||||
|
@ -1139,8 +1140,8 @@ Connection objects
|
||||||
Defaults to ``-1``.
|
Defaults to ``-1``.
|
||||||
|
|
||||||
:param progress:
|
:param progress:
|
||||||
If set to a callable, it is invoked with three integer arguments for
|
If set to a :term:`callable`,
|
||||||
every backup iteration:
|
it is invoked with three integer arguments for every backup iteration:
|
||||||
the *status* of the last iteration,
|
the *status* of the last iteration,
|
||||||
the *remaining* number of pages still to be copied,
|
the *remaining* number of pages still to be copied,
|
||||||
and the *total* number of pages.
|
and the *total* number of pages.
|
||||||
|
@ -1404,8 +1405,8 @@ Connection objects
|
||||||
|
|
||||||
.. attribute:: text_factory
|
.. attribute:: text_factory
|
||||||
|
|
||||||
A callable that accepts a :class:`bytes` parameter and returns a text
|
A :term:`callable` that accepts a :class:`bytes` parameter
|
||||||
representation of it.
|
and returns a text representation of it.
|
||||||
The callable is invoked for SQLite values with the ``TEXT`` data type.
|
The callable is invoked for SQLite values with the ``TEXT`` data type.
|
||||||
By default, this attribute is set to :class:`str`.
|
By default, this attribute is set to :class:`str`.
|
||||||
If you want to return ``bytes`` instead, set *text_factory* to ``bytes``.
|
If you want to return ``bytes`` instead, set *text_factory* to ``bytes``.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue