Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

factor out the Update() function in CDatabase::Open

  • Loading branch information...
commit fd165ea2ba4e0b0934e64fe79f4534396fc8997b 1 parent f656311
Jonathan Marshall authored
Showing with 14 additions and 0 deletions.
  1. +12 −0 xbmc/dbwrappers/Database.cpp
  2. +2 −0  xbmc/dbwrappers/Database.h
View
12 xbmc/dbwrappers/Database.cpp
@@ -279,6 +279,18 @@ bool CDatabase::Open(const DatabaseSettings &settings)
if (dbSettings.name.IsEmpty())
dbSettings.name = GetBaseDBName();
+ CStdString dbName = dbSettings.name;
+ dbName.AppendFormat("%d", GetMinVersion());
+ if (!Connect(dbName, dbSettings, false) || GetDBVersion() != GetMinVersion())
+ {
+ if (!Update(dbSettings))
+ return false;
+ }
+ return true;
+}
+
+bool CDatabase::Update(const DatabaseSettings &dbSettings)
+{
int version = GetMinVersion();
CStdString latestDb = dbSettings.name;
latestDb.AppendFormat("%d", version);
View
2  xbmc/dbwrappers/Database.h
@@ -114,6 +114,8 @@ class CDatabase
bool CommitInsertQueries();
protected:
+ bool Update(const DatabaseSettings &db);
+
void Split(const CStdString& strFileNameAndPath, CStdString& strPath, CStdString& strFileName);
uint32_t ComputeCRC(const CStdString &text);
Please sign in to comment.
Something went wrong with that request. Please try again.