method
configure_connection
v8.0.0 -
Show latest stable
- Class:
ActiveRecord::ConnectionAdapters::SQLite3Adapter
configure_connection()private
No documentation available.
# File activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb, line 815
def configure_connection
if @config[:timeout] && @config[:retries]
raise ArgumentError, "Cannot specify both timeout and retries arguments"
elsif @config[:timeout]
timeout = self.class.type_cast_config_to_integer(@config[:timeout])
raise TypeError, "timeout must be integer, not #{timeout}" unless timeout.is_a?(Integer)
@raw_connection.busy_handler_timeout = timeout
elsif @config[:retries]
ActiveRecord.deprecator.warn(<<~MSG)
The retries option is deprecated and will be removed in Rails 8.1. Use timeout instead.
MSG
retries = self.class.type_cast_config_to_integer(@config[:retries])
raw_connection.busy_handler { |count| count <= retries }
end
super
pragmas = @config.fetch(:pragmas, {}).stringify_keys
DEFAULT_PRAGMAS.merge(pragmas).each do |pragma, value|
if ::SQLite3::Pragmas.method_defined?("#{pragma}=")
@raw_connection.public_send("#{pragma}=", value)
else
warn "Unknown SQLite pragma: #{pragma}"
end
end
end