示例#1
0
    def fromString(cls, string, start, ignoreErrors=False):
        """Decode dbf field definition from the string data.

        Arguments:
            string:
                a string, dbf definition is decoded from. length of
                the string must be 32 bytes.
            start:
                position in the database file.
            ignoreErrors:
                initial error processing mode for the new field (boolean)

        """
        assert len(string) == 32
        _length = ord(string[16])
        return cls(utils.unzfill(string)[:11], _length, ord(string[17]),
            start, start + _length, ignoreErrors=ignoreErrors)
示例#2
0
文件: fields.py 项目: dio4/vista_1
    def fromString(cls, string, start, encoding=None):
        """Decode dbf field definition from the string data.

        Arguments:
            string:
                a string, dbf definition is decoded from. length of
                the string must be 32 bytes.
            start:
                position in the database file.
        """
        assert len(string) == 32
        _length = ord(string[16])
        name = utils.unzfill(string)[:11]
        if encoding:
            name = unicode(name, encoding)
        else:
            name = unicode(name)
        return cls(name, _length, ord(string[17]),
            start, start + _length)
示例#3
0
    def fromString(cls, string, start, encoding=None):
        """Decode dbf field definition from the string data.

        Arguments:
            string:
                a string, dbf definition is decoded from. length of
                the string must be 32 bytes.
            start:
                position in the database file.
        """
        assert len(string) == 32
        _length = ord(string[16])
        name = utils.unzfill(string)[:11]
        if encoding:
            name = unicode(name, encoding)
        else:
            name = unicode(name)
        return cls(name, _length, ord(string[17]),
            start, start + _length)