dbase
dbase copied to clipboard
Support more field types for dbase IV
The project doesn't support Float fields yet.
I tried opening a dbase file that had a Float column.
Here is the error:
Fatal error: Uncaught org\majkel\dbase\Exception: Format dBASE III PLUS does not support field F
I can try adding it myself and see if I can get it working. If I get it working I will make a pull request for it if that is ok. What other fields should be supported? Others I see on https://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm Long, Double, Binary I am not sure which one of these I will need for my project.
PR: https://github.com/majkel89/dbase/pull/23
Hi, Your contribution is welcome.
I think better documentation of DBase Level IV format is in http://www.oocities.org/geoff_wass/dBASE/GaryWhite/dBASE/FAQ/qformt.htm#B (see DEVELOP.md)
According to this documentation only C, D, F, L, M, N are supported. C, D, L, M, N are already present so you will have to implement F field.
F is not supported by DBase Level III so you will have to implement new format DBase4.
Add the new format to FormatFactory.
Currently DBase3 format does not check the version in header. I think you will have to add the version check to Format::readHeader.
I would be glad to receive sample of DBase Level IV file with float field so that I will be able to help you further.
I am adding the files that should make dBase IV and Float a new field.
One question I have is from the Builder class. Should it defualt to DBASE3?
private $formatType = Format::DBASE3;
I made a new FloatField in field folder and I used this for the length and decimal count: `class FloatField extends Field {
/**
* FloatField constructor.
*/
public function __construct() {
$this->length = 16;
$this->decimalCount = 14;
}`
This page says width 16: https://www.stattransfer.com/support/manual/dBase.html
I found a nice page that shows what the version numbers are for each type. https://www.loc.gov/preservation/digital/formats/fdd/fdd000325.shtml 0x03 FoxBASE+/Dbase III plus, no memo 0x30 Visual FoxPro 0x83 FoxBASE+/dBASE III PLUS, with memo
It looks like I have a dbase III file that has Floats. So I will add Float as a type for dbase III. In addition to adding dbase4. According the file header of the file it is version 03. But when I open it with DBF Manager it thinks it is a Visual Foxpro file. How can the code tell the difference between Visual Foxpro and dBase III? I have attached the file to this message. TestVisualFoxproDBF.zip

Hard to tell if the remains of specifications are wrong or your file corrupted. For me it would be ok to just add the float field to dBase III.
Try to test the lib with files in https://www.clicketyclick.dk/databases/xbase/index.shtml.en
Did you fix this? I have the same issue... and cannot open the DBF using this library.. it was generated using Visual FoxPro
Oh, okay... created the "FloatField.php" from "NumericField.php" and it opens the file now. Thanks.
Another solution is to edit the exiting DBF file and change the header structure of that column from Float to Numeric (it also can have decimals)
I got busy and didn't fix this. I did enough to support what I needed though.
tried to make a fork but no time for it. And I discovered antoher package : https://github.com/luads/php-xbase
Use this one support much more types ! (date/timestamp/integer , ....)
Maybe related:
org\majkel\dbase\Exception
Format `dBASE III PLUS` does not support field `I`
Hi, I need help, I have table built by dbase iii+ , and it was created with password, and I forgot the password, how can I reset on change the password.