File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -477,7 +477,7 @@ def __dbfHeader(self):
477
477
self .__recStruct = Struct (fmt )
478
478
479
479
def __recordFmt (self ):
480
- """Calculates the size of a .shp geometry record."""
480
+ """Calculates the format and size of a .dbf record."""
481
481
if not self .numRecords :
482
482
self .__dbfHeader ()
483
483
fmt = '' .join (['%ds' % fieldinfo [2 ] for fieldinfo in self .fields ])
@@ -549,11 +549,13 @@ def records(self):
549
549
"""Returns all records in a dbf file."""
550
550
if not self .numRecords :
551
551
self .__dbfHeader ()
552
+ records = []
552
553
f = self .__getFileObj (self .dbf )
553
554
f .seek (self .__dbfHeaderLength ())
554
- flat = unpack (self .__recStruct .format * self .numRecords , f .read (self .__recStruct .size * self .numRecords ))
555
- rowlen = len (self .fields ) - 1
556
- records = list (izip (* (iter (flat ),) * rowlen ))
555
+ for i in range (self .numRecords ):
556
+ r = self .__record ()
557
+ if r :
558
+ records .append (r )
557
559
return records
558
560
559
561
def iterRecords (self ):
You can’t perform that action at this time.
0 commit comments