From: Jason M. <ja...@on...> - 2010-10-22 20:01:37
|
Hello, Apparently VFP 9 introduced an optional feature that adds a hidden field to a DBF file called "_nullFlags". More information: http://www.matrixlist.com/pipermail/harbour/2007-October/004290.html I was working with a DBF file that had this and caused dbfpy to fail. The typeCode for _nullFlags is 0 (zero), so I tied adding a news class to fields.py with the same properties as the class "DbfCharacterFieldDef", with the exception of the typeCode. That seemed to fix it, at least for the file I was working with. The class would need some work to take advantage of the added features, but here's that class that should prevent the error I had by at least being aware of the new field; [begin code] class DbfNullFlagsFieldDef(DbfFieldDef): """Definition of the _nullFlags field.""" typeCode = "0" defaultValue = "" def decodeValue(self, value): """Return string object. Return value is a ``value`` argument with stripped right spaces. """ return value.rstrip(" ") def encodeValue(self, value): """Return raw data string encoded from a ``value``.""" return str(value)[:self.length].ljust(self.length) [end code] Thanks, Jason (jmcpheron) |