Class: Mysql::Protocol::ExecutePacket

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

Overview

Execute packet

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ExecutePacket

Returns a new instance of ExecutePacket.



483
484
485
# File 'lib/mysql/protocol.rb', line 483

def initialize(*args)
  @statement_id, @cursor_type, @values = args
end

Instance Attribute Details

#cursor_typeObject

Returns the value of attribute cursor_type.



481
482
483
# File 'lib/mysql/protocol.rb', line 481

def cursor_type
  @cursor_type
end

#statement_idObject

Returns the value of attribute statement_id.



481
482
483
# File 'lib/mysql/protocol.rb', line 481

def statement_id
  @statement_id
end

#valuesObject

Returns the value of attribute values.



481
482
483
# File 'lib/mysql/protocol.rb', line 481

def values
  @values
end

Instance Method Details

#serializeObject



487
488
489
490
491
492
493
494
495
496
# File 'lib/mysql/protocol.rb', line 487

def serialize
  nbm = null_bitmap values
  netvalues = ""
  types = values.map do |v|
    t, n = Protocol.value2net v
    netvalues.concat n if v
    t
  end
  [Mysql::COM_STMT_EXECUTE, statement_id, cursor_type, 1, nbm, 1, types.pack("v*"), netvalues].pack("CVCVa*Ca*a*")
end