Example #1
0
    def getPayload(self):
        payload = bytearray()

        payload.extend(Proto.build_byte(Flags.OK))
        payload.extend(Proto.build_lenenc_int(self.affectedRows))
        payload.extend(Proto.build_lenenc_int(self.lastInsertId))
        payload.extend(Proto.build_fixed_int(2, self.statusFlags))
        payload.extend(Proto.build_fixed_int(2, self.warnings))

        return payload
Example #2
0
File: ok.py Project: MPjct/PyMP
    def getPayload(self):
        payload = bytearray()

        payload.extend(Proto.build_byte(Flags.OK))
        payload.extend(Proto.build_lenenc_int(self.affectedRows))
        payload.extend(Proto.build_lenenc_int(self.lastInsertId))
        payload.extend(Proto.build_fixed_int(2, self.statusFlags))
        payload.extend(Proto.build_fixed_int(2, self.warnings))

        return payload
Example #3
0
    def getPayload(self):
        payload = bytearray()

        for col in self.data:
            if self.rowType == Flags.ROW_TYPE_TEXT:
                if isinstance(col, basestring):
                    payload.extend(Proto.build_lenenc_str(col))
                elif isinstance(col, (int, long)):
                    payload.extend(Proto.build_lenenc_int(col))
                elif isinstance(col, (float, complex)):
                    payload.extend(Proto.build_lenenc_str(str(col)))
                else:
                    raise NotImplementedError()
            elif self.rowType == Flags.ROW_TYPE_BINARY:
                raise NotImplementedError()
            else:
                raise NotImplementedError()

        return payload
Example #4
0
File: row.py Project: MPjct/PyMP
    def getPayload(self):
        payload = bytearray()

        for col in self.data:
            if self.rowType == Flags.ROW_TYPE_TEXT:
                if isinstance(col, basestring):
                    payload.extend(Proto.build_lenenc_str(col))
                elif isinstance(col, (int, long)):
                    payload.extend(Proto.build_lenenc_int(col))
                elif isinstance(col, (float, complex)):
                    payload.extend(Proto.build_lenenc_str(str(col)))
                else:
                    raise NotImplementedError()
            elif self.rowType == Flags.ROW_TYPE_BINARY:
                raise NotImplementedError()
            else:
                raise NotImplementedError()

        return payload
Example #5
0
 def getPayload(self):
     payload = Proto.build_lenenc_int(self.colCount)
     return payload
Example #6
0
 def getPayload(self):
     payload = Proto.build_lenenc_int(self.colCount)
     return payload