github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

tmm1 / em-mysql

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 58
    • 7
  • Source
  • Commits
  • Network (7)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • em_watch
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Async MySQL driver for Ruby/Eventmachine — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

version bump 
tmm1 (author)
Mon Feb 08 17:30:45 -0800 2010
commit  603e64d3ddb74199213e8a55aadc0d27f3653569
tree    a451b45f38611ded7f847870504c012008a9c582
parent  94382d80036ab14762c790bf254f94ca5d415318
em-mysql /
name age
history
message
file README Mon Jun 29 16:58:15 -0700 2009 EM.attach is bundled with >= 0.12.2; Blurb abou... [tmm1]
file em-mysql.gemspec Mon Feb 08 17:30:45 -0800 2010 version bump [tmm1]
directory lib/ Mon Feb 08 17:30:22 -0800 2010 Remove call to old method [tmm1]
file test.rb Sat Sep 13 02:51:58 -0700 2008 add more tests [tmm1]
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
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server