Announcement

Collapse
No announcement yet.

Anyone using Cheetah?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Paul Squires
    replied
    When I started to write the new Cheetah (which has since been replaced with SQLitening), I looked into the FoxPro memo format. Here is some info that I learned at the time (IIRC):

    Code:
    ' Memo files contain one header record and any number of 
    ' block structures. The size of the blocks is determined 
    ' by the SET BLOCKSIZE command when the file is created. 
    ' The Header record starts at file position zero and occupies 
    ' 512 bytes. For dbase memo files, we do not use big endian
    ' format or a BlockSize (it is always 512). We also must set the Version field.
    Type DBF_MEMOHEADER_TYPE
       NextFreeBlock As Dword '4     ' Location of next free block (FoxPro uses Big Endian format)
       Reserved1     As Word  '6     ' unused
       BlockSize     As Word  '8     ' Block size (0 for dBase) (Foxpro uses Big Endian format)
       Reserved2     As Long  '12    ' unused
       Reserved3     As Long  '16    ' unused
       MemVersion    As Byte  '17    ' Only used for dbase files (&H03)
       Reserved2   as asciiz * 495  ' unused
    End Type
        
        
    Type DBF_MEMOBLOCK_TYPE  ' used for FoxPro memo entries
       Signature  As Dword   ' Block signature (indicates the type of data in the block) 
                             ' (uses Big Endian format)
                             ' 0 - picture/object (picture field type) 
                             ' 1 - text (memo field type)                                
       MemoLength As Dword   ' Length of memo (in bytes) (uses Big Endian format)
    End Type
    You determine the location of the memo block from the field in the database that you are looking at. Type M fields in FoxPro database are 4 byte pointers to the actual memo data in the fpt file. You then goto that location in the file and read the first two dwords (DBF_MEMOBLOCK_TYPE) to determine the type of data that the memo holds and its size.

    Notice that the values are in Big Endian format. You can use the following function to make it useable for our purposes:

    Code:
    '//
    '//  Swap bytes of a DWORD sized variable (Big Endian format)
    '//                                                         
    Function SwapBytesDWord (ByVal n As Long) As Dword
       Local p As Byte Ptr
       p = VarPtr(n)   
       Swap @p[0], @p[3]
       Swap @p[1], @p[2]
       Function = n
    End Function

    Leave a comment:


  • Paul Squires
    replied
    Hi Neil,

    Cheetah does not create, read, or understand FoxPro fpt memo files. Cheetah was written based on the original dBase III dbt memo file structure.

    Leave a comment:


  • Ian Vincent
    replied
    Originally posted by Neil J Hosgood View Post
    I have a problem with the file attached, it's a Visual Foxpro DBF & FPT.
    Using my own code, VFP ODBC drivers or VFP OLEDB drivers I can not get more than 85 Fields! I know there are 94 Fields.
    I did try Cheetah and from memory it found all fields but could not read the memos
    CDBFW has no problem reading the files and returns ALL fields perfectly.
    Can someone who uses Cheetah often please have a look for me?.

    Cheers,
    N.
    Neil - I see 94 fields when opened with Cheetah Pet.
    The memo fields, as you said are not found.
    You can get Cheetah Pet from here:

    Leave a comment:


  • Neil J Hosgood
    started a topic Anyone using Cheetah?

    Anyone using Cheetah?

    I have a problem with the file attached, it's a Visual Foxpro DBF & FPT.
    Using my own code, VFP ODBC drivers or VFP OLEDB drivers I can not get more than 85 Fields! I know there are 94 Fields.
    I did try Cheetah and from memory it found all fields but could not read the memos
    CDBFW has no problem reading the files and returns ALL fields perfectly.
    Can someone who uses Cheetah often please have a look for me?.

    Cheers,
    N.
    Attached Files
    Last edited by Neil J Hosgood; 22 Feb 2009, 01:57 AM.
Working...
X