Sha256: 0332227d084d00d401778d4834742826f8f69c390824f5e068de5f8a0a03cad2

Contents?: true

Size: 568 Bytes

Versions: 2

Compression:

Stored size: 568 Bytes

Contents

# frozen_string_literal: true

module WithAdvisoryLock
  class DatabaseAdapterSupport
    # Caches nested lock support by MySQL reported version
    @@mysql_nl_cache       = {}
    @@mysql_nl_cache_mutex = Mutex.new

    def initialize(connection)
      @connection = connection
      @sym_name   = connection.adapter_name.downcase.to_sym
    end

    def mysql?
      %i[mysql2 trilogy].include? @sym_name
    end

    def postgresql?
      %i[postgresql empostgresql postgis].include? @sym_name
    end

    def sqlite?
      @sym_name == :sqlite3
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
with_advisory_lock-5.1.0 lib/with_advisory_lock/database_adapter_support.rb
with_advisory_lock-5.0.0 lib/with_advisory_lock/database_adapter_support.rb