Class: Mysql::Protocol::FieldPacket

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

Overview

Field packet

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ FieldPacket

Returns a new instance of FieldPacket.



651
652
653
# File 'lib/mysql/protocol.rb', line 651

def initialize(*args)
  @db, @table, @org_table, @name, @org_name, @charsetnr, @length, @type, @flags, @decimals, @default = args
end

Instance Attribute Details

#charsetnrObject (readonly)

Returns the value of attribute charsetnr.



649
650
651
# File 'lib/mysql/protocol.rb', line 649

def charsetnr
  @charsetnr
end

#dbObject (readonly)

Returns the value of attribute db.



649
650
651
# File 'lib/mysql/protocol.rb', line 649

def db
  @db
end

#decimalsObject (readonly)

Returns the value of attribute decimals.



649
650
651
# File 'lib/mysql/protocol.rb', line 649

def decimals
  @decimals
end

#defaultObject (readonly)

Returns the value of attribute default.



649
650
651
# File 'lib/mysql/protocol.rb', line 649

def default
  @default
end

#flagsObject (readonly)

Returns the value of attribute flags.



649
650
651
# File 'lib/mysql/protocol.rb', line 649

def flags
  @flags
end

#lengthObject (readonly)

Returns the value of attribute length.



649
650
651
# File 'lib/mysql/protocol.rb', line 649

def length
  @length
end

#nameObject (readonly)

Returns the value of attribute name.



649
650
651
# File 'lib/mysql/protocol.rb', line 649

def name
  @name
end

#org_nameObject (readonly)

Returns the value of attribute org_name.



649
650
651
# File 'lib/mysql/protocol.rb', line 649

def org_name
  @org_name
end

#org_tableObject (readonly)

Returns the value of attribute org_table.



649
650
651
# File 'lib/mysql/protocol.rb', line 649

def org_table
  @org_table
end

#tableObject (readonly)

Returns the value of attribute table.



649
650
651
# File 'lib/mysql/protocol.rb', line 649

def table
  @table
end

#typeObject (readonly)

Returns the value of attribute type.



649
650
651
# File 'lib/mysql/protocol.rb', line 649

def type
  @type
end

Class Method Details

.parse(pkt) ⇒ Object

Raises:



629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
# File 'lib/mysql/protocol.rb', line 629

def self.parse(pkt)
  first = pkt.lcs
  db = pkt.lcs
  table = pkt.lcs
  org_table = pkt.lcs
  name = pkt.lcs
  org_name = pkt.lcs
  f0 = pkt.utiny
  charsetnr = pkt.ushort
  length = pkt.ulong
  type = pkt.utiny
  flags = pkt.ushort
  decimals = pkt.utiny
  f1 = pkt.ushort

  raise ProtocolError, "invalid packet: f1=#{f1}" unless f1 == 0
  default = pkt.lcs
  return self.new(db, table, org_table, name, org_name, charsetnr, length, type, flags, decimals, default)
end