Skip to content

Commit

Permalink
RUBY-293: Support query flags as an int for v5 connections (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
absurdfarce authored Oct 19, 2020
1 parent ef10e07 commit 2c984c4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/cassandra/protocol/requests/query_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ def payload?
!!@payload
end

def append_flags(buffer,flags,protocol_version)
if protocol_version < 5
buffer.append(flags.chr)
else
buffer.append_int(flags)
end
end

def write(buffer, protocol_version, encoder)
buffer.append_long_string(@cql)
buffer.append_consistency(@consistency)
Expand All @@ -63,10 +71,10 @@ def write(buffer, protocol_version, encoder)
if @values && !@values.empty?
flags |= 0x01
flags |= 0x40 if protocol_version > 2 && !@names.empty?
buffer.append(flags.chr)
append_flags(buffer, flags, protocol_version)
encoder.write_parameters(buffer, @values, @type_hints, @names)
else
buffer.append(flags.chr)
append_flags(buffer, flags, protocol_version)
end
buffer.append_int(@page_size) if @page_size
buffer.append_bytes(@paging_state) if @paging_state
Expand Down

0 comments on commit 2c984c4

Please sign in to comment.