/[packages]/cauldron/xbmc/current/SOURCES/0001-hack-workaround-for-old-incompatible-PVR-addon-datab.patch
ViewVC logotype

Diff of /cauldron/xbmc/current/SOURCES/0001-hack-workaround-for-old-incompatible-PVR-addon-datab.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 343732 by anssi, Sat Mar 17 02:13:29 2012 UTC revision 343733 by anssi, Wed Jan 9 14:23:48 2013 UTC
# Line 12  old db. Line 12  old db.
12  Bugfixes to sqlitedataset.cpp should be separated and drop() needs to  Bugfixes to sqlitedataset.cpp should be separated and drop() needs to
13  be called in generic UpdateVersion() on failure to prevent continuing  be called in generic UpdateVersion() on failure to prevent continuing
14  failure.  failure.
15  ---  diff -Nurpa -x '*~' -x '*.orig' -x '*.rej' -x '*.swp' xbmc-Frodo_rc3/xbmc/addons/AddonDatabase.cpp xbmc-Frodo_rc3/xbmc/addons/AddonDatabase.cpp
16   xbmc/addons/AddonDatabase.cpp     |   26 +++++++++++++++++++++++++-  --- xbmc-Frodo_rc3/xbmc/addons/AddonDatabase.cpp        2013-01-03 05:29:19.000000000 +0200
17   xbmc/dbwrappers/sqlitedataset.cpp |    5 ++++-  +++ xbmc-Frodo_rc3/xbmc/addons/AddonDatabase.cpp        2013-01-09 15:08:57.509707610 +0200
  2 files changed, 29 insertions(+), 2 deletions(-)  
   
 diff --git a/xbmc/addons/AddonDatabase.cpp b/xbmc/addons/AddonDatabase.cpp  
 index fe4e7b4..b0df1c8 100644  
 --- a/xbmc/addons/AddonDatabase.cpp  
 +++ b/xbmc/addons/AddonDatabase.cpp  
18  @@ -40,7 +40,24 @@ CAddonDatabase::~CAddonDatabase()  @@ -40,7 +40,24 @@ CAddonDatabase::~CAddonDatabase()
19    
20   bool CAddonDatabase::Open()   bool CAddonDatabase::Open()
# Line 47  index fe4e7b4..b0df1c8 100644 Line 41  index fe4e7b4..b0df1c8 100644
41   }   }
42    
43   bool CAddonDatabase::CreateTables()   bool CAddonDatabase::CreateTables()
44  @@ -119,11 +136,18 @@ bool CAddonDatabase::UpdateOldVersion(int version)  @@ -101,6 +118,7 @@ bool CAddonDatabase::CreateTables()
45         m_pDS->exec("CREATE TABLE blacklist (id integer primary key, addonID text, version text)\n");  
46         m_pDS->exec("CREATE UNIQUE INDEX idxBlack ON blacklist(addonID)");   bool CAddonDatabase::UpdateOldVersion(int version)
47       }   {
48  +  +  try {
49  +    // hack for old PVR databases - this will fail and prevent an incorrect update     if (version < 13)
 +    // TODO: proper validation when upgrading databases  
 +    m_pDS->exec("select addon,version,optional from dependencies limit 1");  
    }  
    catch (...)  
50     {     {
51       CLog::Log(LOGERROR, "Error attempting to upgrade an old addon database!");       m_pDS->exec("CREATE TABLE dependencies (id integer, addon text, version text, optional boolean)\n");
52       RollbackTransaction();  @@ -115,6 +133,16 @@ bool CAddonDatabase::UpdateOldVersion(in
53         m_pDS->exec("CREATE TABLE blacklist (id integer primary key, addonID text, version text)\n");
54         m_pDS->exec("CREATE UNIQUE INDEX idxBlack ON blacklist(addonID)");
55       }
56    +  }
57    +  catch (...)
58    +  {
59    +    CLog::Log(LOGERROR, "Error attempting to upgrade an old addon database!");
60    +    RollbackTransaction();
61  +    // hack - drop db or the unupgraded db will be left around and next upgrade will  +    // hack - drop db or the unupgraded db will be left around and next upgrade will
62  +    // fail as well:  +    // fail as well:
63  +    try { m_pDB->drop(); } catch (...) { }  +    try { m_pDB->drop(); } catch (...) { }
64       return false;  +    return false;
65     }  +  }
66     CommitTransaction();     return true;
67  diff --git a/xbmc/dbwrappers/sqlitedataset.cpp b/xbmc/dbwrappers/sqlitedataset.cpp   }
68  index 1833d6f..670167d 100644  
69  --- a/xbmc/dbwrappers/sqlitedataset.cpp  diff -Nurpa -x '*~' -x '*.orig' -x '*.rej' -x '*.swp' xbmc-Frodo_rc3/xbmc/dbwrappers/sqlitedataset.cpp xbmc-Frodo_rc3/xbmc/dbwrappers/sqlitedataset.cpp
70  +++ b/xbmc/dbwrappers/sqlitedataset.cpp  --- xbmc-Frodo_rc3/xbmc/dbwrappers/sqlitedataset.cpp    2013-01-03 05:29:19.000000000 +0200
71  @@ -317,7 +317,10 @@ int SqliteDatabase::copy(const char *backup_name) {  +++ xbmc-Frodo_rc3/xbmc/dbwrappers/sqlitedataset.cpp    2013-01-09 15:05:41.851381387 +0200
72    @@ -317,7 +317,10 @@ int SqliteDatabase::copy(const char *bac
73   int SqliteDatabase::drop() {   int SqliteDatabase::drop() {
74     if (active == false) throw DbErrors("Can't drop database: no active connection...");     if (active == false) throw DbErrors("Can't drop database: no active connection...");
75     disconnect();     disconnect();
# Line 82  index 1833d6f..670167d 100644 Line 81  index 1833d6f..670167d 100644
81        throw DbErrors("Can't drop database: can't unlink the file %s,\nError: %s",db.c_str(),strerror(errno));        throw DbErrors("Can't drop database: can't unlink the file %s,\nError: %s",db.c_str(),strerror(errno));
82        }        }
83     return DB_COMMAND_OK;     return DB_COMMAND_OK;
 --  
 1.7.9.3  
   

Legend:
Removed from v.343732  
changed lines
  Added in v.343733

  ViewVC Help
Powered by ViewVC 1.1.30