def putClob(self, value): """Appends the Clob(Character Large OBject) value to the message.""" length = len(value) lengthStr = toByteString(length) packed = chr(protocol.CLOBLEN0 + len(lengthStr)) + lengthStr + value self.__output += packed return self
def putBlob(self, value): """Appends the Blob(Binary Large OBject) value to the message.""" data = value.string length = len(data) lengthStr = toByteString(length) lenlengthstr = len(lengthStr) packed = chr(protocol.BLOBLEN0 + lenlengthstr) + lengthStr + data self.__output += packed return self
def putScaledTime(self, value): """Appends a Scaled Time value to the message.""" (ticks, scale) = datatype.TimeToTicks(value) valueStr = toByteString(ticks) if len(valueStr) == 0: packed = chr(protocol.SCALEDTIMELEN1) + chr(0) + chr(0) else: packed = chr(protocol.SCALEDTIMELEN1 - 1 + len(valueStr)) + chr(scale) + valueStr self.__output += packed return self
def putString(self, value): """Appends a String to the message.""" length = len(value) if length < 40: packed = chr(protocol.UTF8LEN0 + length) + value else: lengthStr = toByteString(length) packed = chr(protocol.UTF8COUNT1 - 1 + len(lengthStr)) + lengthStr + value self.__output += packed return self
def putOpaque(self, value): """Appends an Opaque data value to the message.""" data = value.string length = len(data) if length < 40: packed = chr(protocol.OPAQUELEN0 + length) + data else: lengthStr = toByteString(length) packed = chr(protocol.OPAQUECOUNT1 - 1 + len(lengthStr)) + lengthStr + data self.__output += packed return self
def putInt(self, value, isMessageId = False): """Appends an Integer value to the message.""" if value < 32 and value > -11: packed = chr(protocol.INT0 + value) else: if isMessageId: valueStr = toByteString(value) else: valueStr = toSignedByteString(value) packed = chr(protocol.INTLEN1 - 1 + len(valueStr)) + valueStr self.__output += packed return self
def putString(self, value): """ Appends a String to the message. @type value str """ length = len(value) if length < 40: packed = chr(protocol.UTF8LEN0 + length) + value else: lengthStr = toByteString(length) packed = chr(protocol.UTF8COUNT1 - 1 + len(lengthStr)) + lengthStr + value self.__output += packed return self
def putInt(self, value, isMessageId=False): """ Appends an Integer value to the message. @type value int @type isMessageId bool """ if value < 32 and value > -11: packed = chr(protocol.INT0 + value) else: if isMessageId: valueStr = toByteString(value) else: valueStr = toSignedByteString(value) packed = chr(protocol.INTLEN1 - 1 + len(valueStr)) + valueStr self.__output += packed return self
def putMsSinceMidnight(self, value): """Appends the MsSinceMidnight value to the message.""" valueStr = toByteString(value) packed = chr(protocol.TIMELEN0 + len(valueStr)) + valueStr self.__output += packed return self