Ticket #10156: 0001-When-deleting-a-video-source-delete-its-multiplexes-.patch

File 0001-When-deleting-a-video-source-delete-its-multiplexes-.patch, 1.6 KB (added by dekarl@…, 12 years ago)

suggested patch

  • mythtv/libs/libmythtv/sourceutil.cpp

    From 3a8a9acb169dc2ddf2636618fdd5efbd93fe96ac Mon Sep 17 00:00:00 2001
    From: Karl Dietz <dekarl@users.sourceforge.net>
    Date: Tue, 8 Nov 2011 08:17:06 +0100
    Subject: [PATCH 1/5] When deleting a video source delete its multiplexes, too.
    
    Fixes: #10156
    ---
     mythtv/libs/libmythtv/sourceutil.cpp |   15 +++++++++++++++
     1 files changed, 15 insertions(+), 0 deletions(-)
    
    diff --git a/mythtv/libs/libmythtv/sourceutil.cpp b/mythtv/libs/libmythtv/sourceutil.cpp
    index f5c559d..a5e92ed 100644
    a b bool SourceUtil::DeleteSource(uint sourceid) 
    482482    MSqlQuery query(MSqlQuery::InitCon());
    483483
    484484    // Delete the channels associated with the source
     485    //
     486    // FIXME should probably call ChannelUtil::DeleteChannel instead
     487    // which should be extended to clean up credits, programrating and
     488    // programgenres, too.
    485489    query.prepare("DELETE FROM channel "
    486490                  "WHERE sourceid = :SOURCEID");
    487491    query.bindValue(":SOURCEID", sourceid);
    bool SourceUtil::DeleteSource(uint sourceid) 
    492496        return false;
    493497    }
    494498
     499    // Delete the multiplexes associated with the source
     500    query.prepare("DELETE FROM dtv_multiplex "
     501                  "WHERE sourceid = :SOURCEID");
     502    query.bindValue(":SOURCEID", sourceid);
     503
     504    if (!query.exec() || !query.isActive())
     505    {
     506        MythDB::DBError("Deleting Multiplexes", query);
     507        return false;
     508    }
     509
    495510    // Delete the inputs associated with the source
    496511    query.prepare("DELETE FROM cardinput "
    497512                  "WHERE sourceid = :SOURCEID");