Permalink
Browse files

factor out CDatabase::GetDBVersion

  • Loading branch information...
1 parent 3e93cc5 commit f6563113fa5c38b3f2a02daba1c28eaf5accb3e9 Jonathan Marshall committed Jul 7, 2012
Showing with 8 additions and 3 deletions.
  1. +7 −3 xbmc/dbwrappers/Database.cpp
  2. +1 −0 xbmc/dbwrappers/Database.h
@@ -420,13 +420,17 @@ bool CDatabase::Connect(const CStdString &dbName, const DatabaseSettings &dbSett
return true;
}
-bool CDatabase::UpdateVersion(const CStdString &dbName)
+int CDatabase::GetDBVersion()
{
- int version = 0;
m_pDS->query("SELECT idVersion FROM version\n");
if (m_pDS->num_rows() > 0)
- version = m_pDS->fv("idVersion").get_asInt();
+ return m_pDS->fv("idVersion").get_asInt();
+ return 0;
+}
+bool CDatabase::UpdateVersion(const CStdString &dbName)
+{
+ int version = GetDBVersion();
if (version < GetMinVersion())
{
CLog::Log(LOGNOTICE, "Attempting to update the database %s from version %i to %i", dbName.c_str(), version, GetMinVersion());
@@ -125,6 +125,7 @@ class CDatabase
virtual int GetMinVersion() const=0;
virtual const char *GetBaseDBName() const=0;
+ int GetDBVersion();
bool UpdateVersion(const CStdString &dbName);
bool m_sqlite; ///< \brief whether we use sqlite (defaults to true)

0 comments on commit f656311

Please sign in to comment.