コード例 #1
0
ファイル: cqltypes.py プロジェクト: pgorla/cassandra-labs
 def serialize_safe(cls, items):
     subtype, = cls.subtypes
     buf = StringIO()
     buf.write(uint16_pack(len(items)))
     for item in items:
         itembytes = subtype.to_binary(item)
         buf.write(uint16_pack(len(itembytes)))
         buf.write(itembytes)
     return buf.getvalue()
コード例 #2
0
 def serialize_safe(cls, items):
     subtype, = cls.subtypes
     buf = StringIO()
     buf.write(uint16_pack(len(items)))
     for item in items:
         itembytes = subtype.to_binary(item)
         buf.write(uint16_pack(len(itembytes)))
         buf.write(itembytes)
     return buf.getvalue()
コード例 #3
0
ファイル: cqltypes.py プロジェクト: pgorla/cassandra-labs
 def serialize_safe(cls, themap):
     subkeytype, subvaltype = cls.subtypes
     buf = StringIO()
     buf.write(uint16_pack(len(themap)))
     for key, val in themap.iteritems():
         keybytes = subkeytype.to_binary(key)
         valbytes = subvaltype.to_binary(val)
         buf.write(uint16_pack(len(keybytes)))
         buf.write(keybytes)
         buf.write(uint16_pack(len(valbytes)))
         buf.write(valbytes)
     return buf.getvalue()
コード例 #4
0
 def serialize_safe(cls, themap):
     subkeytype, subvaltype = cls.subtypes
     buf = StringIO()
     buf.write(uint16_pack(len(themap)))
     for key, val in themap.iteritems():
         keybytes = subkeytype.to_binary(key)
         valbytes = subvaltype.to_binary(val)
         buf.write(uint16_pack(len(keybytes)))
         buf.write(keybytes)
         buf.write(uint16_pack(len(valbytes)))
         buf.write(valbytes)
     return buf.getvalue()
コード例 #5
0
ファイル: native.py プロジェクト: stanhu/cassandra-dbapi2
def write_short(f, s):
    f.write(uint16_pack(s))
コード例 #6
0
ファイル: native.py プロジェクト: murbans1/python-cql
def write_short(f, s):
    f.write(uint16_pack(s))