diff --git a/src/cassandra.lua b/src/cassandra.lua index 6a0761a..0db694e 100644 --- a/src/cassandra.lua +++ b/src/cassandra.lua @@ -63,7 +63,7 @@ local function shuffle(t) end local function startup(self) - local body = encoding.string_map_representation({["CQL_VERSION"]=CQL_VERSION}) + local body = encoding.map_representation({["CQL_VERSION"]=CQL_VERSION}) local response, err = protocol.send_frame_and_get_response(self, constants.op_codes.STARTUP, body) if not response then diff --git a/src/cassandra/encoding.lua b/src/cassandra/encoding.lua index de120be..132c608 100644 --- a/src/cassandra/encoding.lua +++ b/src/cassandra/encoding.lua @@ -68,17 +68,6 @@ local function short_bytes_representation(bytes) return short_representation(#bytes) .. bytes end -local function string_map_representation(map) - local buffer = {} - local n = 0 - for k, v in pairs(map) do - buffer[#buffer + 1] = string_representation(k) - buffer[#buffer + 1] = string_representation(v) - n = n + 1 - end - return short_representation(n) .. table.concat(buffer) -end - local function boolean_representation(value) if value then return "\001" else return "\000" end end @@ -240,11 +229,11 @@ end -- Public interface -- +_M.map_representation = map_representation _M.int_representation = int_representation _M.short_representation = short_representation _M.bytes_representation = bytes_representation _M.boolean_representation = boolean_representation -_M.string_map_representation = string_map_representation _M.short_bytes_representation = short_bytes_representation _M.long_string_representation = long_string_representation