[mythtv-commits] Ticket #3681: mythfilldatabase erroneously deletes record schedules for the current day

MythTV mythtv at cvs.mythtv.org
Fri Jun 29 17:09:06 UTC 2007


#3681: mythfilldatabase erroneously deletes record schedules for the current day
-------------------------------------------------------+--------------------
 Reporter:  Tom Dexter <digitalaudiorock at hotmail.com>  |       Owner:  stuartm
     Type:  defect                                     |      Status:  new    
 Priority:  major                                      |   Milestone:  unknown
Component:  mythfilldatabase                           |     Version:  unknown
 Severity:  medium                                     |     Mlocked:  0      
-------------------------------------------------------+--------------------
 mythfilldata always deletes records from the record table with types of
 single, override, or dontrecord whose enddate is the current day.

 The problem is in the clearOldDBEntries in the file
 programs/mythfilldatabase/filldata.cpp (in 0.20) and
 libs/libmythtv/programdata.cpp (in 0.21):

 query.prepare("DELETE FROM record WHERE (type = :SINGLE "
                   "OR type = :OVERRIDE OR type = :DONTRECORD) "
                   "AND enddate < NOW();");
     query.bindValue(":SINGLE", kSingleRecord);
     query.bindValue(":OVERRIDE", kOverrideRecord);
     query.bindValue(":DONTRECORD", kDontRecord);
     query.exec();

 Since enddate is a date column (not datetime) it's getting compared to
 NOW() as a datetime at 12:00AM, thus always less than NOW().  Using either
 CURDATE(), CURRENT_DATE, or CAST(NOW() AS DATE) in place of NOW() would
 work correctly.

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/3681>
MythTV <http://svn.mythtv.org/trac>
MythTV


More information about the mythtv-commits mailing list