exavera / ndbfreader Goto Github PK
View Code? Open in Web Editor NEWA fully managed reader of DBF files. Fast and lightweight with async support.
License: MIT License
A fully managed reader of DBF files. Fast and lightweight with async support.
License: MIT License
StringColumn.cs文件中36行处方法DoLoad,修改个bug。之前一直解析乱码,修改后就好了。如下:
protected override string DoLoad(byte[] buffer, int offset, Encoding encoding)
{
if (_parsedCharsBuffer == null)
{
_parsedCharsBuffer = new char[Size];
}
var bytes = buffer.Skip(offset).Take(Size).ToArray();
var result = encoding.GetString(bytes).Trim('\0').Trim(' ');
return result;
}
Maybe the following could be a candidate for a new feature in a future release (this is not a bug!) :
Integrate a new option to read table rows with a deleted flag (*) and mark them in an additional column (_deleted) in returned datatable.
Not able to read DateTime column of dbf with size 8. it returns byte array.
any solution ??
This field will be parsed as Decimal (because it is N, not I), while the other readers recognize it as Integer field (10 digits, zero decimals as seen from the screenshot above)
how to export my dbf into generic list using this nu package
its my dbf tanggal is date time and jam is timespan
Hello.
I've spotted a problem, while reading data from columns.
There I have a dbf.
You can see that "GDE" field has length of 5 and for the first record it contains " 1" (e.g. four spaces and "1"). when I'm using reader.GetValue or GetDecimal, it returns 0 to me. For the value " 11" it returns 1.
So I've started to suspect that it cuts the last byte and tried with another field.
I've tried to read from "REK1" field (yeap, its data looks clumsy), and it returned to me that value but with extra "1" before, so it looks that there's a problem with offset.
ADDED!
I've found the reason. That's the damn dBase 7 Extra properties (http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm). As I understood, they are optional, but the file of that format contains extra zero byte, if it doesn't contain that properties.
There we have terminating byte (red), dBase7 extra properties section (yellow, and it is empty, but the byte is present), then deletion marker (space or asterisk, green), and finally the value of first field (" 1", blue).
Please notice, that according to http://www.dbf2002.com/dbf-file-format.html, the 8th and 9th bytes contain offset of data, so we can just seek to that place, ignoring the extra properties.
data starts at 0x0422 = 1058 bytes, while currently NDbfReader will start from 1057
ADDED
I've changed a bit Load method in HeaderLoader:
....
BasicProperties properties = ParseBasicProperties(buffer);
var retVal = LoadColumns(stream, properties, buffer.Last());
var dataOffset = (buffer[DATA_START_OFFSET_H] << 8) | buffer[DATA_START_OFFSET_L];
stream.Seek(dataOffset, SeekOrigin.Begin);
return retVal;
....
DATA_START_OFFSET_H = 8;
DATA_START_OFFSET_L = 9;
p.s.
I'm new to github, I also want to fork this projects. I've added GetBytes method (in addition to GetValue), so now I can get raw bytes for any field I want (I'm just had a problem with decoding of crypted string in a string-typed field, so I did need a raw data to make some operations, without any encoding issues)..
Hello,
how to read "memo" / bytes[] / fpt values?
Thanks
How fix this error?
The DBWINUS0 column's type is not supported.
Thank you.
Some DBF files has the listed columns with bigger size filled by whitespace. NDbfReader can't load these files.
I am trying to read bad data from a DateTime column. Because it cannot parse it to a DateTime it breaks, and I cannot find a suitable alternative method to collect this bad data so I would prefer to use .GetString(myCol) for all columns so I can deal with the parsing and error handling myself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.