Sfoglia il codice sorgente

recalculate index statistics: harden/error reporting

Reinier Olislagers 11 anni fa
parent
commit
ee89a4d170
1 ha cambiato i file con 15 aggiunte e 2 eliminazioni
  1. 15 2
      main.pas

+ 15 - 2
main.pas

@@ -3541,15 +3541,28 @@ begin
 end;
 
 procedure TfmMain.lmRecalculateStatisticsClick(Sender: TObject);
+var
+  Message: string;
 begin
   //Recalculate index statistics. May take a while for big dbs.
+  Message:= '';
   Screen.Cursor:= crSQLWait;
   try
-    dmSysTables.RecalculateIndexStatistics(PtrInt(tvMain.Selected.Data));
+    try
+      dmSysTables.RecalculateIndexStatistics(PtrInt(tvMain.Selected.Data));
+    except
+      on E: Exception do
+      begin
+        Message:= E.Message
+      end;
+    end;
   finally
     Screen.Cursor:= crDefault;
   end;
-  ShowMessage('Recalculation of index statistics complete.');
+  if Message='' then
+    ShowMessage('Recalculation of index statistics complete.')
+  else
+    ShowMessage('Error recalculating index statistics: '+Message);
 end;
 
 (********  Create new database  ********)