Class: Mysql::Protocol::InitialPacket
- Inherits:
-
Object
- Object
- Mysql::Protocol::InitialPacket
- Defined in:
- lib/mysql/protocol.rb
Overview
Initial packet
Instance Attribute Summary collapse
-
#protocol_version ⇒ Object
readonly
Returns the value of attribute protocol_version.
-
#scramble_buff ⇒ Object
readonly
Returns the value of attribute scramble_buff.
-
#server_capabilities ⇒ Object
readonly
Returns the value of attribute server_capabilities.
-
#server_charset ⇒ Object
readonly
Returns the value of attribute server_charset.
-
#server_status ⇒ Object
readonly
Returns the value of attribute server_status.
-
#server_version ⇒ Object
readonly
Returns the value of attribute server_version.
-
#thread_id ⇒ Object
readonly
Returns the value of attribute thread_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ InitialPacket
constructor
A new instance of InitialPacket.
Constructor Details
#initialize(*args) ⇒ InitialPacket
Returns a new instance of InitialPacket.
597 598 599 |
# File 'lib/mysql/protocol.rb', line 597 def initialize(*args) @protocol_version, @server_version, @thread_id, @server_capabilities, @server_charset, @server_status, @scramble_buff = args end |
Instance Attribute Details
#protocol_version ⇒ Object (readonly)
Returns the value of attribute protocol_version.
595 596 597 |
# File 'lib/mysql/protocol.rb', line 595 def protocol_version @protocol_version end |
#scramble_buff ⇒ Object (readonly)
Returns the value of attribute scramble_buff.
595 596 597 |
# File 'lib/mysql/protocol.rb', line 595 def scramble_buff @scramble_buff end |
#server_capabilities ⇒ Object (readonly)
Returns the value of attribute server_capabilities.
595 596 597 |
# File 'lib/mysql/protocol.rb', line 595 def server_capabilities @server_capabilities end |
#server_charset ⇒ Object (readonly)
Returns the value of attribute server_charset.
595 596 597 |
# File 'lib/mysql/protocol.rb', line 595 def server_charset @server_charset end |
#server_status ⇒ Object (readonly)
Returns the value of attribute server_status.
595 596 597 |
# File 'lib/mysql/protocol.rb', line 595 def server_status @server_status end |
#server_version ⇒ Object (readonly)
Returns the value of attribute server_version.
595 596 597 |
# File 'lib/mysql/protocol.rb', line 595 def server_version @server_version end |
#thread_id ⇒ Object (readonly)
Returns the value of attribute thread_id.
595 596 597 |
# File 'lib/mysql/protocol.rb', line 595 def thread_id @thread_id end |
Class Method Details
.parse(pkt) ⇒ Object
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
# File 'lib/mysql/protocol.rb', line 578 def self.parse(pkt) protocol_version = pkt.utiny server_version = pkt.string thread_id = pkt.ulong scramble_buff = pkt.read(8) f0 = pkt.utiny server_capabilities = pkt.ushort server_charset = pkt.utiny server_status = pkt.ushort _f1 = pkt.read(13) rest_scramble_buff = pkt.string raise ProtocolError, "unsupported version: #{protocol_version}" unless protocol_version == VERSION raise ProtocolError, "invalid packet: f0=#{f0}" unless f0 == 0 scramble_buff.concat rest_scramble_buff self.new protocol_version, server_version, thread_id, server_capabilities, server_charset, server_status, scramble_buff end |