Browse Source

fixed error with backup up the db each time

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@598 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 14 years ago
parent
commit
2fc0106ab4
1 changed files with 3 additions and 3 deletions
  1. 3 3
      DatabaseUtilities.cpp

+ 3 - 3
DatabaseUtilities.cpp

@@ -258,9 +258,6 @@ BOOL ValidDB(CString csPath, BOOL bUpgrade)
 		//This was added later so try to add each time and catch the exception here
  		try
  		{
-			if(didBackup == FALSE)
-				didBackup = BackupDB(csPath, backupFilePrefix);
-
 			db.execDML(_T("CREATE TRIGGER delete_data_trigger BEFORE DELETE ON Main FOR EACH ROW\n")
 				_T("BEGIN\n")
 					_T("INSERT INTO MainDeletes VALUES(old.lID, datetime('now'));\n")
@@ -268,6 +265,9 @@ BOOL ValidDB(CString csPath, BOOL bUpgrade)
  		}
 		catch(CppSQLite3Exception& e)
 		{
+			if(didBackup == FALSE)
+				didBackup = BackupDB(csPath, backupFilePrefix);
+
  			e.errorCode();
  		}