diff options
author | jmarshallnz <jcmarsha@gmail.com> | 2013-11-28 18:50:47 -0800 |
---|---|---|
committer | jmarshallnz <jcmarsha@gmail.com> | 2013-11-28 18:50:47 -0800 |
commit | 52409fd8339b88e687db937c4a8a9d44499fae7d (patch) | |
tree | a93f82abf45cfd7afc56160f50cf9d7b1474dd2c | |
parent | 50ed50fe75d0eb4c2cb4b9ca4e8cd0404d9f14a1 (diff) | |
parent | a52226d7d92d1b361cc3debab2518dbdb05989bb (diff) |
Merge pull request #3698 from Montellese/videodb_cleanup_sql_fixes
videodb: SQL query fixes for clean database
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 40033635d3..769e6e0a4f 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -8224,7 +8224,11 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const se } CLog::Log(LOGDEBUG, "%s: Cleaning paths that don't exist and have content set...", __FUNCTION__); - sql = "select * from path where not (strContent='' and strSettings='' and strHash='' and exclude!=1)"; + sql = "select * from path " + "where not ((strContent IS NULL OR strContent='') " + "and (strSettings IS NULL OR strSettings='') " + "and (strHash IS NULL OR strHash='') " + "and (exclude IS NULL OR exclude!=1))"; m_pDS->query(sql.c_str()); CStdString strIds; while (!m_pDS->eof()) @@ -8255,7 +8259,7 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const se "join tvshowlinkpath on tvshow.idShow=tvshowlinkpath.idShow " "join path on path.idPath=tvshowlinkpath.idPath " "where tvshow.idShow not in (select idShow from episode) " - "and path.strContent=''"; + "and (path.strContent IS NULL OR path.strContent='')"; m_pDS->query(sql.c_str()); while (!m_pDS->eof()) { @@ -8322,7 +8326,11 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const se } CLog::Log(LOGDEBUG, "%s: Cleaning path table", __FUNCTION__); - sql = StringUtils::Format("delete from path where strContent='' and strSettings='' and strHash='' and exclude!=1 " + sql = StringUtils::Format("delete from path " + "where (strContent is null or strContent='') " + "and (strSettings is null or strSettings='') " + "and (strHash is null or strHash='') " + "and (exclude is null or exclude!=1) " "and idPath not in (select distinct idPath from files) " "and idPath not in (select distinct idPath from tvshowlinkpath) " "and idPath not in (select distinct c%02d from movie) " |