ID = AutoInc
Val = String
Program has procedure where get any list from this table about 3000 values. This operation very slow.
In ZEOS source, I see fetch from first row to end.
But I have also been sorted by ID, you can use the quick search
I have to do something like this:
Code: Select all
function GetLang(Id:LongWord):string;
var min, max, Ind, Ret:Int64;
begin
min := 0;
max := fDisignerMain.XTLang.RecordCount;
// Parse table
while true do begin
Ind := (max + min) shr 1;
if min >= max then break;
fDisignerMain.XTLang.RecNo := Ind;
ret := fDisignerMain.XTLangI.Value - Integer(Id);
if ret < 0 then
min := Ind + 1
else
max := Ind;
end;
// Test last step
fDisignerMain.XTLang.RecNo := min;
if fDisignerMain.XTLangI.Value <> Integer(Id) then
result := '-Error-'
else
if fDisignerMain.XTLangV.IsNull then
result := '-Error-'
else
result := fDisignerMain.XTLangV.Value;
end;
P.S.
I dont want make Query fror get this list, becouse my connection from Internet wery slow (I read data once wher start program)
Sory for my english