Skip to content

Commit

Permalink
Use the prepared statement performance schema if available
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Apr 11, 2018
1 parent 0496233 commit 450d05a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec/mysql2/statement_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
end

def stmt_count
@client.query("SHOW STATUS LIKE 'Prepared_stmt_count'").first['Value'].to_i
# Use the performance schema in MySQL 5.7 and above
count = @client.query("SELECT COUNT(1) AS count FROM performance_schema.prepared_statements_instances").first['count'].to_i
rescue
# Fall back to the global prepapred statement counter
count = @client.query("SHOW STATUS LIKE 'Prepared_stmt_count'").first['Value'].to_i
end

it "should create a statement" do
Expand Down

0 comments on commit 450d05a

Please sign in to comment.