Lazarus
Programming => Databases => Topic started by: arwen on January 31, 2008, 08:13:16 am
-
On a TDBF Table of level 4 I have add 2 index as below
Dbf1.AddIndex('Ordine','CODD',[]);
DBF1.AddIndex('OrdMac','MACHINE+STR(CODD,10,0)',[]);
The field CODD is a ftInteger and MACHINE is ftString Length 40 .
The problem is that if I create indexes on Linux when I go to open the table with windows the first index works while the second (composite) freezes the application .
If I create and then use indexes and tables on the same operating system, which is windows or linux, everything work.
It is possible that the problem is due to the fact that I did not set a "LanguageID" before creating or using tables?
What LanguageID I should use to open the table both with windows that with Linux ?
Thanks to all
-
When the index don't work correctly the Program go in a closed Loop here:
// repeat until reach the end of database
while not FRM_Duell.DBf1.EOF do
FRM_Duell.PReport1.Print(FRM_Duell.PRList);
In this procedure I'll must reach the end of the database but :shock:
procedure TFRM_Duell.PRLayoutPanel2BeforePrint(Sender: TObject;
ACanvas: TPRCanvas; Rect: TRect);
begin
if not DBf1.EOF then
begin
// my report code
//.......
//.......
DBf1.Next;
end;
If I create this index on Windows
DBF1.AddIndex('OrdMac','MACHINE+STR(CODD,10,0)',[]);
and then I use it on Linux I have a closed loop .
The same things if I crete the index on Linux and then I use it on Windows
If I use a simple index as below :
Dbf1.AddIndex('Ordine','CODD',[]);
it work on Windows and on Linux regardless of the operating system that has created the index. :shock:
Where I made the mistake ?
Thanks to all
-
FROM : Micha Nelissen
It means there is a bug in the index (a loop). What version of tdbf are
you using? Recent versions should have compatible string sorting order
(dbf_collate.pas). Or use TableLevel = 3 when creating (then you have
binary string comparison which is also windows<->linux compatible).
Hope this helps.
Micha
I have solved using a table of level 3 instead of level 4 .
Thanks Micha :wink: