adding FOUND_ROWS to the client flags

This commit is contained in:
Aaron Patterson 2010-08-20 10:14:49 -07:00
parent ce77899848
commit c5f2eb7f3f

View File

@ -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)