From 353edead5fcb425e335de9d22daeb974176f1632 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sat, 20 Aug 2022 03:00:49 -0500 Subject: [PATCH 1/4] Add previously undocumented SQLITE_OK/DENY/IGORNE sqlite3 constants --- Doc/library/sqlite3.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 6413d8859180da..8fc201cfb3ca89 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -417,6 +417,18 @@ Module constants This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` (bitwise or) operator. +.. data:: SQLITE_OK + SQLITE_DENY + SQLITE_IGNORE + + Flags used for return values from the callable passed as + the *authorizer_callback* argument of :meth:`Connection.set_authorizer` + to indicate whether: + + * Access is allowed (:const:`!SQLITE_OK`), + * The SQL statement should be aborted with an error (:const:`!SQLITE_DENY`) + * The column should be treated as a ``NULL`` value (:const:`!SQLITE_IGNORE`) + .. data:: apilevel String constant stating the supported DB-API level. Required by the DB-API. From db0031d570edadc3d4d956fc927113a7939802ec Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sat, 20 Aug 2022 03:02:57 -0500 Subject: [PATCH 2/4] Update desc of Connection.set_authorizer to reflect added constants --- Doc/library/sqlite3.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 8fc201cfb3ca89..38831519ed3d5f 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -804,10 +804,8 @@ Connection objects 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. + one of :const:`SQLITE_OK`, :const:`SQLITE_DENY` or :const:`SQLITE_IGNORE` + to signal how the column should be handled. The first argument to the callback signifies what kind of operation is to be authorized. The second and third argument will be arguments or ``None`` From 77deec20d0723105b4e2bf82d17c15a7e74cfa41 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Mon, 22 Aug 2022 13:56:08 +0200 Subject: [PATCH 3/4] Update Doc/library/sqlite3.rst Co-authored-by: Ezio Melotti --- Doc/library/sqlite3.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 38831519ed3d5f..cec5e5dc989cad 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -804,7 +804,7 @@ Connection objects Register callable *authorizer_callback* to be invoked for each attempt to access a column of a table in the database. The callback should return - one of :const:`SQLITE_OK`, :const:`SQLITE_DENY` or :const:`SQLITE_IGNORE` + one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, or :const:`SQLITE_IGNORE` to signal how the column should be handled. The first argument to the callback signifies what kind of operation is to be From a9a6e884e882ec82b97189dd9e83d56e72f5e6aa Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Tue, 23 Aug 2022 00:53:16 -0500 Subject: [PATCH 4/4] Further clarify sqlite3 SQLITE_* language per reviewer suggestions Co-authored-by: Ezio Melotti Co-authored-by: Erlend E. Aasland --- Doc/library/sqlite3.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index cec5e5dc989cad..ec03dc1951eb42 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -421,9 +421,8 @@ Module constants SQLITE_DENY SQLITE_IGNORE - Flags used for return values from the callable passed as - the *authorizer_callback* argument of :meth:`Connection.set_authorizer` - to indicate whether: + Flags that should be returned by the *authorizer_callback* callable + passed to :meth:`Connection.set_authorizer`, to indicate whether: * Access is allowed (:const:`!SQLITE_OK`), * The SQL statement should be aborted with an error (:const:`!SQLITE_DENY`) @@ -805,7 +804,8 @@ Connection objects Register callable *authorizer_callback* to be invoked for each attempt to access a column of a table in the database. The callback should return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, or :const:`SQLITE_IGNORE` - to signal how the column should be handled. + to signal how access to the column should be handled + by the underlying SQLite library. The first argument to the callback signifies what kind of operation is to be authorized. The second and third argument will be arguments or ``None``