summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/statement.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-44859: Raise more accurate exceptions in `sqlite3` (GH-27695)Erlend Egeberg Aasland2022-03-171-3/+2
| | | | | | | | | | | | * 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-43853: Expand test suite for SQLite UDF's (GH-27642)Erlend Egeberg Aasland2022-01-261-2/+9
|
* bpo-45754: Use correct SQLite limit when checking statement length (GH-29489)Erlend Egeberg Aasland2021-11-101-2/+2
|
* bpo-44958: Revert GH-27844 (GH-28574)Erlend Egeberg Aasland2021-09-261-20/+12
| | | | This reverts commit 050d1035957379d70e8601e6f5636637716a264b, but keeps the tests.
* bpo-44958: Only reset `sqlite3` statements when needed (GH-27844)Erlend Egeberg Aasland2021-09-211-12/+20
|
* bpo-44079: Strip superfluous statement cache from sqlite3.Connection (GH-25998)Erlend Egeberg Aasland2021-08-181-26/+0
|
* bpo-44859: Improve error handling in sqlite3 and and raise more accurate ↵Serhiy Storchaka2021-08-081-3/+0
| | | | | | | | | | | | | | | | | | | | exceptions. (GH-27654) * MemoryError is now raised instead of sqlite3.Warning when memory is not enough for encoding a statement to UTF-8 in Connection.__call__() and Cursor.execute(). * UnicodEncodeError is now raised instead of sqlite3.Warning when the statement contains surrogate characters in Connection.__call__() and Cursor.execute(). * TypeError is now raised instead of ValueError for non-string script argument in Cursor.executescript(). * ValueError is now raised for script containing the null character instead of truncating it in Cursor.executescript(). * Correctly handle exceptions raised when getting boolean value of the result of the progress handler. * Add many tests covering different corner cases. Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* bpo-42064: Optimise `sqlite3` state access, part 1 (GH-27273)Erlend Egeberg Aasland2021-07-291-10/+12
| | | | | | | | | | Prepare for module state: - Add "get state by defining class" and "get state by module def" stubs - Add AC defining class when needed - Add state pointer to connection context - Pass state as argument to utility functions Automerge-Triggered-By: GH:encukou
* bpo-42064: Finalise establishing sqlite3 global state (GH-27155)Erlend Egeberg Aasland2021-07-201-1/+2
| | | | | | With this, all sqlite3 static globals have been moved to the global state. There are a couple of global static strings left, but there should be no need for adding them to the state. https://bugs.python.org/issue42064
* bpo-42064: Move `sqlite3` exceptions to global state, part 2 of 2 (GH-26884)Erlend Egeberg Aasland2021-07-141-8/+13
| | | Automerge-Triggered-By: GH:encukou
* bpo-42064: Move `sqlite3` exceptions to global state, part 1 of 2 (GH-26745)Erlend Egeberg Aasland2021-06-231-7/+11
| | | Also adds a test to verify the (borrowed) exceptions in `sqlite3.Connection`.
* bpo-44087: Disallow instantiation of sqlite3.Statement (GH-26567)Erlend Egeberg Aasland2021-06-201-1/+1
|
* bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351)Erlend Egeberg Aasland2021-06-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make functools types immutable * Multibyte codec types are now immutable * pyexpat.xmlparser is now immutable * array.arrayiterator is now immutable * _thread types are now immutable * _csv types are now immutable * _queue.SimpleQueue is now immutable * mmap.mmap is now immutable * unicodedata.UCD is now immutable * sqlite3 types are now immutable * _lsprof.Profiler is now immutable * _overlapped.Overlapped is now immutable * _operator types are now immutable * winapi__overlapped.Overlapped is now immutable * _lzma types are now immutable * _bz2 types are now immutable * _dbm.dbm and _gdbm.gdbm are now immutable
* bpo-42064: Move sqlite3 types to global state (GH-26537)Erlend Egeberg Aasland2021-06-151-6/+15
| | | | | | | | | * Move connection type to global state * Move cursor type to global state * Move prepare protocol type to global state * Move row type to global state * Move statement type to global state * ADD_TYPE takes a pointer * pysqlite_get_state is now static inline
* bpo-44329: Refactor sqlite3 statement creation (GH-26566)Erlend Egeberg Aasland2021-06-081-43/+35
| | | | | Call SQLite API's first, and return early in case of error. At the end, allocate the object and initialise members. We now avoid unneeded alloc/dealloc's in case the statement creation fails.
* bpo-44326: Remove unused members from pysqlite_Statement (GH-26564)Erlend Egeberg Aasland2021-06-061-14/+2
| | | | | * Remove unused db member of pysqlite_Statement * Remove unused sql method from statement object
* bpo-44304: Ensure the sqlite3 destructor callback is always called with the ↵Pablo Galindo2021-06-051-0/+2
| | | | GIL held (GH-26551)
* bpo-44304: Fix crash in the sqlite3 module when the GC clears Statement ↵Pablo Galindo2021-06-051-7/+4
| | | | objects (GH-26545)
* bpo-44165: pysqlite_statement_create now returns a Py object, not an int ↵Erlend Egeberg Aasland2021-06-021-1/+1
| | | | | (GH-26484) GH-26206 was broken by GH-26475.
* bpo-44165: Optimise sqlite3 statement preparation by passing string size ↵Erlend Egeberg Aasland2021-06-021-1/+7
| | | | (GH-26206)
* bpo-42972: Track sqlite3 statement objects (GH-26475)Erlend Egeberg Aasland2021-06-011-14/+35
| | | | | | | | | | | Allocate and track statement objects in pysqlite_statement_create. By allocating and tracking creation of statement object in pysqlite_statement_create(), the caller does not need to worry about GC syncronization, and eliminates the possibility of getting a badly created object. All related fault handling is moved to pysqlite_statement_create(). Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-42972: Fix sqlite3 traverse/clear functions (GH-26452)Erlend Egeberg Aasland2021-05-311-4/+4
|
* bpo-42972: Fully implement GC protocol for sqlite3 heap types (GH-26104)Erlend Egeberg Aasland2021-05-251-10/+23
|
* bpo-43269: Remove redundant extern keywords (GH-24605)Erlend Egeberg Aasland2021-02-211-1/+2
|
* bpo-43269: Clean up sqlite3 file scope (GH-24578)Erlend Egeberg Aasland2021-02-211-1/+2
|
* bpo-1635741: sqlite3 uses Py_NewRef/Py_XNewRef (GH-23170)Erlend Egeberg Aasland2020-12-271-8/+7
|
* bpo-41861: Convert _sqlite3 RowType and StatementType to heap types (GH-22444)Erlend Egeberg Aasland2020-10-011-44/+27
|
* bpo-41861: Convert _sqlite3 PrepareProtocolType to heap type (GH-22428)Erlend Egeberg Aasland2020-09-281-2/+2
|
* bpo-41662: Fix bugs in binding parameters in sqlite3 (GH-21998)Serhiy Storchaka2020-09-171-2/+5
| | | | | | | * When the parameters argument is a list, correctly handle the case of changing it during iteration. * When the parameters argument is a custom sequence, no longer override an exception raised in ``__len__()``.
* bpo-41638: Improve ProgrammingError message for absent parameter. (GH-21999)Serhiy Storchaka2020-09-041-1/+1
| | | | | It contains now the name of the parameter instead of its index when parameters are supplied as a dict.
* bpo-37406: sqlite3 raises TypeError for wrong operation type (GH-14386)Victor Stinner2019-06-261-0/+2
| | | | | The sqlite3 module now raises TypeError, rather than ValueError, if operation argument type is not str: execute(), executemany() and calling a connection.
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-2/+2
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-32788: Better error handling in sqlite3. (GH-3723)Serhiy Storchaka2018-12-101-15/+19
| | | Propagate unexpected errors (like MemoryError and KeyboardInterrupt) to user.
* bpo-32215: Fix performance regression in sqlite3 (GH-8511)Berker Peksag2018-09-201-4/+4
|
* closes bpo-31525: require sqlite3_prepare_v2 (#3666)Benjamin Peterson2017-09-201-51/+5
| | | | | This is based on https://github.com/ghaering/pysqlite/commit/40b349cadbd87c42f70fc92e5e1aee6d02564c6d#diff-0489411409cd2934730e88bf7767790, though we can be a bit more aggressive about deleting code.
* bpo-9303: Migrate sqlite3 module to _v2 API to enhance performance (#359)Aviv Palivoda2017-03-031-2/+2
|
* bpo-28518: Start a transaction implicitly before a DML statement (#245)Berker Peksag2017-02-261-5/+7
| | | Patch by Aviv Palivoda.
* Added the const qualifier to char* variables that refer to readonly internalSerhiy Storchaka2016-11-201-1/+1
| | | | UTF-8 represenatation of Unicode objects.
* Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSizeSerhiy Storchaka2016-11-201-3/+3
| | | | with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
* Issue #10740: sqlite3 no longer implicitly commit an open transaction before ↵Berker Peksag2016-09-111-0/+18
| | | | | | | | | | | | | | | | | | DDL statements This commit contains the following commits from ghaering/pysqlite: * https://github.com/ghaering/pysqlite/commit/f254c534948c41c0ceb8cbabf0d4a2f547754739 * https://github.com/ghaering/pysqlite/commit/796b3afe38cfdac5d7d5ec260826b0a596554631 * https://github.com/ghaering/pysqlite/commit/cae87ee68613697a5f4947b4a0941f59a28da1b6 * https://github.com/ghaering/pysqlite/commit/3567b31bb5e5b226ba006213a9c69dde3f155faf With the following additions: * Fixed a refcount error * Fixed a compiler warning * Made the string comparison a little more robust * Added a whatsnew entry
* Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()Serhiy Storchaka2015-02-021-5/+8
| | | | and PyObject_AsWriteBuffer().
* Issue #21147: sqlite3 now raises an exception if the request contains a nullSerhiy Storchaka2014-09-111-0/+4
| | | | character instead of truncate it. Based on patch by Victor Stinner.
* sqlite: Use Py_ssize_t to store a size instead of an intVictor Stinner2013-11-181-2/+4
| | | | Fix a compiler warning on Windows 64-bit
* sqlite: raise an OverflowError if a string or a BLOB is longer than INT_MAXVictor Stinner2013-11-181-8/+16
| | | | | | bytes Fix compiler warnings on Windows 64-bit
* Issue #1772673: The type of `char*` arguments now changed to `const char*`.Serhiy Storchaka2013-10-191-1/+1
|
* Issue #18701: Remove support of old CPython versions (<3.0) from C code.Serhiy Storchaka2013-08-161-1/+0
|
* Issue #17073: Fix some integer overflows in sqlite3 module.Serhiy Storchaka2013-02-071-5/+8
|\
| * Issue #17073: Fix some integer overflows in sqlite3 module.Serhiy Storchaka2013-02-071-5/+8
| |
* | Undocument and clean up sqlite3.OptimizedUnicodePetri Lehtinen2012-02-091-4/+4
| | | | | | | | Closes #13921.
* | Merge branch 3.2Petri Lehtinen2012-02-011-2/+2
|\ \ | |/ | | | | Closes #13676.