You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am adding records to an existing dbf, the recs are correctly inserted, but the header field record_count is not incremented with the added records which leads to corrupt db file.
The text was updated successfully, but these errors were encountered:
def flush(self, stream):
if not self.changed:
return
self.last_update = datetime.date.today()
self.write(stream)
you are indeed incrementing the record_count but you are not telling the header that a record was added. Adding this update into db.write() method fixes the issue:
if record.index is None:
# we must increase record count before set index,
# because set index will raise error if out of range
self.header.record_count += 1
record.index = self.header.record_count - 1
self.header._changed = True # <= added line to force header recalc
Hello,
I am adding records to an existing dbf, the recs are correctly inserted, but the header field record_count is not incremented with the added records which leads to corrupt db file.
The text was updated successfully, but these errors were encountered: