Skip to content

Instantly share code, notes, and snippets.

diff --git a/ext/mysql2/client.c b/ext/mysql2/client.c
index 9573e8f..f7783cd 100644
--- a/ext/mysql2/client.c
+++ b/ext/mysql2/client.c
@@ -225,6 +225,9 @@ static VALUE rb_mysql_client_async_result(VALUE self) {
return Qnil;
}
+ // we have a result, mark this connection inactive
+ rb_iv_set(self, "@active", Qfalse);
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
index 78fffaf..b25e961 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
@@ -51,7 +51,31 @@ module ActiveRecord
def select_all(*args)
if @query_cache_enabled
- cache_sql(args.first) { super }
+ cache_sql("select_all:#{args.first}") { super }
#<Mysql2::Client:0x10254cb78>: active?
#<Mysql2::Client:0x10254cb78>: active? - true
Processing WelcomeController#index (for 127.0.0.1 at 2010-07-27 19:47:08) [GET]
SQL (12.0ms) SELECT * FROM mysql2_test LIMIT 100
SQL (10.9ms) SELECT * FROM mysql2_test LIMIT 100
SQL (11.5ms) SELECT * FROM mysql2_test LIMIT 100
SQL (10.9ms) SELECT * FROM mysql2_test LIMIT 100
SQL (10.9ms) SELECT * FROM mysql2_test LIMIT 100
= yajl_common
yajl_malloc_func
yajl_realloc_func
= yajl_gen
yajl_print_t
yajl_gen_number
yajl_gen_string
yajl_gen_get_buf
diff --git a/lib/active_record/connection_adapters/em_mysql2_adapter.rb b/lib/active_record/connection_adapters/em_mysql2_adapter.rb
index 0077e13..e26c9df 100644
--- a/lib/active_record/connection_adapters/em_mysql2_adapter.rb
+++ b/lib/active_record/connection_adapters/em_mysql2_adapter.rb
@@ -42,17 +42,21 @@ module Mysql2
end
def query(sql, opts={})
- super(sql, opts.merge(:async => true))
- deferable = ::EM::DefaultDeferrable.new
diff --git a/ext/yajl_parser.c b/ext/yajl_parser.c
index 3098a92..60ee521 100644
--- a/ext/yajl_parser.c
+++ b/ext/yajl_parser.c
@@ -294,8 +294,15 @@ yajl_do_parse(yajl_handle hand, const unsigned char * jsonText,
}
/* intentional fall-through */
}
+ case yajl_tok_comma: {
+ yajl_state s = yajl_bs_current(hand->stateStack);

String encoding support details in Mysql2

Client

  • The connection encoding defaults to ‘utf8’.
  • A Mysql2::Error exception will be raised if you pass an invalid encoding to Client#new
  • There are two lookup-tables for matching compatible MySQL<>Ruby encodings:
    • Mysql2::Client::CHARSET_MAP – used for looking up valid Ruby encodings by valid MySQL encoding name
    • Mysql2::Client::MYSQL_CHARSET_MAP – used for looking up a valid MySQL encoding name and collation based on it’s encoding ID returned by libmysql
0x7fff5fbfab30: #<Object:0x102486da0>.__script__ in /Users/brianmario/.rvm/gems/rbx-head/gems/gemcutter-0.5.0/lib/rubygems_plugin.rb:1 (+0)
0x7fff5fbfafb0: <included module>#load in kernel/common/kernel.rb:642 (+52)
0x7fff5fbfb3b0: __block__ in lib/rubygems.rb:1117 (+49)
0x7fff5fbfb730: Array#each in kernel/bootstrap/array.rb:158 (+33)
0x7fff5fbfba00: #<Object:0x102486da0>.__script__ in lib/rubygems.rb:1109 (+369)
0x7fff5fbfbed0: Rubinius::CodeLoader.require in kernel/common/codeloader.rb:139 (+60)
0x7fff5fbfc2c0: <included module>#require in kernel/common/kernel.rb:689 (+10)
0x7fff5fbfc690: #<Object:0x102486da0>.__script__ in lib/bin/gem.rb:8 (+8)
0x7fff5fbfcb60: <included module>#load in kernel/common/kernel.rb:642 (+52)
0x7fff5fbfcf60: Rubinius::Loader#script in kernel/loader.rb:444 (+180)
#0 rubinius::TypeError::raise (type=rubinius::ModuleType, obj=0x7fff5fbfaf10, reason=0x0) at vm/exception.cpp:25
#1 0x000000010005864e in rubinius::VMMethod::interpreter (state=0x101004b20, vmm=0x1031bbf90, call_frame=0x7fff5fbfab30) at object_utils.hpp:94
#2 0x00000001001186ca in rubinius::VMMethod::execute_specialized<rubinius::NoArguments> (state=0x101004b20, previous=0x7fff5fbfafb0, msg=@0x7fff5fbfacc0, args=@0x7fff5fbfaf10) at vm/vmmethod.cpp:587
#3 0x000000010013ada1 in rubinius::Object::send_prim (this=0x102486da0, state=0x101004b20, exec=<value temporarily unavailable, due to optimizations>, call_frame=0x7fff5fbfafb0, msg=<value temporarily unavailable, due to optimizations>, args=@0x7fff5fbfaf10) at vm/builtin/object.cpp:502
#4 0x00000001000ad4a8 in rubinius::Primitives::object_send (state=0x101004b20, call_frame=0x7fff5fbfafb0, msg=@0x102a92968, args=@0x7fff5fbfaf10) at primitives_glue.gen.cpp:22337
#5 0x0000000100058a99 in rubinius::VMMethod::interpreter (state=0x101004b20, vmm=0x102a92300, c
#0 rubinius::Exception::make_type_error (state=0x101004b20, type=<value temporarily unavailable, due to optimizations>, object=0x7fff5fbfaf10, reason=<value temporarily unavailable, due to optimizations>) at vm/builtin/exception.cpp:124
#1 0x000000010005c092 in rubinius::VMMethod::interpreter (state=0x101004b20, vmm=0x102f5f350, call_frame=0x7fff5fbfab30) at vm/instructions.cpp:146
#2 0x00000001001186ca in rubinius::VMMethod::execute_specialized<rubinius::NoArguments> (state=0x101004b20, previous=0x7fff5fbfafb0, msg=@0x7fff5fbfacc0, args=@0x7fff5fbfaf10) at vm/vmmethod.cpp:587
#3 0x000000010013ada1 in rubinius::Object::send_prim (this=0x102486da0, state=0x101004b20, exec=<value temporarily unavailable, due to optimizations>, call_frame=0x7fff5fbfafb0, msg=<value temporarily unavailable, due to optimizations>, args=@0x7fff5fbfaf10) at vm/builtin/object.cpp:502
#4 0x00000001000ad4a8 in rubinius::Primitives::object_send (state=0x101004b20, call_frame=0x7fff5fbfafb0, msg=@0x102a92968, args=@0x7fff5fbfaf10) a