Subject | Re: [firebird-support] Activate all indexes |
---|---|
Author | |
Post date | 2018-01-08T23:18:26Z |
Spasibo Dima, I used TFDQuery with
EXECUTE BLOCK AS
DECLARE VARIABLE stmt VARCHAR(1000);
BEGIN
for select 'ALTER INDEX '||rdb$index_name ||' ACTIVE;'
from rdb$indices
where (rdb$system_flag is null or rdb$system_flag = 0)
order by rdb$foreign_key nulls first
into :stmt
do EXECUTE STATEMENT :stmt;
END
DECLARE VARIABLE stmt VARCHAR(1000);
BEGIN
for select 'ALTER INDEX '||rdb$index_name ||' ACTIVE;'
from rdb$indices
where (rdb$system_flag is null or rdb$system_flag = 0)
order by rdb$foreign_key nulls first
into :stmt
do EXECUTE STATEMENT :stmt;
END
I call it
procedure ActivateAllIndexes(dbConn: TFDConnection);
begin
dbConn.StartTransaction;
try
FDQuery1.ConnectionName := dbConn.ConnectionName;
FDQuery1.ExecSQL;
dbConn.Commit;
ShowMessage((Sender As TButton).Caption + ' executed successfully for ' + dbConn.ConnectionName);
except
dbConn.Rollback;
ShowMessage((Sender As TButton).Caption + ' failed for ' + dbConn.ConnectionName);
end;
end;
begin
dbConn.StartTransaction;
try
FDQuery1.ConnectionName := dbConn.ConnectionName;
FDQuery1.ExecSQL;
dbConn.Commit;
ShowMessage((Sender As TButton).Caption + ' executed successfully for ' + dbConn.ConnectionName);
except
dbConn.Rollback;
ShowMessage((Sender As TButton).Caption + ' failed for ' + dbConn.ConnectionName);
end;
end;
It works like a charm! No issues! Esche raz Spasibo!