예제 #1
0
파일: dbf.py 프로젝트: esauro/akademic
	def fromRawData(self, rawFieldDef, startPos):
		'''system: decode dbf field definition from 32-byte raw dbf data
		jjk  02/18/98'''
		self.name = strutil.unzfill(rawFieldDef[:11])
		dataAddress = binnum.unsigned_from_Intel4(rawFieldDef[12:16])
		self.length = ord(rawFieldDef[16])
		self.start = startPos
		self.end = startPos + self.length
		self.decimalCount = ord(rawFieldDef[17])
예제 #2
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])
예제 #3
0
파일: dbfload.py 프로젝트: cyenglish3/stars
 def readFieldDef(self, dbfs, start):
     '''read and dcode dbf field definition from binary input stream
     jjk  11/05/97'''
     self.name = dbfs.read(11)
     while (self.name[-1:] == '\000'): self.name = self.name[:-1]
     self.type = dbfs.read(1)
     dataAddress = binnum.unsigned_from_Intel4(dbfs.read(4))
     self.length = ord(dbfs.read(1))
     self.start = start
     self.end = start + self.length
     self.decimalCount = ord(dbfs.read(1))
     reserved = dbfs.read(14)
예제 #4
0
파일: dbfload.py 프로젝트: kindyzeng/stars
 def readFieldDef(self, dbfs, start):
     '''read and dcode dbf field definition from binary input stream
     jjk  11/05/97'''
     self.name = dbfs.read(11)
     while (self.name[-1:] == '\000'):
         self.name = self.name[:-1]
     self.type = dbfs.read(1)
     dataAddress = binnum.unsigned_from_Intel4(dbfs.read(4))
     self.length = ord(dbfs.read(1))
     self.start = start
     self.end = start + self.length
     self.decimalCount = ord(dbfs.read(1))
     reserved = dbfs.read(14)
예제 #5
0
파일: dbfload.py 프로젝트: kindyzeng/stars
 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)
예제 #6
0
파일: dbfload.py 프로젝트: cyenglish3/stars
 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)