FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour identify Type of DBF
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
identify Type of DBF
Posted: Tue May 02, 2023 05:07 PM
hi,

does Fivewinhave a Function to identify Type of DBF :?:

i mean Header of DBF
Code (fw): Select all Collapse
   nHandle := FOPEN( cDbf )
   FSEEK( nHandle, 0, 0 )                                             // Move pointer to first byte
   FREAD( nHandle, @cBuffer, 1 )
   //   FCLOSE( nHandle )
   nType := ASC( cBuffer )
   FCLOSE( nHandle )

   DO CASE
      CASE nType = 2    //  02h   FoxBASE
         cDbfType = 'Foxbase'
         cDriver := "FOXCDX"
         cInxExt := "CDX"
      CASE nType = 3    //  03h   FoxBASE+/Dbase III plus, no memo
      CASE nType = 4    //* 04h   dbase IV without memofile
      CASE nType = 5    //* 05h   dbase V  without memofile
      CASE nType = 7    //* 07h   visual object for dbase III without memofile
      CASE nType = 48   //  30h   Visual FoxPro
      CASE nType = 49   //  31h   Visual FoxPro, autoincrement enabled
      CASE nType = 67   //  43h   dBASE IV SQL table files, no memo
      CASE nType = 99   //  ???
      CASE nType = 123  //* 7Bh   "dbase IV with memo
      CASE nType = 131  //  83h   FoxBASE+/dBASE III PLUS, with memo
      CASE nType = 135  //* 87h   visual object for dbase III with memofile
      CASE nType = 139  //  8Bh   dbase IV with memo
      CASE nType = 142  //* 8Eh   dbase IV with SQL table
      CASE nType = 179  //* B3h   .dbv memo and dbt memo flagship
      CASE nType = 203  //  0xCB  dBASE IV SQL table files, with memo
      CASE nType = 229  //* E5h   HiPer-Six format with SMT memo file
      CASE nType = 245  //  F5h   FoxPro 2.x (or earlier) with memo
      CASE nType = 251  //  FBh   FoxBASE
   ENDCASE
i want to SET "right" RDD to use
greeting,

Jimmy
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: identify Type of DBF
Posted: Tue May 02, 2023 06:08 PM
Sorry Jimmy, I honestly didn't understand your question. Are you referring to this? Explain better, please.

https://vivaclipper.wordpress.com/2013/07/17/c5_rddsetdefault/

https://vivaclipper.wordpress.com/2013/07/25/clipper-5-x-drivers-guide/

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: identify Type of DBF
Posted: Tue May 02, 2023 06:32 PM
hi,
karinha wrote:didn't understand your question. Are you referring to this? Explain better, please.
i often get DBF which e.g. "Original" DBU can´t open as it have only NTX RDD as default

now i want to "identify" Type of DBF using 1st Byte of DBF Header
my Question is : does Fivewin already have a Function for it :?:
greeting,

Jimmy
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: identify Type of DBF
Posted: Tue May 02, 2023 07:44 PM

Dear Jimmy,

As far as I remember FWH does not provide such function.

I guess Harbour should be the one to provide it, maybe it has it...

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: identify Type of DBF
Posted: Wed May 03, 2023 12:03 AM
As far as (x)Harbour is concerned, we need to decide whether to open VIA "DBFNTX" or "DBFCDX".

In our functions we use this logic internally, when we open DBF internally:
Code (fw): Select all Collapse
if File( cFileSetExt( cDbf, "fpt" ) ) .or. File( cFileSetExt( cDbf, "cdx" ) )
  // use DBFCDX
elseif File( cFileSetExt( cDbf, "dbt" )
  // use DBFNTX
else
  // use RDDSETDEFAULT() // user's choice
endif
We don't need any more information than this, which is not of any practical use.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: identify Type of DBF
Posted: Wed May 03, 2023 05:14 PM

hi,

you talk about "rights" DBF e.g. create by Fivewin

i do have DBF Files, made by Xbase++, which might be "mis-configured" DBE ( = RDD )

i also had DBF Files which just have ".DBF" Extension but are Fake, so i also use XbrHexEdit()

so my "DualGrid" Tool is not a "normal" App , i want to made a "Swiss Knife" to use with xBase ( and "more" )

greeting,

Jimmy

Continue the discussion