match-adapters-v2.diff

Go MAEDA, 2018-06-04 04:53

Download (1.97 KB)

View differences:

lib/redmine/database.rb (working copy)
21 21
    class << self
22 22
      # Returns true if the database is PostgreSQL
23 23
      def postgresql?
24
        (ActiveRecord::Base.connection.adapter_name =~ /postgresql/i).present?
24
        /postgresql/i.match?(ActiveRecord::Base.connection.adapter_name)
25 25
      end
26 26

  
27 27
      # Returns the PostgreSQL version or nil if another DBMS is used
......
46 46

  
47 47
      # Returns true if the database is MySQL
48 48
      def mysql?
49
        (ActiveRecord::Base.connection.adapter_name =~ /mysql/i).present?
49
        /mysql/i.match?(ActiveRecord::Base.connection.adapter_name)
50 50
      end
51 51

  
52 52
      # Returns a SQL statement for case/accent (if possible) insensitive match
lib/redmine/nested_set/issue_nested_set.rb (working copy)
149 149
      end
150 150

  
151 151
      def lock_nested_set
152
        if self.class.connection.adapter_name =~ /sqlserver/i
152
        if /sqlserver/i.match?(self.class.connection.adapter_name)
153 153
          lock = "WITH (ROWLOCK HOLDLOCK UPDLOCK)"
154 154
          # Custom lock for SQLServer
155 155
          # This can be problematic if root_id or parent root_id changes
lib/redmine/nested_set/project_nested_set.rb (working copy)
119 119

  
120 120
      def lock_nested_set
121 121
        lock = true
122
        if self.class.connection.adapter_name =~ /sqlserver/i
122
        if /sqlserver/i.match?(self.class.connection.adapter_name)
123 123
          lock = "WITH (ROWLOCK HOLDLOCK UPDLOCK)"
124 124
        end
125 125
        self.class.order(:id).lock(lock).ids