Method: Mysql::ServerProtocol#process_command

Defined in:
lib/nose/proxy/mysql.rb

#process_command(&block) ⇒ Object

Process a single incoming command



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/nose/proxy/mysql.rb', line 112

def process_command(&block)
  reset
  pkt = read
  command = pkt.utiny

  case command
  when COM_QUIT
    # Stop processing because the client left
    return
  when COM_QUERY
    process_query pkt.to_s, &block
  when COM_PING
    write ResultPacket.serialize 0
  else
    # Return error for invalid commands
    protocol.error ::Mysql::ServerError::ER_NOT_SUPPORTED_YET,
                   'Command not supported'
  end
end