Recent

Author Topic: TDBF -unable to share DBFs with FoxPro, true?  (Read 4134 times)

xaver13

  • Full Member
  • ***
  • Posts: 111
TDBF -unable to share DBFs with FoxPro, true?
« on: September 20, 2012, 08:34:08 am »
Hello, seems to me that neither cdx index files but also idx are not implemented in TDBF?
I am getting an error index based on unknown field "YR" on line MyDbf.OpenIndexFile('VYR~V.IDX'); in folowing sample.
(index is based on RZNAK+CVYR)
The packed full small sample containing dbf and index is here http://www.cvrk.com/reindex.zip

Main code:
Code: [Select]
program Reindex;

{$mode objfpc}{$H+}

uses

  { We will require the following units be in the USES clause: }
  Dbf, db, Dbf_Common, SysUtils,

  { The Dbf is put there e.g. when you drop a TDbf component on a form...   }
  { but you will need db for the DataSet object and Dbf_Common              }
  { for things such as the field type definitions                           }
  { Finally, use SysUtils for ForceDirectories.                             }
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes
  { you can add units after this };
var
  MyDbf: TDbf;

begin
  MyDbf := TDbf.Create(nil);
  try
    { make sure the data directory exists: }
    ForceDirectories('data');
    { use relative path to "data" directory }
    MyDbf.FilePath := 'data' + DirectorySeparator;
    // Note: November 2011: tablelevel 25 does not seem to work...
    MyDbf.TableLevel := 4;
    MyDbf.Exclusive := True;
    MyDbf.TableName := 'vyr.dbf';
    MyDbf.Open;
    MyDbf.OpenIndexFile('VYR~V.IDX');
    //MyDbf.OpenIndexFile('VYR.CDX');
    MyDbf.RegenerateIndexes;
    MyDbf.Close;
  finally
    MyDbf.Free;
  end;
  readln;
end.

Thank you for any possible suggestions..
« Last Edit: September 20, 2012, 08:37:40 am by xaver13 »
--
Jiri Cvrk

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TDBF -unable to share DBFs with FoxPro, true?
« Reply #1 on: September 20, 2012, 09:39:10 am »
AFAIR, TDBF does not support FoxPro indexes, no.
Can you use index files that both FoxPro and TDBF support perhaps?
(If you have a patch for .cdx/.idx, I'd love to help get this into FPC's TDBF).
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

xaver13

  • Full Member
  • ***
  • Posts: 111
--
Jiri Cvrk

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TDBF -unable to share DBFs with FoxPro, true?
« Reply #3 on: September 22, 2012, 10:49:56 pm »
Some information on .idx files (Visual FoxPro, don't know what flavors there are...)
stackoverflow question on idx:
http://stackoverflow.com/questions/404015/visual-foxpro-compact-index-file-format
idx:
http://msdn.microsoft.com/en-us/library/s8tb8f47%28VS.80%29.aspx
cdx:
http://msdn.microsoft.com/en-US/library/k35b9hs2%28v=vs.80%29.aspx
table file structure (dbf, fpt which contains memo fields etc):
http://msdn.microsoft.com/en-US/library/st4a0s68%28v=vs.80%29.aspx
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018