albfernandez / javadbf

Java library for reading and writing Xbase (dBase/DBF) files.
GNU Lesser General Public License v3.0
220 stars 98 forks source link

DBFWriter: "Invalid number of fields in row" #87

Closed toburger closed 3 years ago

toburger commented 3 years ago

I try to write a record to an existing Fox Pro DBF file which uses a FPT file to store memo fields.

I don't know if the memo file is needed in order to write the data. I cannot set it so I assume the memo file is only needed for reading (?).

I can read all the data just fine, but when I try to write a record via addRecord I get the following error:

Invalid record. Invalid number of fields in row

I have the equal number of fields that I get when calling the reader's getFields method.

Also when I try using an existing record that i get from the reader and then write this record with the DBFWriter I get the same error message.

So somehow there is a mismatch between the field count of the reader and the field count when it comes to write the record...

Has this something to do with the missing memo file on the DBFWriter? Is this scenario unsupported?

albfernandez commented 3 years ago

Writing files with memo fields are not supported, but the error message is wrong. It must ignore memo files or throw an excepction that clearly says "memo fields are not supported for writting"

I'll take a look.

toburger commented 3 years ago

Thanks a lot! That makes sense now. Is there a way to ignore the memo field(s) but write the other fields?

albfernandez commented 3 years ago

Is there a way to ignore the memo field(s) but write the other fields?

Sorry, not with the current version.

toburger commented 3 years ago

Thanks for the clarification. At least I have learned a lot about the XBASE file format. 😃