Class: Mysql::Protocol::PrepareResultPacket

Inherits:
Object
  • Object
show all
Defined in:
lib/mysql/protocol.rb

Overview

Prepare result packet

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ PrepareResultPacket

Returns a new instance of PrepareResultPacket.



776
777
778
# File 'lib/mysql/protocol.rb', line 776

def initialize(*args)
  @statement_id, @field_count, @param_count, @warning_count = args
end

Instance Attribute Details

#field_countObject (readonly)

Returns the value of attribute field_count.



774
775
776
# File 'lib/mysql/protocol.rb', line 774

def field_count
  @field_count
end

#param_countObject (readonly)

Returns the value of attribute param_count.



774
775
776
# File 'lib/mysql/protocol.rb', line 774

def param_count
  @param_count
end

#statement_idObject (readonly)

Returns the value of attribute statement_id.



774
775
776
# File 'lib/mysql/protocol.rb', line 774

def statement_id
  @statement_id
end

#warning_countObject (readonly)

Returns the value of attribute warning_count.



774
775
776
# File 'lib/mysql/protocol.rb', line 774

def warning_count
  @warning_count
end

Class Method Details

.parse(pkt) ⇒ Object

Raises:



763
764
765
766
767
768
769
770
771
772
# File 'lib/mysql/protocol.rb', line 763

def self.parse(pkt)
  raise ProtocolError, "invalid packet" unless pkt.utiny == 0
  statement_id = pkt.ulong
  field_count = pkt.ushort
  param_count = pkt.ushort
  f = pkt.utiny
  warning_count = pkt.ushort
  raise ProtocolError, "invalid packet" unless f == 0x00
  self.new statement_id, field_count, param_count, warning_count
end