Opened 17 years ago

Closed 17 years ago

#3820 closed (fixed)

DebugCursorWrapper not working on Oracle

Reported by: Ben Khoo <benk@…> Owned by: Jacob
Component: Uncategorized Version: other branch
Severity: Keywords: Oracle DebugCursorWrapper fetchall
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello,

I believe there may be an issue with the latest update to the boulder-oracle-sprint branch. A change was made on the 23rd of March so that a DebugCursorWrapper is returned if DEBUG == True. (Refer to the SVN log of /django/branches/boulder-oracle-sprint/django/db/oracle/base.py for the message).

The exhibits itself in /django/branches/boulder-oracle-sprint/django/db/oracle/base.py line 288 which reads:

for unresolved_row in cursor:

If DEBUG == True the cursor is a DebugCursorWrapper and is not iterable. Instead I believe that it should read something like the following:

for unresolved_row in cursor.fetchall():

Similarly in the file /django/branches/boulder-oracle-sprint/django/db/oracle/introspection.py on line 9, it reads:

return [row[0].upper() for row in cursor]

when I believe it should read

return [row[0].upper() for row in cursor.fetchall()]

Regards

Attachments (1)

oracle_cursor.patch (1.2 KB ) - added by Ben Khoo <benk@…> 17 years ago.

Download all attachments as: .zip

Change History (3)

by Ben Khoo <benk@…>, 17 years ago

Attachment: oracle_cursor.patch added

comment:1 by Matt Boersma, 17 years ago

The problem is that some of the Oracle backend code assumed cursors to be iterable and has code like:
for row in cursor:

pass

Supporting .next() and .iter() is actually an optional extension in the python DB-API 2.0. And once this change was made, we discovered the CursorDebugWrapper doesn't support either method. I made a quick fix in the boulder-oracle-sprint branch, and I'll make a more proper fix soon using your patch as a basis (there are a couple other locations this crops up.)

Thank you so much for helping test. We'll get there!

comment:2 by Matt Boersma, 17 years ago

Resolution: fixed
Status: newclosed

(In [4843]) boulder-oracle-sprint: Fixed #3820. See #3835 too, as this is a more
correct fix for the same issue (CursorDebugWrapper not iterable).

Note: See TracTickets for help on using tickets.
Back to Top