Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 543 Bytes

README.textile

File metadata and controls

29 lines (22 loc) · 543 Bytes

EmMysql2ConnectionPool

Usage:

conf = {
    :host => "localhost",
    :database => 'my_db',
    :reconnect => true,
    :username => "root",
    # :password => ''
}

my_query = "SELECT * FROM track WHERE in_progress != 0 LIMIT 10"

Mysql2::Client.default_query_options.merge! :symbolize_keys => true, :cast_booleans => true

MySQL = EmMysql2ConnectionPool.new conf

EM.run do
  MySQL.query my_query do |results|
    results.each do |result|
      p result
    end
    EM.stop
  end
end

Go ahead, try the example.