Ticket #5286: mythtv-5286-no_backup_for_new_database.patch
File mythtv-5286-no_backup_for_new_database.patch, 1.8 KB (added by , 17 years ago) |
---|
-
libs/libmyth/dbutil.h
30 30 bool BackupDB(QString &filename); 31 31 32 32 static QMap<QString,bool> GetTableMap(void); 33 static bool IsNewDatabase(void); 33 34 static bool IsBackupInProgress(void); 34 35 35 36 static const int kUnknownVersionNumber; -
libs/libmyth/dbutil.cpp
70 70 return result; 71 71 } 72 72 73 /** \fn DBUtil::BackupInProgress(void) 73 /** \fn DBUtil::IsNewDatabase(void) 74 * \brief Returns true for a new (empty) database. 75 */ 76 bool DBUtil::IsNewDatabase(void) 77 { 78 const QStringList tables = GetTables(); 79 const int size = tables.size(); 80 // Usually there will be a single table called schemalock, but check for 81 // no tables, also, just in case. 82 return (((size == 1) && (tables.at(0) == "schemalock")) || 83 (size == 0)); 84 } 85 86 /** \fn DBUtil::IsBackupInProgress(void) 74 87 * \brief Test to see if a DB backup is in progress 75 88 * 76 89 */ … … 162 175 */ 163 176 bool DBUtil::BackupDB(QString &filename) 164 177 { 178 filename = ""; 179 if (IsNewDatabase()) 180 { 181 VERBOSE(VB_IMPORTANT, "New database detected. Skipping backup."); 182 return true; 183 } 184 165 185 bool result = false; 166 186 MSqlQuery query(MSqlQuery::InitCon()); 167 187 -
libs/libmythtv/dbcheck.cpp
555 555 556 556 QString backupResult = ""; 557 557 #ifndef USING_MINGW 558 if (dbver != "0")559 558 dbutil.BackupDB(backupResult); 560 559 #endif 561 560