Class: Mysql::Protocol::FieldPacket

Inherits:
RxPacket
  • 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.

[View source]

445
446
447
# File 'lib/mysql/protocol.rb', line 445

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

Instance Attribute Details

#charsetnrObject

Returns the value of attribute charsetnr.


443
444
445
# File 'lib/mysql/protocol.rb', line 443

def charsetnr
  @charsetnr
end

#dbObject

Returns the value of attribute db.


443
444
445
# File 'lib/mysql/protocol.rb', line 443

def db
  @db
end

#decimalsObject

Returns the value of attribute decimals.


443
444
445
# File 'lib/mysql/protocol.rb', line 443

def decimals
  @decimals
end

#defaultObject

Returns the value of attribute default.


443
444
445
# File 'lib/mysql/protocol.rb', line 443

def default
  @default
end

#flagsObject

Returns the value of attribute flags.


443
444
445
# File 'lib/mysql/protocol.rb', line 443

def flags
  @flags
end

#lengthObject

Returns the value of attribute length.


443
444
445
# File 'lib/mysql/protocol.rb', line 443

def length
  @length
end

#nameObject

Returns the value of attribute name.


443
444
445
# File 'lib/mysql/protocol.rb', line 443

def name
  @name
end

#org_nameObject

Returns the value of attribute org_name.


443
444
445
# File 'lib/mysql/protocol.rb', line 443

def org_name
  @org_name
end

#org_tableObject

Returns the value of attribute org_table.


443
444
445
# File 'lib/mysql/protocol.rb', line 443

def org_table
  @org_table
end

#tableObject

Returns the value of attribute table.


443
444
445
# File 'lib/mysql/protocol.rb', line 443

def table
  @table
end

#typeObject

Returns the value of attribute type.


443
444
445
# File 'lib/mysql/protocol.rb', line 443

def type
  @type
end

Class Method Details

.parse(data) ⇒ Object

Raises:

[View source]

430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/mysql/protocol.rb', line 430

def self.parse(data)
  first = Protocol.lcs2str! data
  db = Protocol.lcs2str! data
  table = Protocol.lcs2str! data
  org_table = Protocol.lcs2str! data
  name = Protocol.lcs2str! data
  org_name = Protocol.lcs2str! data
  f0, charsetnr, length, type, flags, decimals, f1, data = data.unpack("CvVCvCva*")
  raise ProtocolError, "invalid packet: f1=#{f1}" unless f1 == 0
  default = Protocol.lcs2str! data
  return self.new(db, table, org_table, name, org_name, charsetnr, length, type, flags, decimals, default)
end