diff --git a/spec/mysql2/statement_spec.rb b/spec/mysql2/statement_spec.rb index 6d617eab0..dbc185e6b 100644 --- a/spec/mysql2/statement_spec.rb +++ b/spec/mysql2/statement_spec.rb @@ -6,6 +6,10 @@ end def stmt_count + # Use the performance schema in MySQL 5.7 and above + @client.query("SELECT COUNT(1) AS count FROM performance_schema.prepared_statements_instances").first['count'].to_i + rescue Mysql2::Error + # Fall back to the global prepapred statement counter @client.query("SHOW STATUS LIKE 'Prepared_stmt_count'").first['Value'].to_i end