Browse Source

delete pending Main record deletes before shrinking the database on clip cleanup

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@708 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 11 years ago
parent
commit
4471a07f8b
1 changed files with 13 additions and 0 deletions
  1. 13 0
      DeleteClipData.cpp

+ 13 - 0
DeleteClipData.cpp

@@ -587,6 +587,19 @@ void CDeleteClipData::ApplyDelete()
 			progress.StepIt();
 			progress.SetText(_T("Shrinking database"));
 
+			try
+			{
+				for(int i = 0; i < 100; i++)
+				{
+					int toDeleteCount = theApp.m_db.execScalar(_T("SELECT COUNT(clipID) FROM MainDeletes"));
+					if(toDeleteCount <= 0)
+						break;
+
+					RemoveOldEntries(false);
+				}
+			}
+			CATCH_SQLITE_EXCEPTION
+
 			theApp.m_db.execDML(_T("PRAGMA auto_vacuum = 1"));
 			theApp.m_db.execQuery(_T("VACUUM"));