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

Writes are not working #16

Open
cooldemo opened this issue Jul 11, 2015 · 4 comments
Open

Writes are not working #16

cooldemo opened this issue Jul 11, 2015 · 4 comments

Comments

@cooldemo
Copy link

The writes to a dbf file are broken - header is not written properly.

@cooldemo cooldemo changed the title Writest not working Writes are not working Jul 11, 2015
@laptio
Copy link

laptio commented Aug 29, 2016

I think, I have the same problem.
When I'm trying to open file, I have "Table 'xx.dbf' has become corrupted. Table will need to be repaired before using again"

@laptio
Copy link

laptio commented Aug 29, 2016

I think smth wrong with this:

private void writeHeader() throws IOException {
byte[] bytes = DbfMetadataUtils.toByteArrayHeader(metadata);
// assert(bytes.length == 16);
out.write(bytes);
BitUtils.memset(bytes, 0);
out.write(bytes);

@cooldemo
Copy link
Author

jdbf.zip
example.zip

Hi,
I have made quite a few changes to it. I don't know if you will be able to create new files, but it should work on appending to existing files as well as reading them.

I have attached fixed sources and part of my code as an example how to use it.

@laptio
Copy link

laptio commented Aug 31, 2016

Thank you alot!!!
I found the main reason.
It's necessary to add number of rows and maybe necessary , I'm not sure, to add the date.
You do it in your example here:
dbfMetaFakvy.setRecordsQty(billCount); dbfMetaFakvy.setUpdateDate(Calendar.getInstance().getTime());

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

No branches or pull requests

2 participants