From ef583de22e2d28f7fae2471350e9dc5c1c21e82a Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Tue, 4 Feb 2014 08:49:32 +1300 Subject: [PATCH] [database] use IF EXISTS on DROP TABLE if we're not completely sure the table exists --- xbmc/TextureDatabase.cpp | 6 +++--- xbmc/music/MusicDatabase.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xbmc/TextureDatabase.cpp b/xbmc/TextureDatabase.cpp index 1905f71332464..6916b601e4a42 100644 --- a/xbmc/TextureDatabase.cpp +++ b/xbmc/TextureDatabase.cpp @@ -214,12 +214,12 @@ void CTextureDatabase::UpdateTables(int version) } if (version < 9) { // get rid of the old path table and add the type column - m_pDS->exec("DROP TABLE path"); + m_pDS->exec("DROP TABLE IF EXISTS path"); m_pDS->exec("CREATE TABLE path (id integer primary key, urlhash integer, url text, type text, texture text)\n"); } if (version < 10) { // get rid of urlhash in both tables... - m_pDS->exec("DROP TABLE path"); + m_pDS->exec("DROP TABLE IF EXISTS path"); m_pDS->exec("CREATE TABLE path (id integer primary key, url text, type text, texture text)\n"); m_pDS->exec("CREATE TEMPORARY TABLE texture_backup(id,url,cachedurl,usecount,lastusetime,imagehash,lasthashcheck)"); @@ -235,7 +235,7 @@ void CTextureDatabase::UpdateTables(int version) } if (version < 12) { // create new sizes table and move usecount info to it. - m_pDS->exec("DROP TABLE texture"); + m_pDS->exec("DROP TABLE IF EXISTS texture"); m_pDS->exec("CREATE TABLE texture (id integer primary key, url text, cachedurl text, imagehash text, lasthashcheck text)"); m_pDS->exec("CREATE TABLE sizes (idtexture integer, size integer, width integer, height integer, usecount integer, lastusetime text)"); } diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index d34f9d01f8378..b398dfe322489 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -3830,7 +3830,7 @@ void CMusicDatabase::UpdateTables(int version) if (version < 27) { - m_pDS->exec("DROP TABLE thumb"); + m_pDS->exec("DROP TABLE IF EXISTS thumb"); CMediaSettings::Get().SetMusicNeedsUpdate(27); CSettings::Get().Save();