Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.
test_sqlite3.test_transactions now completes ~10 times faster than before.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
The size of the returned data is too implementation specific.
(cherry picked from commit 61405da9a5)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
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 46740073ef)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* Test with with escaped non-ascii characters
* Test read-only open of existing DB.
(cherry picked from commit 4e2b664892)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* 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.
* 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-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>