diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-20 10:15:52 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-20 10:16:22 -0700 |
commit | 0420fb56475409c209193fbd45f9afffe8cd35eb (patch) | |
tree | 8db597e2dec8e7237a6630b88576fa4916286356 | |
parent | 0c75ec51a9b60252125534b8f9a3f6406713a957 (diff) | |
download | rails-0420fb56475409c209193fbd45f9afffe8cd35eb.tar.gz rails-0420fb56475409c209193fbd45f9afffe8cd35eb.tar.bz2 rails-0420fb56475409c209193fbd45f9afffe8cd35eb.zip |
adding FOUND_ROWS to the connect flags for mysql2
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb index 96cf2d09db..b5bf7f46ef 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -6,6 +6,11 @@ module ActiveRecord class Base def self.mysql2_connection(config) config[:username] = 'root' if config[:username].nil? + + if Mysql2::Client.const_defined? :FOUND_ROWS + config[:flags] = Mysql2::Client::FOUND_ROWS + end + client = Mysql2::Client.new(config.symbolize_keys) options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0] ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config) |