xsharp.eu • dbf/cdx Limits
Page 1 of 2

dbf/cdx Limits

Posted: Wed Feb 02, 2022 3:30 pm
by Horst
Hallo
I was looking in the X# help for the limits of the dbf/cdx . Like max. size of a dbf, max records , max. length of a charater field etc.
I cant find it, any hint ?

Horst

dbf/cdx Limits

Posted: Wed Feb 02, 2022 3:52 pm
by robert
Horst
Horst wrote: I was looking in the X# help for the limits of the dbf/cdx . Like max. size of a dbf, max records , max. length of a charater field etc.

We follow the same specs as FoxPro and the other DBFCDX implementations:

DBF Max 2 Gb
FPT Max 2 Gb
CDX Max 2 Gb
Record Size Max 64 K
# of Fields: 255
Max # of Characters in field: 254, however you can have more by storing length and decimals for a field. That will make the table incompatible with FoxPro
Max size of index key: 240
Max size of index expression + for condition expression: 512
I will make a note to add a page to the help file about this.

Robert

dbf/cdx Limits

Posted: Wed Feb 02, 2022 4:18 pm
by Horst
Hallo Robert

Thanks, i was already using the dbf with a fieldsize of 1000, was hoping for more :-)

Horst

dbf/cdx Limits

Posted: Wed Feb 02, 2022 10:53 pm
by Jamal
Robert,

Are you sure about the # of Fields: 255 ?

I have a DBF file with 336 fields.

Jamal

dbf/cdx Limits

Posted: Thu Feb 03, 2022 5:38 am
by wriedmann
Hi Robert,
AFAIK the maximum number of fields in a table is 1024, but I cannot find any reference of it. The programmers guide where this page was seems to have been lost in 2.8 SP4.
DBaseIV for DOS says 255, DBaseIV for Windows says 1024.
My largest table currently has 503 fields.
Wolfgang

dbf/cdx Limits

Posted: Thu Feb 03, 2022 5:04 pm
by robert
Wolfgang,
There is no field in the DBF header with the # of fields. So that does not result in a limit. There is a field with the header size which is 16 bits. The start of the header is 32 bytes and each field is also 32 bytes. If you see the header size as unsigned then you can store (2^16 - 32 ) / 32 = 2046 fields in there. I think the 1024 you mention should actually be 1022 and is based on signed numbers
If the DBF is part of a FoxPro DBC file then an additional 262 bytes in the header are reserved for the link to the DBC, so you will be able to store less fields.
The # of fields that I have was based on the FoxPro specs.
There is also a field in the header of the DBF with the record size. This is also 16 bits, so that determines the max 64K record size.
The 2 Gb file sizes are based on the locking scheme (for DBF) and on the fact that page offsets are stored in the CDX as signed integers.
Harbour has the option to store page numbers instead of offsets in a CDX (these CDX files are incompatible with FoxPro) which allows for much larger CDX files (1 Tb). They also have a special custom locking scheme for the DBF files that allows for MUCH larger DBF files sizes. I am not sure if that is such a good idea though.

Robert

dbf/cdx Limits

Posted: Thu Feb 03, 2022 5:19 pm
by Horst
Hi Robert
One little question. VO and X# dbf's are the same ?
So i can still use dbalite to create dbf's ?
Or its better to create them with x# ?

Horst

dbf/cdx Limits

Posted: Thu Feb 03, 2022 5:33 pm
by FFF
Wolfgang,i found the text in my old 2.5 ProgGuide copy ;-)
DBF_Spec_1.png
DBF_Spec_1.png (151.4 KiB) Viewed 458 times
What the heck does this site do to attachments? I upload a gif, and it makes it a png, and a bad one ;-(

dbf/cdx Limits

Posted: Thu Feb 03, 2022 6:26 pm
by Chris
Hi Horst,

Dbfs in X#/VO should be usable in the exact same way. Almost any difference regarding dbf usage between the two is most probably a bug that we'd need a sample to look into it and fix it.

dbf/cdx Limits

Posted: Thu Feb 03, 2022 7:14 pm
by Horst
Hi Chris
Thanks for the pic. I have one 'static' dbf , the dbf grows up to about 500 records and then records will be receicled , But the fpt files still grows up and up. now i can define a charaterfield with 30kb and i have no additional work on that dbf.

Thanks
Horst

btw
i think i saw this table in the vo2.7 help, i lost that file