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

Error creating dbf when Integer fields are defined. #53

Open
JosepMariaGomez opened this issue Jan 13, 2022 · 0 comments
Open

Error creating dbf when Integer fields are defined. #53

JosepMariaGomez opened this issue Jan 13, 2022 · 0 comments

Comments

@JosepMariaGomez
Copy link

Error on read dbf files created with jdbf if there is one (or more) field of Integer type.

            String fieldsInfo = "CODE,C,12,0|TITLE,C,40,0|CATEGORY,I,5,0";
            DbfMetadata meta1 = DbfMetadataUtils.fromFieldsString(fieldsInfo);
            meta1.setType(DbfFileTypeEnum.FoxBASEPlus1);
            DbfWriter writer = new DbfWriter(meta1, out);  // out is a OutputStream to send the file to the client side.
            writer.setStringCharset(Charset.forName("ISO-8859-1")); // ISO-LATIN-1
            Map<String, Object> map = new HashMap<>();
            map.put("CODE", "1");
            map.put("TITLE", "FIRST");
            map.put("CATEGORY", 1);
            writer.write(map);
            writer.close();

No error is raised during creation process.

           String fieldsInfo = "CODE,C,12,0|TITLE,C,40,0|CATEGORY,N,5,0";

Changing the definition to N, converts the field to Float, and dbf file can be readed (with an external dbf browser).

Many thanks.

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

1 participant