使用十六进制查看器检查数据库版本
check dbase version with hex viewer
如何在十六进制查看器中检查 dbf 文件类型的字节以检索 dbf 版本?
下面的示例屏幕截图来自 FoxBASE+/Dbase III plus,无备注
基于 http://www.digitalpreservation.gov/formats/fdd/fdd000325.shtml 的文章。
0x03 = FoxBASE+/Dbase III plus,无备忘录
第一行第一个字符03 = 0x03我能理解吗?
03 75 02 11 92 00 00
以下是我想检查的未知 DBase 版本。它以 04 75 02 10 DF
开头 我怎么知道这是哪个版本的 dBase?
我尝试使用 php dbase_open 进行连接,但它不起作用。 (错误消息:'Warning: dbase_open(): unable to open database C:...')
我想我找到答案了,http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm
04 = 4 表示 dBASE 级别 7。
header结构与dbase网站描述的完全一样。
Byte Contents Description
0 1 byte Valid 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-3 3 bytes Date 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-7 32-bit Number of records in the table. (Least significant byte first.)
8-9 16-bit Number of bytes in the header. (Least significant byte first.)
10-11 16-bit Number of bytes in the record. (Least significant byte first.)
12-13 2 bytes Reserved; filled with zeros.
14 1 byte Flag indicating incomplete dBASE IV transaction.
15 1 byte dBASE IV encryption flag.
16-27 12 bytes Reserved for multi-user processing.
28 1 byte Production MDX flag; 0x01 if a production .MDX file exists for this table; 0x00 if no .MDX file exists.
29 1 byte Language driver ID.
30-31 2 bytes Reserved; filled with zeros.
32-63 32 bytes Language driver name.
64-67 4 bytes Reserved.
68-n 48 bytes each Field Descriptor Array (see 1.2).
n+1 1 byte 0x0D stored as the Field Descriptor terminator.
n+2 Field Properties Structure
1.2 字段描述符数组
(One for each field in the table)
Byte Contents Description
0-31 32 bytes Field name in ASCII (zero-filled).
32 1 byte Field type in ASCII (B, C, D, N, L, M, @, I, +, F, 0 or G).
33 1 byte Field length in binary.
34 1 byte Field decimal count in binary.
35-36 2 bytes Reserved.
37 1 byte Production .MDX field flag; 0x01 if field has an index tag in the production .MDX file; 0x00 if the field is not indexed.
38-39 2 bytes Reserved.
40-43 4 bytes Next Autoincrement value, if the Field type is Autoincrement, 0x00 otherwise.
44-47 4 bytes Reserved.
示例
;04 = 4 for dBASE Level 7
;75 02 10 = Date of last update; in YYMMDD
;DF = 223 number of record
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
04 75 02 10 DF 00 00 00 15 03 B6 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
44 42 57 49 4E 55 53 30 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
;Column name start from 68 offset (Need to convert from hex to ascii)
;http://www.rapidtables.com/convert/number/hex-to-ascii.htm
;Example, 53 49 54 45 4E 4D = SITENM
;64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
; 00 01 02 03 04 05 06 07 08 09 10 11
00 00 00 00 53 49 54 45 4E 4D 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
;(See 1.2 Field Descriptor Array)
;0-31 = Field name in ASCII (zero-filled)
;32 = Field type in ASCII
;From below example the field type is 43 which is equal to 'C' in ascii
;33 = Field length in binary.
;From below example the field length is 0A which is equal to '10' in decimal
;28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
00 00 00 00 43 0A 00 00 00 00 00 00 00 00 00 00
;Column will start from 00 and end in offset 47 (total 48 bytes until it readched '0D' Field Descriptor terminator)
;So below 00 is start with another column
;Example, 44 41 54 45 = DATE
;44 45 46 47 00 01 02 03 04 05 06 07 08 09 10 11
00 00 00 00 44 41 54 45 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 0A 00 00 00 00 00 00 00 00 00 00
00 00 00 00 54 49 4D 45 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 08 00 00 00 00 00 00 00 00 00 00
00 00 00 00 54 52 41 4E 53 5F 43 4F 44 45 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 02 00 00 00 00 00 00 00 00 00 00
00 00 00 00 54 52 41 4E 53 5F 44 45 53 43 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 1E 00 00 00 00 00 00 00 00 00 00
00 00 00 00 42 55 53 4E 4F 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 02 00 00 00 00 00 00 00 00 00 00
00 00 00 00 55 4E 49 54 4E 4F 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 02 00 00 00 00 00 00 00 00 00 00
00 00 00 00 52 45 41 44 45 52 4E 4F 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 02 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 4F 4E 54 4E 41 4D 45 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 0C 00 00 00 00 00 00 00 00 00 00
00 00 00 00 44 52 4E 41 4D 45 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 0C 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 41 52 44 4E 4F 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 06 00 00 00 00 00 00 00 00 00 00
00 00 00 00 4E 41 4D 45 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 23 00 00 00 00 00 00 00 00 00 00
00 00 00 00 44 45 50 54 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 0C 00 00 00 00 00 00 00 00 00 00
00 00 00 00 4A 4F 42 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 0C 00 00 00 00 00 00 00 00 00 00
00 00 00 00 49 46 49 45 4C 44 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 1A 00 00 00 00 00 00 00 00 00 00
00 00 00 00 0D -> Here is the Field Descriptor terminator '0D'
```
如何在十六进制查看器中检查 dbf 文件类型的字节以检索 dbf 版本?
下面的示例屏幕截图来自 FoxBASE+/Dbase III plus,无备注
基于 http://www.digitalpreservation.gov/formats/fdd/fdd000325.shtml 的文章。
0x03 = FoxBASE+/Dbase III plus,无备忘录
第一行第一个字符03 = 0x03我能理解吗?
03 75 02 11 92 00 00
以下是我想检查的未知 DBase 版本。它以 04 75 02 10 DF
开头 我怎么知道这是哪个版本的 dBase?
我尝试使用 php dbase_open 进行连接,但它不起作用。 (错误消息:'Warning: dbase_open(): unable to open database C:...')
我想我找到答案了,http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm
04 = 4 表示 dBASE 级别 7。
header结构与dbase网站描述的完全一样。
Byte Contents Description
0 1 byte Valid 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-3 3 bytes Date 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-7 32-bit Number of records in the table. (Least significant byte first.)
8-9 16-bit Number of bytes in the header. (Least significant byte first.)
10-11 16-bit Number of bytes in the record. (Least significant byte first.)
12-13 2 bytes Reserved; filled with zeros.
14 1 byte Flag indicating incomplete dBASE IV transaction.
15 1 byte dBASE IV encryption flag.
16-27 12 bytes Reserved for multi-user processing.
28 1 byte Production MDX flag; 0x01 if a production .MDX file exists for this table; 0x00 if no .MDX file exists.
29 1 byte Language driver ID.
30-31 2 bytes Reserved; filled with zeros.
32-63 32 bytes Language driver name.
64-67 4 bytes Reserved.
68-n 48 bytes each Field Descriptor Array (see 1.2).
n+1 1 byte 0x0D stored as the Field Descriptor terminator.
n+2 Field Properties Structure
1.2 字段描述符数组
(One for each field in the table)
Byte Contents Description
0-31 32 bytes Field name in ASCII (zero-filled).
32 1 byte Field type in ASCII (B, C, D, N, L, M, @, I, +, F, 0 or G).
33 1 byte Field length in binary.
34 1 byte Field decimal count in binary.
35-36 2 bytes Reserved.
37 1 byte Production .MDX field flag; 0x01 if field has an index tag in the production .MDX file; 0x00 if the field is not indexed.
38-39 2 bytes Reserved.
40-43 4 bytes Next Autoincrement value, if the Field type is Autoincrement, 0x00 otherwise.
44-47 4 bytes Reserved.
示例
;04 = 4 for dBASE Level 7
;75 02 10 = Date of last update; in YYMMDD
;DF = 223 number of record
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
04 75 02 10 DF 00 00 00 15 03 B6 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
44 42 57 49 4E 55 53 30 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
;Column name start from 68 offset (Need to convert from hex to ascii)
;http://www.rapidtables.com/convert/number/hex-to-ascii.htm
;Example, 53 49 54 45 4E 4D = SITENM
;64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
; 00 01 02 03 04 05 06 07 08 09 10 11
00 00 00 00 53 49 54 45 4E 4D 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
;(See 1.2 Field Descriptor Array)
;0-31 = Field name in ASCII (zero-filled)
;32 = Field type in ASCII
;From below example the field type is 43 which is equal to 'C' in ascii
;33 = Field length in binary.
;From below example the field length is 0A which is equal to '10' in decimal
;28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
00 00 00 00 43 0A 00 00 00 00 00 00 00 00 00 00
;Column will start from 00 and end in offset 47 (total 48 bytes until it readched '0D' Field Descriptor terminator)
;So below 00 is start with another column
;Example, 44 41 54 45 = DATE
;44 45 46 47 00 01 02 03 04 05 06 07 08 09 10 11
00 00 00 00 44 41 54 45 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 0A 00 00 00 00 00 00 00 00 00 00
00 00 00 00 54 49 4D 45 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 08 00 00 00 00 00 00 00 00 00 00
00 00 00 00 54 52 41 4E 53 5F 43 4F 44 45 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 02 00 00 00 00 00 00 00 00 00 00
00 00 00 00 54 52 41 4E 53 5F 44 45 53 43 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 1E 00 00 00 00 00 00 00 00 00 00
00 00 00 00 42 55 53 4E 4F 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 02 00 00 00 00 00 00 00 00 00 00
00 00 00 00 55 4E 49 54 4E 4F 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 02 00 00 00 00 00 00 00 00 00 00
00 00 00 00 52 45 41 44 45 52 4E 4F 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 02 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 4F 4E 54 4E 41 4D 45 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 0C 00 00 00 00 00 00 00 00 00 00
00 00 00 00 44 52 4E 41 4D 45 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 0C 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 41 52 44 4E 4F 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 06 00 00 00 00 00 00 00 00 00 00
00 00 00 00 4E 41 4D 45 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 23 00 00 00 00 00 00 00 00 00 00
00 00 00 00 44 45 50 54 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 0C 00 00 00 00 00 00 00 00 00 00
00 00 00 00 4A 4F 42 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 0C 00 00 00 00 00 00 00 00 00 00
00 00 00 00 49 46 49 45 4C 44 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 43 1A 00 00 00 00 00 00 00 00 00 00
00 00 00 00 0D -> Here is the Field Descriptor terminator '0D'
```