Edgewall Software

Opened 12 years ago

Last modified 10 years ago

#10893 closed defect

Environment.db_query example should not call fetchall — at Version 1

Reported by: Ryan J Ollos <ryan.j.ollos@…> Owned by:
Priority: normal Milestone:
Component: database backend Version:
Severity: normal Keywords:
Cc: documentation Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos <ryan.j.ollos@…>)

In Trac 1.0, a call to Environment.db_query can be traced to a call to trac.db.util.ConnectionWrapper.execute with readonly=True, which calls fetchall to return the iterable. Therefore it seems like the example in the documentation for using Environment.db_query needs to be updated to remove the call to fetchall.

This is a pretty minor issue, so I'm not sure it is worth a ticket, but I've been trying to understand when it is necessary to call fetchall, and couldn't think of another way to relay the info.

I grep'ed the source for instances in which fetchall is called in the application code (outside the db layer), and only found 3. The call in db21.py seems unnecessary.

Change History (2)

by Ryan J Ollos <ryan.j.ollos@…>, 12 years ago

Attachment: t10893-r11401-1.patch added

Patch against r11401 of the trunk.

comment:1 by Ryan J Ollos <ryan.j.ollos@…>, 12 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.