[issue44976] [sqlite3] lazy creation of result rows

2021-08-25 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44976] [sqlite3] lazy creation of result rows

2021-08-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 3df0fc89bc2714f5ef03e36a926bc795dcd5e05a by Erlend Egeberg 
Aasland in branch 'main':
bpo-44976: Lazy creation of sqlite3 result rows (GH-27884)
https://github.com/python/cpython/commit/3df0fc89bc2714f5ef03e36a926bc795dcd5e05a


--
nosy: +pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44976] [sqlite3] lazy creation of result rows

2021-08-22 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Historical note:
The current behaviour was introduced in pysqlite v2.0.2 (May 21 2005), in order 
to be able to finalise statements and thus close cursors as soon as possible. 
However, that effect was cancelled just after a couple of months, by the 
addition of the LRU cache and the ability to reuse prepared statements.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44976] [sqlite3] lazy creation of result rows

2021-08-22 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
keywords: +patch
pull_requests: +26339
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27884

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44976] [sqlite3] lazy creation of result rows

2021-08-22 Thread Erlend E. Aasland

New submission from Erlend E. Aasland :

Currently, we build the first result row in the _pysqlite_query_execute() loop 
if sqlite3_step() returned SQLITE_ROW. When the user asks for a row (for 
example, using sqlite3.Cursor.fetchone()), this pre-built row is returned, and 
the next row is prepared.

Suggesting to lazily build result rows instead.

Cons:
- no result tuples are built unless sqlite3.Cursor.fetch*() is called
- no need to keep the next result row (tuple) in pysqlite_Cursor; rows are 
built on demand
- pysqlite_cursor_iternext() is vastly simplified (50% less lines of code)
- the main loop in _pysqlite_query_execute() is further simplified

Cons:
- code churn


git diff main --shortstat: 2 files changed, 29 insertions(+), 58 deletions(-)

--
components: Extension Modules
messages: 400062
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite3] lazy creation of result rows
type: enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com