Handle v3 schema change messages

This commit is contained in:
Tyler Hobbs
2014-05-28 18:53:45 -05:00
parent a90996759c
commit 47e79ac668

View File

@@ -608,11 +608,21 @@ class ResultMessage(_MessageType):
return paging_state, column_metadata
@classmethod
def recv_results_schema_change(cls, f):
def recv_results_schema_change(cls, f, protocol_version):
change_type = read_string(f)
keyspace = read_string(f)
table = read_string(f)
return dict(change_type=change_type, keyspace=keyspace, table=table)
if protocol_version >= 3:
target = read_string(f)
keyspace = read_string(f)
if target != "KEYSPACE":
table_or_type = read_string(f)
return {'change_type': change_type, 'keyspace': keyspace, target.lower(): table_or_type}
else:
return {'change_type': change_type, 'keyspace': keyspace}
else:
keyspace = read_string(f)
table = read_string(f)
return {'change_type': change_type, 'keyspace': keyspace, 'table': table}
@classmethod
def read_type(cls, f):