Class: WithAdvisoryLock::DatabaseAdapterSupport
- Inherits:
-
Object
- Object
- WithAdvisoryLock::DatabaseAdapterSupport
- Defined in:
- lib/with_advisory_lock/database_adapter_support.rb
Constant Summary collapse
- @@mysql_nl_cache =
Caches nested lock support by MySQL reported version
{}
- @@mysql_nl_cache_mutex =
Mutex.new
Instance Method Summary collapse
-
#initialize(connection) ⇒ DatabaseAdapterSupport
constructor
A new instance of DatabaseAdapterSupport.
- #mysql? ⇒ Boolean
- #postgresql? ⇒ Boolean
- #sqlite? ⇒ Boolean
Constructor Details
#initialize(connection) ⇒ DatabaseAdapterSupport
Returns a new instance of DatabaseAdapterSupport.
9 10 11 12 |
# File 'lib/with_advisory_lock/database_adapter_support.rb', line 9 def initialize(connection) @connection = connection @sym_name = connection.adapter_name.downcase.to_sym end |
Instance Method Details
#mysql? ⇒ Boolean
14 15 16 |
# File 'lib/with_advisory_lock/database_adapter_support.rb', line 14 def mysql? %i[mysql2 trilogy].include? @sym_name end |
#postgresql? ⇒ Boolean
18 19 20 |
# File 'lib/with_advisory_lock/database_adapter_support.rb', line 18 def postgresql? %i[postgresql empostgresql postgis].include? @sym_name end |
#sqlite? ⇒ Boolean
22 23 24 |
# File 'lib/with_advisory_lock/database_adapter_support.rb', line 22 def sqlite? @sym_name == :sqlite3 end |