diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d676dfd4..8f9440ffd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.1.3 (April 15th, 2010) +* added an EventMachine Deferrable API +* added an ActiveRecord connection adapter +** should be compatible with 2.3.5 and 3.0 (including Arel) + ## 0.1.2 (April 9th, 2010) * fix a bug (copy/paste fail) around checking for empty TIME values and returning nil (thanks @marius) diff --git a/README.rdoc b/README.rdoc index 9e1a5ffbf..c67ee26a3 100644 --- a/README.rdoc +++ b/README.rdoc @@ -75,6 +75,32 @@ NOTE: Because of the way MySQL's query API works, this method will block until t So if you really need things to stay async, it's best to just monitor the socket with something like EventMachine. If you need multiple query concurrency take a look at using a connection pool. +== ActiveRecord + +To use the ActiveRecord driver, all you should need to do is have this gem installed and set the adapter in your database.yml to "mysql2". +That was easy right? :) + +== EventMachine + +The mysql2 EventMachine deferrable api allows you to make async queries using EventMachine, +while specifying callbacks for success for failure. Here's a simple example: + + require 'mysql2/em' + + EM.run do + client1 = Mysql2::EM::Client.new + defer1 = client1.query "SELECT sleep(3) as first_query" + defer1.callback do |result| + puts "Result: #{result.to_a.inspect}" + end + + client2 = Mysql2::EM::Client.new + defer2 = client2.query "SELECT sleep(1) second_query" + defer2.callback do |result| + puts "Result: #{result.to_a.inspect}" + end + end + == Compatibility The specs pass on my system (SL 10.6.3, x86_64) in these rubies: @@ -85,6 +111,8 @@ The specs pass on my system (SL 10.6.3, x86_64) in these rubies: * ruby-trunk * rbx-head +The ActiveRecord driver should work on 2.3.5 and 3.0 + == Yeah... but why? Someone: Dude, the Mysql gem works fiiiiiine. diff --git a/lib/mysql2.rb b/lib/mysql2.rb index e0b0cd17a..a5a9cee7d 100644 --- a/lib/mysql2.rb +++ b/lib/mysql2.rb @@ -5,5 +5,5 @@ # # A modern, simple and very fast Mysql library for Ruby - binding to libmysql module Mysql2 - VERSION = "0.1.2" + VERSION = "0.1.3" end \ No newline at end of file diff --git a/mysql2.gemspec b/mysql2.gemspec index b86896b7c..076eb4168 100644 --- a/mysql2.gemspec +++ b/mysql2.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = %q{mysql2} - s.version = "0.1.2" + s.version = "0.1.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Brian Lopez"] - s.date = %q{2010-04-09} + s.date = %q{2010-04-15} s.email = %q{seniorlopez@gmail.com} s.extensions = ["ext/extconf.rb"] s.extra_rdoc_files = [ @@ -22,14 +22,21 @@ Gem::Specification.new do |s| "README.rdoc", "Rakefile", "VERSION", + "benchmark/active_record.rb", "benchmark/escape.rb", "benchmark/query.rb", "benchmark/setup_db.rb", + "examples/eventmachine.rb", "ext/extconf.rb", "ext/mysql2_ext.c", "ext/mysql2_ext.h", + "lib/active_record/connection_adapters/mysql2_adapter.rb", + "lib/arel/engines/sql/compilers/mysql2_compiler.rb", "lib/mysql2.rb", + "lib/mysql2/em.rb", "mysql2.gemspec", + "spec/active_record/active_record_spec.rb", + "spec/em/em_spec.rb", "spec/mysql2/client_spec.rb", "spec/mysql2/result_spec.rb", "spec/rcov.opts", @@ -42,9 +49,12 @@ Gem::Specification.new do |s| s.rubygems_version = %q{1.3.6} s.summary = %q{A simple, fast Mysql library for Ruby, binding to libmysql} s.test_files = [ - "spec/mysql2/client_spec.rb", + "spec/active_record/active_record_spec.rb", + "spec/em/em_spec.rb", + "spec/mysql2/client_spec.rb", "spec/mysql2/result_spec.rb", - "spec/spec_helper.rb" + "spec/spec_helper.rb", + "examples/eventmachine.rb" ] if s.respond_to? :specification_version then