Closed josePhoenix closed 7 years ago
This might need some more methods to enable round-trip of the binary blobs... perhaps inspired by VarBinarySerializerMax
's write*
methods?
class VarBinarySerializerMax(VarBinarySerializer):
# [ ... ]
def write_info(self, w):
w.put_usmallint(tds_base.PLP_MARKER)
def write(self, w, val):
if val is None:
w.put_uint8(tds_base.PLP_NULL)
else:
w.put_uint8(len(val))
if val:
w.put_uint(len(val))
w.write(val)
w.put_uint(0)
# [ ... ]
Looks good to me, merging. Maybe you can add some tests for it?
I'll have a look at the existing tests, but I'm not sure if I'll be able to craft a good test case. I have read-only access to this database I'm using, which is bad for experimenting
Actually, if you could give me some pointers as to where in the test code I should look and what I should attempt to test, that would help. I see some tests with byte strings and fake sockets, which I could try to replicate with my wireshark capture of the UDT info.
The type ID 240 is reserved for CLR types. (
UDTTYPE = SYBMSUDT = 240
) TheUDT_INFO_IN_COLMETADATA
layout is described in [MS-TDS] Section 2.2.5.5.2: "Common Language Runtime (CLR) Instances". The contents of the column are specified in [MS-SSCLRT].This PR makes no attempt to parse the bytes within the column, beyond interpreting them as partially-length-prefixed with the existing PlpReader class.