mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Issue #23758: Improve num_params docs of create_{function,aggregate} functions
If you pass -1, the callable can take any number of arguments. Added tests to verify the behavior. Initial patch by Cédric Krier.
This commit is contained in:
parent
f70fe6f6cf
commit
fa0f62d6ab
2 changed files with 36 additions and 3 deletions
|
@ -324,8 +324,9 @@ Connection Objects
|
|||
|
||||
Creates a user-defined function that you can later use from within SQL
|
||||
statements under the function name *name*. *num_params* is the number of
|
||||
parameters the function accepts, and *func* is a Python callable that is called
|
||||
as the SQL function.
|
||||
parameters the function accepts (if *num_params* is -1, the function may
|
||||
take any number of arguments), and *func* is a Python callable that is
|
||||
called as the SQL function.
|
||||
|
||||
The function can return any of the types supported by SQLite: bytes, str, int,
|
||||
float and None.
|
||||
|
@ -340,7 +341,8 @@ Connection Objects
|
|||
Creates a user-defined aggregate function.
|
||||
|
||||
The aggregate class must implement a ``step`` method, which accepts the number
|
||||
of parameters *num_params*, and a ``finalize`` method which will return the
|
||||
of parameters *num_params* (if *num_params* is -1, the function may take
|
||||
any number of arguments), and a ``finalize`` method which will return the
|
||||
final result of the aggregate.
|
||||
|
||||
The ``finalize`` method can return any of the types supported by SQLite:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue