Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more field types for dbase IV #22

Open
stokescomp opened this issue May 15, 2019 · 10 comments
Open

Support more field types for dbase IV #22

stokescomp opened this issue May 15, 2019 · 10 comments

Comments

@stokescomp
Copy link

stokescomp commented May 15, 2019

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: #23

@majkel89
Copy link
Owner

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.

@stokescomp
Copy link
Author

stokescomp commented May 18, 2019

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

image

@majkel89
Copy link
Owner

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

@mzvarik
Copy link

mzvarik commented Feb 10, 2020

Did you fix this?
I have the same issue... and cannot open the DBF using this library.. it was generated using Visual FoxPro

@mzvarik
Copy link

mzvarik commented Feb 10, 2020

Oh, okay... created the "FloatField.php" from "NumericField.php" and it opens the file now. Thanks.

@mzvarik
Copy link

mzvarik commented Feb 10, 2020

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)

@stokescomp
Copy link
Author

I got busy and didn't fix this. I did enough to support what I needed though.

@neoteknic
Copy link

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 , ....)

@razvanphp
Copy link

Maybe related:

org\majkel\dbase\Exception
Format `dBASE III PLUS` does not support field `I`

@MohammedRawhi
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants