summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/connection.c
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-129346: Handle allocation errors for SQLite aggregate context ↵Miss Islington (bot)2025-01-271-0/+5
| | | | | | | (GH-129347) (#129373) (cherry picked from commit 379ab856f59423c570333403a7d5d72f3ea82d52) Co-authored-by: Erlend E. Aasland <erlend@python.org>
* [3.12] gh-108083: Don't ignore exceptions in sqlite3.Connection.__init__() ↵Erlend E. Aasland2023-08-191-31/+75
| | | | | | | | | | | | | | | | and .close() (#108084) (#108141) - Add explanatory comments - Add return value to connection_close() for propagating errors - Always check the return value of connection_exec_stmt() - Assert pre/post state in remove_callbacks() - Don't log unraisable exceptions in case of interpreter shutdown - Make sure we're not initialized if reinit fails - Try to close the database even if ROLLBACK fails (cherry picked from commit fd195092204aa7fc9f13c5c6d423bc723d0b3520) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-105375: Improve error handling in sqlite3 collation callback ↵Miss Islington (bot)2023-06-071-3/+5
| | | | | | | | (GH-105412) (#105440) Check for error after each call to PyUnicode_FromStringAndSize(). (cherry picked from commit a24a780d937109a0982d807473ae410cc75b0e3b) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization ↵Eric Snow2023-05-151-1/+1
| | | | | (gh-104437) With the move to a per-interpreter GIL, this check slipped through the cracks.
* gh-100370: fix OverflowError in sqlite3.Connection.blobopen for 32-bit ↵Erlend E. Aasland2023-05-071-4/+22
| | | | builds (#103902)
* gh-103489: Add get/set config methods to sqlite3.Connection (#103506)Erlend E. Aasland2023-04-261-0/+117
|
* gh-103015: Add entrypoint keyword param to sqlite3.Connection.load_extension ↵Erlend E. Aasland2023-04-261-3/+6
| | | | (#103073)
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-02-241-8/+6
| | | | (in Modules/) (#102196)
* bpo-15999: Accept arbitrary values for boolean parameters. (#15609)Serhiy Storchaka2022-12-031-6/+6
| | | builtins and extension module functions and methods that expect boolean values for parameters now accept any Python object rather than just a bool or int type. This is more consistent with how native Python code itself behaves.
* gh-83638: Add sqlite3.Connection.autocommit for PEP 249 compliant behaviour ↵Erlend E. Aasland2022-11-121-32/+148
| | | | | | | | | | (#93823) Introduce the autocommit attribute to Connection and the autocommit parameter to connect() for PEP 249-compliant transaction handling. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
* gh-95132: Correctly relay *args and **kwds from sqlite3.connect to factory ↵Erlend Egeberg Aasland2022-07-231-0/+1
| | | | | | | | | | | | (#95146) 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>
* gh-93925: Improve clarity of sqlite3 commit/rollback, and close docs (#93926)Erlend Egeberg Aasland2022-06-191-6/+12
| | | Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
* gh-93829: In sqlite3, replace Py_BuildValue with faster APIs (#93830)Erlend Egeberg Aasland2022-06-151-2/+1
| | | | - In Modules/_sqlite/connection.c, use PyLong_FromLong - In Modules/_sqlite/microprotocols.c, use PyTuple_Pack
* gh-93741: Add private C API _PyImport_GetModuleAttrString() (GH-93742)Serhiy Storchaka2022-06-141-28/+6
| | | | | | It combines PyImport_ImportModule() and PyObject_GetAttrString() and saves 4-6 lines of code on every use. Add also _PyImport_GetModuleAttr() which takes Python strings as arguments.
* gh-92434: Silence compiler warning in Modules/_sqlite/connection.c on 32-bit ↵neonene2022-06-101-1/+1
| | | | systems (#93090)
* gh-91922: Fix sqlite connection on nonstardard locales and paths (GH-92926)Serhiy Storchaka2022-05-201-42/+14
|
* gh-89289: Fix compiler warning in _sqlite/connection.c (#92258)Erlend Egeberg Aasland2022-05-031-1/+1
|
* 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 register cursor helper (#92212)Erlend Egeberg Aasland2022-05-031-26/+0
|
* gh-89301: Fix regression with bound values in traced SQLite statements (#92053)Erlend Egeberg Aasland2022-05-021-14/+40
|
* 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: Support basic incremental I/O to blobs in `sqlite3` (GH-30680)Erlend Egeberg Aasland2022-04-151-2/+85
| | | | | | | 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-121-7/+172
|
* bpo-41930: Add support for SQLite serialise/deserialise API (GH-26728)Erlend Egeberg Aasland2022-04-051-0/+121
| | | | 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-171-2/+5
| | | | | | | | | | | | * 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.
* 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
|
* bpo-46878: Purge 'non-standard' from sqlite3 docstrings (GH-31612)Erlend Egeberg Aasland2022-03-081-30/+26
|
* bpo-46874: Speed up sqlite3 user-defined aggregate 'step' method (GH-31604)Erlend Egeberg Aasland2022-03-031-4/+6
|
* bpo-46541: Replace _Py_IDENTIFIER with _Py_ID in sqlite3 (GH-31351)Erlend Egeberg Aasland2022-02-161-23/+18
|
* bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized ↵Eric Snow2022-02-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-261-1/+5
|
* 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-181-55/+65
|
* bpo-45512: Simplify manage isolation level (GH-29562)Dong-hee Na2021-11-171-35/+21
|
* bpo-45126: Harden `sqlite3` connection initialisation (GH-28227)Erlend Egeberg Aasland2021-11-161-56/+66
|
* bpo-45512: Raise exception if sqlite3.Connection.__init__ is called with bad ↵Erlend Egeberg Aasland2021-11-151-3/+3
| | | | | | | | | | | | | | | isolation level (#29561) * bpo-45512: Raise sqlite3.Connection.__init__ is called with bad isolation level * Also explicitly test allowed isolation levels * Use subTest for better error messages if something goes wrong * Update Lib/test/test_sqlite3/test_dbapi.py Co-authored-by: Dong-hee Na <donghee.na92@gmail.com> Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* bpo-45512: Simplify isolation_level handling in `sqlite3` (GH-29053)Erlend Egeberg Aasland2021-11-151-56/+63
|
* bpo-45731: Handle --enable-loadable-sqlite-extensions in configure (GH-29434)Christian Heimes2021-11-061-1/+1
|
* bpo-45243: Add support for setting/getting `sqlite3` connection limits ↵Erlend Egeberg Aasland2021-11-011-0/+53
| | | | (GH-28463)
* bpo-45581: Raise `MemoryError` in `sqlite3.connect` if SQLite signals memory ↵Erlend Egeberg Aasland2021-10-291-0/+4
| | | | error (GH-29171)
* bpo-42064: Convert `sqlite3` global state to module state (GH-29073)Erlend Egeberg Aasland2021-10-271-2/+3
|
* bpo-42064: Add module backref to `sqlite3` callback context (GH-28242)Erlend Egeberg Aasland2021-10-191-17/+44
|
* bpo-44991: Normalise function and collation callback naming (GH-28209)Erlend Egeberg Aasland2021-10-121-7/+5
|
* bpo-45439: Move _PyObject_CallNoArgs() to pycore_call.h (GH-28895)Victor Stinner2021-10-121-2/+2
| | | | | | | * Move _PyObject_CallNoArgs() to pycore_call.h (internal C API). * _ssl, _sqlite and _testcapi extensions now call the public PyObject_CallNoArgs() function, rather than _PyObject_CallNoArgs(). * _lsprof extension is now built with Py_BUILD_CORE_MODULE macro defined to get access to internal _PyObject_CallNoArgs().
* bpo-45439: Rename _PyObject_CallNoArg() to _PyObject_CallNoArgs() (GH-28891)Victor Stinner2021-10-111-2/+2
| | | | | Fix typo in the private _PyObject_CallNoArg() function name: rename it to _PyObject_CallNoArgs() to be consistent with the public function PyObject_CallNoArgs().
* bpo-45040: Simplify sqlite3 transaction control functions (GH-28019)Erlend Egeberg Aasland2021-09-191-47/+21
|
* bpo-45126: Fix ref. leak in `sqlite3.Connection.__init__` (GH-28231)Erlend Egeberg Aasland2021-09-121-8/+41
|
* bpo-42064: Pass module state to trace, progress, and authorizer callbacks ↵Erlend Egeberg Aasland2021-09-071-69/+107
| | | | | | | | (GH-27940) - add print-or-clear traceback helper - add helpers to clear and visit saved contexts - modify callbacks to use the new callback_context struct