示例#1
0
文件: dbf.py 项目: esauro/akademic
	def _fromRawData(self, rawData):
		'''private: instantiate the receiver from dbf 32-byte raw header
		jjk  02/19/98'''
		self.version = ord(rawData[0])
		self.year = 1900+ord(rawData[1])
		self.month = ord(rawData[2])
		self.day = ord(rawData[3])
		self.recordCount = binnum.unsigned_from_Intel4(rawData[4:8])
		self.headerLength = binnum.unsigned_from_Intel2(rawData[8:10])
		self.recordLength = binnum.unsigned_from_Intel2(rawData[10:12])
示例#2
0
	def _fromRawData(self, rawData):
		'''private: instantiate the receiver from dbf 32-byte raw header
		jjk  02/19/98'''
		self.version = ord(rawData[0])
		self.year = 1900+ord(rawData[1])
		self.month = ord(rawData[2])
		self.day = ord(rawData[3])
		self.recordCount = binnum.unsigned_from_Intel4(rawData[4:8])
		self.headerLength = binnum.unsigned_from_Intel2(rawData[8:10])
		self.recordLength = binnum.unsigned_from_Intel2(rawData[10:12])
示例#3
0
 def readHeaderData(self, dbfs):
     '''private: read and dcode dbf header data from binary input stream
     jjk  11/05/97'''
     self.version = ord(dbfs.read(1))
     year = ord(dbfs.read(1))
     month = ord(dbfs.read(1))
     day = ord(dbfs.read(1))
     self.lastUpdate = "%2d/%2d/%2d" % (month, day, year)
     self.recordCount = binnum.unsigned_from_Intel4(dbfs.read(4))
     self.headerLength = binnum.unsigned_from_Intel2(dbfs.read(2))
     self.recordLength = binnum.unsigned_from_Intel2(dbfs.read(2))
     reserved = dbfs.read(20)
     self.fieldDefs = []
     fieldCount = (self.headerLength - 33) / 32
     start = 1  #byte 0 is delete flag
     for fn in range(fieldCount):
         fd = DbfFieldDef()
         fd.readFieldDef(dbfs, start)
         self.fieldDefs.append(fd)
         start = fd.end
     skip = dbfs.read(1)
示例#4
0
 def readHeaderData(self, dbfs):
     '''private: read and dcode dbf header data from binary input stream
     jjk  11/05/97'''
     self.version = ord(dbfs.read(1))
     year = ord(dbfs.read(1))
     month = ord(dbfs.read(1))
     day = ord(dbfs.read(1))
     self.lastUpdate = "%2d/%2d/%2d" % (month, day, year)
     self.recordCount = binnum.unsigned_from_Intel4(dbfs.read(4))
     self.headerLength = binnum.unsigned_from_Intel2(dbfs.read(2))
     self.recordLength = binnum.unsigned_from_Intel2(dbfs.read(2))
     reserved = dbfs.read(20)
     self.fieldDefs = []
     fieldCount = (self.headerLength - 33) / 32
     start = 1 #byte 0 is delete flag
     for fn in range(fieldCount):
         fd = DbfFieldDef()
         fd.readFieldDef(dbfs, start)
         self.fieldDefs.append(fd)
         start = fd.end
     skip = dbfs.read(1)