Code

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#1624 closed defect (fixed)

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

Reported by: akaihola Owned by: adrian
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: UI/UX:

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 akaihola 8 years ago.
adds default value for the params argument in debug and mysql cursor wrappers
executemany_arguments.2.diff (1.6 KB) - added by akaihola 8 years ago.
unifies executemany arguments and fixes a crash-causing bug in sqlite's executemany

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by akaihola

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

comment:1 Changed 8 years ago by akaihola

  • Summary changed from argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper to [patch] argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper

comment:2 Changed 8 years ago by akaihola

  • priority changed from lowest to normal
  • Severity changed from trivial to normal
  • Summary changed from [patch] argument mismatch between SQLiteCursorWrapper and MysqlDebugWrapper/CursorDebugWrapper to [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.

Changed 8 years ago by akaihola

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

comment:3 Changed 8 years ago by adrian

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 Changed 8 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.