summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sqlite3
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] gh-95132: Correctly relay *args and **kwds from sqlite3.connect to ↵Erlend Egeberg Aasland2022-07-231-0/+20
| | | | | | | | | | | | | | | 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-94998: Remove redundant condition in test_sqlite3/__main__.py (GH-95052)Miss Islington (bot)2022-07-201-2/+1
| | | | | (cherry picked from commit 9d09e7b0263c248659f3b4a2c597fca9ac4f8f91) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-84461: Fix test_sqlite for Emscripten/WASI (GH-94125) (GH-94157)Christian Heimes2022-06-231-1/+8
| | | | | (cherry picked from commit 15bfabd1aabb0335f33202b28f96b4e4062b3bce) Co-authored-by: Christian Heimes <christian@python.org>
* gh-94028: Clear and reset sqlite3 statements properly in cursor iternext ↵Miss Islington (bot)2022-06-211-0/+39
| | | | | | | (GH-94042) (cherry picked from commit 94eeac03dc8c643ff050e7d0d306637d9556f798) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* gh-79009: sqlite3.iterdump now correctly handles tables with autoincrement ↵Miss Islington (bot)2022-06-191-0/+47
| | | | | | | | (GH-9621) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> (cherry picked from commit affa9f22cfd1e83a5fb413e5ce2feef9ea1a49ac) Co-authored-by: itssme <itssme3000@gmail.com>
* [3.11] gh-93795: Use test.support TESTFN/unlink in sqlite3 tests (GH-93796) ↵Erlend Egeberg Aasland2022-06-141-17/+15
| | | | (#93808)
* [3.11] gh-79579: Improve DML query detection in sqlite3 (GH-93623) (#93800)Erlend Egeberg Aasland2022-06-141-10/+56
| | | | | | | | | | | | 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-93421: Update sqlite3 cursor.rowcount only after SQLITE_DONE (GH-93526)Miss Islington (bot)2022-06-081-0/+8
| | | | | (cherry picked from commit 875de61c296604f3a3a51e9d76355e0f1a24c6af) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* GH-93115: Fix version check in sqlite3 module constants test (GH-93116)Miss Islington (bot)2022-05-231-18/+18
| | | | | (cherry picked from commit d5f0dd160011826f0196d220aefc29d2ce497428) Co-authored-by: Florian Bruhin <me@the-compiler.org>
* Clean up the sqlite3 tests (GH-93056)Miss Islington (bot)2022-05-212-33/+23
| | | | | | | Remove helper managed_connect(). Use memory_database() or contextlib.closing() + addCleanup(unlink) instead. (cherry picked from commit e5d8dbdd304935dbd0631ee9605efb501332f792) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Improve tests for opening Sqlite by URI (GH-93047)Miss Islington (bot)2022-05-211-5/+42
| | | | | | | * Test with with escaped non-ascii characters * Test read-only open of existing DB. (cherry picked from commit 4e2b66489289cfd4db2a02edf173ac03cbb2fffe) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.11] gh-93044: No longer convert the database argument of ↵Serhiy Storchaka2022-05-211-0/+13
| | | | | | | | 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-201-11/+17
| | | | | (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-5/+5
| | | | | | | | | | | | | 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-0/+39
| | | | Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-89301: Fix regression with bound values in traced SQLite statements (#92053)Erlend Egeberg Aasland2022-05-021-1/+61
|
* gh-92019: Make sqlite3.Blob indexing conform with the norm (#92020)Erlend Egeberg Aasland2022-04-301-22/+29
| | | | | | - get index now returns an int - set index now requires an int in range(0, 256) Resolves #92019
* gh-69093: Add indexing and slicing support to sqlite3.Blob (#91599)Erlend Egeberg Aasland2022-04-221-4/+134
| | | | 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-161-0/+23
|
* gh-69093: Don't allow instantiation of sqlite3.Blob objects (GH-91570)Erlend Egeberg Aasland2022-04-151-0/+1
|
* gh-69093: Expose sqlite3.Blob as a class (GH-91550)Jelle Zijlstra2022-04-151-0/+3
| | | | 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-151-1/+156
| | | | | | | 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-122-5/+165
|
* bpo-41930: Add support for SQLite serialise/deserialise API (GH-26728)Erlend Egeberg Aasland2022-04-051-0/+55
| | | | 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-173-9/+28
| | | | | | | | | | | | * 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-60/+1
| | | | | 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-1/+60
|
* bpo-46874: Speed up sqlite3 user-defined aggregate 'step' method (GH-31604)Erlend Egeberg Aasland2022-03-031-2/+4
|
* bpo-43853: Expand test suite for SQLite UDF's (GH-27642)Erlend Egeberg Aasland2022-01-261-64/+64
|
* bpo-46425: use absolute imports in `test_sqlite3` (GH-30676)Nikita Sobolev2022-01-224-6/+5
|
* bpo-44092: Don't reset statements/cursors before rollback (GH-26026)Erlend Egeberg Aasland2022-01-032-28/+39
| | | 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-292-29/+34
|
* bpo-45512: Extend `sqlite3` test suite regarding isolation levels (GH-29576)Erlend Egeberg Aasland2021-11-172-3/+124
|
* bpo-45126: Harden `sqlite3` connection initialisation (GH-28227)Erlend Egeberg Aasland2021-11-161-0/+38
|
* bpo-45512: Raise exception if sqlite3.Connection.__init__ is called with bad ↵Erlend Egeberg Aasland2021-11-151-2/+16
| | | | | | | | | | | | | | | 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-45754: Use correct SQLite limit when checking statement length (GH-29489)Erlend Egeberg Aasland2021-11-102-7/+7
|
* bpo-45243: Use connection limits to simplify `sqlite3` tests (GH-29356)Erlend Egeberg Aasland2021-11-053-21/+54
|
* bpo-45613: Set `sqlite3.threadsafety` dynamically (GH-29227)Erlend Egeberg Aasland2021-11-031-2/+3
| | | | | | | | | Use the compile-time selected default SQLite threaded mode to set the DB-API 2.0 attribute 'threadsafety' Mappings: - SQLITE_THREADSAFE=0 => threadsafety=0 - SQLITE_THREADSAFE=1 => threadsafety=3 - SQLITE_THREADSAFE=2 => threadsafety=1
* bpo-24139: Fix test_sqlite3 `test_extended_error_code_on_exception()` on ↵Erlend Egeberg Aasland2021-11-031-1/+1
| | | | s390x RHEL buildbots (GH-29382)
* bpo-24139: Add support for SQLite extended result codes (GH-28076)Erlend Egeberg Aasland2021-11-021-2/+127
|
* bpo-45243: Add support for setting/getting `sqlite3` connection limits ↵Erlend Egeberg Aasland2021-11-011-0/+38
| | | | (GH-28463)
* bpo-10572: Move `sqlite3` tests to `Lib/test` (GH-29304)Erlend Egeberg Aasland2021-10-2911-0/+3918
Automerge-Triggered-By: GH:brettcannon