New submission from Erlend E. Aasland <erlend.aasl...@innova.no>:

Currently, if a non-DML statement is executed with executemany(), we only bail 
as late as possible: just before the call to _pysqlite_fetch_one_row(). This 
means that we've already stepped through the statement once (!), and possibly 
bound values, built the row cast map, and created the description tuple, all 
before raising the "executemany() can only execute DML statements."

So, the error message currently is not quite true, because we already executed 
the statement once.

Checking for this earlier will prevent a (possibly time-consuming) 
sqlite3_step(), and it will leave the main loop in _pysqlite_query_execute() 
slightly easier to read, IMO.

----------
components: Extension Modules
messages: 399992
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: low
severity: normal
status: open
title: [sqlite3] early exit for non-DML statements in executemany()
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44965>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to