DBF文件结构
来源:互联网 发布:西安源宇轩软件怎么样 编辑:程序博客网 时间:2024/06/04 17:52
The length of a record, in bytes, is determined by summing the defined lengths of all fields. Integers in table files are stored with the least significant byte first.
DBF File Header
0x02 FoxBASE
0x03 FoxBASE+/Dbase III plus, no memo
0x30 Visual FoxPro
0x31 Visual FoxPro, autoincrement enabled
0x43 dBASE IV SQL table files, no memo
0x63 dBASE IV SQL system files, no memo
0x83 FoxBASE+/dBASE III PLUS, with memo
0x8B dBASE IV with memo
0xCB dBASE IV SQL table files, with memo
0xF5 FoxPro 2.x (or earlier) with memo
0xFB FoxBASE1 - 3Last update (YYMMDD)4 – 7Number of records in file8 – 9Position of first data record10 – 11Length of one data record, including delete flag12 – 27Reserved28Table flags:
0x01 file has a structural .cdx
0x02 file has a Memo field
0x04 file is a database (.dbc)
This byte can contain the sum of any of the above values. For example, the value 0x03 indicates the table has a structural .cdx and a Memo field.29Code page mark30 – 31Reserved, contains 0x0032 – nField subrecords
The number of fields determines the number of field subrecords. One field subrecord exists for each field in the table.n+1Header record terminator (0x0D)n+2 to n+264A 263-byte range that contains the backlink, which is the relative path of an associated database (.dbc) file, information. If the first byte is 0x00, the file is not associated with a database. Therefore, database files always contain 0x00.
Field Subrecords Structure
C – Character
Y – Currency
N – Numeric
F – Float
D – Date
T – DateTime
B – Double
I – Integer
L – Logical
M – Memo
G – General
C – Character (binary)
M – Memo (binary)
P – Picture12 – 15Displacement of field in record16Length of field (in bytes)17Number of decimal places18Field flags:
0x01 System Column (not visible to user)
0x02 Column can store null values
0x04 Binary column (for CHAR and MEMO only)
0x06 (0x02+0x04) When a field is NULL and binary (Integer, Currency, and Character/Memo fields)
0x0C Column is autoincrementing19 - 22Value of autoincrement Next value23Value of autoincrement Step value24 – 31Reserved
typedef struct
{
FILE *fp;
int nRecords;
int nRecordLength;
int nHeaderLength;
int nFields;
int *panFieldOffset;
int *panFieldSize;
int *panFieldDecimals;
char *pachFieldType;
char *pszHeader;
int nCurrentRecord;
int bCurrentRecordModified;
char *pszCurrentRecord;
int bNoHeader;
int bUpdated;
} DBFInfo;
-----------------------------------------------------------------------------------------------------------
DBF文件结构分为两大部分:文件结构说明区和数据区。
一、文件结构说明区包括数据库参数区和记录结构表区。数据库参数区占32个字节:
1字节 数据库开始标志(若数据库含DBT文件为80H,否则为03H)
2-4字节 文件建立或修改的日期(YYMMDD 其中YY=日期-1900)
5-8字节 数据库的记录记录数,低字节在前,高字节在后
9-10字节 文件结构说明区长度
11-12字节 每条记录的总长度
12-32字节 保留
记录结构表区包括各字段参数,每个字段占32字节:
1-11字节 字段名
12 字段类型
13-14 首记录中该字段对应内存地址的偏移量
15-16 首记录中该字段对应内存地址的段地址
17 字段长度
18 字段小数位数
在所有记录结构表区后是数据库结构结束标志,其中 Foxbase 以0D结束,dBASE 以0D,00
结束。
二、数据库数据区每条记录按字段依次存放,没有分隔符,也没有终止符,每条记录以删除标志
20H开始,若该记录被删除,则该标志为2AH 即“*”。
数据库的最后一个字节为结束标志1AH。
- DBF文件结构
- dbf文件结构分析
- DBF数据表文件的结构分析
- 如何判断两个dbf文件的结构是否完全相同?
- JavaDBF操作DBF文件
- C#读取DBF文件
- ruby读dbf文件
- UNDOTBS01.DBF文件很大
- C# 创建DBF文件
- TQuery访问DBF文件
- java读写dbf文件
- C#读取dbf文件
- C#操作dbf文件
- .net连接DBF文件
- C# 创建DBF文件
- java操作dbf文件
- UNDOTBS01.DBF文件很大 .
- DBF 文件数据读取
- 如何修改ubuntu系统的主机名
- python解决 'ascii' codec can't decode byte 0xe5 in position 3: ordinal not in range(128)
- 四种常见的鼠标事件
- sizeof(空类或空结构体)
- 4.7使用jar文件
- DBF文件结构
- 1048. Inverso
- lds文件分析
- Android模拟器相关操作设置
- 山寨手机风行6年开始退潮:华强北商家大批撤离
- 滚动条范围的计算
- File
- 1059. Exocenter of a Trian
- RzListView