PC3000 军达成数据恢复论坛

 找回密码
 立即注册
查看: 3793|回复: 2
打印 上一主题 下一主题

Data File Header Structure for the dBASE Version 7 Table File [复制链接]

管理员

军达成网站技术

Rank: 9Rank: 9Rank: 9

  • TA的每日心情
    慵懒
    2013-7-7 17:56:22
  • 签到天数: 5 天

    [LV.2]偶尔看看I

    金钱
    2035
    元宝
    994657
    专业度
    8659

    最佳新人

    跳转到指定楼层
    楼主
    发表于 2011-8-14 16:37:14 |只看该作者 |倒序浏览
    Note: Unless prefaced by "0x", all numbers specified in the Description column of the following tables are decimal. 1.1 Table File Header
    ByteContentsDescription
    01 byteValid dBASE for Windows table file, bits 0-2 indicate version number: 3 for dBASE Level 5, 4 for dBASE Level 7. Bit 3 and bit 7 indicate presence of a dBASE IV or dBASE for Windows memo file; bits 4-6 indicate the presence of a dBASE IV SQL table; bit 7 indicates the presence of any .DBT memo file (either a dBASE III PLUS type or a dBASE IV or dBASE for Windows memo file).
    1-33 bytesDate of last update; in YYMMDD format.  Each byte contains the number as a binary.  YY is added to a base of 1900 decimal to determine the actual year. Therefore, YY has possible values from 0x00-0xFF, which allows for a range from 1900-2155.
    4-732-bit numberNumber of records in the table. (Least significant byte first.)
    8-916-bit numberNumber of bytes in the header. (Least significant byte first.)
    10-1116-bit numberNumber of bytes in the record. (Least significant byte first.)
    12-132 bytesReserved; filled with zeros.
    141 byteFlag indicating incomplete dBASE IV transaction.
    151 bytedBASE IV encryption flag.
    16-2712 bytesReserved for multi-user processing.
    281 byteProduction MDX flag; 0x01 if a production .MDX file exists for this table; 0x00 if no .MDX file exists.
    291 byteLanguage driver ID.
    30-312 bytesReserved; filled with zeros.
    32-6332 bytesLanguage driver name.
    64-674 bytesReserved.
    68-n48 bytes eachField Descriptor Array (see 1.2).
    n+11 byte0x0D stored as the Field Descriptor terminator.
    n+2See below for
    calculations of size
    Field Properties Structure
    n above is the last byte in the field descriptor array. The size of the array depends on the number of fields in the table file.
    1. 2 Field Descriptor Array(One for each field in the table)
    ByteContentsDescription
    0-3132 bytesField name in ASCII (zero-filled).
    321 byteField type in ASCII (B, C, D, N, L, M, @, I, +, F, 0 or G).
    331 byteField length in binary.
    341 byteField decimal count in binary.
    35-362 bytesReserved.
    371 byteProduction .MDX field flag; 0x01 if field has an index tag in the production .MDX file; 0x00 if the field is not indexed.
    38-392 bytesReserved.
    40-434 bytesNext Autoincrement value, if the Field type is Autoincrement, 0x00 otherwise.
    44-474 bytesReserved.
    1.3 Field Properties StructureThis contains a header describing the Field Properties array, followed by the actual array, followed by property data. It is contained in the .DBF header and comes immediately after the Field Descriptor terminator (See Table 1.1).   
    ByteContentsDescription
    0-116-bit numberNumber of Standard Properties.
    2-316-bit numberStart of Standard Property Descriptor Array. (see 1.3.1 )
    4-516-bit numberNumber of Custom Properties.
    6-716-bit numberStart of Custom Property Descriptor Array. (see 1.3.2 )
    8-916-bit numberNumber of Referential Integrity (RI) properties.
    10-1116-bit numberStart of RI Property Descriptor Array. (see 1.3.3 )
    12-1316-bit numberStart of data - this points past the Descriptor arrays to data used by the arrays - for example Custom property names are stored here.
    14-1516-bit numberActual size of structure, including data (Note: in the .DBF this will be padded with zeroes to the nearest 0x200, and may have 0x1A at the end). If the structure contains RI data, it will not be padded.
    16-n15 bytes eachStandard Property Descriptor Array (n = (15*number of standard properties) + 16). (see 1.3.1)
    (n+1)-m14 bytes eachCustom Property Descriptor Array (m = n+ 14*number of custom properties). (see 1.3.2)
    (m+1)-o22 bytes eachRI Property Descriptor Array (o = m+ 22*number of RI properties). (see 1.3.3)
    1.3.1 Standard Property and Constraint Descriptor Array
    ByteContentsDescription
    0-116-bit numberGenerational number. More than one value may exist for a property. The current value is the value with the highest generational number.
    2-316-bit numberTable field offset - base one. 01 for the first field in the table, 02 for the second field, etc. Note: this will be 0 in the case of a constraint.
    48-bit numberWhich property is described in this record:
    01 Required

    02 Min

    03 Max

    04 Default

    06 Database constraint
    51 byteField Type:
    00 No type - constraint

    01 Char

    02 Numeric

    03 Memo

    04 Logical

    05 Date

    06 Float

    08 OLE

    09 Binary

    11 Long

    12 Timestamp

    13 Double

    14 AutoIncrement (not settable from the Inspector)
    61 byte0x00 if the array element is a constraint, 0x02 otherwise.
    7-104 bytesReserved
    11-1216-bit numberOffset from the start of this structure to the data for the property. The Required property has no data associated with it, so it is always 0.
    13-1416-bit numberWidth of database field associated with the property, and hence size of the data (includes 0 terminator in the case of a constraint).
    1.3.2 Custom Property Descriptor Array
    ByteContentsDescription
    0-116-bit numberGenerational number. More than one value may exist for a property. The current value is the value with the highest generational number.
    2-316-bit numberTable field offset - base one.  01 for the first field in the table, 02 for the second field, etc.
    41 byteField Type
    01 Char

    02 Numeric

    03 Memo

    04 Logical

    05 Date

    06 Float

    08 OLE

    09 Binary

    11 Long

    12 Timestamp

    13 Double

    14 AutoIncrement (not settable from the Inspector)
    51 byteReserved
    6-716-bit numberOffset from the start of this structure to the Custom property name.
    8-916-bit numberLength of the Custom property name.
    10-1116-bit numberOffset from the start of this structure to the Custom property data.
    12-1316-bit numberLength of the Custom property data (does not include null terminator).
    1.3.3 Referential Integrity Property Descriptor Array
    ByteContentsDescription
    08-bit number0x07 if Master (parent), 0x08 if Dependent (child).
    1-216-bit numberSequential number, 1 based counting. If this number is 0, this RI rule has been dropped.
    3-416-bit numberOffset of the RI rule name - 0 terminated.
    5-616-bit numberSize of previous value.
    7-816-bit numberOffset of the name of the Foreign Table - 0 terminated.
    9-1016-bit numberSize of previous value.
    111 byteUpdate & delete behaviour:
    Update Cascade 0x10

    Delete Cascade 0x01
    12-1316-bit numberNumber of fields in the linking key.
    14-1516-bit numberOffset of the Local Table tag name - 0 terminated.
    16-1716-bit numberSize of previous value.
    18-1916-bit numberOffset of the Foreign Table tag name - 0 terminated.
    20-2116-bit numberSize of previous value.
    (Foreign = in the other table,  Local = in this table)
    Property DataFor standard properties, everything is stored exactly as it is in the Table records. Custom property data is stored as the Name string, followed immediately by the Value string, and a null terminator. The Constraint text is stored as a null-terminated string.
    Table RecordsThe records follow the header in the table file. Data records are preceded by one byte, that is, a space (0x20) if the record is not deleted, an asterisk (0x2A) if the record is deleted. Fields are packed into records without field separators or record terminators. The end of the file is marked by a single byte, with the end-of-file marker, an OEM code page character value of 26 (0x1A).
    Storage of dBASE Data TypesExcept for autoincrement fields, all types are initialized to binary zeroes. In addition, any fields which have been assigned a default property will contain the default value.
    SymbolData TypeDescription
    BBinary, a string10 digits representing a .DBT block number. The number is stored as a string, right justified and padded with blanks.
    CCharacterAll OEM code page characters - padded with blanks to the width of the field.
    DDate8 bytes - date stored as a string in the format YYYYMMDD.
    NNumericNumber stored as a string, right justified, and padded with blanks to the width of the field.
    LLogical1 byte - initialized to 0x20 (space) otherwise T or F.
    MMemo, a string10 digits (bytes) representing a .DBT block number. The number is stored as a string, right justified and padded with blanks.
    @Timestamp8 bytes - two longs, first for date, second for time.  The date is the number of days since  01/01/4713 BC. Time is hours * 3600000L + minutes * 60000L + Seconds * 1000L
    ILong4 bytes. Leftmost bit used to indicate sign, 0 negative.
    +AutoincrementSame as a Long
    FFloatNumber stored as a string, right justified, and padded with blanks to the width of the field.
    ODouble8 bytes - no conversions, stored as a double.
    GOLE10 digits (bytes) representing a .DBT block number. The number is stored as a string, right justified and padded with blanks.
    Binary, Memo, OLE Fields and .DBT FilesBinary, memo, and OLE fields store data in .DBT files consisting of blocks numbered sequentially (0, 1, 2, etc.). SET BLOCKSIZE determines the size of each block. The first block in the .DBT file, block 0, is the .DBT file header.
    Each binary, memo, or OLE field of each record in the .DBF file contains the number of the block (in OEM code page values) where the field's data actually begins. If a field contains no data, the .DBF file contains blanks (0x20) rather than a number.
    When data is changed in a field, the block numbers may also change and the number in the .DBF may be changed to reflect the new location.

    使用道具 举报

    Rank: 6Rank: 6

    该用户从未签到

    金钱
    0
    元宝
    1946
    专业度
    0
    沙发
    发表于 2023-7-27 14:25:35 |只看该作者
    感谢分享,学习了,谢谢

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    Archiver|手机版|PC3000 数据恢复 ( 京ICP备09023376号-1 )

    GMT+8, 2024-5-20 07:46 , Processed in 0.172352 second(s), 12 queries .

    Powered by Discuz! X2

    © 2001-2011 Comsenz Inc.

    回顶部