#332 - mysql2+jruby support, speedup

This commit is contained in:
Pavel Rosický 2015-01-21 01:26:35 +01:00
parent 5b15b4cd90
commit 42aa52309c

View file

@ -54,14 +54,14 @@ module DatabaseCleaner::ActiveRecord
def tables_with_new_rows(connection)
@db_name ||= connection.instance_variable_get('@config')[:database]
result = connection.execute("SELECT table_name FROM information_schema.tables WHERE table_schema = '#{@db_name}' AND table_rows > 0")
result.map{ |row| row[0] } - ['schema_migrations']
result = connection.select_all("SELECT table_name FROM information_schema.tables WHERE table_schema = '#{@db_name}' AND table_rows > 0")
result.map{ |row| row.values[0] } - ['schema_migrations']
end
def information_schema_exists? connection
@information_schema_exists ||=
begin
connection.execute("SELECT * FROM information_schema.tables")
connection.execute("SELECT 1 FROM information_schema.tables")
true
rescue
false