Ticket #10992: 0013-also-clean-up-inputgroup-memberships-when-deleting-c.patch

File 0013-also-clean-up-inputgroup-memberships-when-deleting-c.patch, 1.5 KB (added by dekarl@…, 7 years ago)
  • mythtv/libs/libmythtv/cardutil.cpp

    From 2a87c08ffc91b92e4e02e74d1de7f764e15f2d0d Mon Sep 17 00:00:00 2001
    From: Karl Dietz <dekarl@users.sourceforge.net>
    Date: Sat, 11 Aug 2012 16:48:14 +0200
    Subject: [PATCH 13/13] also clean up inputgroup memberships when deleting cardinput
    
    Fixes #10992
    ---
     mythtv/libs/libmythtv/cardutil.cpp |   11 +++++++++++
     mythtv/libs/libmythtv/dbcheck.cpp  |   13 +++++++++++++
     2 files changed, 24 insertions(+), 0 deletions(-)
    
    diff --git a/mythtv/libs/libmythtv/cardutil.cpp b/mythtv/libs/libmythtv/cardutil.cpp
    index 66effc2..b7e3459 100644
    a b bool CardUtil::DeleteInput(uint inputid) 
    14121412        return false;
    14131413    }
    14141414
     1415    query.prepare(
     1416        "DELETE FROM inputgroup "
     1417        "WHERE cardinputid = :INPUTID");
     1418    query.bindValue(":INPUTID", inputid);
     1419
     1420    if (!query.exec())
     1421    {
     1422        MythDB::DBError("DeleteInput", query);
     1423        return false;
     1424    }
     1425
    14151426    return true;
    14161427}
    14171428
  • mythtv/libs/libmythtv/dbcheck.cpp

    diff --git a/mythtv/libs/libmythtv/dbcheck.cpp b/mythtv/libs/libmythtv/dbcheck.cpp
    index 10e498f..5dffbda 100644
    a b NULL 
    22772277            return false;
    22782278    }
    22792279
     2280    if (dbver == "1307")
     2281    {
     2282        const char *updates[] = {
     2283"DELETE FROM inputgroup"
     2284"WHERE cardinputid NOT IN ("
     2285"    SELECT cardinputid FROM cardinput"
     2286");",
     2287NULL
     2288};
     2289        if (!performActualUpdate(updates, "1308", dbver))
     2290            return false;
     2291    }
     2292
    22802293    return true;
    22812294}
    22822295