summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] gh-95132: Correctly relay *args and **kwds from sqlite3.connect to ↵Erlend Egeberg Aasland2022-07-233-147/+35
| | | | | | | | | | | | | | | factory (GH-95146) (#95158) This PR partially reverts gh-24421 (PR) and fixes the remaining concerns given in gh-93044 (issue): - keyword arguments are passed as positional arguments to factory() - if an argument is not passed to sqlite3.connect(), its default value is passed to factory() Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>. (cherry picked from commit a3d4d15f53777662ce0957500e5a538ce7161f5e) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* gh-94321: Document sqlite3.PrepareProtocol (GH-94620)Miss Islington (bot)2022-07-071-0/+3
| | | | | (cherry picked from commit fb6dccae348b954d9f625031b54711a9a33da525) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-90016: Reword sqlite3 adapter/converter docs (GH-93095) (#94272)Erlend Egeberg Aasland2022-06-252-11/+11
| | | | | | | Also add adapters and converter recipes. Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com. (cherry picked from commit bd3c1c187e0e4fde5aec6835d180e9eddde8ceb6)
* gh-94028: Clear and reset sqlite3 statements properly in cursor iternext ↵Miss Islington (bot)2022-06-211-0/+3
| | | | | | | (GH-94042) (cherry picked from commit 94eeac03dc8c643ff050e7d0d306637d9556f798) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* gh-93925: Improve clarity of sqlite3 commit/rollback, and close docs (GH-93926)Miss Islington (bot)2022-06-192-10/+22
| | | | | | Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM> (cherry picked from commit 6446592c89b0c581c00e170ae6278291e940755c) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* [3.11] gh-79579: Improve DML query detection in sqlite3 (GH-93623) (#93800)Erlend Egeberg Aasland2022-06-141-74/+45
| | | | | | | | | | | | The fix involves using pysqlite_check_remaining_sql(), not only to check for multiple statements, but now also to strip leading comments and whitespace from SQL statements, so we can improve DML query detection. pysqlite_check_remaining_sql() is renamed lstrip_sql(), to more accurately reflect its function, and hardened to handle more SQL comment corner cases. (cherry picked from commit 46740073ef32bf83964c39609c7a7a4772c51ce3) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* gh-92434: Silence compiler warning in Modules/_sqlite/connection.c on 32-bit ↵Miss Islington (bot)2022-06-101-1/+1
| | | | | | | systems (GH-93090) (cherry picked from commit d8395eb38d3d05f74a7f348da81a280ad272b8c8) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
* gh-93421: Update sqlite3 cursor.rowcount only after SQLITE_DONE (GH-93526)Miss Islington (bot)2022-06-081-8/+11
| | | | | (cherry picked from commit 875de61c296604f3a3a51e9d76355e0f1a24c6af) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-93044: No longer convert the database argument of ↵Serhiy Storchaka2022-05-212-7/+4
| | | | | | | | sqlite3.connect() to bytes (GH-93046) (GH-93048) Just pass it to the factory as is. (cherry picked from commit 14c0d33016a967a98155f2e1615660e9328aef5d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-91922: Fix sqlite connection on nonstardard locales and paths (GH-92926)Miss Islington (bot)2022-05-202-53/+20
| | | | | (cherry picked from commit d8537580921b2e02f477ff1a8dedcf82c24ef0c2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-89022: Improve sqlite3 exceptions related to binding params and API ↵Erlend Egeberg Aasland2022-05-042-15/+19
| | | | | | | | | | | | | misuse (#91572) * Map SQLITE_MISUSE to sqlite3.InterfaceError SQLITE_MISUSE implies misuse of the SQLite C API, which, if it happens, is _not_ a user error; it is an sqlite3 extension module error. * Raise better errors when binding parameters fail. Instead of always raising InterfaceError, guessing what went wrong, raise accurate exceptions with more accurate error messages.
* gh-80254: Disallow recursive usage of cursors in `sqlite3` converters (#29054)Erlend Egeberg Aasland2022-05-031-7/+24
| | | | Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-92206: Improve scoping of sqlite3 statement helper (#92260)Erlend Egeberg Aasland2022-05-033-9/+8
|
* gh-89289: Fix compiler warning in _sqlite/connection.c (#92258)Erlend Egeberg Aasland2022-05-031-1/+1
|
* gh-92206: Improve scoping of sqlite3 bind param functions (#92250)Erlend Egeberg Aasland2022-05-033-257/+250
|
* gh-91320: Argument Clinic uses _PyCFunction_CAST() (#32210)Victor Stinner2022-05-034-33/+33
| | | | Replace "(PyCFunction)(void(*)(void))func" cast with _PyCFunction_CAST(func).
* gh-89289: Harden sqlite3.Connection init (#92214)Erlend Egeberg Aasland2022-05-031-8/+15
| | | | | - Make sure SQLite resources are freed if database open fails - Remove unneeded branches if init is aborted
* gh-92206: Improve scoping of sqlite3 reset statement helper (#92241)Erlend Egeberg Aasland2022-05-033-30/+28
|
* gh-92206: Improve scoping of sqlite3 register cursor helper (#92212)Erlend Egeberg Aasland2022-05-033-28/+23
|
* gh-92206: Move pysqlite_step() to Modules/_sqlite/cursor.c (#92207)Erlend Egeberg Aasland2022-05-033-16/+14
|
* gh-89301: Fix regression with bound values in traced SQLite statements (#92053)Erlend Egeberg Aasland2022-05-021-14/+40
|
* gh-92019: Make sqlite3.Blob indexing conform with the norm (#92020)Erlend Egeberg Aasland2022-04-301-18/+44
| | | | | | - get index now returns an int - set index now requires an int in range(0, 256) Resolves #92019
* gh-91583: AC: Fix regression for functions with defining_class (GH-91739)Serhiy Storchaka2022-04-301-22/+113
| | | | | Argument Clinic now generates the same efficient code as before adding the defining_class parameter.
* gh-69093: Add indexing and slicing support to sqlite3.Blob (#91599)Erlend Egeberg Aasland2022-04-221-5/+202
| | | | Authored-by: Aviv Palivoda <palaviv@gmail.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@innova.no>
* gh-69093: Add context manager support to sqlite3.Blob (GH-91562)Erlend Egeberg Aasland2022-04-162-1/+95
|
* gh-69093: improve sqlite3.Connection.blobopen() error handling (GH-91571)Erlend Egeberg Aasland2022-04-151-1/+5
| | | | | Unless sqlite3_blob_open() returns SQLITE_MISUSE, the error code and message are available on the connection object. This means we have to handle SQLITE_MISUSE error messages explicitly.
* gh-69093: Don't allow instantiation of sqlite3.Blob objects (GH-91570)Erlend Egeberg Aasland2022-04-151-1/+1
|
* gh-69093: Expose sqlite3.Blob as a class (GH-91550)Jelle Zijlstra2022-04-151-0/+1
| | | | I noticed this was missing while writing typeshed stubs. It's useful to expose it for use in annotations and for exploration.
* gh-69093: Support basic incremental I/O to blobs in `sqlite3` (GH-30680)Erlend Egeberg Aasland2022-04-158-6/+739
| | | | | | | Authored-by: Aviv Palivoda <palaviv@gmail.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@innova.no> Co-authored-by: palaviv <palaviv@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-79097: Add support for aggregate window functions in sqlite3 (GH-20903)Erlend Egeberg Aasland2022-04-124-8/+230
|
* bpo-41930: Add support for SQLite serialise/deserialise API (GH-26728)Erlend Egeberg Aasland2022-04-052-1/+280
| | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-44859: Raise more accurate exceptions in `sqlite3` (GH-27695)Erlend Egeberg Aasland2022-03-172-5/+7
| | | | | | | | | | | | * Improve exception compliance with PEP 249 * Raise InterfaceError instead of ProgrammingError for SQLITE_MISUSE. If SQLITE_MISUSE is raised, it is a sqlite3 module bug. Users of the sqlite3 module are not responsible for using the SQLite C API correctly. * Don't overwrite BufferError with ValueError when conversion to BLOB fails. * Raise ProgrammingError instead of Warning if user tries to execute() more than one SQL statement. * Raise ProgrammingError instead of ValueError if an SQL query contains null characters. * Make sure `_pysqlite_set_result` raises an exception if it returns -1.
* sqlite3: normalise pre-acronym determiners (GH-31772)Erlend Egeberg Aasland2022-03-112-7/+7
| | | For consistency, replace "a SQL" with "an SQL".
* bpo-45138: Revert GH-28240: Expand traced SQL statements (GH-31788)Erlend Egeberg Aasland2022-03-091-35/+14
| | | | | This reverts commit d1777515f9f53b452a4231d68196a7c0e5deb879. Automerge-Triggered-By: GH:JelleZijlstra
* bpo-45138: Expand traced SQL statements in `sqlite3` trace callback (GH-28240)Erlend Egeberg Aasland2022-03-091-14/+35
|
* Docstring: replace pysqlite with sqlite3 (GH-31758)Erlend Egeberg Aasland2022-03-092-7/+7
| | | | Replace two instances of "pysqlite" with "sqlite3" in sqlite3 docstrings. Also reword "is a no-op" to "does nothing" for clarity.
* bpo-46878: Purge 'non-standard' from sqlite3 docstrings (GH-31612)Erlend Egeberg Aasland2022-03-086-69/+67
|
* bpo-46874: Speed up sqlite3 user-defined aggregate 'step' method (GH-31604)Erlend Egeberg Aasland2022-03-033-4/+9
|
* bpo-46541: Remove unneeded visits from sqlite3 (GH-31609)Erlend Egeberg Aasland2022-02-281-7/+0
|
* bpo-46541: Replace _Py_IDENTIFIER with _Py_ID in sqlite3 (GH-31351)Erlend Egeberg Aasland2022-02-165-39/+61
|
* bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)Petr Viktorin2022-02-111-1/+1
| | | | | * Make PyType_GetModuleByDef public (remove underscore) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized ↵Eric Snow2022-02-084-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | global objects. (gh-30928) We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code. It is still used in a number of non-builtin stdlib modules. The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime. A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings). https://bugs.python.org/issue46541#msg411799 explains the rationale for this change. The core of the change is in: * (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros * Include/internal/pycore_runtime_init.h - added the static initializers for the global strings * Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState * Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings. That check is added to the PR CI config. The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()). This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *. The following are not changed (yet): * stop using _Py_IDENTIFIER() in the stdlib modules * (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API * (maybe) intern the strings during runtime init https://bugs.python.org/issue46541
* bpo-43853: Expand test suite for SQLite UDF's (GH-27642)Erlend Egeberg Aasland2022-01-262-3/+14
|
* bpo-46249: Move set lastrowid out of the sqlite3 query loop (GH-30489)Erlend Egeberg Aasland2022-01-221-11/+11
|
* bpo-44092: Remove unused member `reset` from `sqlite3.Cursor` (GH-30377)Erlend Egeberg Aasland2022-01-032-20/+0
| | | Automerge-Triggered-By: GH:pablogsal
* bpo-44092: Don't reset statements/cursors before rollback (GH-26026)Erlend Egeberg Aasland2022-01-031-24/+0
| | | In SQLite versions pre 3.7.11, pending statements would block a rollback. This is no longer the case, so remove the workaround.
* bpo-45828: Use unraisable exceptions within sqlite3 callbacks (FH-29591)Erlend Egeberg Aasland2021-11-291-1/+1
|
* bpo-45512: Use Argument Clinic to set sqlite3 isolation level (GH-29593)Erlend Egeberg Aasland2021-11-182-72/+67
|
* bpo-45512: Simplify manage isolation level (GH-29562)Dong-hee Na2021-11-173-41/+33
|
* bpo-45126: Harden `sqlite3` connection initialisation (GH-28227)Erlend Egeberg Aasland2021-11-162-62/+72
|