Merge pull request #28938 from kamipo/deprecate_supports_statement_cache

Deprecate `supports_statement_cache?`
This commit is contained in:
Rafael França 2017-05-01 17:24:45 -07:00 committed by GitHub
commit 00f1f95569
6 changed files with 12 additions and 22 deletions

@ -1,3 +1,7 @@
* Deprecate `supports_statement_cache?`.
*Ryuta Kamizono*
* Quote database name in `db:create` grant statement (when database user does not have access to create the database). * Quote database name in `db:create` grant statement (when database user does not have access to create the database).
*Rune Philosof* *Rune Philosof*

@ -137,9 +137,10 @@ def delete(arel, name = nil, binds = [])
# Returns +true+ when the connection adapter supports prepared statement # Returns +true+ when the connection adapter supports prepared statement
# caching, otherwise returns +false+ # caching, otherwise returns +false+
def supports_statement_cache? def supports_statement_cache? # :nodoc:
false true
end end
deprecate :supports_statement_cache?
# Runs the given block in a database transaction, and returns the result # Runs the given block in a database transaction, and returns the result
# of the block. # of the block.

@ -76,12 +76,6 @@ def supports_bulk_alter? #:nodoc:
true true
end end
# Returns true, since this connection adapter supports prepared statement
# caching.
def supports_statement_cache?
true
end
def supports_index_sort_order? def supports_index_sort_order?
!mariadb? && version >= "8.0.1" !mariadb? && version >= "8.0.1"
end end

@ -121,12 +121,6 @@ class PostgreSQLAdapter < AbstractAdapter
include PostgreSQL::DatabaseStatements include PostgreSQL::DatabaseStatements
include PostgreSQL::ColumnDumper include PostgreSQL::ColumnDumper
# Returns true, since this connection adapter supports prepared statement
# caching.
def supports_statement_cache?
true
end
def supports_index_sort_order? def supports_index_sort_order?
true true
end end

@ -105,12 +105,6 @@ def supports_partial_index?
sqlite_version >= "3.8.0" sqlite_version >= "3.8.0"
end end
# Returns true, since this connection adapter supports prepared statement
# caching.
def supports_statement_cache?
true
end
def requires_reloading? def requires_reloading?
true true
end end

@ -3,8 +3,7 @@
require "models/author" require "models/author"
require "models/post" require "models/post"
if ActiveRecord::Base.connection.supports_statement_cache? && if ActiveRecord::Base.connection.prepared_statements
ActiveRecord::Base.connection.prepared_statements
module ActiveRecord module ActiveRecord
class BindParameterTest < ActiveRecord::TestCase class BindParameterTest < ActiveRecord::TestCase
fixtures :topics, :authors, :author_addresses, :posts fixtures :topics, :authors, :author_addresses, :posts
@ -66,6 +65,10 @@ def test_logs_legacy_binds_after_type_cast
assert_logs_binds(binds) assert_logs_binds(binds)
end end
def test_deprecate_supports_statement_cache
assert_deprecated { ActiveRecord::Base.connection.supports_statement_cache? }
end
private private
def assert_logs_binds(binds) def assert_logs_binds(binds)
payload = { payload = {