jdbf中试图支持Foxpro的dbf数据类型

今天下午在更新jdbf包的时候,发现它对foxpro的dbf文件格式支持非常有限。
在我的jdbf包里,只支持C, N, L, D, F五种类型,我试图扩充I (Integer)类型,几本上能通过。

可是在扩充M(Memo), Y(Currency), T(Datetime)类型时,由于不知道它到底是怎么存储的,程序出错。
如果时间充足,借助于hex dump工具,也许能分析出这几种类型在foxpro里是怎么存储的。sigh, 微软都快要放弃foxpro了,为什么格式还那么保密呢。

 

Code Type Length Description
C Character < 254

ASCII text < 254 characters long in dBASE. Character fields can be up to 32 KB long (in
Clipper and FoxPro) using decimal count as high byte in field length. It's possible to use up
to 64KB long fields by reading length as unsigned.

Only fields <= 100 characters can be indexed.

N Number <18 ASCII text up till 18 characters long (include sign and decimal point). Valid characters: "0" -
"9" and "-". Number fields can be up to 20 characters long in FoxPro and Clipper. 
L Logical 1 Boolean/byte (8 bit) Legal values: 
? Not initialised (default)  
Y,y Yes
N,n No
F,f False
T,t True
Logical fields are always displayed using T/F/?. Some sources claims that space
(ASCII 20h) is valid for not initialised. Space may occur, but is not defined.
 
D Date 8 Date in format YYYYMMDD. A date like 0000-00- 00 is *NOT* valid. 
M Memo 10 Pointer to ASCII text field in memo file 10 digits representing a pointer to a DBT block
(default is blanks). 
F Floating point 20 (dBASE IV and later, FoxPro, Clipper) 20 digits 
N/A Character name variable < 254 1-254 characters (64 KB in FoxBase and Clipper) 
B Binary ?? (dBASE V) Like Memo fields, but not for text processing. 

(FoxPro/FoxBase) Double integer *NOT* a memo field

G General ?? (dBASE V: like Memo) OLE Objects in MS Windows versions 
P Picture ?? (FoxPro) Like Memo fields, but not for text processing. 
Y Currency ?? (FoxPro)
T DateTime ?? (FoxPro)
I Integer 4 byte little endian integer (FoxPro)
V VariField 2-10 bytes There are weakly-typed and strongly-typed VariFields.
Weakly-typed VariFields allow to store a portion of any character data in the .DBF field itself,
with any additional amount, if any, being automatically stored in the MEMO file. This
substantially reduces the amount of disk space required to store the data. This is sort of a
cross between using a CHARACTER field and a MEMO field at the same time.

A 6 byte pointer is maintained at the end of the weakly-typed "V" field entry within the DBF
file. When you define the field width for a new database file, keep in mind that weakly-typed
"V" fields require this additional 6 bytes at the end.

Strongly-typed VariFields store DATE values in only three bytes, instead of eight, and LONG
INTEGER values (up to ~2G) in only 4 bytes. Any "V" field defined with 4 bytes is
automatically considered a strongly-typed integer, and "V" fields defined with 3 bytes are
automatically considered strongly-typed DATE values. No additional space is required (6-
byte pointer) for strongly typed VariFields.

FlagShip has additional types

V 10   Variable  Variable, bin/asc data in .dbv      (.dbf type = 0xB3)

                 4bytes bin= start pos in memo

                 4bytes bin= block size

                 1byte     = subtype

                 1byte     = reserved (0x1a)

                 10spaces if no entry in .dbv


2 2    short int binary int max +/- 32767       (.dbf type = 0xB3)

4 4    long int  binary int max +/- 2147483647  (.dbf type = 0xB3)

8 8    double    binary signed double IEEE      (.dbf type = 0xB3)

X Variant (X) for compatibility with SQL-s (i.e. varChar).   (CLIP)
@ Timestamp. 8 bytes (two longs) First long repecents date and second long time. Date is the number of days since January
1st, 4713 BC. Time is hours * 3600000L + minutes * 60000L + seconds * 1000L.
O Double 8 bytes (no conversion)
+ Autoincrement long (no conversion)

你可能感兴趣的:(Date,Integer,database,UP,character,byte)