26. November 2010 17:27
26. November 2010 23:13
26. November 2010 23:33
27. November 2010 14:37
OBJECT Codeunit 90208 Disable Keys & SIFT
{
OBJECT-PROPERTIES
{
Date=27.11.10;
Time=13:35:46;
Modified=Yes;
Version List=SSI/TEMP;
}
PROPERTIES
{
OnRun=BEGIN
IF NOT CONFIRM('CAUTION: This will disable ALL Indexes and SIFTs!\\' +
'Backup the database and export all Tables into a FOB before running this!\\' +
'Continue?', FALSE)
THEN
EXIT;
IF NOT CONFIRM('Really?', FALSE) THEN
EXIT;
Key.SETRANGE(TableNo, 1, 1999999999);
Key.SETRANGE("No.", 1, 255);
Key.SETRANGE(Enabled, TRUE);
IF Key.FINDSET THEN BEGIN
c := Key.COUNT;
Window.OPEN('Table #1######## #2##################\' +
'Key #3########\' +
'@4@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@');
REPEAT
i := i + 1;
Window.UPDATE(1, Key.TableNo);
Window.UPDATE(2, Key.TableName);
Window.UPDATE(3, Key."No.");
Window.UPDATE(4, ROUND(10000 / c * i, 1));
IF Key.MaintainSQLIndex AND (NOT IsClustered(Key.TableNo, Key."No.")) THEN
Key.VALIDATE(MaintainSQLIndex, FALSE);
IF Key.MaintainSIFTIndex THEN
Key.VALIDATE(MaintainSIFTIndex, FALSE);
Key.MODIFY;
IF (i MOD 100) = 0 THEN
COMMIT;
UNTIL Key.NEXT = 0;
Window.CLOSE;
END;
END;
}
CODE
{
VAR
Key@1000000000 : Record 2000000063;
c@1000000003 : Integer;
i@1000000001 : Integer;
Window@1000000002 : Dialog;
PROCEDURE IsClustered@1000000006(TableNo@1000000000 : Integer;KeyNo@1000000001 : Integer) : Boolean;
VAR
Key2@1000000002 : Record 2000000063;
BEGIN
Key2.SETRANGE(TableNo, TableNo);
Key2.SETRANGE(Clustered, TRUE);
IF Key2.FINDFIRST THEN
EXIT(KeyNo = Key2."No.")
ELSE
EXIT(KeyNo = 1);
END;
BEGIN
END.
}
}
29. November 2010 09:44