Opened 19 years ago

Closed 19 years ago

Last modified 17 years ago

#1624 closed defect (fixed)

[patch] argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper PLUS a crash-causing typo

Reported by: Antti Kaihola Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version:
Severity: normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I use an in-memory SQLite db for unit testing. I noticed that in SQLiteCursorWrapper the params argument has an empty list as the default value, but in MysqlDebugWrapper and CursorDebugWrapper there's no default value.

Attachments (2)

executemany_arguments.diff (1.0 KB ) - added by Antti Kaihola 19 years ago.
adds default value for the params argument in debug and mysql cursor wrappers
executemany_arguments.2.diff (1.6 KB ) - added by Antti Kaihola 19 years ago.
unifies executemany arguments and fixes a crash-causing bug in sqlite's executemany

Download all attachments as: .zip

Change History (6)

by Antti Kaihola, 19 years ago

Attachment: executemany_arguments.diff added

adds default value for the params argument in debug and mysql cursor wrappers

comment:1 by Antti Kaihola, 19 years ago

Summary: argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper[patch] argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper

comment:2 by Antti Kaihola, 19 years ago

priority: lowestnormal
Severity: trivialnormal
Summary: [patch] argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper[patch] argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper PLUS a crash-causing typo

Found an obvious bug as well. I suppose that in executemany, params=[] has been *params at some point, since SqliteCursorWrapper tries to do len(params[0]). I'll include a fix for that in the patch as well.

by Antti Kaihola, 19 years ago

unifies executemany arguments and fixes a crash-causing bug in sqlite's executemany

comment:3 by Adrian Holovaty, 19 years ago

The SQLiteCursorWrapper is incorrect in this case; it shouldn't have a default argument. Also, the bug you found isn't really a bug, because params is a *list* of parameter tuples, so len(params[0]) is indeed the length of the parameters.

comment:4 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

(In [2686]) magic-removal: Fixed #1624 -- Made small changes to parameters in executemany() in cursor implementations in MySQL and SQLite database backends

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