Class: Mysql::RawRecord

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

Overview

raw record

Instance Method Summary collapse

Constructor Details

#initialize(packet, fields, encoding) ⇒ RawRecord

Returns a new instance of RawRecord.



859
860
861
# File 'lib/mysql/protocol.rb', line 859

def initialize(packet, fields, encoding)
  @packet, @fields, @encoding = packet, fields, encoding
end

Instance Method Details

#to_aObject



863
864
865
866
867
868
869
870
871
872
873
874
# File 'lib/mysql/protocol.rb', line 863

def to_a
  @fields.map do |f|
    s = @packet.lcs
    if s.nil?
      nil
    elsif f.type == Field::TYPE_BIT or f.charsetnr == Charset::BINARY_CHARSET_NUMBER
      s.b
    else
      Charset.convert_encoding(s, @encoding)
    end
  end
end