Opened 17 years ago

Closed 17 years ago

Last modified 16 years ago

#6344 closed defect (fixed)

Workaround lastError bug in Qt 4.5.0

Reported by: sphery <mtdean@…> Owned by: Isaac Richards
Priority: minor Milestone: 0.22
Component: MythTV - General Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Qt 4.5.0 modified the Qt MySQL driver and added a bug which causes a lastError to sometimes be reported, even when the last statement executed was successfully executed. Since Myth's DB upgrade code only checks lastError, non-failures are sometimes treated as failures (i.e. when executing the ALTER DATABASE statements that are passed to performActualUpdate()).

The attached patch works around the issue by simply checking the return value of exec() as well as the lastError(). It only works around the issue in the one location where I know it exists--the DB upgrade code. I've checked all other locations in dbcheck.cpp that look only at lastError() and none will be affected by the bug (i.e. their statements can be executed either as prepared or non-prepared statements). However, similar problems may exist in other parts of Myth.

I've reported the bug to Qt's bug tracker and posted a patch, but it seems to be moderated, so a link to the bug isn't yet available. The Qt patch is simple, but distros are already starting to use the buggy version of Qt, so the workaround may be worthwhile.

Attachments (2)

mythtv-6344-workaround_for_Qt_4_5_lastError_bug.patch (624 bytes ) - added by sphery <mtdean@…> 17 years ago.
lastError_bug.patch (4.0 KB ) - added by OJ <olejl77@…> 17 years ago.
patch for plugins as well

Download all attachments as: .zip

Change History (5)

by sphery <mtdean@…>, 17 years ago

comment:1 by sphery <mtdean@…>, 17 years ago

This was fixed by Janne in [20186]

comment:2 by paulh, 17 years ago

Milestone: unknown0.22
Resolution: fixed
Status: newclosed
Version: 0.21head

by OJ <olejl77@…>, 17 years ago

Attachment: lastError_bug.patch added

patch for plugins as well

comment:3 by paulh, 16 years ago

(In [20473]) Similar to [20186] always check MSqlQuery::exec() return value this time for all the plugins. Thanks to OJ for the patch. Refs #6344.

Note: See TracTickets for help on using tickets.