From 91671e0d9aa3eed0011c5597807169ce565c0a34 Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Mon, 16 Aug 2010 12:38:08 -0700 Subject: [PATCH] update files for 0.2.0 release --- CHANGELOG.md | 11 +++++++++++ README.rdoc | 24 +++++++++++++++++++++--- lib/mysql2.rb | 2 +- mysql2.gemspec | 15 +++++++++++---- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f90d6f1..0ee7689 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 0.2.0 (August 16th, 2010) +* switch back to letting libmysql manage all allocation/thread-state/freeing for the connection +* cache various numeric type conversions in hot-spots of the code for a little speed boost +* ActiveRecord adapter moved into Rails 3 core +** Don't worry 2.3.x users! We'll either release the adapter as a separate gem, or try to get it into 2.3.9 +* Fix for the "closed MySQL connection" error (GH #34) +* Fix for the "can't modify frozen object" error in 1.9.2 (GH #37) +* Introduce cascading query and result options (more info in README) +* Sequel adapter pulled into core (will be in the next release - 3.15.0 at the time of writing) +* add a safety check when attempting to send a query before a result has been fetched + ## 0.1.9 (July 17th, 2010) * Support async ActiveRecord access with fibers and EventMachine (mperham) * string encoding support for 1.9, respecting Encoding.default_internal diff --git a/README.rdoc b/README.rdoc index 990b5cd..ad7ef85 100644 --- a/README.rdoc +++ b/README.rdoc @@ -102,7 +102,22 @@ If you'd like to see either of these (or others), open an issue and start buggin == Timezones -You can set the :timezone option to :local or :utc to tell Mysql2 which timezone you'd like to have Time objects in +Mysql2 now supports two timezone options: + + :database_timezone - this is the timezone Mysql2 will assume fields are already stored as, and will use this when creating the initial Time objects in ruby + :application_timezone - this is the timezone Mysql2 will convert to before finally handing back to the caller + +In other words, if :database_timezone is set to :utc - Mysql2 will create the Time objects using Time.utc(...) from the raw value libmysql hands over initially. +Then, if :application_timezone is set to say - :local - Mysql2 will then convert the just-created UTC Time object to local time. + +Both options only allow two values - :local or :utc - with the exception that :application_timezone can be [and defaults to] nil + +== Casting "boolean" columns + +You can now tell Mysql2 to cast tinyint(1) fields to boolean values in Ruby with the :cast_booleans option. + + client = Mysql2::Client.new + result = client.query("SELECT * FROM table_with_boolean_field", :cast_booleans => true) == Async @@ -123,14 +138,17 @@ 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? :) +The ActiveRecord adapter has been removed from the mysql2 gem and is now part of Rails 3 core. We'll be releasing a separate gem or trying to get it into 2.3.9 for 2.3.x users. == Asynchronous ActiveRecord You can also use Mysql2 with asynchronous Rails (first introduced at http://www.mikeperham.com/2010/04/03/introducing-phat-an-asynchronous-rails-app/) by setting the adapter in your database.yml to "em_mysql2". You must be running Ruby 1.9, thin and the rack-fiber_pool middleware for it to work. +== Sequel + +The Sequel adapter was pulled out into Sequel core (will be part of the next release) and can be used by specifying the "mysql2://" prefix to your connection specification. + == EventMachine The mysql2 EventMachine deferrable api allows you to make async queries using EventMachine, diff --git a/lib/mysql2.rb b/lib/mysql2.rb index fb24cfc..8244d0c 100644 --- a/lib/mysql2.rb +++ b/lib/mysql2.rb @@ -11,5 +11,5 @@ require 'mysql2/result' # # A modern, simple and very fast Mysql library for Ruby - binding to libmysql module Mysql2 - VERSION = "0.1.9" + VERSION = "0.2.0" end diff --git a/mysql2.gemspec b/mysql2.gemspec index 4fac216..ae28cbb 100644 --- a/mysql2.gemspec +++ b/mysql2.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = %q{mysql2} - s.version = "0.1.9" + s.version = "0.2.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Brian Lopez"] - s.date = %q{2010-08-01} + s.date = %q{2010-08-16} s.email = %q{seniorlopez@gmail.com} s.extensions = ["ext/mysql2/extconf.rb"] s.extra_rdoc_files = [ @@ -23,12 +23,15 @@ Gem::Specification.new do |s| "Rakefile", "VERSION", "benchmark/active_record.rb", + "benchmark/allocations.rb", "benchmark/escape.rb", "benchmark/query_with_mysql_casting.rb", "benchmark/query_without_mysql_casting.rb", "benchmark/sequel.rb", "benchmark/setup_db.rb", + "benchmark/thread_alone.rb", "examples/eventmachine.rb", + "examples/threaded.rb", "ext/mysql2/client.c", "ext/mysql2/client.h", "ext/mysql2/extconf.rb", @@ -51,7 +54,10 @@ Gem::Specification.new do |s| "spec/mysql2/result_spec.rb", "spec/rcov.opts", "spec/spec.opts", - "spec/spec_helper.rb" + "spec/spec_helper.rb", + "tasks/benchmarks.rake", + "tasks/compile.rake", + "tasks/vendor_mysql.rake" ] s.homepage = %q{http://github.com/brianmario/mysql2} s.rdoc_options = ["--charset=UTF-8"] @@ -64,7 +70,8 @@ Gem::Specification.new do |s| "spec/mysql2/error_spec.rb", "spec/mysql2/result_spec.rb", "spec/spec_helper.rb", - "examples/eventmachine.rb" + "examples/eventmachine.rb", + "examples/threaded.rb" ] if s.respond_to? :specification_version then