当前位置: 首页 > 工具软件 > jdbf > 使用案例 >

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

斜和硕
2023-12-01

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

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

CodeTypeLengthDescription
CCharacter< 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.

NNumber<18ASCII 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.
LLogical1Boolean/byte (8 bit) Legal values:
?Not initialised (default)
Y,yYes
N,nNo
F,fFalse
T,tTrue
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.
DDate8Date in format YYYYMMDD. A date like 0000-00- 00 is *NOT* valid.
MMemo10Pointer to ASCII text field in memo file 10 digits representing a pointer to a DBT block
(default is blanks).
FFloating point20(dBASE IV and later, FoxPro, Clipper) 20 digits
N/ACharacter name variable< 2541-254 characters (64 KB in FoxBase and Clipper)
BBinary??(dBASE V) Like Memo fields, but not for text processing.

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

GGeneral??(dBASE V: like Memo) OLE Objects in MS Windows versions
PPicture??(FoxPro) Like Memo fields, but not for text processing.
YCurrency??(FoxPro)
TDateTime??(FoxPro)
IInteger4 byte little endian integer(FoxPro)
VVariField2-10 bytesThere 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)
XVariant (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.
ODouble8 bytes(no conversion)
+Autoincrementlong(no conversion)
<script type="text/javascript"><!-- google_ad_client = "ca-pub-7104628658411459"; /* wide1 */ google_ad_slot = "8564482570"; google_ad_width = 728; google_ad_height = 90; //--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
 类似资料: