Class: Mysql::FieldPacket

Inherits:
Object show all
Defined in:
lib/nose/proxy/mysql.rb

Overview

Add serialization of field packets

Class Method Summary collapse

Class Method Details

.serialize(db, table, org_table, name, org_name, length, type, flags, decimals, default) ⇒ String

Serialize all the data for a field rubocop:disable Metrics/ParameterLists

Returns:

  • (String)


215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/nose/proxy/mysql.rb', line 215

def self.serialize(db, table, org_table, name, org_name, length, type,
                   flags, decimals, default)
  Packet.lcs('def') + # catalog
    Packet.lcs(db) +
    Packet.lcs(table) +
    Packet.lcs(org_table) +
    Packet.lcs(name) +
    Packet.lcs(org_name) +
    [
      0x0c,
      33, # utf8_general_ci
      length,
      type,
      flags,
      decimals,
      0
    ].pack('CvVCvCv') + Packet.lcs(default)
end