From c5f2eb7f3fcd6ff704aa041b8eb69700ab7cdb9f Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 20 Aug 2010 10:14:49 -0700 Subject: [PATCH] adding FOUND_ROWS to the client flags --- lib/active_record/connection_adapters/mysql2_adapter.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/active_record/connection_adapters/mysql2_adapter.rb b/lib/active_record/connection_adapters/mysql2_adapter.rb index b5ee9cd..e4ab71d 100644 --- a/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/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)