plugin/dbf: Version handling improved (thanks zsolt)

git-svn-id: svn://ultimatepp.org/upp/trunk@7439 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-06-11 06:24:23 +00:00
parent aae8de0c2b
commit 91abf69578
2 changed files with 9 additions and 3 deletions

View file

@ -304,10 +304,12 @@ void DbfStream::Field::Serialize(Stream& stream)
DbfStream::DbfStream()
{
version = 0x03;
}
DbfStream::DbfStream(const char *_file, bool write, byte _charset, bool _delete_share)
{
version = 0x03;
Open(_file, write, _charset, _delete_share);
}
@ -362,14 +364,17 @@ bool DbfStream::StreamHeader(bool full)
data_offset = 32 + fields.GetCount() * 32 + 1;
if(dbf.IsStoring()) {
ASSERT(!IsReadOnly());
dbf.Put(0x03); // #0: version number - 03 without a DBT file
dbf.Put(version); // #0: version number - 03 without a DBT file
Date date = GetSysDate();
dbf.Put(date.year - 1900); // #1 - 3: date of last update
dbf.Put(date.month);
dbf.Put(date.day);
}
else
dbf.Get32le();
else {
version = dbf.Get8();
dbf.Get8();
dbf.Get16();
}
sStreamIL(dbf, rows);
if(!full)
return true;

View file

@ -144,6 +144,7 @@ protected:
bool dirty;
bool dirty_header;
bool has_memo;
byte version;
};
END_UPP_NAMESPACE