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

Pr. now, we call sqlite3_column_count() for every iteration in the 
_pysqlite_query_execute() loop. If detect_types is set, we call it twice for 
every loop.

Suggesting to move it out of the loop and into the pysqlite_Statement object. 
In pysqlite_statement_create(), after sqlite3_prepare_v2(), if self->is_dml == 
0 we fetch the column count: self->column_count = sqlite3_column_count(). Else, 
it's 0.


# SQLite API interaction examples (pseudo-code), as diffs
--- now
+++ patched

## Create table
 sqlite3_prepare_v2
+sqlite3_column_count
 sqlite3_bind_blob_parameter_count
 sqlite3_step
-sqlite3_column_count
 sqlite3_last_insert_rowid
 sqlite3_reset

## Triple insert (executemany)
 sqlite3_prepare_v2
 sqlite3_get_autocommit
 sqlite3_bind_blob_parameter_count
 sqlite3_bind_int64
 sqlite3_step
-sqlite3_column_count
 sqlite3_changes
 sqlite3_reset
 sqlite3_bind_blob_parameter_count
 sqlite3_bind_int64
 sqlite3_step
-sqlite3_column_count
 sqlite3_changes
 sqlite3_reset
 sqlite3_bind_blob_parameter_count
 sqlite3_bind_int64
 sqlite3_step
-sqlite3_column_count
 sqlite3_changes
 sqlite3_reset

----------
components: Extension Modules
messages: 392964
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
type: enhancement
versions: Python 3.11

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

Reply via email to