From 42aa52309c1c67cba04bec0615b3e5f4115a63ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Rosick=C3=BD?= Date: Wed, 21 Jan 2015 01:26:35 +0100 Subject: [PATCH] #332 - mysql2+jruby support, speedup --- lib/database_cleaner/active_record/deletion.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/database_cleaner/active_record/deletion.rb b/lib/database_cleaner/active_record/deletion.rb index 4414e2d..4ea3a41 100644 --- a/lib/database_cleaner/active_record/deletion.rb +++ b/lib/database_cleaner/active_record/deletion.rb @@ -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