This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
commit cdd1648a785c717bf2c4a1580e59a7da3cc48eb9
tree 5b614432f9f957726bc66bdf11d51405ddd3a08b
parent 43a4e24ed3687fa50a7f95474063350d477f75b9
tree 5b614432f9f957726bc66bdf11d51405ddd3a08b
parent 43a4e24ed3687fa50a7f95474063350d477f75b9
em-mysql /
| name | age | message | |
|---|---|---|---|
| |
README | Mon Jun 29 16:58:15 -0700 2009 | |
| |
em-mysql.gemspec | ||
| |
lib/ | ||
| |
test.rb | Sat Sep 13 02:51:58 -0700 2008 |
README
Async MySQL driver for Ruby/EventMachine
(c) 2008 Aman Gupta (tmm1)
Requires mysqlplus.
require 'em/mysql'
# alias SQL for simpler syntax
SQL = EventedMysql
def SQL(query, &blk) SQL.select(query, &blk) end
# setup connection details and allow 4 connections to the server
SQL.settings.update :host => 'localhost',
:port => 3306,
:database => 'test',
:connections => 4
# use 4 connections to execute queries in parallel
SQL('select sleep(0.25)'){ p 'done' }
SQL('select sleep(0.25)'){ p 'done' }
SQL('select sleep(0.25)'){ p 'done' }
SQL('select sleep(0.25)'){ p 'done' }
Also includes a sequel async wrapper
require 'sequel'
require 'sequel/async'
DB = Sequel.connect(:adapter => 'mysql', :user => 'root', :database => 'test', ...)
EventedMysql.settings.update(..., :on_error => proc{|e| log 'error', e })
DB[:table].where(:field => 'value').async_update(:field => 'new value')
For more info, see the comments in lib/sequel/async.rb







