mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-45754: Use correct SQLite limit when checking statement length (GH-29489)
This commit is contained in:
parent
4cdeee5978
commit
c1323d4b8c
5 changed files with 14 additions and 11 deletions
|
@ -729,8 +729,8 @@ pysqlite_cursor_executescript_impl(pysqlite_Cursor *self,
|
|||
|
||||
size_t sql_len = strlen(sql_script);
|
||||
int max_length = sqlite3_limit(self->connection->db,
|
||||
SQLITE_LIMIT_LENGTH, -1);
|
||||
if (sql_len >= (unsigned)max_length) {
|
||||
SQLITE_LIMIT_SQL_LENGTH, -1);
|
||||
if (sql_len > (unsigned)max_length) {
|
||||
PyErr_SetString(self->connection->DataError,
|
||||
"query string is too large");
|
||||
return NULL;
|
||||
|
|
|
@ -60,8 +60,8 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
|
|||
}
|
||||
|
||||
sqlite3 *db = connection->db;
|
||||
int max_length = sqlite3_limit(db, SQLITE_LIMIT_LENGTH, -1);
|
||||
if (size >= max_length) {
|
||||
int max_length = sqlite3_limit(db, SQLITE_LIMIT_SQL_LENGTH, -1);
|
||||
if (size > max_length) {
|
||||
PyErr_SetString(connection->DataError,
|
||||
"query string is too large");
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue