Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
aovertus committed Oct 10, 2023
1 parent d1a3b1d commit f8322c7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

require "active_record/connection_adapters/abstract_adapter"

module ActiveRecord
module ConnectionAdapters
module SQLServer
module CoreExt
module AbstractAdapter
def sqlserver?
false
end
end
end
end
end
end

ActiveSupport.on_load(:active_record) do
mod = ActiveRecord::ConnectionAdapters::SQLServer::CoreExt::AbstractAdapter
ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(mod)
end
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ module ConnectionAdapters
module SQLServerTransaction
private

def sqlserver?
connection.respond_to?(:sqlserver?) && connection.sqlserver?
end

def current_isolation_level
return unless sqlserver?

Expand Down
3 changes: 2 additions & 1 deletion lib/active_record/connection_adapters/sqlserver_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
require "active_record/connection_adapters/sqlserver/core_ext/attribute_methods"
require "active_record/connection_adapters/sqlserver/core_ext/finder_methods"
require "active_record/connection_adapters/sqlserver/core_ext/preloader"
require "active_record/connection_adapters/sqlserver/core_ext/abstract_adapter"
require "active_record/connection_adapters/sqlserver/version"
require "active_record/connection_adapters/sqlserver/type"
require "active_record/connection_adapters/sqlserver/database_limits"
Expand Down Expand Up @@ -100,7 +101,7 @@ def initialize(...)
super

@config[:tds_version] = "7.3" unless @config[:tds_version]
@config[:appname] = rails_application_name unless @config[:appname]
@config[:appname] = self.class.rails_application_name unless @config[:appname]
@config[:login_timeout] = @config[:login_timeout].present? ? @config[:login_timeout].to_i : nil
@config[:timeout] = @config[:timeout].present? ? @config[:timeout].to_i / 1000 : nil
@config[:encoding] = @config[:encoding].present? ? @config[:encoding] : nil
Expand Down

0 comments on commit f8322c7

Please sign in to comment.