Lazarus

Programming => Databases => Topic started by: arwen on January 31, 2008, 08:13:16 am

Title: TDBf and problem with Index [SOLVED]
Post by: arwen on January 31, 2008, 08:13:16 am
On a TDBF Table of level 4 I have add 2 index as below

Code: [Select]
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
Title: TDBf and problem with Index [SOLVED]
Post by: arwen on January 31, 2008, 09:26:40 am
When the index don't work correctly the Program go in a closed Loop here:

Code: [Select]
// 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:
Code: [Select]
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
Code: [Select]
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 :
Code: [Select]
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
Title: TDBf and problem with Index [SOLVED]
Post by: arwen on February 04, 2008, 11:42:36 am
FROM : Micha Nelissen

Quote

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:
TinyPortal © 2005-2018